mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Created Core module
This commit is contained in:
parent
ba06ad44bd
commit
ab9c2f728a
@ -37,7 +37,6 @@
|
|||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Acelaya\\UrlShortener\\": "src",
|
|
||||||
"Shlinkio\\Shlink\\CLI\\": "module/CLI/src",
|
"Shlinkio\\Shlink\\CLI\\": "module/CLI/src",
|
||||||
"Shlinkio\\Shlink\\Rest\\": "module/Rest/src",
|
"Shlinkio\\Shlink\\Rest\\": "module/Rest/src",
|
||||||
"Shlinkio\\Shlink\\Core\\": "module/Core/src",
|
"Shlinkio\\Shlink\\Core\\": "module/Core/src",
|
||||||
@ -46,7 +45,6 @@
|
|||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"AcelayaTest\\UrlShortener\\": "tests",
|
|
||||||
"ShlinkioTest\\Shlink\\CLI\\": "module/CLI/test",
|
"ShlinkioTest\\Shlink\\CLI\\": "module/CLI/test",
|
||||||
"ShlinkioTest\\Shlink\\Rest\\": "module/Rest/test",
|
"ShlinkioTest\\Shlink\\Rest\\": "module/Rest/test",
|
||||||
"ShlinkioTest\\Shlink\\Core\\": "module/Core/test",
|
"ShlinkioTest\\Shlink\\Core\\": "module/Core/test",
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
use Acelaya\UrlShortener\Middleware;
|
|
||||||
use Acelaya\UrlShortener\Service;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Factory\V3\AnnotatedFactory;
|
|
||||||
use Zend\Expressive;
|
use Zend\Expressive;
|
||||||
use Zend\Expressive\Container;
|
use Zend\Expressive\Container;
|
||||||
use Zend\Expressive\Helper;
|
use Zend\Expressive\Helper;
|
||||||
@ -26,14 +23,6 @@ return [
|
|||||||
// View
|
// View
|
||||||
'Zend\Expressive\FinalHandler' => Container\TemplatedErrorHandlerFactory::class,
|
'Zend\Expressive\FinalHandler' => Container\TemplatedErrorHandlerFactory::class,
|
||||||
Template\TemplateRendererInterface::class => Twig\TwigRendererFactory::class,
|
Template\TemplateRendererInterface::class => Twig\TwigRendererFactory::class,
|
||||||
|
|
||||||
// Services
|
|
||||||
Service\UrlShortener::class => AnnotatedFactory::class,
|
|
||||||
Service\VisitsTracker::class => AnnotatedFactory::class,
|
|
||||||
Service\ShortUrlService::class => AnnotatedFactory::class,
|
|
||||||
|
|
||||||
// Middleware
|
|
||||||
Middleware\Routable\RedirectMiddleware::class => AnnotatedFactory::class,
|
|
||||||
],
|
],
|
||||||
'aliases' => [
|
'aliases' => [
|
||||||
Router\RouterInterface::class => Router\FastRouteRouter::class,
|
Router\RouterInterface::class => Router\FastRouteRouter::class,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
use Shlinkio\Shlink\CLI;
|
use Shlinkio\Shlink\CLI;
|
||||||
use Shlinkio\Shlink\Common;
|
use Shlinkio\Shlink\Common;
|
||||||
|
use Shlinkio\Shlink\Core;
|
||||||
use Shlinkio\Shlink\Rest;
|
use Shlinkio\Shlink\Rest;
|
||||||
use Zend\Expressive\ConfigManager\ConfigManager;
|
use Zend\Expressive\ConfigManager\ConfigManager;
|
||||||
use Zend\Expressive\ConfigManager\ZendConfigProvider;
|
use Zend\Expressive\ConfigManager\ZendConfigProvider;
|
||||||
@ -18,6 +19,7 @@ return call_user_func(function () {
|
|||||||
$configManager = new ConfigManager([
|
$configManager = new ConfigManager([
|
||||||
new ZendConfigProvider('config/autoload/{{,*.}global,{,*.}local}.php'),
|
new ZendConfigProvider('config/autoload/{{,*.}global,{,*.}local}.php'),
|
||||||
Common\ConfigProvider::class,
|
Common\ConfigProvider::class,
|
||||||
|
Core\ConfigProvider::class,
|
||||||
CLI\ConfigProvider::class,
|
CLI\ConfigProvider::class,
|
||||||
Rest\ConfigProvider::class,
|
Rest\ConfigProvider::class,
|
||||||
], 'data/cache/app_config.php');
|
], 'data/cache/app_config.php');
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\CLI\Command;
|
namespace Shlinkio\Shlink\CLI\Command;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidUrlException;
|
|
||||||
use Acelaya\UrlShortener\Service\UrlShortener;
|
|
||||||
use Acelaya\UrlShortener\Service\UrlShortenerInterface;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
|
||||||
|
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||||
|
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
|
||||||
use Symfony\Component\Console\Question\Question;
|
use Symfony\Component\Console\Question\Question;
|
||||||
use Zend\Diactoros\Uri;
|
use Zend\Diactoros\Uri;
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\CLI\Command;
|
namespace Shlinkio\Shlink\CLI\Command;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Service\VisitsTracker;
|
|
||||||
use Acelaya\UrlShortener\Service\VisitsTrackerInterface;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
|
use Shlinkio\Shlink\Core\Service\VisitsTracker;
|
||||||
|
use Shlinkio\Shlink\Core\Service\VisitsTrackerInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||||
use Symfony\Component\Console\Helper\Table;
|
use Symfony\Component\Console\Helper\Table;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\CLI\Command;
|
namespace Shlinkio\Shlink\CLI\Command;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Service\ShortUrlService;
|
|
||||||
use Acelaya\UrlShortener\Service\ShortUrlServiceInterface;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
use Shlinkio\Shlink\Common\Paginator\Adapter\PaginableRepositoryAdapter;
|
use Shlinkio\Shlink\Common\Paginator\Adapter\PaginableRepositoryAdapter;
|
||||||
use Shlinkio\Shlink\Common\Paginator\Util\PaginatorUtilsTrait;
|
use Shlinkio\Shlink\Common\Paginator\Util\PaginatorUtilsTrait;
|
||||||
|
use Shlinkio\Shlink\Core\Service\ShortUrlService;
|
||||||
|
use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||||
use Symfony\Component\Console\Helper\Table;
|
use Symfony\Component\Console\Helper\Table;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\CLI\Command;
|
namespace Shlinkio\Shlink\CLI\Command;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidShortCodeException;
|
|
||||||
use Acelaya\UrlShortener\Service\UrlShortener;
|
|
||||||
use Acelaya\UrlShortener\Service\UrlShortenerInterface;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
||||||
|
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||||
|
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Entity;
|
namespace Shlinkio\Shlink\Common\Entity;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
use Acelaya\UrlShortener\Middleware\Routable;
|
use Shlinkio\Shlink\Core\Action\RedirectMiddleware;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ return [
|
|||||||
[
|
[
|
||||||
'name' => 'long-url-redirect',
|
'name' => 'long-url-redirect',
|
||||||
'path' => '/{shortCode}',
|
'path' => '/{shortCode}',
|
||||||
'middleware' => Routable\RedirectMiddleware::class,
|
'middleware' => RedirectMiddleware::class,
|
||||||
'allowed_methods' => ['GET'],
|
'allowed_methods' => ['GET'],
|
||||||
],
|
],
|
||||||
],
|
],
|
20
module/Core/config/services.config.php
Normal file
20
module/Core/config/services.config.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
use Acelaya\ZsmAnnotatedServices\Factory\V3\AnnotatedFactory;
|
||||||
|
use Shlinkio\Shlink\Core\Action\RedirectMiddleware;
|
||||||
|
use Shlinkio\Shlink\Core\Service;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
'services' => [
|
||||||
|
'factories' => [
|
||||||
|
// Services
|
||||||
|
Service\UrlShortener::class => AnnotatedFactory::class,
|
||||||
|
Service\VisitsTracker::class => AnnotatedFactory::class,
|
||||||
|
Service\ShortUrlService::class => AnnotatedFactory::class,
|
||||||
|
|
||||||
|
// Middleware
|
||||||
|
RedirectMiddleware::class => AnnotatedFactory::class,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Middleware\Routable;
|
namespace Shlinkio\Shlink\Core\Action;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Service\UrlShortener;
|
|
||||||
use Acelaya\UrlShortener\Service\UrlShortenerInterface;
|
|
||||||
use Acelaya\UrlShortener\Service\VisitsTracker;
|
|
||||||
use Acelaya\UrlShortener\Service\VisitsTrackerInterface;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||||
|
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
||||||
|
use Shlinkio\Shlink\Core\Service\VisitsTracker;
|
||||||
|
use Shlinkio\Shlink\Core\Service\VisitsTrackerInterface;
|
||||||
use Zend\Diactoros\Response\RedirectResponse;
|
use Zend\Diactoros\Response\RedirectResponse;
|
||||||
use Zend\Stratigility\MiddlewareInterface;
|
use Zend\Stratigility\MiddlewareInterface;
|
||||||
|
|
13
module/Core/src/ConfigProvider.php
Normal file
13
module/Core/src/ConfigProvider.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
namespace Shlinkio\Shlink\Core;
|
||||||
|
|
||||||
|
use Zend\Config\Factory;
|
||||||
|
use Zend\Stdlib\Glob;
|
||||||
|
|
||||||
|
class ConfigProvider
|
||||||
|
{
|
||||||
|
public function __invoke()
|
||||||
|
{
|
||||||
|
return Factory::fromFiles(Glob::glob(__DIR__ . '/../config/{,*.}config.php', Glob::GLOB_BRACE));
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Entity;
|
namespace Shlinkio\Shlink\Core\Entity;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Shlinkio\Shlink\Common\Entity\AbstractEntity;
|
||||||
use Shlinkio\Shlink\Common\Util\StringUtilsTrait;
|
use Shlinkio\Shlink\Common\Util\StringUtilsTrait;
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,16 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Entity;
|
namespace Shlinkio\Shlink\Core\Entity;
|
||||||
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Shlinkio\Shlink\Common\Entity\AbstractEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ShortUrl
|
* Class ShortUrl
|
||||||
* @author
|
* @author
|
||||||
* @link
|
* @link
|
||||||
*
|
*
|
||||||
* @ORM\Entity(repositoryClass="Acelaya\UrlShortener\Repository\ShortUrlRepository")
|
* @ORM\Entity(repositoryClass="Shlinkio\Shlink\Core\Repository\ShortUrlRepository")
|
||||||
* @ORM\Table(name="short_urls")
|
* @ORM\Table(name="short_urls")
|
||||||
*/
|
*/
|
||||||
class ShortUrl extends AbstractEntity implements \JsonSerializable
|
class ShortUrl extends AbstractEntity implements \JsonSerializable
|
@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Entity;
|
namespace Shlinkio\Shlink\Core\Entity;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Shlinkio\Shlink\Common\Entity\AbstractEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Visit
|
* Class Visit
|
6
module/Core/src/Exception/ExceptionInterface.php
Normal file
6
module/Core/src/Exception/ExceptionInterface.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
namespace Shlinkio\Shlink\Core\Exception;
|
||||||
|
|
||||||
|
interface ExceptionInterface
|
||||||
|
{
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Exception;
|
namespace Shlinkio\Shlink\Core\Exception;
|
||||||
|
|
||||||
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
|
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
|
||||||
{
|
{
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Exception;
|
namespace Shlinkio\Shlink\Core\Exception;
|
||||||
|
|
||||||
class InvalidShortCodeException extends RuntimeException
|
class InvalidShortCodeException extends RuntimeException
|
||||||
{
|
{
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Exception;
|
namespace Shlinkio\Shlink\Core\Exception;
|
||||||
|
|
||||||
class InvalidUrlException extends RuntimeException
|
class InvalidUrlException extends RuntimeException
|
||||||
{
|
{
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Exception;
|
namespace Shlinkio\Shlink\Core\Exception;
|
||||||
|
|
||||||
class RuntimeException extends \RuntimeException implements ExceptionInterface
|
class RuntimeException extends \RuntimeException implements ExceptionInterface
|
||||||
{
|
{
|
@ -1,9 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Repository;
|
namespace Shlinkio\Shlink\Core\Repository;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Entity\ShortUrl;
|
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
|
|
||||||
class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryInterface
|
class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryInterface
|
||||||
{
|
{
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Repository;
|
namespace Shlinkio\Shlink\Core\Repository;
|
||||||
|
|
||||||
use Doctrine\Common\Persistence\ObjectRepository;
|
use Doctrine\Common\Persistence\ObjectRepository;
|
||||||
use Shlinkio\Shlink\Common\Repository\PaginableRepositoryInterface;
|
use Shlinkio\Shlink\Common\Repository\PaginableRepositoryInterface;
|
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Service;
|
namespace Shlinkio\Shlink\Core\Service;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Entity\ShortUrl;
|
|
||||||
use Acelaya\UrlShortener\Repository\ShortUrlRepository;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Shlinkio\Shlink\Common\Paginator\Adapter\PaginableRepositoryAdapter;
|
use Shlinkio\Shlink\Common\Paginator\Adapter\PaginableRepositoryAdapter;
|
||||||
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
|
use Shlinkio\Shlink\Core\Repository\ShortUrlRepository;
|
||||||
use Zend\Paginator\Paginator;
|
use Zend\Paginator\Paginator;
|
||||||
|
|
||||||
class ShortUrlService implements ShortUrlServiceInterface
|
class ShortUrlService implements ShortUrlServiceInterface
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Service;
|
namespace Shlinkio\Shlink\Core\Service;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Entity\ShortUrl;
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
use Zend\Paginator\Paginator;
|
use Zend\Paginator\Paginator;
|
||||||
|
|
||||||
interface ShortUrlServiceInterface
|
interface ShortUrlServiceInterface
|
@ -1,16 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Service;
|
namespace Shlinkio\Shlink\Core\Service;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Entity\ShortUrl;
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidShortCodeException;
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidUrlException;
|
|
||||||
use Acelaya\UrlShortener\Exception\RuntimeException;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\ORMException;
|
use Doctrine\ORM\ORMException;
|
||||||
use GuzzleHttp\ClientInterface;
|
use GuzzleHttp\ClientInterface;
|
||||||
use GuzzleHttp\Exception\GuzzleException;
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
use Psr\Http\Message\UriInterface;
|
use Psr\Http\Message\UriInterface;
|
||||||
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\RuntimeException;
|
||||||
|
|
||||||
class UrlShortener implements UrlShortenerInterface
|
class UrlShortener implements UrlShortenerInterface
|
||||||
{
|
{
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Service;
|
namespace Shlinkio\Shlink\Core\Service;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidShortCodeException;
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidUrlException;
|
|
||||||
use Acelaya\UrlShortener\Exception\RuntimeException;
|
|
||||||
use Psr\Http\Message\UriInterface;
|
use Psr\Http\Message\UriInterface;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\RuntimeException;
|
||||||
|
|
||||||
interface UrlShortenerInterface
|
interface UrlShortenerInterface
|
||||||
{
|
{
|
@ -1,12 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Service;
|
namespace Shlinkio\Shlink\Core\Service;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Entity\ShortUrl;
|
|
||||||
use Acelaya\UrlShortener\Entity\Visit;
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidArgumentException;
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidShortCodeException;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
|
use Shlinkio\Shlink\Core\Entity\Visit;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\InvalidArgumentException;
|
||||||
use Zend\Paginator\Paginator;
|
use Zend\Paginator\Paginator;
|
||||||
|
|
||||||
class VisitsTracker implements VisitsTrackerInterface
|
class VisitsTracker implements VisitsTrackerInterface
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Acelaya\UrlShortener\Service;
|
namespace Shlinkio\Shlink\Core\Service;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Entity\Visit;
|
use Shlinkio\Shlink\Core\Entity\Visit;
|
||||||
use Zend\Paginator\Paginator;
|
use Zend\Paginator\Paginator;
|
||||||
|
|
||||||
interface VisitsTrackerInterface
|
interface VisitsTrackerInterface
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace AcelayaTest\UrlShortener\Service;
|
namespace ShlinkioTest\Shlink\Core\Service;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Entity\ShortUrl;
|
|
||||||
use Acelaya\UrlShortener\Repository\ShortUrlRepository;
|
|
||||||
use Acelaya\UrlShortener\Service\ShortUrlService;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use PHPUnit_Framework_TestCase as TestCase;
|
use PHPUnit_Framework_TestCase as TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
|
use Shlinkio\Shlink\Core\Repository\ShortUrlRepository;
|
||||||
|
use Shlinkio\Shlink\Core\Service\ShortUrlService;
|
||||||
|
|
||||||
class ShortUrlServiceTest extends TestCase
|
class ShortUrlServiceTest extends TestCase
|
||||||
{
|
{
|
@ -1,8 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace AcelayaTest\UrlShortener\Service;
|
namespace ShlinkioTest\Shlink\Core\Service;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Entity\ShortUrl;
|
|
||||||
use Acelaya\UrlShortener\Service\UrlShortener;
|
|
||||||
use Doctrine\Common\Persistence\ObjectRepository;
|
use Doctrine\Common\Persistence\ObjectRepository;
|
||||||
use Doctrine\DBAL\Connection;
|
use Doctrine\DBAL\Connection;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
@ -10,10 +8,11 @@ use Doctrine\ORM\ORMException;
|
|||||||
use GuzzleHttp\ClientInterface;
|
use GuzzleHttp\ClientInterface;
|
||||||
use GuzzleHttp\Exception\ClientException;
|
use GuzzleHttp\Exception\ClientException;
|
||||||
use GuzzleHttp\Psr7\Request;
|
use GuzzleHttp\Psr7\Request;
|
||||||
use GuzzleHttp\Psr7\Response;
|
|
||||||
use PHPUnit_Framework_TestCase as TestCase;
|
use PHPUnit_Framework_TestCase as TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
use Prophecy\Prophecy\ObjectProphecy;
|
use Prophecy\Prophecy\ObjectProphecy;
|
||||||
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
|
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||||
use Zend\Diactoros\Uri;
|
use Zend\Diactoros\Uri;
|
||||||
|
|
||||||
class UrlShortenerTest extends TestCase
|
class UrlShortenerTest extends TestCase
|
@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace AcelayaTest\UrlShortener\Service;
|
namespace ShlinkioTest\Shlink\Core\Service;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Entity\ShortUrl;
|
|
||||||
use Acelaya\UrlShortener\Service\VisitsTracker;
|
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use PHPUnit_Framework_TestCase as TestCase;
|
use PHPUnit_Framework_TestCase as TestCase;
|
||||||
use Prophecy\Argument;
|
use Prophecy\Argument;
|
||||||
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
||||||
|
use Shlinkio\Shlink\Core\Service\VisitsTracker;
|
||||||
|
|
||||||
class VisitsTrackerTest extends TestCase
|
class VisitsTrackerTest extends TestCase
|
||||||
{
|
{
|
@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\Rest\Action;
|
namespace Shlinkio\Shlink\Rest\Action;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidUrlException;
|
|
||||||
use Acelaya\UrlShortener\Service\UrlShortener;
|
|
||||||
use Acelaya\UrlShortener\Service\UrlShortenerInterface;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
|
||||||
|
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||||
|
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
||||||
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
use Zend\Diactoros\Uri;
|
use Zend\Diactoros\Uri;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\Rest\Action;
|
namespace Shlinkio\Shlink\Rest\Action;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidArgumentException;
|
|
||||||
use Acelaya\UrlShortener\Service\VisitsTracker;
|
|
||||||
use Acelaya\UrlShortener\Service\VisitsTrackerInterface;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\InvalidArgumentException;
|
||||||
|
use Shlinkio\Shlink\Core\Service\VisitsTracker;
|
||||||
|
use Shlinkio\Shlink\Core\Service\VisitsTrackerInterface;
|
||||||
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\Rest\Action;
|
namespace Shlinkio\Shlink\Rest\Action;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Service\ShortUrlService;
|
|
||||||
use Acelaya\UrlShortener\Service\ShortUrlServiceInterface;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
use Shlinkio\Shlink\Common\Paginator\Util\PaginatorUtilsTrait;
|
use Shlinkio\Shlink\Common\Paginator\Util\PaginatorUtilsTrait;
|
||||||
|
use Shlinkio\Shlink\Core\Service\ShortUrlService;
|
||||||
|
use Shlinkio\Shlink\Core\Service\ShortUrlServiceInterface;
|
||||||
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\Rest\Action;
|
namespace Shlinkio\Shlink\Rest\Action;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidShortCodeException;
|
|
||||||
use Acelaya\UrlShortener\Service\UrlShortener;
|
|
||||||
use Acelaya\UrlShortener\Service\UrlShortenerInterface;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\InvalidShortCodeException;
|
||||||
|
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||||
|
use Shlinkio\Shlink\Core\Service\UrlShortenerInterface;
|
||||||
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\Rest\Exception;
|
namespace Shlinkio\Shlink\Rest\Exception;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Exception\ExceptionInterface;
|
use Shlinkio\Shlink\Core\Exception\ExceptionInterface;
|
||||||
|
|
||||||
class AuthenticationException extends \RuntimeException implements ExceptionInterface
|
class AuthenticationException extends \RuntimeException implements ExceptionInterface
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\Rest\Middleware;
|
namespace Shlinkio\Shlink\Rest\Middleware;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidArgumentException;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\InvalidArgumentException;
|
||||||
use Shlinkio\Shlink\Rest\Service\RestTokenService;
|
use Shlinkio\Shlink\Rest\Service\RestTokenService;
|
||||||
use Shlinkio\Shlink\Rest\Service\RestTokenServiceInterface;
|
use Shlinkio\Shlink\Rest\Service\RestTokenServiceInterface;
|
||||||
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\Rest\Service;
|
namespace Shlinkio\Shlink\Rest\Service;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Entity\RestToken;
|
|
||||||
use Acelaya\UrlShortener\Exception\InvalidArgumentException;
|
|
||||||
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
use Acelaya\ZsmAnnotatedServices\Annotation\Inject;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Shlinkio\Shlink\Core\Entity\RestToken;
|
||||||
|
use Shlinkio\Shlink\Core\Exception\InvalidArgumentException;
|
||||||
use Shlinkio\Shlink\Rest\Exception\AuthenticationException;
|
use Shlinkio\Shlink\Rest\Exception\AuthenticationException;
|
||||||
|
|
||||||
class RestTokenService implements RestTokenServiceInterface
|
class RestTokenService implements RestTokenServiceInterface
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\Rest\Service;
|
namespace Shlinkio\Shlink\Rest\Service;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Entity\RestToken;
|
use Shlinkio\Shlink\Core\Entity\RestToken;
|
||||||
use Acelaya\UrlShortener\Exception\InvalidArgumentException;
|
use Shlinkio\Shlink\Core\Exception\InvalidArgumentException;
|
||||||
use Shlinkio\Shlink\Rest\Exception\AuthenticationException;
|
use Shlinkio\Shlink\Rest\Exception\AuthenticationException;
|
||||||
|
|
||||||
interface RestTokenServiceInterface
|
interface RestTokenServiceInterface
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Shlinkio\Shlink\Rest\Util;
|
namespace Shlinkio\Shlink\Rest\Util;
|
||||||
|
|
||||||
use Acelaya\UrlShortener\Exception as Core;
|
use Shlinkio\Shlink\Core\Exception as Core;
|
||||||
use Shlinkio\Shlink\Rest\Exception as Rest;
|
use Shlinkio\Shlink\Rest\Exception as Rest;
|
||||||
|
|
||||||
class RestUtils
|
class RestUtils
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Acelaya\UrlShortener\Exception;
|
|
||||||
|
|
||||||
interface ExceptionInterface
|
|
||||||
{
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user