@@ -19,7 +19,7 @@ |
||
| 19 | 19 | public function getFunctions() |
| 20 | 20 | { |
| 21 | 21 | return array( |
| 22 | - new \Twig_SimpleFunction('render_location', array($this,'renderLocation'), array('is_safe' => array('html'))), |
|
| 22 | + new \Twig_SimpleFunction('render_location', array($this, 'renderLocation'), array('is_safe' => array('html'))), |
|
| 23 | 23 | ); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -41,8 +41,9 @@ |
||
| 41 | 41 | throw new \InvalidArgumentException('Trying to create Entity with no content or location'); |
| 42 | 42 | } |
| 43 | 43 | if ($content != null && $location != null) { |
| 44 | - if ($location->contentId != $content->id) |
|
| 45 | - throw new \InvalidArgumentException('Trying to create Entity with mismatching content and location'); |
|
| 44 | + if ($location->contentId != $content->id) { |
|
| 45 | + throw new \InvalidArgumentException('Trying to create Entity with mismatching content and location'); |
|
| 46 | + } |
|
| 46 | 47 | } |
| 47 | 48 | $this->content = $content; |
| 48 | 49 | $this->location = $location; |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | * @param array $settings used to pass to the Entity instance anything that would be done via DIC if it was a service |
| 36 | 36 | * @throws \InvalidArgumentException |
| 37 | 37 | */ |
| 38 | - public function __construct(eZRepository $repository, Content $content=null, Location $location=null, array $settings = array()) |
|
| 38 | + public function __construct(eZRepository $repository, Content $content = null, Location $location = null, array $settings = array()) |
|
| 39 | 39 | { |
| 40 | 40 | if ($content == null && $location == null) { |
| 41 | 41 | throw new \InvalidArgumentException('Trying to create Entity with no content or location'); |
@@ -22,46 +22,64 @@ |
||
| 22 | 22 | |
| 23 | 23 | protected function emergency($message, array $context = array()) |
| 24 | 24 | { |
| 25 | - if ($this->logger) $this->logger->emergency($message, $context); |
|
| 25 | + if ($this->logger) { |
|
| 26 | + $this->logger->emergency($message, $context); |
|
| 27 | + } |
|
| 26 | 28 | } |
| 27 | 29 | |
| 28 | 30 | protected function alert($message, array $context = array()) |
| 29 | 31 | { |
| 30 | - if ($this->logger) $this->logger->alert($message, $context); |
|
| 32 | + if ($this->logger) { |
|
| 33 | + $this->logger->alert($message, $context); |
|
| 34 | + } |
|
| 31 | 35 | } |
| 32 | 36 | |
| 33 | 37 | protected function critical($message, array $context = array()) |
| 34 | 38 | { |
| 35 | - if ($this->logger) $this->logger->critical($message, $context); |
|
| 39 | + if ($this->logger) { |
|
| 40 | + $this->logger->critical($message, $context); |
|
| 41 | + } |
|
| 36 | 42 | } |
| 37 | 43 | |
| 38 | 44 | protected function error($message, array $context = array()) |
| 39 | 45 | { |
| 40 | - if ($this->logger) $this->logger->error($message, $context); |
|
| 46 | + if ($this->logger) { |
|
| 47 | + $this->logger->error($message, $context); |
|
| 48 | + } |
|
| 41 | 49 | } |
| 42 | 50 | |
| 43 | 51 | protected function warning($message, array $context = array()) |
| 44 | 52 | { |
| 45 | - if ($this->logger) $this->logger->warning($message, $context); |
|
| 53 | + if ($this->logger) { |
|
| 54 | + $this->logger->warning($message, $context); |
|
| 55 | + } |
|
| 46 | 56 | } |
| 47 | 57 | |
| 48 | 58 | protected function notice($message, array $context = array()) |
| 49 | 59 | { |
| 50 | - if ($this->logger) $this->logger->notice($message, $context); |
|
| 60 | + if ($this->logger) { |
|
| 61 | + $this->logger->notice($message, $context); |
|
| 62 | + } |
|
| 51 | 63 | } |
| 52 | 64 | |
| 53 | 65 | protected function info($message, array $context = array()) |
| 54 | 66 | { |
| 55 | - if ($this->logger) $this->logger->info($message, $context); |
|
| 67 | + if ($this->logger) { |
|
| 68 | + $this->logger->info($message, $context); |
|
| 69 | + } |
|
| 56 | 70 | } |
| 57 | 71 | |
| 58 | 72 | protected function debug($message, array $context = array()) |
| 59 | 73 | { |
| 60 | - if ($this->logger) $this->logger->debug($message, $context); |
|
| 74 | + if ($this->logger) { |
|
| 75 | + $this->logger->debug($message, $context); |
|
| 76 | + } |
|
| 61 | 77 | } |
| 62 | 78 | |
| 63 | 79 | protected function log($level, $message, array $context = array()) |
| 64 | 80 | { |
| 65 | - if ($this->logger) $this->logger->log($level, $message, $context); |
|
| 81 | + if ($this->logger) { |
|
| 82 | + $this->logger->log($level, $message, $context); |
|
| 83 | + } |
|
| 66 | 84 | } |
| 67 | 85 | } |
@@ -11,9 +11,9 @@ |
||
| 11 | 11 | public function __construct(eZRepository $repository, Content $content=null, Location $location=null); |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * Return the content of the current location |
|
| 15 | - * @return \eZ\Publish\API\Repository\Values\Content\Content |
|
| 16 | - */ |
|
| 14 | + * Return the content of the current location |
|
| 15 | + * @return \eZ\Publish\API\Repository\Values\Content\Content |
|
| 16 | + */ |
|
| 17 | 17 | public function content(); |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | interface EntityInterface |
| 10 | 10 | { |
| 11 | - public function __construct(eZRepository $repository, Content $content=null, Location $location=null); |
|
| 11 | + public function __construct(eZRepository $repository, Content $content = null, Location $location = null); |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Return the content of the current location |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace Kaliop\eZObjectWrapperBundle\Core\Traits; |
| 4 | 4 | |
| 5 | 5 | use Kaliop\eZObjectWrapperBundle\Core\EntityInterface; |
| 6 | - |
|
| 7 | 6 | use eZ\Publish\Core\FieldType\RelationList; |
| 8 | 7 | use eZ\Publish\Core\FieldType\Relation; |
| 9 | 8 | |
@@ -22,12 +22,12 @@ discard block |
||
| 22 | 22 | $relatedEntities = array(); |
| 23 | 23 | |
| 24 | 24 | $fieldValue = $this->content()->getFieldValue($fieldName); |
| 25 | - if (! $fieldValue instanceof RelationList\Value) { |
|
| 25 | + if (!$fieldValue instanceof RelationList\Value) { |
|
| 26 | 26 | throw new \RuntimeException("Field '$fieldName' is not of type RelationList"); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | $relatedContentItems = array(); |
| 30 | - foreach($fieldValue->destinationContentIds as $contentId) { |
|
| 30 | + foreach ($fieldValue->destinationContentIds as $contentId) { |
|
| 31 | 31 | // Just in case the object has been pu tin the trash or hidden and they have not updated the related fields to remove from view. |
| 32 | 32 | try { |
| 33 | 33 | $relatedContentItems[] = $this->getRepository()->getContentService()->loadContent($contentId); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | protected function getRelation($fieldName) |
| 50 | 50 | { |
| 51 | 51 | $fieldValue = $this->content()->getFieldValue($fieldName); |
| 52 | - if (! $fieldValue instanceof Relation\Value) { |
|
| 52 | + if (!$fieldValue instanceof Relation\Value) { |
|
| 53 | 53 | throw new \RuntimeException("Field '$fieldName' is not of type Relation"); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param array $classMap array of classes exposing a RepositoryInterface |
| 30 | 30 | * @param RepositoryManagerInterface[] $serviceMap array of services exposing a RepositoryInterface |
| 31 | 31 | */ |
| 32 | - public function __construct(eZRepository $repository, array $classMap=array(), array $serviceMap=array()) |
|
| 32 | + public function __construct(eZRepository $repository, array $classMap = array(), array $serviceMap = array()) |
|
| 33 | 33 | { |
| 34 | 34 | $this->repository = $repository; |
| 35 | 35 | foreach ($classMap as $contentTypeIdentifier => $className) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public function load($content) |
| 143 | 143 | { |
| 144 | - switch(true) |
|
| 144 | + switch (true) |
|
| 145 | 145 | { |
| 146 | 146 | case $content instanceof ContentInfo: |
| 147 | 147 | return $this |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | ->getRepositoryByContentTypeId($content->contentInfo->contentTypeId) |
| 157 | 157 | ->loadEntityFromLocation($content); |
| 158 | 158 | } |
| 159 | - throw new \UnexpectedValueException("Can not load an Entity for php object of class " . get_class($content)); |
|
| 159 | + throw new \UnexpectedValueException("Can not load an Entity for php object of class ".get_class($content)); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function loadMany($contents) |
| 170 | 170 | { |
| 171 | - switch(true) |
|
| 171 | + switch (true) |
|
| 172 | 172 | { |
| 173 | 173 | case $contents instanceof SearchResult: |
| 174 | 174 | $entities = array(); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | return $entities; |
| 185 | 185 | } |
| 186 | - throw new \UnexpectedValueException("Can not load an Entities for php object of class " . get_class($contents)); |
|
| 186 | + throw new \UnexpectedValueException("Can not load an Entities for php object of class ".get_class($contents)); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
@@ -44,6 +44,7 @@ discard block |
||
| 44 | 44 | * Registers an existing service to be used as repository for a given content type |
| 45 | 45 | * @var RepositoryInterface $service |
| 46 | 46 | * @var string $contentTypeIdentifier when null, we will ask the Repository to see if it already has its own $contentTypeIdentifier set up |
| 47 | + * @param integer $contentTypeIdentifier |
|
| 47 | 48 | */ |
| 48 | 49 | public function registerService(RepositoryInterface $service, $contentTypeIdentifier) |
| 49 | 50 | { |
@@ -196,7 +197,7 @@ discard block |
||
| 196 | 197 | } |
| 197 | 198 | |
| 198 | 199 | /** |
| 199 | - * @param mixed $id |
|
| 200 | + * @param integer $id |
|
| 200 | 201 | * @return string |
| 201 | 202 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If a content type with the given id and status DEFINED can not be found |
| 202 | 203 | */ |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | /** @var LoggerInterface $logger */ |
| 63 | 63 | protected $logger; |
| 64 | 64 | |
| 65 | - public function __construct(eZRepository $repository, $entityManager, array $settings=array(), $contentTypeIdentifier='') |
|
| 65 | + public function __construct(eZRepository $repository, $entityManager, array $settings = array(), $contentTypeIdentifier = '') |
|
| 66 | 66 | { |
| 67 | 67 | $this->repository = $repository; |
| 68 | 68 | $this->entityManager = $entityManager; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | return $this; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function setLogger(LoggerInterface $logger=null) |
|
| 85 | + public function setLogger(LoggerInterface $logger = null) |
|
| 86 | 86 | { |
| 87 | 87 | $this->logger = $logger; |
| 88 | 88 | return $this; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function __call($method, $args) |
| 115 | 115 | { |
| 116 | - switch($method) { |
|
| 116 | + switch ($method) { |
|
| 117 | 117 | case 'emergency': |
| 118 | 118 | case 'alert': |
| 119 | 119 | case 'critical': |