@@ -35,11 +35,11 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function createInjection(\ReflectionClass $class, string $context = null) |
| 37 | 37 | { |
| 38 | - if (!$this->orm->getSchema()->defines($context)) { |
|
| 38 | + if (!$this->orm->getSchema()->defines($context)){ |
|
| 39 | 39 | $context = Inflector::singularize($context); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if (!$this->orm->getSchema()->defines($context)) { |
|
| 42 | + if (!$this->orm->getSchema()->defines($context)){ |
|
| 43 | 43 | throw new ORMException('Cycle schema is not initiated or role missing, run `cycle`'); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -35,11 +35,13 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function createInjection(\ReflectionClass $class, string $context = null) |
| 37 | 37 | { |
| 38 | - if (!$this->orm->getSchema()->defines($context)) { |
|
| 38 | + if (!$this->orm->getSchema()->defines($context)) |
|
| 39 | + { |
|
| 39 | 40 | $context = Inflector::singularize($context); |
| 40 | 41 | } |
| 41 | 42 | |
| 42 | - if (!$this->orm->getSchema()->defines($context)) { |
|
| 43 | + if (!$this->orm->getSchema()->defines($context)) |
|
| 44 | + { |
|
| 43 | 45 | throw new ORMException('Cycle schema is not initiated or role missing, run `cycle`'); |
| 44 | 46 | } |
| 45 | 47 | |
@@ -45,17 +45,17 @@ discard block |
||
| 45 | 45 | string $mergeMode = self::FOLLOW, |
| 46 | 46 | int $mode = FilesInterface::READONLY |
| 47 | 47 | ): void { |
| 48 | - if (!$this->files->isFile($filename)) { |
|
| 48 | + if (!$this->files->isFile($filename)){ |
|
| 49 | 49 | throw new PublishException("Given '{$filename}' is not valid file"); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if ($this->files->exists($destination)) { |
|
| 53 | - if ($this->files->md5($destination) == $this->files->md5($filename)) { |
|
| 52 | + if ($this->files->exists($destination)){ |
|
| 53 | + if ($this->files->md5($destination) == $this->files->md5($filename)){ |
|
| 54 | 54 | //Nothing to do |
| 55 | 55 | return; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if ($mergeMode == self::FOLLOW) { |
|
| 58 | + if ($mergeMode == self::FOLLOW){ |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | string $mergeMode = self::REPLACE, |
| 78 | 78 | int $mode = FilesInterface::READONLY |
| 79 | 79 | ): void { |
| 80 | - if (!$this->files->isDirectory($directory)) { |
|
| 80 | + if (!$this->files->isDirectory($directory)){ |
|
| 81 | 81 | throw new PublishException("Given '{$directory}' is not valid directory"); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | /** |
| 88 | 88 | * @var SplFileInfo $file |
| 89 | 89 | */ |
| 90 | - foreach ($finder->getIterator() as $file) { |
|
| 90 | + foreach ($finder->getIterator() as $file){ |
|
| 91 | 91 | $this->publish( |
| 92 | 92 | (string)$file, |
| 93 | - $destination . '/' . $file->getRelativePathname(), |
|
| 93 | + $destination.'/'.$file->getRelativePathname(), |
|
| 94 | 94 | $mergeMode, |
| 95 | 95 | $mode |
| 96 | 96 | ); |
@@ -45,17 +45,21 @@ discard block |
||
| 45 | 45 | string $mergeMode = self::FOLLOW, |
| 46 | 46 | int $mode = FilesInterface::READONLY |
| 47 | 47 | ): void { |
| 48 | - if (!$this->files->isFile($filename)) { |
|
| 48 | + if (!$this->files->isFile($filename)) |
|
| 49 | + { |
|
| 49 | 50 | throw new PublishException("Given '{$filename}' is not valid file"); |
| 50 | 51 | } |
| 51 | 52 | |
| 52 | - if ($this->files->exists($destination)) { |
|
| 53 | - if ($this->files->md5($destination) == $this->files->md5($filename)) { |
|
| 53 | + if ($this->files->exists($destination)) |
|
| 54 | + { |
|
| 55 | + if ($this->files->md5($destination) == $this->files->md5($filename)) |
|
| 56 | + { |
|
| 54 | 57 | //Nothing to do |
| 55 | 58 | return; |
| 56 | 59 | } |
| 57 | 60 | |
| 58 | - if ($mergeMode == self::FOLLOW) { |
|
| 61 | + if ($mergeMode == self::FOLLOW) |
|
| 62 | + { |
|
| 59 | 63 | return; |
| 60 | 64 | } |
| 61 | 65 | } |
@@ -77,7 +81,8 @@ discard block |
||
| 77 | 81 | string $mergeMode = self::REPLACE, |
| 78 | 82 | int $mode = FilesInterface::READONLY |
| 79 | 83 | ): void { |
| 80 | - if (!$this->files->isDirectory($directory)) { |
|
| 84 | + if (!$this->files->isDirectory($directory)) |
|
| 85 | + { |
|
| 81 | 86 | throw new PublishException("Given '{$directory}' is not valid directory"); |
| 82 | 87 | } |
| 83 | 88 | |
@@ -87,7 +92,8 @@ discard block |
||
| 87 | 92 | /** |
| 88 | 93 | * @var SplFileInfo $file |
| 89 | 94 | */ |
| 90 | - foreach ($finder->getIterator() as $file) { |
|
| 95 | + foreach ($finder->getIterator() as $file) |
|
| 96 | + { |
|
| 91 | 97 | $this->publish( |
| 92 | 98 | (string)$file, |
| 93 | 99 | $destination . '/' . $file->getRelativePathname(), |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function createPaginator(string $parameter, int $limit = 25): PaginatorInterface |
| 48 | 48 | { |
| 49 | - if (!$this->container->has(ServerRequestInterface::class)) { |
|
| 49 | + if (!$this->container->has(ServerRequestInterface::class)){ |
|
| 50 | 50 | throw new ScopeException('Unable to create paginator, no request scope found'); |
| 51 | 51 | } |
| 52 | 52 | /** |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | //Getting page number |
| 58 | 58 | $page = 0; |
| 59 | - if (!empty($query[$parameter]) && is_scalar($query[$parameter])) { |
|
| 59 | + if (!empty($query[$parameter]) && is_scalar($query[$parameter])){ |
|
| 60 | 60 | $page = (int)$query[$parameter]; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -46,7 +46,8 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function createPaginator(string $parameter, int $limit = 25): PaginatorInterface |
| 48 | 48 | { |
| 49 | - if (!$this->container->has(ServerRequestInterface::class)) { |
|
| 49 | + if (!$this->container->has(ServerRequestInterface::class)) |
|
| 50 | + { |
|
| 50 | 51 | throw new ScopeException('Unable to create paginator, no request scope found'); |
| 51 | 52 | } |
| 52 | 53 | /** |
@@ -56,7 +57,8 @@ discard block |
||
| 56 | 57 | |
| 57 | 58 | //Getting page number |
| 58 | 59 | $page = 0; |
| 59 | - if (!empty($query[$parameter]) && is_scalar($query[$parameter])) { |
|
| 60 | + if (!empty($query[$parameter]) && is_scalar($query[$parameter])) |
|
| 61 | + { |
|
| 60 | 62 | $page = (int)$query[$parameter]; |
| 61 | 63 | } |
| 62 | 64 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | $finalizer->addFinalizer(function () use ($container): void { |
| 29 | 29 | /** @var DatabaseManager $dbal */ |
| 30 | 30 | $dbal = $container->get(DatabaseManager::class); |
| 31 | - foreach ($dbal->getDrivers() as $driver) { |
|
| 31 | + foreach ($dbal->getDrivers() as $driver){ |
|
| 32 | 32 | $driver->disconnect(); |
| 33 | 33 | } |
| 34 | 34 | }); |
@@ -28,7 +28,8 @@ |
||
| 28 | 28 | $finalizer->addFinalizer(function () use ($container): void { |
| 29 | 29 | /** @var DatabaseManager $dbal */ |
| 30 | 30 | $dbal = $container->get(DatabaseManager::class); |
| 31 | - foreach ($dbal->getDrivers() as $driver) { |
|
| 31 | + foreach ($dbal->getDrivers() as $driver) |
|
| 32 | + { |
|
| 32 | 33 | $driver->disconnect(); |
| 33 | 34 | } |
| 34 | 35 | }); |
@@ -40,8 +40,8 @@ |
||
| 40 | 40 | EnvironmentInterface $env, |
| 41 | 41 | DirectoriesInterface $dirs |
| 42 | 42 | ): void { |
| 43 | - if (!$dirs->has('migrations')) { |
|
| 44 | - $dirs->set('migrations', $dirs->get('app') . 'migrations'); |
|
| 43 | + if (!$dirs->has('migrations')){ |
|
| 44 | + $dirs->set('migrations', $dirs->get('app').'migrations'); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $config->setDefaults('migration', [ |
@@ -40,7 +40,8 @@ |
||
| 40 | 40 | EnvironmentInterface $env, |
| 41 | 41 | DirectoriesInterface $dirs |
| 42 | 42 | ): void { |
| 43 | - if (!$dirs->has('migrations')) { |
|
| 43 | + if (!$dirs->has('migrations')) |
|
| 44 | + { |
|
| 44 | 45 | $dirs->set('migrations', $dirs->get('app') . 'migrations'); |
| 45 | 46 | } |
| 46 | 47 | |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | string $footer, |
| 129 | 129 | array $options |
| 130 | 130 | ): Append { |
| 131 | - if (is_array($sequence) || $sequence instanceof \Closure) { |
|
| 131 | + if (is_array($sequence) || $sequence instanceof \Closure){ |
|
| 132 | 132 | return new Append( |
| 133 | 133 | $target, |
| 134 | 134 | null, |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | public function boot(Container $container, FinalizerInterface $finalizer, SchemaInterface $schema = null): void |
| 51 | 51 | { |
| 52 | 52 | $finalizer->addFinalizer(function () use ($container): void { |
| 53 | - if ($container->hasInstance(ORMInterface::class)) { |
|
| 53 | + if ($container->hasInstance(ORMInterface::class)){ |
|
| 54 | 54 | $container->get(ORMInterface::class)->getHeap()->clean(); |
| 55 | 55 | } |
| 56 | 56 | }); |
| 57 | 57 | |
| 58 | 58 | $container->bindInjector(Select::class, SelectInjector::class); |
| 59 | 59 | |
| 60 | - if ($schema !== null) { |
|
| 60 | + if ($schema !== null){ |
|
| 61 | 61 | $this->bindRepositories($container, $schema); |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function bindRepositories(Container $container, SchemaInterface $schema): void |
| 72 | 72 | { |
| 73 | - foreach ($schema->getRoles() as $role) { |
|
| 73 | + foreach ($schema->getRoles() as $role){ |
|
| 74 | 74 | $repository = $schema->define($role, SchemaInterface::REPOSITORY); |
| 75 | - if ($repository === Select\Repository::class || $repository === null) { |
|
| 75 | + if ($repository === Select\Repository::class || $repository === null){ |
|
| 76 | 76 | // default repository can not be wired |
| 77 | 77 | continue; |
| 78 | 78 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | ): ORMInterface { |
| 98 | 98 | $orm = new ORM($factory, $schema); |
| 99 | 99 | |
| 100 | - if ($promiseFactory !== null) { |
|
| 100 | + if ($promiseFactory !== null){ |
|
| 101 | 101 | return $orm->withPromiseFactory($promiseFactory); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -50,14 +50,16 @@ discard block |
||
| 50 | 50 | public function boot(Container $container, FinalizerInterface $finalizer, SchemaInterface $schema = null): void |
| 51 | 51 | { |
| 52 | 52 | $finalizer->addFinalizer(function () use ($container): void { |
| 53 | - if ($container->hasInstance(ORMInterface::class)) { |
|
| 53 | + if ($container->hasInstance(ORMInterface::class)) |
|
| 54 | + { |
|
| 54 | 55 | $container->get(ORMInterface::class)->getHeap()->clean(); |
| 55 | 56 | } |
| 56 | 57 | }); |
| 57 | 58 | |
| 58 | 59 | $container->bindInjector(Select::class, SelectInjector::class); |
| 59 | 60 | |
| 60 | - if ($schema !== null) { |
|
| 61 | + if ($schema !== null) |
|
| 62 | + { |
|
| 61 | 63 | $this->bindRepositories($container, $schema); |
| 62 | 64 | } |
| 63 | 65 | } |
@@ -70,15 +72,18 @@ discard block |
||
| 70 | 72 | */ |
| 71 | 73 | public function bindRepositories(Container $container, SchemaInterface $schema): void |
| 72 | 74 | { |
| 73 | - foreach ($schema->getRoles() as $role) { |
|
| 75 | + foreach ($schema->getRoles() as $role) |
|
| 76 | + { |
|
| 74 | 77 | $repository = $schema->define($role, SchemaInterface::REPOSITORY); |
| 75 | - if ($repository === Select\Repository::class || $repository === null) { |
|
| 78 | + if ($repository === Select\Repository::class || $repository === null) |
|
| 79 | + { |
|
| 76 | 80 | // default repository can not be wired |
| 77 | 81 | continue; |
| 78 | 82 | } |
| 79 | 83 | |
| 80 | 84 | // initiate all repository dependencies using factory method forwarded to ORM |
| 81 | - $container->bindSingleton($repository, function (ORMInterface $orm) use ($role) { |
|
| 85 | + $container->bindSingleton($repository, function (ORMInterface $orm) use ($role) |
|
| 86 | + { |
|
| 82 | 87 | return $orm->getRepository($role); |
| 83 | 88 | }); |
| 84 | 89 | } |
@@ -97,7 +102,8 @@ discard block |
||
| 97 | 102 | ): ORMInterface { |
| 98 | 103 | $orm = new ORM($factory, $schema); |
| 99 | 104 | |
| 100 | - if ($promiseFactory !== null) { |
|
| 105 | + if ($promiseFactory !== null) |
|
| 106 | + { |
|
| 101 | 107 | return $orm->withPromiseFactory($promiseFactory); |
| 102 | 108 | } |
| 103 | 109 | |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | 'handler' => new Autowire( |
| 63 | 63 | FileHandler::class, |
| 64 | 64 | [ |
| 65 | - 'directory' => $directories->get('runtime') . 'session', |
|
| 65 | + 'directory' => $directories->get('runtime').'session', |
|
| 66 | 66 | 'lifetime' => 86400 |
| 67 | 67 | ] |
| 68 | 68 | ) |
@@ -58,8 +58,8 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function boot(EnvironmentInterface $env, DirectoriesInterface $dirs): void |
| 60 | 60 | { |
| 61 | - if (!$dirs->has('locale')) { |
|
| 62 | - $dirs->set('locale', $dirs->get('app') . 'locale/'); |
|
| 61 | + if (!$dirs->has('locale')){ |
|
| 62 | + $dirs->set('locale', $dirs->get('app').'locale/'); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $this->config->setDefaults('translator', [ |
@@ -58,7 +58,8 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function boot(EnvironmentInterface $env, DirectoriesInterface $dirs): void |
| 60 | 60 | { |
| 61 | - if (!$dirs->has('locale')) { |
|
| 61 | + if (!$dirs->has('locale')) |
|
| 62 | + { |
|
| 62 | 63 | $dirs->set('locale', $dirs->get('app') . 'locale/'); |
| 63 | 64 | } |
| 64 | 65 | |