@@ -34,58 +34,58 @@ |
||
34 | 34 | */ |
35 | 35 | class Application implements ApplicationContracts |
36 | 36 | { |
37 | - /** |
|
38 | - * Get the Lenevor class instance. |
|
39 | - * |
|
40 | - * @var \Syscodes\Contracts\Core\Lenevor $core |
|
41 | - */ |
|
42 | - protected $core; |
|
37 | + /** |
|
38 | + * Get the Lenevor class instance. |
|
39 | + * |
|
40 | + * @var \Syscodes\Contracts\Core\Lenevor $core |
|
41 | + */ |
|
42 | + protected $core; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Console constructor. Initialize the console of Lenevor. |
|
46 | - * |
|
47 | - * @param \Syscodes\Contracts\Core\Lenevor $core |
|
48 | - * |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function __construct(Lenevor $core) |
|
52 | - { |
|
53 | - // Initialize the Cli |
|
54 | - if (isCli()) { |
|
55 | - Cli::initialize(); |
|
56 | - } |
|
44 | + /** |
|
45 | + * Console constructor. Initialize the console of Lenevor. |
|
46 | + * |
|
47 | + * @param \Syscodes\Contracts\Core\Lenevor $core |
|
48 | + * |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function __construct(Lenevor $core) |
|
52 | + { |
|
53 | + // Initialize the Cli |
|
54 | + if (isCli()) { |
|
55 | + Cli::initialize(); |
|
56 | + } |
|
57 | 57 | |
58 | - $this->core = $core; |
|
59 | - } |
|
58 | + $this->core = $core; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Runs the current command discovered on the CLI. |
|
63 | - * |
|
64 | - * @return void |
|
65 | - */ |
|
66 | - public function run() |
|
67 | - { |
|
68 | - Cli::getURI(); |
|
61 | + /** |
|
62 | + * Runs the current command discovered on the CLI. |
|
63 | + * |
|
64 | + * @return void |
|
65 | + */ |
|
66 | + public function run() |
|
67 | + { |
|
68 | + Cli::getURI(); |
|
69 | 69 | |
70 | 70 | |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Displays basic information about the Console. |
|
75 | - * |
|
76 | - * @return void |
|
77 | - * |
|
78 | - * @uses Version::PRODUCT |
|
79 | - * @uses Version::RELEASE |
|
80 | - */ |
|
81 | - public function showHeader() |
|
82 | - { |
|
83 | - Cli::write(Version::PRODUCT.' ' |
|
84 | - .Cli::color(Version::RELEASE, 'cyan').' | ' |
|
85 | - .'Server Time: '.Cli::color(date('Y/m/d H:i:sa'), 'light_yellow').' | ' |
|
86 | - .cli::color('['.PHP_OS.']', 'light_purple') |
|
87 | - ); |
|
73 | + /** |
|
74 | + * Displays basic information about the Console. |
|
75 | + * |
|
76 | + * @return void |
|
77 | + * |
|
78 | + * @uses Version::PRODUCT |
|
79 | + * @uses Version::RELEASE |
|
80 | + */ |
|
81 | + public function showHeader() |
|
82 | + { |
|
83 | + Cli::write(Version::PRODUCT.' ' |
|
84 | + .Cli::color(Version::RELEASE, 'cyan').' | ' |
|
85 | + .'Server Time: '.Cli::color(date('Y/m/d H:i:sa'), 'light_yellow').' | ' |
|
86 | + .cli::color('['.PHP_OS.']', 'light_purple') |
|
87 | + ); |
|
88 | 88 | |
89 | - Cli::newLine(1); |
|
90 | - } |
|
89 | + Cli::newLine(1); |
|
90 | + } |
|
91 | 91 | } |
92 | 92 | \ No newline at end of file |
@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | public function register() |
55 | 55 | { |
56 | - $this->booting(function () { |
|
56 | + $this->booting(function() { |
|
57 | 57 | $events = $this->listens(); |
58 | 58 | |
59 | 59 | foreach ((array) $events as $event => $listeners) { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | return $this->createClassListener($listener, $wildcard); |
134 | 134 | } |
135 | 135 | |
136 | - return function ($event, $payload) use ($listener, $wildcard) { |
|
136 | + return function($event, $payload) use ($listener, $wildcard) { |
|
137 | 137 | if ($wildcard) { |
138 | 138 | return $listener($event, $payload); |
139 | 139 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function createClassListener($listener, $wildcard = false) |
154 | 154 | { |
155 | - return function ($event, $payload) use ($listener, $wildcard) { |
|
155 | + return function($event, $payload) use ($listener, $wildcard) { |
|
156 | 156 | if ($wildcard) { |
157 | 157 | return call_user_func($this->createClassClosure($listener), $event, $payload); |
158 | 158 | } |
@@ -34,156 +34,156 @@ |
||
34 | 34 | */ |
35 | 35 | class Parameters implements IteratorAggregate, Countable |
36 | 36 | { |
37 | - /** |
|
38 | - * Array parameters from the Server global. |
|
39 | - * |
|
40 | - * @var array $parameters |
|
41 | - */ |
|
42 | - protected $parameters = []; |
|
37 | + /** |
|
38 | + * Array parameters from the Server global. |
|
39 | + * |
|
40 | + * @var array $parameters |
|
41 | + */ |
|
42 | + protected $parameters = []; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Parameter Object Constructor. |
|
46 | - * |
|
47 | - * @param array $parameters |
|
48 | - * |
|
49 | - * @return array |
|
50 | - */ |
|
51 | - public function __construct(array $parameters = []) |
|
52 | - { |
|
53 | - $this->parameters = $parameters; |
|
54 | - } |
|
44 | + /** |
|
45 | + * Parameter Object Constructor. |
|
46 | + * |
|
47 | + * @param array $parameters |
|
48 | + * |
|
49 | + * @return array |
|
50 | + */ |
|
51 | + public function __construct(array $parameters = []) |
|
52 | + { |
|
53 | + $this->parameters = $parameters; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Returns the parameters. |
|
58 | - * |
|
59 | - * @return array |
|
60 | - */ |
|
61 | - public function all() |
|
62 | - { |
|
63 | - return $this->parameters; |
|
64 | - } |
|
56 | + /** |
|
57 | + * Returns the parameters. |
|
58 | + * |
|
59 | + * @return array |
|
60 | + */ |
|
61 | + public function all() |
|
62 | + { |
|
63 | + return $this->parameters; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Returns the parameter keys. |
|
68 | - * |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - public function keys() |
|
72 | - { |
|
73 | - return array_keys($this->parameters); |
|
74 | - } |
|
66 | + /** |
|
67 | + * Returns the parameter keys. |
|
68 | + * |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + public function keys() |
|
72 | + { |
|
73 | + return array_keys($this->parameters); |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Replaces the current parameters. |
|
78 | - * |
|
79 | - * @param array $parameters |
|
80 | - * |
|
81 | - * @return array |
|
82 | - */ |
|
83 | - public function replace(array $parameters = []) |
|
84 | - { |
|
85 | - $this->parameters = $parameters; |
|
86 | - } |
|
76 | + /** |
|
77 | + * Replaces the current parameters. |
|
78 | + * |
|
79 | + * @param array $parameters |
|
80 | + * |
|
81 | + * @return array |
|
82 | + */ |
|
83 | + public function replace(array $parameters = []) |
|
84 | + { |
|
85 | + $this->parameters = $parameters; |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * Adds parameters. |
|
90 | - * |
|
91 | - * @param array $parameters |
|
92 | - * |
|
93 | - * @return array |
|
94 | - */ |
|
95 | - public function add(array $parameters = []) |
|
96 | - { |
|
97 | - $this->parameters = array_replace($this->parameters, $parameters); |
|
98 | - } |
|
88 | + /** |
|
89 | + * Adds parameters. |
|
90 | + * |
|
91 | + * @param array $parameters |
|
92 | + * |
|
93 | + * @return array |
|
94 | + */ |
|
95 | + public function add(array $parameters = []) |
|
96 | + { |
|
97 | + $this->parameters = array_replace($this->parameters, $parameters); |
|
98 | + } |
|
99 | 99 | |
100 | - /** |
|
101 | - * Get a parameter array item. |
|
102 | - * |
|
103 | - * @param string $key |
|
104 | - * @param string|null $default |
|
105 | - * |
|
106 | - * @return mixed |
|
107 | - */ |
|
108 | - public function get($key, $default = null) |
|
109 | - { |
|
110 | - if ($this->has($key)) { |
|
111 | - return $this->parameters[$key]; |
|
112 | - } |
|
100 | + /** |
|
101 | + * Get a parameter array item. |
|
102 | + * |
|
103 | + * @param string $key |
|
104 | + * @param string|null $default |
|
105 | + * |
|
106 | + * @return mixed |
|
107 | + */ |
|
108 | + public function get($key, $default = null) |
|
109 | + { |
|
110 | + if ($this->has($key)) { |
|
111 | + return $this->parameters[$key]; |
|
112 | + } |
|
113 | 113 | |
114 | - return $default; |
|
115 | - } |
|
114 | + return $default; |
|
115 | + } |
|
116 | 116 | |
117 | - /** |
|
118 | - * Check if a parameter array item exists. |
|
119 | - * |
|
120 | - * @param string $key |
|
121 | - * |
|
122 | - * @return mixed |
|
123 | - */ |
|
124 | - public function has($key) |
|
125 | - { |
|
126 | - return Arr::exists($this->parameters, $key); |
|
127 | - } |
|
117 | + /** |
|
118 | + * Check if a parameter array item exists. |
|
119 | + * |
|
120 | + * @param string $key |
|
121 | + * |
|
122 | + * @return mixed |
|
123 | + */ |
|
124 | + public function has($key) |
|
125 | + { |
|
126 | + return Arr::exists($this->parameters, $key); |
|
127 | + } |
|
128 | 128 | |
129 | - /** |
|
130 | - * Set a parameter array item. |
|
131 | - * |
|
132 | - * @param string $key |
|
133 | - * @param string $value |
|
134 | - * |
|
135 | - * @return mixed |
|
136 | - */ |
|
137 | - public function set($key, $value) |
|
138 | - { |
|
139 | - $this->parameters[$key] = $value; |
|
140 | - } |
|
129 | + /** |
|
130 | + * Set a parameter array item. |
|
131 | + * |
|
132 | + * @param string $key |
|
133 | + * @param string $value |
|
134 | + * |
|
135 | + * @return mixed |
|
136 | + */ |
|
137 | + public function set($key, $value) |
|
138 | + { |
|
139 | + $this->parameters[$key] = $value; |
|
140 | + } |
|
141 | 141 | |
142 | - /** |
|
143 | - * Remove a parameter array item. |
|
144 | - * |
|
145 | - * @param string $key |
|
146 | - * |
|
147 | - * @return void |
|
148 | - */ |
|
149 | - public function remove($key) |
|
150 | - { |
|
151 | - if ($this->has($key)) { |
|
152 | - unset($this->parameters[$key]); |
|
153 | - } |
|
154 | - } |
|
142 | + /** |
|
143 | + * Remove a parameter array item. |
|
144 | + * |
|
145 | + * @param string $key |
|
146 | + * |
|
147 | + * @return void |
|
148 | + */ |
|
149 | + public function remove($key) |
|
150 | + { |
|
151 | + if ($this->has($key)) { |
|
152 | + unset($this->parameters[$key]); |
|
153 | + } |
|
154 | + } |
|
155 | 155 | |
156 | - /* |
|
156 | + /* |
|
157 | 157 | |----------------------------------------------------------------- |
158 | 158 | | IteratorAggregate Method |
159 | 159 | |----------------------------------------------------------------- |
160 | 160 | */ |
161 | 161 | |
162 | - /** |
|
163 | - * Retrieve an external iterator. |
|
164 | - * |
|
165 | - * @see \IteratorAggregate::getIterator |
|
166 | - * |
|
167 | - * @return new \ArrayIterator |
|
168 | - */ |
|
169 | - public function getIterator() |
|
170 | - { |
|
171 | - return new ArrayIterator($this->parameters); |
|
172 | - } |
|
162 | + /** |
|
163 | + * Retrieve an external iterator. |
|
164 | + * |
|
165 | + * @see \IteratorAggregate::getIterator |
|
166 | + * |
|
167 | + * @return new \ArrayIterator |
|
168 | + */ |
|
169 | + public function getIterator() |
|
170 | + { |
|
171 | + return new ArrayIterator($this->parameters); |
|
172 | + } |
|
173 | 173 | |
174 | - /* |
|
174 | + /* |
|
175 | 175 | |----------------------------------------------------------------- |
176 | 176 | | Countable Method |
177 | 177 | |----------------------------------------------------------------- |
178 | 178 | */ |
179 | 179 | |
180 | - /** |
|
181 | - * Returns the number of parameters. |
|
182 | - * |
|
183 | - * @return int The number of parameters |
|
184 | - */ |
|
185 | - public function count() |
|
186 | - { |
|
187 | - return count($this->parameters); |
|
188 | - } |
|
180 | + /** |
|
181 | + * Returns the number of parameters. |
|
182 | + * |
|
183 | + * @return int The number of parameters |
|
184 | + */ |
|
185 | + public function count() |
|
186 | + { |
|
187 | + return count($this->parameters); |
|
188 | + } |
|
189 | 189 | } |
190 | 190 | \ No newline at end of file |
@@ -33,46 +33,46 @@ discard block |
||
33 | 33 | final class Inputs extends Parameters |
34 | 34 | { |
35 | 35 | /** |
36 | - * {@inheritdoc} |
|
37 | - */ |
|
38 | - public function all(string $key = null) |
|
39 | - { |
|
40 | - return parent::all($key); |
|
36 | + * {@inheritdoc} |
|
37 | + */ |
|
38 | + public function all(string $key = null) |
|
39 | + { |
|
40 | + return parent::all($key); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | - * {@inheritdoc} |
|
45 | - */ |
|
46 | - public function replace(array $inputs = []) |
|
47 | - { |
|
48 | - $this->parameters = []; |
|
44 | + * {@inheritdoc} |
|
45 | + */ |
|
46 | + public function replace(array $inputs = []) |
|
47 | + { |
|
48 | + $this->parameters = []; |
|
49 | 49 | $this->add($inputs); |
50 | - } |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Adds input values. |
|
52 | + /** |
|
53 | + * Adds input values. |
|
54 | 54 | * |
55 | 55 | * @param array $inputs |
56 | 56 | * |
57 | 57 | * @return mixed |
58 | - */ |
|
59 | - public function add(array $inputs = []) |
|
60 | - { |
|
58 | + */ |
|
59 | + public function add(array $inputs = []) |
|
60 | + { |
|
61 | 61 | foreach ($inputs as $key => $file) { |
62 | 62 | $this->set($key, $file); |
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | - * Gets a string input value by name. |
|
68 | - * |
|
69 | - * @param string $key |
|
70 | - * @param string|null $default |
|
71 | - * |
|
72 | - * @return string|null |
|
73 | - */ |
|
74 | - public function get($key, $default = null) |
|
75 | - { |
|
67 | + * Gets a string input value by name. |
|
68 | + * |
|
69 | + * @param string $key |
|
70 | + * @param string|null $default |
|
71 | + * |
|
72 | + * @return string|null |
|
73 | + */ |
|
74 | + public function get($key, $default = null) |
|
75 | + { |
|
76 | 76 | if (null !== $default && ! is_scalar($default) && ! (is_object($default)) && ! method_exist($default, '__toString')) { |
77 | 77 | throw new BadRequestHttpException(sprintf('Passing a non-string value as 2nd argument to "%s()" is deprecated, pass a string or null instead', __METHOD__)); |
78 | 78 | } |
@@ -87,19 +87,19 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | - * Sets an input by name. |
|
91 | - * |
|
92 | - * @param string $key |
|
93 | - * @param string|array|null $value |
|
94 | - * |
|
95 | - * @return mixed |
|
96 | - */ |
|
97 | - public function set($key, $value) |
|
98 | - { |
|
90 | + * Sets an input by name. |
|
91 | + * |
|
92 | + * @param string $key |
|
93 | + * @param string|array|null $value |
|
94 | + * |
|
95 | + * @return mixed |
|
96 | + */ |
|
97 | + public function set($key, $value) |
|
98 | + { |
|
99 | 99 | if (null !== $value && ! is_scalar($value) && ! is_array($value) && ! method_exist($value, '__toString')) { |
100 | 100 | throw new BadRequestHttpException(sprintf('Passing "%s" as a 2nd Argument to "%s()" is deprecated, pass a string, array, or null instead', get_debug_type($value), __METHOD__)); |
101 | 101 | } |
102 | 102 | |
103 | - $this->parameters[$key] = $value; |
|
104 | - } |
|
103 | + $this->parameters[$key] = $value; |
|
104 | + } |
|
105 | 105 | } |
106 | 106 | \ No newline at end of file |
@@ -33,35 +33,35 @@ |
||
33 | 33 | */ |
34 | 34 | class PostTooLargeHttpException extends HttpException |
35 | 35 | { |
36 | - /** |
|
37 | - * Get the HTTP status code. |
|
38 | - * |
|
39 | - * @var int $code |
|
40 | - */ |
|
41 | - protected $code = 413; |
|
36 | + /** |
|
37 | + * Get the HTTP status code. |
|
38 | + * |
|
39 | + * @var int $code |
|
40 | + */ |
|
41 | + protected $code = 413; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Initialize constructor. |
|
45 | - * |
|
46 | - * @param string|null $message |
|
47 | - * @param \Throwable|null $previous |
|
48 | - * @param int $code |
|
49 | - * @param array $headers |
|
50 | - * |
|
51 | - * @return void |
|
52 | - */ |
|
53 | - public function __construct( |
|
54 | - string $message = null, |
|
55 | - Throwable $previous = null, |
|
56 | - int $code = 0, |
|
57 | - array $headers = [] |
|
58 | - ) { |
|
43 | + /** |
|
44 | + * Initialize constructor. |
|
45 | + * |
|
46 | + * @param string|null $message |
|
47 | + * @param \Throwable|null $previous |
|
48 | + * @param int $code |
|
49 | + * @param array $headers |
|
50 | + * |
|
51 | + * @return void |
|
52 | + */ |
|
53 | + public function __construct( |
|
54 | + string $message = null, |
|
55 | + Throwable $previous = null, |
|
56 | + int $code = 0, |
|
57 | + array $headers = [] |
|
58 | + ) { |
|
59 | 59 | parent::__construct( |
60 | - $this->code, |
|
61 | - $message, |
|
62 | - $previous, |
|
63 | - $headers, |
|
64 | - $code |
|
65 | - ); |
|
66 | - } |
|
60 | + $this->code, |
|
61 | + $message, |
|
62 | + $previous, |
|
63 | + $headers, |
|
64 | + $code |
|
65 | + ); |
|
66 | + } |
|
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -32,178 +32,178 @@ |
||
32 | 32 | */ |
33 | 33 | trait ManagesLayouts |
34 | 34 | { |
35 | - /** |
|
36 | - * Started blocks. |
|
37 | - * |
|
38 | - * @var array $sections |
|
39 | - */ |
|
40 | - protected $sections = []; |
|
35 | + /** |
|
36 | + * Started blocks. |
|
37 | + * |
|
38 | + * @var array $sections |
|
39 | + */ |
|
40 | + protected $sections = []; |
|
41 | 41 | |
42 | - /** |
|
43 | - * The stack of in-progress sections. |
|
44 | - * |
|
45 | - * @var array $sectionStack |
|
46 | - */ |
|
47 | - protected $sectionStack = []; |
|
42 | + /** |
|
43 | + * The stack of in-progress sections. |
|
44 | + * |
|
45 | + * @var array $sectionStack |
|
46 | + */ |
|
47 | + protected $sectionStack = []; |
|
48 | 48 | |
49 | - /** |
|
50 | - * Starting section. |
|
51 | - * |
|
52 | - * @param string $section |
|
53 | - * @param string|null $content |
|
54 | - * |
|
55 | - * @return array |
|
56 | - */ |
|
57 | - public function beginSection($section, $content = null) |
|
58 | - { |
|
59 | - if (null === $content) { |
|
60 | - if (ob_start()) { |
|
61 | - $this->sectionStack[] = $section; |
|
62 | - } |
|
63 | - } else { |
|
64 | - $this->extendSection($section, $content instanceof View ? $content : e($content)); |
|
65 | - } |
|
66 | - } |
|
49 | + /** |
|
50 | + * Starting section. |
|
51 | + * |
|
52 | + * @param string $section |
|
53 | + * @param string|null $content |
|
54 | + * |
|
55 | + * @return array |
|
56 | + */ |
|
57 | + public function beginSection($section, $content = null) |
|
58 | + { |
|
59 | + if (null === $content) { |
|
60 | + if (ob_start()) { |
|
61 | + $this->sectionStack[] = $section; |
|
62 | + } |
|
63 | + } else { |
|
64 | + $this->extendSection($section, $content instanceof View ? $content : e($content)); |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Append content to a given section. |
|
70 | - * |
|
71 | - * @param string $section |
|
72 | - * @param string $content |
|
73 | - * |
|
74 | - * @return void |
|
75 | - */ |
|
76 | - protected function extendSection($section, $content) |
|
77 | - { |
|
78 | - if (isset($this->sections[$section])) { |
|
79 | - $content = str_replace(static::parent(), $content, $this->sections[$section]); |
|
80 | - } |
|
68 | + /** |
|
69 | + * Append content to a given section. |
|
70 | + * |
|
71 | + * @param string $section |
|
72 | + * @param string $content |
|
73 | + * |
|
74 | + * @return void |
|
75 | + */ |
|
76 | + protected function extendSection($section, $content) |
|
77 | + { |
|
78 | + if (isset($this->sections[$section])) { |
|
79 | + $content = str_replace(static::parent(), $content, $this->sections[$section]); |
|
80 | + } |
|
81 | 81 | |
82 | - $this->sections[$section] = $content; |
|
83 | - } |
|
82 | + $this->sections[$section] = $content; |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * Close and printing section. |
|
87 | - * |
|
88 | - * @return string |
|
89 | - */ |
|
90 | - public function showSection() |
|
91 | - { |
|
92 | - if (empty($this->sectionStack)) { |
|
93 | - return ''; |
|
94 | - } |
|
85 | + /** |
|
86 | + * Close and printing section. |
|
87 | + * |
|
88 | + * @return string |
|
89 | + */ |
|
90 | + public function showSection() |
|
91 | + { |
|
92 | + if (empty($this->sectionStack)) { |
|
93 | + return ''; |
|
94 | + } |
|
95 | 95 | |
96 | - return $this->giveContent($this->stopSection()); |
|
97 | - } |
|
96 | + return $this->giveContent($this->stopSection()); |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * Give sections the page view from the master page. |
|
101 | - * |
|
102 | - * @param string $name |
|
103 | - * |
|
104 | - * @return string |
|
105 | - */ |
|
106 | - public function giveContent($name, $default = '') |
|
107 | - { |
|
108 | - $sectionContent = $default instanceof View ? $default : e($default); |
|
99 | + /** |
|
100 | + * Give sections the page view from the master page. |
|
101 | + * |
|
102 | + * @param string $name |
|
103 | + * |
|
104 | + * @return string |
|
105 | + */ |
|
106 | + public function giveContent($name, $default = '') |
|
107 | + { |
|
108 | + $sectionContent = $default instanceof View ? $default : e($default); |
|
109 | 109 | |
110 | - if (isset($this->sections[$name])) { |
|
111 | - $sectionContent = $this->sections[$name]; |
|
112 | - } |
|
110 | + if (isset($this->sections[$name])) { |
|
111 | + $sectionContent = $this->sections[$name]; |
|
112 | + } |
|
113 | 113 | |
114 | - return str_replace(static::parent(), '', $sectionContent); |
|
115 | - } |
|
114 | + return str_replace(static::parent(), '', $sectionContent); |
|
115 | + } |
|
116 | 116 | |
117 | - /** |
|
118 | - * Closing section. |
|
119 | - * |
|
120 | - * @param bool $overwrite |
|
121 | - * |
|
122 | - * @return mixed |
|
123 | - * |
|
124 | - * @throws \InvalidArgumentException |
|
125 | - */ |
|
126 | - public function stopSection($overwrite = false) |
|
127 | - { |
|
128 | - if (empty($this->sectionStack)) { |
|
129 | - throw new InvalidArgumentException('You cannot finish a section without first starting with one.'); |
|
130 | - } |
|
117 | + /** |
|
118 | + * Closing section. |
|
119 | + * |
|
120 | + * @param bool $overwrite |
|
121 | + * |
|
122 | + * @return mixed |
|
123 | + * |
|
124 | + * @throws \InvalidArgumentException |
|
125 | + */ |
|
126 | + public function stopSection($overwrite = false) |
|
127 | + { |
|
128 | + if (empty($this->sectionStack)) { |
|
129 | + throw new InvalidArgumentException('You cannot finish a section without first starting with one.'); |
|
130 | + } |
|
131 | 131 | |
132 | - $last = array_pop($this->sectionStack); |
|
132 | + $last = array_pop($this->sectionStack); |
|
133 | 133 | |
134 | - if ($overwrite) { |
|
135 | - $this->sections[$last] = ob_get_clean(); |
|
136 | - } else { |
|
137 | - $this->extendSection($last, ob_get_clean()); |
|
138 | - } |
|
134 | + if ($overwrite) { |
|
135 | + $this->sections[$last] = ob_get_clean(); |
|
136 | + } else { |
|
137 | + $this->extendSection($last, ob_get_clean()); |
|
138 | + } |
|
139 | 139 | |
140 | - return $last; |
|
141 | - } |
|
140 | + return $last; |
|
141 | + } |
|
142 | 142 | |
143 | - /** |
|
144 | - * Stop injecting content into a section and append it. |
|
145 | - * |
|
146 | - * @return string |
|
147 | - * |
|
148 | - * @throws \InvalidArgumentException |
|
149 | - */ |
|
150 | - public function appendSection() |
|
151 | - { |
|
152 | - if (empty($this->sectionStack)) { |
|
153 | - throw new InvalidArgumentException('You cannot finish a section without first starting with one.'); |
|
154 | - } |
|
143 | + /** |
|
144 | + * Stop injecting content into a section and append it. |
|
145 | + * |
|
146 | + * @return string |
|
147 | + * |
|
148 | + * @throws \InvalidArgumentException |
|
149 | + */ |
|
150 | + public function appendSection() |
|
151 | + { |
|
152 | + if (empty($this->sectionStack)) { |
|
153 | + throw new InvalidArgumentException('You cannot finish a section without first starting with one.'); |
|
154 | + } |
|
155 | 155 | |
156 | - $last = array_pop($this->sectionStack); |
|
156 | + $last = array_pop($this->sectionStack); |
|
157 | 157 | |
158 | - if (isset($this->sections[$last])) { |
|
159 | - $this->sections[$last] .= ob_get_clean(); |
|
160 | - } else { |
|
161 | - $this->sections[$last] = ob_get_clean(); |
|
162 | - } |
|
158 | + if (isset($this->sections[$last])) { |
|
159 | + $this->sections[$last] .= ob_get_clean(); |
|
160 | + } else { |
|
161 | + $this->sections[$last] = ob_get_clean(); |
|
162 | + } |
|
163 | 163 | |
164 | - return $last; |
|
165 | - } |
|
164 | + return $last; |
|
165 | + } |
|
166 | 166 | |
167 | - /** |
|
168 | - * Check if section exists. |
|
169 | - * |
|
170 | - * @param string $name |
|
171 | - * |
|
172 | - * @return bool |
|
173 | - */ |
|
174 | - public function hasSection($name) |
|
175 | - { |
|
176 | - return array_key_exists($name, $this->sections); |
|
177 | - } |
|
167 | + /** |
|
168 | + * Check if section exists. |
|
169 | + * |
|
170 | + * @param string $name |
|
171 | + * |
|
172 | + * @return bool |
|
173 | + */ |
|
174 | + public function hasSection($name) |
|
175 | + { |
|
176 | + return array_key_exists($name, $this->sections); |
|
177 | + } |
|
178 | 178 | |
179 | - /** |
|
180 | - * Get the entire array of sections. |
|
181 | - * |
|
182 | - * @return array |
|
183 | - */ |
|
184 | - public function getSections() |
|
185 | - { |
|
186 | - return $this->sections; |
|
187 | - } |
|
179 | + /** |
|
180 | + * Get the entire array of sections. |
|
181 | + * |
|
182 | + * @return array |
|
183 | + */ |
|
184 | + public function getSections() |
|
185 | + { |
|
186 | + return $this->sections; |
|
187 | + } |
|
188 | 188 | |
189 | - /** |
|
190 | - * Replace the @parent directive to a placeholder. |
|
191 | - * |
|
192 | - * @return string |
|
193 | - */ |
|
194 | - public static function parent() |
|
195 | - { |
|
196 | - return '@parent'; |
|
197 | - } |
|
189 | + /** |
|
190 | + * Replace the @parent directive to a placeholder. |
|
191 | + * |
|
192 | + * @return string |
|
193 | + */ |
|
194 | + public static function parent() |
|
195 | + { |
|
196 | + return '@parent'; |
|
197 | + } |
|
198 | 198 | |
199 | - /** |
|
200 | - * Flush all of the section contents. |
|
201 | - * |
|
202 | - * @return void |
|
203 | - */ |
|
204 | - public function flushSections() |
|
205 | - { |
|
206 | - $this->sections = []; |
|
207 | - $this->sectionStack = []; |
|
208 | - } |
|
199 | + /** |
|
200 | + * Flush all of the section contents. |
|
201 | + * |
|
202 | + * @return void |
|
203 | + */ |
|
204 | + public function flushSections() |
|
205 | + { |
|
206 | + $this->sections = []; |
|
207 | + $this->sectionStack = []; |
|
208 | + } |
|
209 | 209 | } |
210 | 210 | \ No newline at end of file |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | $this->timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone); |
59 | 59 | |
60 | 60 | if ( ! empty($time)) { |
61 | - if (is_string($time) && static::hasRelativeKeywords($time)) { |
|
62 | - $dateTime = new DateTime('now', $this->timezone); |
|
63 | - $dateTime->modify($time); |
|
61 | + if (is_string($time) && static::hasRelativeKeywords($time)) { |
|
62 | + $dateTime = new DateTime('now', $this->timezone); |
|
63 | + $dateTime->modify($time); |
|
64 | 64 | |
65 | - $time = $dateTime->format('Y-m-d H:i:s'); |
|
66 | - } |
|
65 | + $time = $dateTime->format('Y-m-d H:i:s'); |
|
66 | + } |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return parent::__construct($time, $this->timezone); |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | * @return \Syscodes\Support\Chronos\Time |
119 | 119 | */ |
120 | 120 | public static function yesterday($timezone = null, string $locale = null) |
121 | - { |
|
122 | - return static::parse(date('Y-m-d 00:00:00', strtotime('-1 day')), $timezone, $locale); |
|
121 | + { |
|
122 | + return static::parse(date('Y-m-d 00:00:00', strtotime('-1 day')), $timezone, $locale); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @return \Syscodes\Support\Chronos\Time |
132 | 132 | */ |
133 | 133 | public static function tomorrow($timezone = null, string $locale = null) |
134 | - { |
|
135 | - return static::parse(date('Y-m-d 00:00:00', strtotime('+1 day')), $timezone, $locale); |
|
134 | + { |
|
135 | + return static::parse(date('Y-m-d 00:00:00', strtotime('+1 day')), $timezone, $locale); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | /** |
266 | 266 | * Creates an instance of Time that will be returned during testing |
267 | - * when calling 'Time::now' instead of the current time. |
|
267 | + * when calling 'Time::now' instead of the current time. |
|
268 | 268 | * |
269 | 269 | * @param \Syscodes\Support\Chronos\Time|string $datetime |
270 | 270 | * @param string|null $timezone |
@@ -29,139 +29,139 @@ |
||
29 | 29 | */ |
30 | 30 | trait RouteMap |
31 | 31 | { |
32 | - /** |
|
33 | - * All of the verbs supported by the router. |
|
34 | - * |
|
35 | - * @var array $verbs |
|
36 | - */ |
|
37 | - public static $verbs = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS']; |
|
32 | + /** |
|
33 | + * All of the verbs supported by the router. |
|
34 | + * |
|
35 | + * @var array $verbs |
|
36 | + */ |
|
37 | + public static $verbs = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS']; |
|
38 | 38 | |
39 | - /** |
|
40 | - * Add a route to the underlying route collection. |
|
41 | - * |
|
42 | - * @param string $method |
|
43 | - * @param string $route |
|
44 | - * @param mixed $action |
|
45 | - * |
|
46 | - * @return \Syscodes\Routing\Route |
|
47 | - */ |
|
48 | - abstract public function addRoute($method, $route, $action); |
|
39 | + /** |
|
40 | + * Add a route to the underlying route collection. |
|
41 | + * |
|
42 | + * @param string $method |
|
43 | + * @param string $route |
|
44 | + * @param mixed $action |
|
45 | + * |
|
46 | + * @return \Syscodes\Routing\Route |
|
47 | + */ |
|
48 | + abstract public function addRoute($method, $route, $action); |
|
49 | 49 | |
50 | - /** |
|
51 | - * Add a route for all posible methods. |
|
52 | - * |
|
53 | - * @param string $route |
|
54 | - * @param string|callable|null $action |
|
55 | - * |
|
56 | - * @return void |
|
57 | - */ |
|
58 | - public function any($route, $action = null) |
|
59 | - { |
|
60 | - return $this->addRoute(self::$verbs, $route, $action); |
|
61 | - } |
|
50 | + /** |
|
51 | + * Add a route for all posible methods. |
|
52 | + * |
|
53 | + * @param string $route |
|
54 | + * @param string|callable|null $action |
|
55 | + * |
|
56 | + * @return void |
|
57 | + */ |
|
58 | + public function any($route, $action = null) |
|
59 | + { |
|
60 | + return $this->addRoute(self::$verbs, $route, $action); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Add a route with delete method. |
|
65 | - * |
|
66 | - * @param string $route |
|
67 | - * @param string|callable|null $action |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - public function delete($route, $action = null) |
|
72 | - { |
|
73 | - return $this->addRoute('DELETE', $route, $action); |
|
74 | - } |
|
63 | + /** |
|
64 | + * Add a route with delete method. |
|
65 | + * |
|
66 | + * @param string $route |
|
67 | + * @param string|callable|null $action |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + public function delete($route, $action = null) |
|
72 | + { |
|
73 | + return $this->addRoute('DELETE', $route, $action); |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Add a route with get method. |
|
78 | - * |
|
79 | - * @param string $route |
|
80 | - * @param string|callable|null $action |
|
81 | - * |
|
82 | - * @return void |
|
83 | - */ |
|
84 | - public function get($route, $action = null) |
|
85 | - { |
|
86 | - return $this->addRoute(['GET', 'HEAD'], $route, $action); |
|
87 | - } |
|
76 | + /** |
|
77 | + * Add a route with get method. |
|
78 | + * |
|
79 | + * @param string $route |
|
80 | + * @param string|callable|null $action |
|
81 | + * |
|
82 | + * @return void |
|
83 | + */ |
|
84 | + public function get($route, $action = null) |
|
85 | + { |
|
86 | + return $this->addRoute(['GET', 'HEAD'], $route, $action); |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * Add a route with head method. |
|
91 | - * |
|
92 | - * @param string $route |
|
93 | - * @param string|callable|null $action |
|
94 | - * |
|
95 | - * @return void |
|
96 | - */ |
|
97 | - public function head($route, $action = null) |
|
98 | - { |
|
99 | - return $this->addRoute('HEAD', $route, $action); |
|
100 | - } |
|
89 | + /** |
|
90 | + * Add a route with head method. |
|
91 | + * |
|
92 | + * @param string $route |
|
93 | + * @param string|callable|null $action |
|
94 | + * |
|
95 | + * @return void |
|
96 | + */ |
|
97 | + public function head($route, $action = null) |
|
98 | + { |
|
99 | + return $this->addRoute('HEAD', $route, $action); |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
103 | - * Register a new route with the given methods. |
|
104 | - * |
|
105 | - * @param array|string $methods |
|
106 | - * @param string $route |
|
107 | - * @param string|callable|null $action |
|
108 | - * |
|
109 | - * @return void |
|
110 | - */ |
|
111 | - public function match($methods, $route, $action = null) |
|
112 | - { |
|
113 | - return $this->addRoute(array_map('strtoupper', (array) $methods), $route, $action); |
|
114 | - } |
|
102 | + /** |
|
103 | + * Register a new route with the given methods. |
|
104 | + * |
|
105 | + * @param array|string $methods |
|
106 | + * @param string $route |
|
107 | + * @param string|callable|null $action |
|
108 | + * |
|
109 | + * @return void |
|
110 | + */ |
|
111 | + public function match($methods, $route, $action = null) |
|
112 | + { |
|
113 | + return $this->addRoute(array_map('strtoupper', (array) $methods), $route, $action); |
|
114 | + } |
|
115 | 115 | |
116 | - /** |
|
117 | - * Add a route with options method. |
|
118 | - * |
|
119 | - * @param string $route |
|
120 | - * @param string|callable|null $action |
|
121 | - * |
|
122 | - * @return void |
|
123 | - */ |
|
124 | - public function options($route, $action = null) |
|
125 | - { |
|
126 | - return $this->addRoute('OPTIONS', $route, $action); |
|
127 | - } |
|
116 | + /** |
|
117 | + * Add a route with options method. |
|
118 | + * |
|
119 | + * @param string $route |
|
120 | + * @param string|callable|null $action |
|
121 | + * |
|
122 | + * @return void |
|
123 | + */ |
|
124 | + public function options($route, $action = null) |
|
125 | + { |
|
126 | + return $this->addRoute('OPTIONS', $route, $action); |
|
127 | + } |
|
128 | 128 | |
129 | - /** |
|
130 | - * Add a route with patch method. |
|
131 | - * |
|
132 | - * @param string $route |
|
133 | - * @param string|callable|null $action |
|
134 | - * |
|
135 | - * @return void |
|
136 | - */ |
|
137 | - public function patch($route, $action = null) |
|
138 | - { |
|
139 | - return $this->addRoute('PATCH', $route, $action); |
|
140 | - } |
|
129 | + /** |
|
130 | + * Add a route with patch method. |
|
131 | + * |
|
132 | + * @param string $route |
|
133 | + * @param string|callable|null $action |
|
134 | + * |
|
135 | + * @return void |
|
136 | + */ |
|
137 | + public function patch($route, $action = null) |
|
138 | + { |
|
139 | + return $this->addRoute('PATCH', $route, $action); |
|
140 | + } |
|
141 | 141 | |
142 | - /** |
|
143 | - * Add a route with post method. |
|
144 | - * |
|
145 | - * @param string $route |
|
146 | - * @param string|callable|null $action |
|
147 | - * |
|
148 | - * @return void |
|
149 | - */ |
|
150 | - public function post($route, $action = null) |
|
151 | - { |
|
152 | - return $this->addRoute('POST', $route, $action); |
|
153 | - } |
|
142 | + /** |
|
143 | + * Add a route with post method. |
|
144 | + * |
|
145 | + * @param string $route |
|
146 | + * @param string|callable|null $action |
|
147 | + * |
|
148 | + * @return void |
|
149 | + */ |
|
150 | + public function post($route, $action = null) |
|
151 | + { |
|
152 | + return $this->addRoute('POST', $route, $action); |
|
153 | + } |
|
154 | 154 | |
155 | - /** |
|
156 | - * Add a route with put method. |
|
157 | - * |
|
158 | - * @param string $route |
|
159 | - * @param string|callable|null $action |
|
160 | - * |
|
161 | - * @return void |
|
162 | - */ |
|
163 | - public function put($route, $action = null) |
|
164 | - { |
|
165 | - return $this->addRoute('PUT', $route, $action); |
|
166 | - } |
|
155 | + /** |
|
156 | + * Add a route with put method. |
|
157 | + * |
|
158 | + * @param string $route |
|
159 | + * @param string|callable|null $action |
|
160 | + * |
|
161 | + * @return void |
|
162 | + */ |
|
163 | + public function put($route, $action = null) |
|
164 | + { |
|
165 | + return $this->addRoute('PUT', $route, $action); |
|
166 | + } |
|
167 | 167 | } |
168 | 168 | \ No newline at end of file |