@@ -28,8 +28,8 @@ |
||
28 | 28 | * |
29 | 29 | * @var array |
30 | 30 | */ |
31 | - protected $fields=[ |
|
32 | - 'q' => [ |
|
31 | + protected $fields=[ |
|
32 | + 'q' => [ |
|
33 | 33 | 'enabled' => true |
34 | 34 | ], |
35 | 35 | 'l' => [ |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @var array |
30 | 30 | */ |
31 | - protected $fields=[ |
|
31 | + protected $fields = [ |
|
32 | 32 | 'q' => [ |
33 | 33 | 'enabled' => true |
34 | 34 | ], |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * @return int |
58 | 58 | */ |
59 | - public function getPerPage(){ |
|
59 | + public function getPerPage() { |
|
60 | 60 | return $this->perPage; |
61 | 61 | } |
62 | 62 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @return $this |
67 | 67 | */ |
68 | 68 | public function setPerPage($perPage) { |
69 | - $this->perPage=$perPage; |
|
69 | + $this->perPage = $perPage; |
|
70 | 70 | return $this; |
71 | 71 | } |
72 | 72 | } |
73 | 73 | \ No newline at end of file |
@@ -32,7 +32,7 @@ |
||
32 | 32 | /** |
33 | 33 | * Sets the entity |
34 | 34 | * |
35 | - * @param $entity |
|
35 | + * @param EntityInterface $entity |
|
36 | 36 | * @throws \Core\Exception\ImmutablePropertyException |
37 | 37 | */ |
38 | 38 | public function __construct($entity) |
@@ -67,6 +67,9 @@ discard block |
||
67 | 67 | return $return === $entity ? $this : $return; |
68 | 68 | } |
69 | 69 | |
70 | + /** |
|
71 | + * @param string $property |
|
72 | + */ |
|
70 | 73 | protected function inaccessible($property) |
71 | 74 | { |
72 | 75 | throw new \DomainException(sprintf( |
@@ -75,6 +78,9 @@ discard block |
||
75 | 78 | )); |
76 | 79 | } |
77 | 80 | |
81 | + /** |
|
82 | + * @param string $property |
|
83 | + */ |
|
78 | 84 | protected function immutable($property) |
79 | 85 | { |
80 | 86 | throw new ImmutablePropertyException($property, $this); |
@@ -58,7 +58,7 @@ |
||
58 | 58 | if (!is_callable($callback)) { |
59 | 59 | throw new \BadMethodCallException(sprintf( |
60 | 60 | 'Proxy error: Method "%s" does not exist in proxied "%s"', |
61 | - $method, get_class($entity) |
|
61 | + $method, get_class($entity) |
|
62 | 62 | )); |
63 | 63 | } |
64 | 64 |
@@ -140,12 +140,12 @@ |
||
140 | 140 | public function findLatest($sourceId, $isDraft = false) |
141 | 141 | { |
142 | 142 | return $this->createQueryBuilder() |
143 | - ->field('snapshotMeta.entity.$id')->equals(new \MongoId($sourceId)) |
|
144 | - ->field('snapshotMeta.isDraft')->equals($isDraft) |
|
145 | - ->sort('snapshotMeta.dateCreated.date', 'desc') |
|
146 | - ->limit(1) |
|
147 | - ->getQuery() |
|
148 | - ->getSingleResult(); |
|
143 | + ->field('snapshotMeta.entity.$id')->equals(new \MongoId($sourceId)) |
|
144 | + ->field('snapshotMeta.isDraft')->equals($isDraft) |
|
145 | + ->sort('snapshotMeta.dateCreated.date', 'desc') |
|
146 | + ->limit(1) |
|
147 | + ->getQuery() |
|
148 | + ->getSingleResult(); |
|
149 | 149 | |
150 | 150 | } |
151 | 151 |
@@ -189,7 +189,7 @@ |
||
189 | 189 | |
190 | 190 | protected function checkEntityType($entity) |
191 | 191 | { |
192 | - if ( !is_a($entity, $this->getDocumentName()) ) { |
|
192 | + if (!is_a($entity, $this->getDocumentName())) { |
|
193 | 193 | throw new \InvalidArgumentException(sprintf( |
194 | 194 | 'Entity must be of type %s but recieved %s instead', |
195 | 195 | $this->getDocumentName(), |
@@ -31,7 +31,7 @@ |
||
31 | 31 | public function setMetaData($key, $value = null) |
32 | 32 | { |
33 | 33 | if (is_array($key)) { |
34 | - $this->metaData = $key; |
|
34 | + $this->metaData = $key; |
|
35 | 35 | |
36 | 36 | } else { |
37 | 37 | $this->metaData[$key] = $value; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | use EntityTrait, ClonePropertiesTrait; |
30 | 30 | |
31 | - private $cloneProperties = [ '!items' ]; |
|
31 | + private $cloneProperties = ['!items']; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * The leafs. |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $parent = $nextParent; |
113 | 113 | } |
114 | 114 | $nameParts[] = $item->getName(); |
115 | - $items[] = join(' | ' , $nameParts); |
|
115 | + $items[] = join(' | ', $nameParts); |
|
116 | 116 | |
117 | 117 | } |
118 | 118 |
@@ -89,7 +89,7 @@ |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | if (!$target) { |
92 | - $target = get_class($source) . 'Snapshot'; |
|
92 | + $target = get_class($source).'Snapshot'; |
|
93 | 93 | $target = new $target($source); |
94 | 94 | } |
95 | 95 |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | |
53 | 53 | public function __construct($status = self::CREATED) |
54 | 54 | { |
55 | - $constant = 'self::' . strtoupper(str_replace(' ', '_', $status)); |
|
55 | + $constant = 'self::'.strtoupper(str_replace(' ', '_', $status)); |
|
56 | 56 | if (!defined($constant)) { |
57 | - throw new \DomainException('Unknown status: ' . $status); |
|
57 | + throw new \DomainException('Unknown status: '.$status); |
|
58 | 58 | } |
59 | - $this->name=constant($constant); |
|
60 | - $this->order=$this->getOrder(); |
|
59 | + $this->name = constant($constant); |
|
60 | + $this->order = $this->getOrder(); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function getName() |
68 | 68 | { |
69 | - return isset($this->name)?$this->name:''; |
|
69 | + return isset($this->name) ? $this->name : ''; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $collection->add(clone $item); |
48 | 48 | } |
49 | 49 | $value = $collection; |
50 | - } elseif(null === $value) { |
|
50 | + } elseif (null === $value) { |
|
51 | 51 | |
52 | 52 | } else { |
53 | 53 | $value = clone $value; |