| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class CreateAuthor | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class CreateAuthor implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractAuthorRepository | |
| 27 | */ | |
| 28 | private $authorRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var Author | |
| 32 | */ | |
| 33 | private $author; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * CreateAuthor constructor. | |
| 42 | * @param AbstractAuthorRepository $authorRepository | |
| 43 | * @param Author $author | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractAuthorRepository $authorRepository, Author $author, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->authorRepository = $authorRepository; | |
| 49 | $this->author = $author; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return UuidInterface|null | |
| 55 | */ | |
| 56 | public function run() | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->authorRepository->save($this->author); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return null; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class CreatePost | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class CreatePost implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractPostRepository | |
| 27 | */ | |
| 28 | private $postRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var Post | |
| 32 | */ | |
| 33 | private $post; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * CreatePost constructor. | |
| 42 | * @param AbstractPostRepository $postRepository | |
| 43 | * @param Post $post | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractPostRepository $postRepository, Post $post, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->postRepository = $postRepository; | |
| 49 | $this->post = $post; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return UuidInterface|null | |
| 55 | */ | |
| 56 | public function run() | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->postRepository->save($this->post); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return null; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class CreateTag | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class CreateTag implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractTagRepository | |
| 27 | */ | |
| 28 | private $tagRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var Tag | |
| 32 | */ | |
| 33 | private $tag; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * CreateTag constructor. | |
| 42 | * @param AbstractTagRepository $tagRepository | |
| 43 | * @param Tag $tag | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractTagRepository $tagRepository, Tag $tag, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->tagRepository = $tagRepository; | |
| 49 | $this->tag = $tag; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return UuidInterface|null | |
| 55 | */ | |
| 56 | public function run() | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->tagRepository->save($this->tag); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return null; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class CreateTrail | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class CreateTrail implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractTrailRepository | |
| 27 | */ | |
| 28 | private $trailRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var Trail | |
| 32 | */ | |
| 33 | private $trail; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * CreateTrail constructor. | |
| 42 | * @param AbstractTrailRepository $trailRepository | |
| 43 | * @param Trail $trail | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractTrailRepository $trailRepository, Trail $trail, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->trailRepository = $trailRepository; | |
| 49 | $this->trail = $trail; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return UuidInterface|null | |
| 55 | */ | |
| 56 | public function run() | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->trailRepository->save($this->trail); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return null; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class DeleteAuthor | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class DeleteAuthor implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractAuthorRepository | |
| 27 | */ | |
| 28 | private $authorRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var Author | |
| 32 | */ | |
| 33 | private $author; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * DeleteAuthor constructor. | |
| 42 | * @param AbstractAuthorRepository $authorRepository | |
| 43 | * @param Author $author | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractAuthorRepository $authorRepository, Author $author, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->authorRepository = $authorRepository; | |
| 49 | $this->author = $author; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return boolean | |
| 55 | */ | |
| 56 | public function run(): bool | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->authorRepository->delete($this->author); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return false; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class DeletePost | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class DeletePost implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractPostRepository | |
| 27 | */ | |
| 28 | private $postRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var Post | |
| 32 | */ | |
| 33 | private $post; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * DeletePost constructor. | |
| 42 | * @param AbstractPostRepository $postRepository | |
| 43 | * @param Post $post | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractPostRepository $postRepository, Post $post, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->postRepository = $postRepository; | |
| 49 | $this->post = $post; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return boolean | |
| 55 | */ | |
| 56 | public function run(): bool | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->postRepository->delete($this->post); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return false; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class DeleteTag | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class DeleteTag implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractTagRepository | |
| 27 | */ | |
| 28 | private $tagRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var Tag | |
| 32 | */ | |
| 33 | private $tag; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * DeleteTag constructor. | |
| 42 | * @param AbstractTagRepository $tagRepository | |
| 43 | * @param Tag $tag | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractTagRepository $tagRepository, Tag $tag, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->tagRepository = $tagRepository; | |
| 49 | $this->tag = $tag; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return boolean | |
| 55 | */ | |
| 56 | public function run(): bool | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->tagRepository->delete($this->tag); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return false; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class DeleteTrail | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class DeleteTrail implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractTrailRepository | |
| 27 | */ | |
| 28 | private $trailRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var Trail | |
| 32 | */ | |
| 33 | private $trail; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * DeleteTrail constructor. | |
| 42 | * @param AbstractTrailRepository $trailRepository | |
| 43 | * @param Trail $trail | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractTrailRepository $trailRepository, Trail $trail, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->trailRepository = $trailRepository; | |
| 49 | $this->trail = $trail; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return boolean | |
| 55 | */ | |
| 56 | public function run(): bool | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->trailRepository->delete($this->trail); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return false; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class EditAuthor | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class EditAuthor implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractAuthorRepository | |
| 27 | */ | |
| 28 | private $authorRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var Author | |
| 32 | */ | |
| 33 | private $author; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * EditAuthor constructor. | |
| 42 | * @param AbstractAuthorRepository $authorRepository | |
| 43 | * @param Author $author | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractAuthorRepository $authorRepository, Author $author, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->authorRepository = $authorRepository; | |
| 49 | $this->author = $author; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return UuidInterface|null | |
| 55 | */ | |
| 56 | public function run() | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->authorRepository->save($this->author); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return null; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class EditPost | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class EditPost implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractPostRepository | |
| 27 | */ | |
| 28 | private $postRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var Post | |
| 32 | */ | |
| 33 | private $post; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * EditPost constructor. | |
| 42 | * @param AbstractPostRepository $postRepository | |
| 43 | * @param Post $post | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractPostRepository $postRepository, Post $post, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->postRepository = $postRepository; | |
| 49 | $this->post = $post; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return UuidInterface|null | |
| 55 | */ | |
| 56 | public function run() | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->postRepository->save($this->post); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return null; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class EditTag | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class EditTag implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractTagRepository | |
| 27 | */ | |
| 28 | private $tagRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var Tag | |
| 32 | */ | |
| 33 | private $tag; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * EditTag constructor. | |
| 42 | * @param AbstractTagRepository $tagRepository | |
| 43 | * @param Tag $tag | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractTagRepository $tagRepository, Tag $tag, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->tagRepository = $tagRepository; | |
| 49 | $this->tag = $tag; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return UuidInterface|null | |
| 55 | */ | |
| 56 | public function run() | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->tagRepository->save($this->tag); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return null; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class EditTrail | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class EditTrail implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractTrailRepository | |
| 27 | */ | |
| 28 | private $trailRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var Trail | |
| 32 | */ | |
| 33 | private $trail; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * EditTrail constructor. | |
| 42 | * @param AbstractTrailRepository $trailRepository | |
| 43 | * @param Trail $trail | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractTrailRepository $trailRepository, Trail $trail, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->trailRepository = $trailRepository; | |
| 49 | $this->trail = $trail; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return UuidInterface|null | |
| 55 | */ | |
| 56 | public function run() | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->trailRepository->save($this->trail); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return null; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-69 (lines=47) @@ | ||
| 20 | * Class GetAuthor | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class GetAuthor implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractAuthorRepository | |
| 27 | */ | |
| 28 | private $authorRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var UuidInterface | |
| 32 | */ | |
| 33 | private $uuid; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * GetAuthor constructor. | |
| 42 | * @param AbstractAuthorRepository $authorRepository | |
| 43 | * @param UuidInterface $uuid | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct( | |
| 47 | AbstractAuthorRepository $authorRepository, | |
| 48 | UuidInterface $uuid, | |
| 49 | LoggerInterface $logger | |
| 50 |     ) { | |
| 51 | $this->uuid = $uuid; | |
| 52 | $this->logger = $logger; | |
| 53 | $this->authorRepository = $authorRepository; | |
| 54 | } | |
| 55 | ||
| 56 | /** | |
| 57 | * @return stdClass|false | |
| 58 | */ | |
| 59 | public function run() | |
| 60 |     { | |
| 61 |         try { | |
| 62 | return $this->authorRepository->get($this->uuid); | |
| 63 |         } catch (Exception $e) { | |
| 64 | $this->logger->error($e->getMessage()); | |
| 65 | } | |
| 66 | ||
| 67 | return false; | |
| 68 | } | |
| 69 | } | |
| 70 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class GetPost | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class GetPost implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractPostRepository | |
| 27 | */ | |
| 28 | private $postRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var UuidInterface | |
| 32 | */ | |
| 33 | private $uuid; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * GetPost constructor. | |
| 42 | * @param AbstractPostRepository $postRepository | |
| 43 | * @param UuidInterface $uuid | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractPostRepository $postRepository, UuidInterface $uuid, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->postRepository = $postRepository; | |
| 49 | $this->uuid = $uuid; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return stdClass|false | |
| 55 | */ | |
| 56 | public function run() | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->postRepository->get($this->uuid); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return false; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class GetTag | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class GetTag implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractTagRepository | |
| 27 | */ | |
| 28 | private $tagRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var UuidInterface | |
| 32 | */ | |
| 33 | private $uuid; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * GetTag constructor. | |
| 42 | * @param AbstractTagRepository $tagRepository | |
| 43 | * @param UuidInterface $uuid | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractTagRepository $tagRepository, UuidInterface $uuid, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->tagRepository = $tagRepository; | |
| 49 | $this->uuid = $uuid; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return stdClass|false | |
| 55 | */ | |
| 56 | public function run() | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->tagRepository->get($this->uuid); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return false; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 23-66 (lines=44) @@ | ||
| 20 | * Class GetTrail | |
| 21 | * @package DavisPeixoto\BlogCore\Service | |
| 22 | */ | |
| 23 | class GetTrail implements ServiceInterface | |
| 24 | { | |
| 25 | /** | |
| 26 | * @var AbstractTrailRepository | |
| 27 | */ | |
| 28 | private $trailRepository; | |
| 29 | ||
| 30 | /** | |
| 31 | * @var UuidInterface | |
| 32 | */ | |
| 33 | private $uuid; | |
| 34 | ||
| 35 | /** | |
| 36 | * @var LoggerInterface | |
| 37 | */ | |
| 38 | private $logger; | |
| 39 | ||
| 40 | /** | |
| 41 | * GetTrail constructor. | |
| 42 | * @param AbstractTrailRepository $trailRepository | |
| 43 | * @param UuidInterface $uuid | |
| 44 | * @param LoggerInterface $logger | |
| 45 | */ | |
| 46 | public function __construct(AbstractTrailRepository $trailRepository, UuidInterface $uuid, LoggerInterface $logger) | |
| 47 |     { | |
| 48 | $this->trailRepository = $trailRepository; | |
| 49 | $this->uuid = $uuid; | |
| 50 | $this->logger = $logger; | |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * @return stdClass|false | |
| 55 | */ | |
| 56 | public function run() | |
| 57 |     { | |
| 58 |         try { | |
| 59 | return $this->trailRepository->get($this->uuid); | |
| 60 |         } catch (Exception $e) { | |
| 61 | $this->logger->error($e->getMessage()); | |
| 62 | } | |
| 63 | ||
| 64 | return false; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| @@ 22-65 (lines=44) @@ | ||
| 19 | * Class ListAuthors | |
| 20 | * @package DavisPeixoto\BlogCore\Service | |
| 21 | */ | |
| 22 | class ListAuthors implements ServiceInterface | |
| 23 | { | |
| 24 | /** | |
| 25 | * @var AbstractAuthorRepository | |
| 26 | */ | |
| 27 | private $authorRepository; | |
| 28 | ||
| 29 | /** | |
| 30 | * @var array | |
| 31 | */ | |
| 32 | private $filters; | |
| 33 | ||
| 34 | /** | |
| 35 | * @var LoggerInterface | |
| 36 | */ | |
| 37 | private $logger; | |
| 38 | ||
| 39 | /** | |
| 40 | * ListAuthors constructor. | |
| 41 | * @param AbstractAuthorRepository $authorRepository | |
| 42 | * @param array $filters | |
| 43 | * @param LoggerInterface $logger | |
| 44 | */ | |
| 45 | public function __construct(AbstractAuthorRepository $authorRepository, Array $filters, LoggerInterface $logger) | |
| 46 |     { | |
| 47 | $this->authorRepository = $authorRepository; | |
| 48 | $this->filters = $filters; | |
| 49 | $this->logger = $logger; | |
| 50 | } | |
| 51 | ||
| 52 | /** | |
| 53 | * @return array|stdClass[] | |
| 54 | */ | |
| 55 | public function run(): array | |
| 56 |     { | |
| 57 |         try { | |
| 58 | return $this->authorRepository->getList($this->filters); | |
| 59 |         } catch (Exception $e) { | |
| 60 | $this->logger->error($e->getMessage()); | |
| 61 | } | |
| 62 | ||
| 63 | return []; | |
| 64 | } | |
| 65 | } | |
| 66 | ||
| @@ 22-65 (lines=44) @@ | ||
| 19 | * Class ListPosts | |
| 20 | * @package DavisPeixoto\BlogCore\Service | |
| 21 | */ | |
| 22 | class ListPosts implements ServiceInterface | |
| 23 | { | |
| 24 | /** | |
| 25 | * @var AbstractPostRepository | |
| 26 | */ | |
| 27 | private $postRepository; | |
| 28 | ||
| 29 | /** | |
| 30 | * @var array | |
| 31 | */ | |
| 32 | private $filters; | |
| 33 | ||
| 34 | /** | |
| 35 | * @var LoggerInterface | |
| 36 | */ | |
| 37 | private $logger; | |
| 38 | ||
| 39 | /** | |
| 40 | * ListPosts constructor. | |
| 41 | * @param AbstractPostRepository $postRepository | |
| 42 | * @param array $filters | |
| 43 | * @param LoggerInterface $logger | |
| 44 | */ | |
| 45 | public function __construct(AbstractPostRepository $postRepository, Array $filters, LoggerInterface $logger) | |
| 46 |     { | |
| 47 | $this->postRepository = $postRepository; | |
| 48 | $this->filters = $filters; | |
| 49 | $this->logger = $logger; | |
| 50 | } | |
| 51 | ||
| 52 | /** | |
| 53 | * @return array|stdClass[] | |
| 54 | */ | |
| 55 | public function run(): array | |
| 56 |     { | |
| 57 |         try { | |
| 58 | return $this->postRepository->getList($this->filters); | |
| 59 |         } catch (Exception $e) { | |
| 60 | $this->logger->error($e->getMessage()); | |
| 61 | } | |
| 62 | ||
| 63 | return []; | |
| 64 | } | |
| 65 | } | |
| 66 | ||
| @@ 22-65 (lines=44) @@ | ||
| 19 | * Class ListTags | |
| 20 | * @package DavisPeixoto\BlogCore\Service | |
| 21 | */ | |
| 22 | class ListTags implements ServiceInterface | |
| 23 | { | |
| 24 | /** | |
| 25 | * @var AbstractTagRepository | |
| 26 | */ | |
| 27 | private $tagRepository; | |
| 28 | ||
| 29 | /** | |
| 30 | * @var array | |
| 31 | */ | |
| 32 | private $filters; | |
| 33 | ||
| 34 | /** | |
| 35 | * @var LoggerInterface | |
| 36 | */ | |
| 37 | private $logger; | |
| 38 | ||
| 39 | /** | |
| 40 | * ListTags constructor. | |
| 41 | * @param AbstractTagRepository $tagRepository | |
| 42 | * @param array $filters | |
| 43 | * @param LoggerInterface $logger | |
| 44 | */ | |
| 45 | public function __construct(AbstractTagRepository $tagRepository, Array $filters, LoggerInterface $logger) | |
| 46 |     { | |
| 47 | $this->tagRepository = $tagRepository; | |
| 48 | $this->filters = $filters; | |
| 49 | $this->logger = $logger; | |
| 50 | } | |
| 51 | ||
| 52 | /** | |
| 53 | * @return array|stdClass[] | |
| 54 | */ | |
| 55 | public function run(): array | |
| 56 |     { | |
| 57 |         try { | |
| 58 | return $this->tagRepository->getList($this->filters); | |
| 59 |         } catch (Exception $e) { | |
| 60 | $this->logger->error($e->getMessage()); | |
| 61 | } | |
| 62 | ||
| 63 | return []; | |
| 64 | } | |
| 65 | } | |
| 66 | ||
| @@ 22-65 (lines=44) @@ | ||
| 19 | * Class ListTrails | |
| 20 | * @package DavisPeixoto\BlogCore\Service | |
| 21 | */ | |
| 22 | class ListTrails implements ServiceInterface | |
| 23 | { | |
| 24 | /** | |
| 25 | * @var AbstractTrailRepository | |
| 26 | */ | |
| 27 | private $trailRepository; | |
| 28 | ||
| 29 | /** | |
| 30 | * @var array | |
| 31 | */ | |
| 32 | private $filters; | |
| 33 | ||
| 34 | /** | |
| 35 | * @var LoggerInterface | |
| 36 | */ | |
| 37 | private $logger; | |
| 38 | ||
| 39 | /** | |
| 40 | * ListTrails constructor. | |
| 41 | * @param AbstractTrailRepository $trailRepository | |
| 42 | * @param array $filters | |
| 43 | * @param LoggerInterface $logger | |
| 44 | */ | |
| 45 | public function __construct(AbstractTrailRepository $trailRepository, Array $filters, LoggerInterface $logger) | |
| 46 |     { | |
| 47 | $this->trailRepository = $trailRepository; | |
| 48 | $this->filters = $filters; | |
| 49 | $this->logger = $logger; | |
| 50 | } | |
| 51 | ||
| 52 | /** | |
| 53 | * @return array|stdClass[] | |
| 54 | */ | |
| 55 | public function run(): array | |
| 56 |     { | |
| 57 |         try { | |
| 58 | return $this->trailRepository->getList($this->filters); | |
| 59 |         } catch (Exception $e) { | |
| 60 | $this->logger->error($e->getMessage()); | |
| 61 | } | |
| 62 | ||
| 63 | return []; | |
| 64 | } | |
| 65 | } | |
| 66 | ||