@@ -28,6 +28,6 @@ |
||
| 28 | 28 | |
| 29 | 29 | public function getUri(): string |
| 30 | 30 | { |
| 31 | - return '/'.trim('file/Core.Images/' . $this->id . "/" . urlencode($this->name), '/'); |
|
| 31 | + return '/'.trim('file/Core.Images/'.$this->id."/".urlencode($this->name), '/'); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | \ No newline at end of file |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $images = $this->images; |
| 65 | 65 | $metadata = $image->getMetadata(); |
| 66 | - if(!is_null($current = $this->get($metadata->getKey(), false))){ |
|
| 66 | + if (!is_null($current = $this->get($metadata->getKey(), false))) { |
|
| 67 | 67 | $index = $images->indexOf($current); |
| 68 | 68 | $images->remove($index); |
| 69 | 69 | } |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | public function get(string $key, bool $fallback = true): ?ImageInterface |
| 75 | 75 | { |
| 76 | - foreach($this->images as $image){ |
|
| 77 | - try{ |
|
| 78 | - if(!is_null($metadata = $image->getMetadata())){ |
|
| 79 | - if($metadata->getKey() === $key){ |
|
| 76 | + foreach ($this->images as $image) { |
|
| 77 | + try { |
|
| 78 | + if (!is_null($metadata = $image->getMetadata())) { |
|
| 79 | + if ($metadata->getKey() === $key) { |
|
| 80 | 80 | return $image; |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - }catch (\Exception $e){ |
|
| 83 | + } catch (\Exception $e) { |
|
| 84 | 84 | return null; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | return $image; |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - }catch (\Exception $e){ |
|
| 83 | + } catch (\Exception $e){ |
|
| 84 | 84 | return null; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -94,17 +94,17 @@ |
||
| 94 | 94 | $size = $this->getLength(); |
| 95 | 95 | |
| 96 | 96 | if ($size >= 1073741824) { |
| 97 | - return round($size / 1073741824, 2) . ' GB'; |
|
| 97 | + return round($size / 1073741824, 2).' GB'; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | if ($size >= 1048576) { |
| 101 | - return round($size / 1048576, 2) . ' MB'; |
|
| 101 | + return round($size / 1048576, 2).' MB'; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | if ($size >= 1024) { |
| 105 | - return round($size / 1024, 2) . ' kB'; |
|
| 105 | + return round($size / 1024, 2).' kB'; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - return (string)$size; |
|
| 108 | + return (string) $size; |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | \ No newline at end of file |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | * Image specifications. |
| 42 | 42 | */ |
| 43 | 43 | protected array $images = [ |
| 44 | - ImageSetInterface::THUMBNAIL => [100,100], |
|
| 44 | + ImageSetInterface::THUMBNAIL => [100, 100], |
|
| 45 | 45 | ]; |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | 'entity' => $snapshot |
| 126 | 126 | ]); |
| 127 | 127 | $this->dm->getEventManager() |
| 128 | - ->dispatchEvent(DoctrineMongoODM\Event\RepositoryEventsSubscriber::postCreate, $eventArgs); |
|
| 128 | + ->dispatchEvent(DoctrineMongoODM\Event\RepositoryEventsSubscriber::postCreate, $eventArgs); |
|
| 129 | 129 | |
| 130 | 130 | $this->copy($source, $snapshot); |
| 131 | 131 | |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | public function findLatest($sourceId, $isDraft = false) |
| 202 | 202 | { |
| 203 | 203 | $entity = $this->createQueryBuilder() |
| 204 | - ->field('snapshotEntity')->equals(new ObjectId($sourceId)) |
|
| 205 | - ->field('snapshotMeta.isDraft')->equals($isDraft) |
|
| 206 | - ->sort('snapshotMeta.dateCreated.date', 'desc') |
|
| 207 | - ->limit(1) |
|
| 208 | - ->getQuery() |
|
| 209 | - ->getSingleResult() |
|
| 204 | + ->field('snapshotEntity')->equals(new ObjectId($sourceId)) |
|
| 205 | + ->field('snapshotMeta.isDraft')->equals($isDraft) |
|
| 206 | + ->sort('snapshotMeta.dateCreated.date', 'desc') |
|
| 207 | + ->limit(1) |
|
| 208 | + ->getQuery() |
|
| 209 | + ->getSingleResult() |
|
| 210 | 210 | ; |
| 211 | 211 | if ($entity) { |
| 212 | 212 | $this->dm->getEventManager()->dispatchEvent( |
@@ -69,11 +69,11 @@ |
||
| 69 | 69 | $proxyDir = $config->getProxyDir(); |
| 70 | 70 | $hydratorDir = $config->getHydratorDir(); |
| 71 | 71 | |
| 72 | - if(!is_dir($proxyDir)){ |
|
| 72 | + if (!is_dir($proxyDir)) { |
|
| 73 | 73 | mkdir($proxyDir, 0777, true); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if(!is_dir($hydratorDir)){ |
|
| 76 | + if (!is_dir($hydratorDir)) { |
|
| 77 | 77 | mkdir($hydratorDir, 0777, true); |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $timezone = $value->getTimezone()->getName(); |
| 57 | 57 | $timestamp = $value->getTimestamp(); |
| 58 | - $date = new UTCDateTime($timestamp*1000); |
|
| 58 | + $date = new UTCDateTime($timestamp * 1000); |
|
| 59 | 59 | |
| 60 | 60 | return array( |
| 61 | 61 | 'date' => $date, |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | public function closureToDatabase() |
| 73 | 73 | { |
| 74 | 74 | return ' |
| 75 | - /* CODE FROM: ' . __METHOD__ . ' */ |
|
| 75 | + /* CODE FROM: ' . __METHOD__.' */ |
|
| 76 | 76 | if (!$value instanceOf \DateTime) return null; |
| 77 | 77 | $return = array( |
| 78 | 78 | "date" => new UTCDateTime($value->getTimestamp()), |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | public function closureToPhp(): string |
| 115 | 115 | { |
| 116 | 116 | return ' |
| 117 | - /* CODE FROM: ' . __METHOD__ . ' */ |
|
| 117 | + /* CODE FROM: ' . __METHOD__.' */ |
|
| 118 | 118 | if (!is_array($value) |
| 119 | 119 | || !isset($value["date"]) |
| 120 | 120 | || is_null($value["date"]) |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $name = "\\$namespace\\Entity\\$entityName"; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $repository = $this->dm->getRepository($name); |
|
| 41 | + $repository = $this->dm->getRepository($name); |
|
| 42 | 42 | |
| 43 | 43 | if (!$repository instanceof AbstractRepository) { |
| 44 | 44 | $eventArgs = new DoctrineMongoODM\Event\EventArgs( |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function flush($entity = null, array $options = array()) |
| 68 | 68 | { |
| 69 | - if(!is_null($entity)){ |
|
| 69 | + if (!is_null($entity)) { |
|
| 70 | 70 | $this->dm->persist($entity); |
| 71 | 71 | } |
| 72 | 72 | $this->dm->flush(); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | && $events->dispatchEvent('postCommit', new EventArgs(array('document' => $entity, 'documentManager' => $this->dm))); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function remove(EntityInterface $entity, $flush=false) |
|
| 78 | + public function remove(EntityInterface $entity, $flush = false) |
|
| 79 | 79 | { |
| 80 | 80 | $dm = $this->dm; |
| 81 | 81 | $events = $dm->getEventManager(); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $properties = $refl->getProperties(); |
| 50 | 50 | |
| 51 | 51 | foreach ($properties as $property) { |
| 52 | - $name = $property->getName(); |
|
| 52 | + $name = $property->getName(); |
|
| 53 | 53 | |
| 54 | 54 | // @TODO: check if '-' check is necessary |
| 55 | 55 | if ( |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | continue; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - $value = $rating->{'get' . $name}(); |
|
| 62 | + $value = $rating->{'get'.$name}(); |
|
| 63 | 63 | $input = array( |
| 64 | 64 | 'type' => 'Core/Rating', |
| 65 | 65 | 'name' => $name, |