@@ -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 | |
@@ -35,7 +35,7 @@ discard block |
||
| 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'); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function content() |
| 71 | 71 | { |
| 72 | - if($this->content == null){ |
|
| 72 | + if ($this->content == null) { |
|
| 73 | 73 | $this->content = $this->repository->getContentService()->loadContent($this->location->contentId); |
| 74 | 74 | } |
| 75 | 75 | return $this->content; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function location() |
| 83 | 83 | { |
| 84 | - if($this->location == null){ |
|
| 84 | + if ($this->location == null) { |
|
| 85 | 85 | $this->location = $this->repository->getLocationService()->loadLocation($this->content->contentInfo->mainLocationId); |
| 86 | 86 | } |
| 87 | 87 | return $this->location; |
@@ -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 |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | protected $settings; |
| 59 | 59 | protected $logger; |
| 60 | 60 | |
| 61 | - public function __construct(eZRepository $repository, $entityManager, array $settings=array(), $contentTypeIdentifier='') |
|
| 61 | + public function __construct(eZRepository $repository, $entityManager, array $settings = array(), $contentTypeIdentifier = '') |
|
| 62 | 62 | { |
| 63 | 63 | $this->repository = $repository; |
| 64 | 64 | $this->entityManager = $entityManager; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | return $this; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function setLogger(LoggerInterface $logger=null) |
|
| 81 | + public function setLogger(LoggerInterface $logger = null) |
|
| 82 | 82 | { |
| 83 | 83 | $this->logger = $logger; |
| 84 | 84 | return $this; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function __call($method, $args) |
| 111 | 111 | { |
| 112 | - switch($method) { |
|
| 112 | + switch ($method) { |
|
| 113 | 113 | case 'emergency': |
| 114 | 114 | case 'alert': |
| 115 | 115 | case 'critical': |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | protected function loadEntitiesFromSearchResults(SearchResult $searchResult) |
| 245 | 245 | { |
| 246 | 246 | $entities = array(); |
| 247 | - foreach($searchResult->searchHits as $searchHit) { |
|
| 247 | + foreach ($searchResult->searchHits as $searchHit) { |
|
| 248 | 248 | // let's hope that in the future eZPublish does not add new types of results to SearchResult... :-P |
| 249 | 249 | if ($searchHit->valueObject instanceof \eZ\Publish\API\Repository\Values\Content\Location) { |
| 250 | 250 | $entities[] = $this->loadEntityFromLocation($searchHit->valueObject); |
@@ -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,22 +168,22 @@ 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(); |
| 175 | - foreach($contents->searchHits as $searchHit) { |
|
| 175 | + foreach ($contents->searchHits as $searchHit) { |
|
| 176 | 176 | $entities[] = $this->load($searchHit->valueObject); |
| 177 | 177 | } |
| 178 | 178 | return $entities; |
| 179 | 179 | case is_array($contents): |
| 180 | 180 | $entities = array(); |
| 181 | - foreach($contents as $key => $value) { |
|
| 181 | + foreach ($contents as $key => $value) { |
|
| 182 | 182 | $entities[$key] = $this->load($value); |
| 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 | /** |