@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | public function __construct() |
23 | 23 | { |
24 | - $this->config = $this->di('config')->toArray()[$this->configKey]; |
|
24 | + $this->config = $this->di('config')->toArray()[$this->configKey]; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function boot() |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $this->initTwig(); |
24 | 24 | |
25 | 25 | $this->_view->setContent( |
26 | - $this->twig->render($this->normalizePath($path), empty($params) ? [] : (array)$params) |
|
26 | + $this->twig->render($this->normalizePath($path), empty($params) ? [] : (array) $params) |
|
27 | 27 | ); |
28 | 28 | } |
29 | 29 |
@@ -99,8 +99,7 @@ |
||
99 | 99 | // Use default value. |
100 | 100 | elseif ($dependency->isOptional()) { |
101 | 101 | $resolved[] = $dependency->getDefaultValue(); |
102 | - } |
|
103 | - else { |
|
102 | + } else { |
|
104 | 103 | throw new \RuntimeException('Cannot resolve dependency $' . $name); |
105 | 104 | } |
106 | 105 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | return true; |
21 | 21 | } |
22 | 22 | |
23 | - $label = $this->getOption('label') ?: $validation->getLabel($field); |
|
23 | + $label = $this->getOption('label') ?: $validation->getLabel($field); |
|
24 | 24 | $error = $this->getOption('message') ?: $validation->getDefaultMessage('Existence'); |
25 | 25 | $error = \strtr($error, [':field' => $label]); |
26 | 26 |
@@ -91,11 +91,11 @@ |
||
91 | 91 | |
92 | 92 | protected function getMessageParts(\Swift_Mime_SimpleMessage $message) |
93 | 93 | { |
94 | - $attachments = \array_filter($message->getChildren(), function ($part) { |
|
94 | + $attachments = \array_filter($message->getChildren(), function($part) { |
|
95 | 95 | return $part instanceof \Swift_Attachment; |
96 | 96 | }); |
97 | 97 | |
98 | - $attachments = \array_map(function ($part) { |
|
98 | + $attachments = \array_map(function($part) { |
|
99 | 99 | return $part->getName(); |
100 | 100 | }, $attachments); |
101 | 101 |
@@ -78,7 +78,7 @@ |
||
78 | 78 | ->setTo('me@localhost')->setSubject('Hi')->setBody('Hello')->mail(); |
79 | 79 | |
80 | 80 | $info['newTemplateMail[mail]=1'] = $this->di('mailer')->newTemplateMail('mail.template') |
81 | - ->setTo('me@localhost')->setSubject('Hi')->mail(); |
|
81 | + ->setTo('me@localhost')->setSubject('Hi')->mail(); |
|
82 | 82 | |
83 | 83 | return '<pre>' . print_r($info, 1) . '</pre>' |
84 | 84 | . '<p>You can check mail logs in <code>example/.var/mail/</code></p>'; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $this->di()->registerAliases([ |
54 | 54 | 'theTwig' => 'twig', |
55 | - 'Phalcon\\Db\\Adapter' => 'db', // needs alias as `NeedsDb` has its name `_db` |
|
55 | + 'Phalcon\\Db\\Adapter' => 'db', // needs alias as `NeedsDb` has its name `_db` |
|
56 | 56 | // Mailer::class => 'mailer', // no need- `DeepNest` uses known name `mailer` |
57 | 57 | ]); |
58 | 58 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $validation = $this->di('validation'); // or $this->di('validator'); |
102 | 102 | |
103 | 103 | // Register new validation rule (if it is used app wide- register when defining in di) |
104 | - $validation->register('gmail', function ($data) { |
|
104 | + $validation->register('gmail', function($data) { |
|
105 | 105 | return stripos($data['email'] ?? '', '@gmail.com') > 0; |
106 | 106 | }, 'Field :field must be an email with @gmail.com'); |
107 | 107 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $di = require_once __DIR__ . '/bootstrap.php'; |
15 | 15 | |
16 | 16 | // However we will use simple view here |
17 | -$di->setShared('view', function () { |
|
17 | +$di->setShared('view', function() { |
|
18 | 18 | $view = new SimpleView; |
19 | 19 | |
20 | 20 | $view->setViewsDir($this->get('config')->toArray()['view']['dir']); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | (new Cors)->boot(); |
52 | 52 | (new Cache)->boot(); |
53 | 53 | |
54 | -$app->notFound(function () use ($di) { |
|
54 | +$app->notFound(function() use ($di) { |
|
55 | 55 | return $di->get('response')->setContent('')->setStatusCode(404); |
56 | 56 | }); |
57 | 57 |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | // Setting config in DI is REQUIRED by this package. |
27 | 27 | $di->setShared('config', new Phalcon\Config(require __DIR__ . '/config.php')); |
28 | 28 | |
29 | -$di->setShared('db', function () { |
|
29 | +$di->setShared('db', function() { |
|
30 | 30 | $config = $this->get('config')->toArray(); |
31 | 31 | |
32 | 32 | // PS: If you had already extended your db adapter then imoort trait `PhalconExt\Db\Extension` |
33 | 33 | return (new Sqlite($config['database']))->registerLogger($config['sqllogger']); |
34 | 34 | }); |
35 | 35 | |
36 | -$di->setShared('view', function () { |
|
36 | +$di->setShared('view', function() { |
|
37 | 37 | return (new View) |
38 | 38 | ->setViewsDir($this->get('config')->toArray()['view']['dir']) |
39 | 39 | ->registerEngines([ |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ]); |
42 | 42 | }); |
43 | 43 | |
44 | -$di->setShared('twig', function () { |
|
44 | +$di->setShared('twig', function() { |
|
45 | 45 | $twig = new Twig($this->get('view'), $this); |
46 | 46 | |
47 | 47 | // Here you can: |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | return $twig; |
52 | 52 | }); |
53 | 53 | |
54 | -$di->setShared('mailer', function () { |
|
54 | +$di->setShared('mailer', function() { |
|
55 | 55 | return (new Mailer($this->get('config')->toArray()['mail'])); |
56 | 56 | }); |
57 | 57 | |
58 | -$di->setShared('redis', function () { |
|
58 | +$di->setShared('redis', function() { |
|
59 | 59 | return new Redis(new CacheFront(['lifetime' => 0])); |
60 | 60 | }); |
61 | 61 |