@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | protected function registerSessionManager() |
| 52 | 52 | { |
| 53 | - $this->app->singleton('session', function () { |
|
| 53 | + $this->app->singleton('session', function() { |
|
| 54 | 54 | return (new SessionManager($this->app))->driver(); |
| 55 | 55 | }); |
| 56 | 56 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | protected function registerSessionDriver() |
| 64 | 64 | { |
| 65 | - $this->app->singleton('session.store', function ($app) { |
|
| 65 | + $this->app->singleton('session.store', function($app) { |
|
| 66 | 66 | return $app->make('session')->driver(); |
| 67 | 67 | }); |
| 68 | 68 | } |
@@ -356,7 +356,7 @@ |
||
| 356 | 356 | */ |
| 357 | 357 | public function regenerate($destroy = false) |
| 358 | 358 | { |
| 359 | - return take($this->migrate($destroy), function () { |
|
| 359 | + return take($this->migrate($destroy), function() { |
|
| 360 | 360 | $this->regenerateToken(); |
| 361 | 361 | }); |
| 362 | 362 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $this->files->getRequire($path, $data); |
| 86 | 86 | } |
| 87 | - catch(Throwable $e) |
|
| 87 | + catch (Throwable $e) |
|
| 88 | 88 | { |
| 89 | 89 | return $this->handleViewException($e, $obLevel); |
| 90 | 90 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | protected function handleViewException(Throwable $e, $obLevel) |
| 106 | 106 | { |
| 107 | - while(ob_get_level() > $obLevel) |
|
| 107 | + while (ob_get_level() > $obLevel) |
|
| 108 | 108 | { |
| 109 | 109 | ob_end_clean(); |
| 110 | 110 | } |
@@ -83,8 +83,7 @@ |
||
| 83 | 83 | try |
| 84 | 84 | { |
| 85 | 85 | $this->files->getRequire($path, $data); |
| 86 | - } |
|
| 87 | - catch(Throwable $e) |
|
| 86 | + } catch(Throwable $e) |
|
| 88 | 87 | { |
| 89 | 88 | return $this->handleViewException($e, $obLevel); |
| 90 | 89 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function registerView() |
| 60 | 60 | { |
| 61 | - $this->app->singleton('view', function ($app) { |
|
| 61 | + $this->app->singleton('view', function($app) { |
|
| 62 | 62 | |
| 63 | 63 | // The resolver will be used by an environment to get each of the various |
| 64 | 64 | // engine implementations such as plain PHP or Plaze engine. |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function registerViewFinder() |
| 88 | 88 | { |
| 89 | - $this->app->bind('view.finder', function ($app) { |
|
| 89 | + $this->app->bind('view.finder', function($app) { |
|
| 90 | 90 | return new FileViewFinder($app['files'], $app['config']['view.paths']); |
| 91 | 91 | }); |
| 92 | 92 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function registerPlazeTranspiler() |
| 100 | 100 | { |
| 101 | - $this->app->singleton('plaze.transpiler', function ($app) { |
|
| 101 | + $this->app->singleton('plaze.transpiler', function($app) { |
|
| 102 | 102 | |
| 103 | 103 | return new PlazeTranspiler( |
| 104 | 104 | $app['files'], $app['config']['view.transpiled'] |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function registerEngineResolver() |
| 116 | 116 | { |
| 117 | - $this->app->singleton('view.engine.resolver', function () { |
|
| 117 | + $this->app->singleton('view.engine.resolver', function() { |
|
| 118 | 118 | |
| 119 | 119 | $resolver = new EngineResolver; |
| 120 | 120 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function registerFileEngine($resolver) |
| 139 | 139 | { |
| 140 | - $resolver->register('file', function () { |
|
| 140 | + $resolver->register('file', function() { |
|
| 141 | 141 | return new FileEngine; |
| 142 | 142 | }); |
| 143 | 143 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function registerPhpEngine($resolver) |
| 153 | 153 | { |
| 154 | - $resolver->register('php', function () { |
|
| 154 | + $resolver->register('php', function() { |
|
| 155 | 155 | return new PhpEngine($this->app['files']); |
| 156 | 156 | }); |
| 157 | 157 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function registerPlazeEngine($resolver) |
| 167 | 167 | { |
| 168 | - $resolver->register('plaze', function () { |
|
| 168 | + $resolver->register('plaze', function() { |
|
| 169 | 169 | return new TranspilerEngine($this->app['plaze.transpiler'], $this->app['files']); |
| 170 | 170 | }); |
| 171 | 171 | } |
@@ -43,13 +43,13 @@ |
||
| 43 | 43 | { |
| 44 | 44 | $delimiter = ViewFinder::HINT_PATH_DELIMITER; |
| 45 | 45 | |
| 46 | - if (strpos($name, $delimiter) === false) |
|
| 47 | - { |
|
| 48 | - return str_replace('/', '.', $name); |
|
| 49 | - } |
|
| 46 | + if (strpos($name, $delimiter) === false) |
|
| 47 | + { |
|
| 48 | + return str_replace('/', '.', $name); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - [$namespace, $name] = explode($delimiter, $name); |
|
| 51 | + [$namespace, $name] = explode($delimiter, $name); |
|
| 52 | 52 | |
| 53 | - return $namespace.$delimiter.str_replace('/', '.', $name); |
|
| 53 | + return $namespace.$delimiter.str_replace('/', '.', $name); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | \ No newline at end of file |
@@ -39,320 +39,320 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | class Factory implements FactoryContract |
| 41 | 41 | { |
| 42 | - use Extensions, |
|
| 43 | - Concerns\ManagesLayouts, |
|
| 44 | - Concerns\ManagesComponents, |
|
| 45 | - Concerns\ManagesTranslations; |
|
| 42 | + use Extensions, |
|
| 43 | + Concerns\ManagesLayouts, |
|
| 44 | + Concerns\ManagesComponents, |
|
| 45 | + Concerns\ManagesTranslations; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * The IoC container instance. |
|
| 49 | - * |
|
| 50 | - * @var \Syscodes\Contracts\Container\Container $container |
|
| 51 | - */ |
|
| 52 | - protected $container; |
|
| 47 | + /** |
|
| 48 | + * The IoC container instance. |
|
| 49 | + * |
|
| 50 | + * @var \Syscodes\Contracts\Container\Container $container |
|
| 51 | + */ |
|
| 52 | + protected $container; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * The engine implementation. |
|
| 56 | - * |
|
| 57 | - * @var \Syscodes\View\Engines\EngineResolver $engines |
|
| 58 | - */ |
|
| 59 | - protected $engines; |
|
| 54 | + /** |
|
| 55 | + * The engine implementation. |
|
| 56 | + * |
|
| 57 | + * @var \Syscodes\View\Engines\EngineResolver $engines |
|
| 58 | + */ |
|
| 59 | + protected $engines; |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * The event dispatcher instance. |
|
| 63 | - * |
|
| 64 | - * @var \Syscodes\Contracts\Events\Dispatcher $events |
|
| 65 | - */ |
|
| 66 | - protected $events; |
|
| 61 | + /** |
|
| 62 | + * The event dispatcher instance. |
|
| 63 | + * |
|
| 64 | + * @var \Syscodes\Contracts\Events\Dispatcher $events |
|
| 65 | + */ |
|
| 66 | + protected $events; |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * The view finder implementation. |
|
| 70 | - * |
|
| 71 | - * @var \Syscodes\View\FileViewFinder $finder |
|
| 72 | - */ |
|
| 73 | - protected $finder; |
|
| 68 | + /** |
|
| 69 | + * The view finder implementation. |
|
| 70 | + * |
|
| 71 | + * @var \Syscodes\View\FileViewFinder $finder |
|
| 72 | + */ |
|
| 73 | + protected $finder; |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * The number of active rendering operations. |
|
| 77 | - * |
|
| 78 | - * @var int $renderCount |
|
| 79 | - */ |
|
| 80 | - protected $renderCount = 0; |
|
| 75 | + /** |
|
| 76 | + * The number of active rendering operations. |
|
| 77 | + * |
|
| 78 | + * @var int $renderCount |
|
| 79 | + */ |
|
| 80 | + protected $renderCount = 0; |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Array of shared data. |
|
| 84 | - * |
|
| 85 | - * @var array $shared |
|
| 86 | - */ |
|
| 87 | - protected $shared = []; |
|
| 82 | + /** |
|
| 83 | + * Array of shared data. |
|
| 84 | + * |
|
| 85 | + * @var array $shared |
|
| 86 | + */ |
|
| 87 | + protected $shared = []; |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * Constructor: Create a new Parser class instance. |
|
| 91 | - * |
|
| 92 | - * @param \Syscodes\View\Engines\EngineResolver $engine |
|
| 93 | - * @param \Syscodes\Contracts\View\ViewFinder $finder |
|
| 94 | - * @param \Syscodes\Contracts\Events\Dispatcher $events |
|
| 95 | - * |
|
| 96 | - * @return void |
|
| 97 | - */ |
|
| 98 | - public function __construct(EngineResolver $engines, ViewFinder $finder, Dispatcher $events) |
|
| 99 | - { |
|
| 100 | - $this->finder = $finder; |
|
| 101 | - $this->engines = $engines; |
|
| 102 | - $this->events = $events; |
|
| 89 | + /** |
|
| 90 | + * Constructor: Create a new Parser class instance. |
|
| 91 | + * |
|
| 92 | + * @param \Syscodes\View\Engines\EngineResolver $engine |
|
| 93 | + * @param \Syscodes\Contracts\View\ViewFinder $finder |
|
| 94 | + * @param \Syscodes\Contracts\Events\Dispatcher $events |
|
| 95 | + * |
|
| 96 | + * @return void |
|
| 97 | + */ |
|
| 98 | + public function __construct(EngineResolver $engines, ViewFinder $finder, Dispatcher $events) |
|
| 99 | + { |
|
| 100 | + $this->finder = $finder; |
|
| 101 | + $this->engines = $engines; |
|
| 102 | + $this->events = $events; |
|
| 103 | 103 | |
| 104 | - $this->share('__env', $this); |
|
| 105 | - } |
|
| 104 | + $this->share('__env', $this); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Check existance view file. |
|
| 109 | - * |
|
| 110 | - * @param string $view |
|
| 111 | - * |
|
| 112 | - * @return bool |
|
| 113 | - */ |
|
| 114 | - public function viewExists($view) |
|
| 115 | - { |
|
| 116 | - try |
|
| 117 | - { |
|
| 118 | - $this->finder->find($view); |
|
| 119 | - } |
|
| 120 | - catch(InvalidArgumentException $e) |
|
| 121 | - { |
|
| 122 | - return false; |
|
| 123 | - } |
|
| 107 | + /** |
|
| 108 | + * Check existance view file. |
|
| 109 | + * |
|
| 110 | + * @param string $view |
|
| 111 | + * |
|
| 112 | + * @return bool |
|
| 113 | + */ |
|
| 114 | + public function viewExists($view) |
|
| 115 | + { |
|
| 116 | + try |
|
| 117 | + { |
|
| 118 | + $this->finder->find($view); |
|
| 119 | + } |
|
| 120 | + catch(InvalidArgumentException $e) |
|
| 121 | + { |
|
| 122 | + return false; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - return true; |
|
| 126 | - } |
|
| 125 | + return true; |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * Global and local data are merged and extracted to create local variables within the view file. |
|
| 130 | - * Renders the view object to a string. |
|
| 131 | - * |
|
| 132 | - * @example $output = $view->make(); |
|
| 133 | - * |
|
| 134 | - * @param string $view View filename |
|
| 135 | - * @param array $data Array of values |
|
| 136 | - * |
|
| 137 | - * @return string |
|
| 138 | - */ |
|
| 139 | - public function make($view, $data = []) |
|
| 140 | - { |
|
| 141 | - $path = $this->finder->find( |
|
| 142 | - $view = $this->normalizeName($view) |
|
| 143 | - ); |
|
| 128 | + /** |
|
| 129 | + * Global and local data are merged and extracted to create local variables within the view file. |
|
| 130 | + * Renders the view object to a string. |
|
| 131 | + * |
|
| 132 | + * @example $output = $view->make(); |
|
| 133 | + * |
|
| 134 | + * @param string $view View filename |
|
| 135 | + * @param array $data Array of values |
|
| 136 | + * |
|
| 137 | + * @return string |
|
| 138 | + */ |
|
| 139 | + public function make($view, $data = []) |
|
| 140 | + { |
|
| 141 | + $path = $this->finder->find( |
|
| 142 | + $view = $this->normalizeName($view) |
|
| 143 | + ); |
|
| 144 | 144 | |
| 145 | - // Loader class instance. |
|
| 146 | - return take($this->viewInstance($view, $path, $data), function ($view) { |
|
| 147 | - $this->callCreator($view); |
|
| 148 | - }); |
|
| 149 | - } |
|
| 145 | + // Loader class instance. |
|
| 146 | + return take($this->viewInstance($view, $path, $data), function ($view) { |
|
| 147 | + $this->callCreator($view); |
|
| 148 | + }); |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | - /** |
|
| 152 | - * Normalize a view name. |
|
| 153 | - * |
|
| 154 | - * @param string $name |
|
| 155 | - * |
|
| 156 | - * @return string |
|
| 157 | - */ |
|
| 158 | - protected function normalizeName($name) |
|
| 151 | + /** |
|
| 152 | + * Normalize a view name. |
|
| 153 | + * |
|
| 154 | + * @param string $name |
|
| 155 | + * |
|
| 156 | + * @return string |
|
| 157 | + */ |
|
| 158 | + protected function normalizeName($name) |
|
| 159 | 159 | { |
| 160 | - return ViewName::normalize($name); |
|
| 160 | + return ViewName::normalize($name); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - /** |
|
| 164 | - * Create a new view instance from the given arguments. |
|
| 165 | - * |
|
| 166 | - * @param string $file View filename |
|
| 167 | - * * @param string $path Path filename |
|
| 168 | - * @param array $data Array of values |
|
| 169 | - * |
|
| 170 | - * @return \Syscodes\Contracts\View\View |
|
| 171 | - */ |
|
| 172 | - protected function viewInstance($view, $path, $data) |
|
| 173 | - { |
|
| 174 | - return new View($this, $this->getEngineFromPath($path), $view, $path, $data); |
|
| 175 | - } |
|
| 163 | + /** |
|
| 164 | + * Create a new view instance from the given arguments. |
|
| 165 | + * |
|
| 166 | + * @param string $file View filename |
|
| 167 | + * * @param string $path Path filename |
|
| 168 | + * @param array $data Array of values |
|
| 169 | + * |
|
| 170 | + * @return \Syscodes\Contracts\View\View |
|
| 171 | + */ |
|
| 172 | + protected function viewInstance($view, $path, $data) |
|
| 173 | + { |
|
| 174 | + return new View($this, $this->getEngineFromPath($path), $view, $path, $data); |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | - /** |
|
| 178 | - * Get the appropriate view engine for the given path. |
|
| 179 | - * |
|
| 180 | - * @param string $path |
|
| 181 | - * |
|
| 182 | - * @return \Illuminate\Contracts\View\Engine |
|
| 183 | - * |
|
| 184 | - * @throws \InvalidArgumentException |
|
| 185 | - */ |
|
| 186 | - public function getEngineFromPath($path) |
|
| 187 | - { |
|
| 188 | - if ( ! $extension = $this->getExtension($path)) |
|
| 189 | - { |
|
| 190 | - throw new InvalidArgumentException("Unrecognized extension in file: {$path}"); |
|
| 191 | - } |
|
| 177 | + /** |
|
| 178 | + * Get the appropriate view engine for the given path. |
|
| 179 | + * |
|
| 180 | + * @param string $path |
|
| 181 | + * |
|
| 182 | + * @return \Illuminate\Contracts\View\Engine |
|
| 183 | + * |
|
| 184 | + * @throws \InvalidArgumentException |
|
| 185 | + */ |
|
| 186 | + public function getEngineFromPath($path) |
|
| 187 | + { |
|
| 188 | + if ( ! $extension = $this->getExtension($path)) |
|
| 189 | + { |
|
| 190 | + throw new InvalidArgumentException("Unrecognized extension in file: {$path}"); |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | - $engine = $this->extensions[$extension]; |
|
| 193 | + $engine = $this->extensions[$extension]; |
|
| 194 | 194 | |
| 195 | - return $this->engines->resolve($engine); |
|
| 196 | - } |
|
| 195 | + return $this->engines->resolve($engine); |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | - /** |
|
| 199 | - * Get the extension used by the view file. |
|
| 200 | - * |
|
| 201 | - * @param string $path |
|
| 202 | - * |
|
| 203 | - * @return string |
|
| 204 | - */ |
|
| 205 | - protected function getExtension($path) |
|
| 206 | - { |
|
| 207 | - $extensions = array_keys($this->extensions); |
|
| 198 | + /** |
|
| 199 | + * Get the extension used by the view file. |
|
| 200 | + * |
|
| 201 | + * @param string $path |
|
| 202 | + * |
|
| 203 | + * @return string |
|
| 204 | + */ |
|
| 205 | + protected function getExtension($path) |
|
| 206 | + { |
|
| 207 | + $extensions = array_keys($this->extensions); |
|
| 208 | 208 | |
| 209 | - return Arr::first($extensions, function($key, $value) use ($path) |
|
| 210 | - { |
|
| 211 | - return Str::endsWith($path, '.'.$value); |
|
| 212 | - }); |
|
| 213 | - } |
|
| 209 | + return Arr::first($extensions, function($key, $value) use ($path) |
|
| 210 | + { |
|
| 211 | + return Str::endsWith($path, '.'.$value); |
|
| 212 | + }); |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - /** |
|
| 216 | - * Call the creator for a given view. |
|
| 217 | - * |
|
| 218 | - * @param \Syscodes\View\View $view |
|
| 219 | - * |
|
| 220 | - * @return void |
|
| 221 | - */ |
|
| 222 | - public function callCreator(View $view) |
|
| 223 | - { |
|
| 224 | - $this->events->dispatch('creating: '.$view->getView(), [$view]); |
|
| 225 | - } |
|
| 215 | + /** |
|
| 216 | + * Call the creator for a given view. |
|
| 217 | + * |
|
| 218 | + * @param \Syscodes\View\View $view |
|
| 219 | + * |
|
| 220 | + * @return void |
|
| 221 | + */ |
|
| 222 | + public function callCreator(View $view) |
|
| 223 | + { |
|
| 224 | + $this->events->dispatch('creating: '.$view->getView(), [$view]); |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | - /** |
|
| 228 | - * Get the extension to engine bindings. |
|
| 229 | - * |
|
| 230 | - * @return array |
|
| 231 | - */ |
|
| 232 | - public function getExtensions() |
|
| 233 | - { |
|
| 234 | - return $this->extensions; |
|
| 235 | - } |
|
| 227 | + /** |
|
| 228 | + * Get the extension to engine bindings. |
|
| 229 | + * |
|
| 230 | + * @return array |
|
| 231 | + */ |
|
| 232 | + public function getExtensions() |
|
| 233 | + { |
|
| 234 | + return $this->extensions; |
|
| 235 | + } |
|
| 236 | 236 | |
| 237 | - /** |
|
| 238 | - * Add a piece of shared data to the environment. |
|
| 239 | - * |
|
| 240 | - * @param array|string $key |
|
| 241 | - * @param mixed|null $value (null by default) |
|
| 242 | - * |
|
| 243 | - * @return mixed |
|
| 244 | - */ |
|
| 245 | - public function share($key, $value = null) |
|
| 246 | - { |
|
| 247 | - $keys = is_array($key) ? $key : [$key => $value]; |
|
| 237 | + /** |
|
| 238 | + * Add a piece of shared data to the environment. |
|
| 239 | + * |
|
| 240 | + * @param array|string $key |
|
| 241 | + * @param mixed|null $value (null by default) |
|
| 242 | + * |
|
| 243 | + * @return mixed |
|
| 244 | + */ |
|
| 245 | + public function share($key, $value = null) |
|
| 246 | + { |
|
| 247 | + $keys = is_array($key) ? $key : [$key => $value]; |
|
| 248 | 248 | |
| 249 | - foreach ($keys as $key => $value) |
|
| 250 | - { |
|
| 251 | - $this->shared[$key] = $value; |
|
| 252 | - } |
|
| 249 | + foreach ($keys as $key => $value) |
|
| 250 | + { |
|
| 251 | + $this->shared[$key] = $value; |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | - return $value; |
|
| 255 | - } |
|
| 254 | + return $value; |
|
| 255 | + } |
|
| 256 | 256 | |
| 257 | - /** |
|
| 258 | - * Replace the namespace hints for the given namespace. |
|
| 259 | - * |
|
| 260 | - * @param string $namespace |
|
| 261 | - * @param string|array $hints |
|
| 262 | - * |
|
| 263 | - * @return $this |
|
| 264 | - */ |
|
| 265 | - public function replaceNamespace($namespace, $hints) |
|
| 266 | - { |
|
| 267 | - $this->finder->replaceNamespace($namespace, $hints); |
|
| 257 | + /** |
|
| 258 | + * Replace the namespace hints for the given namespace. |
|
| 259 | + * |
|
| 260 | + * @param string $namespace |
|
| 261 | + * @param string|array $hints |
|
| 262 | + * |
|
| 263 | + * @return $this |
|
| 264 | + */ |
|
| 265 | + public function replaceNamespace($namespace, $hints) |
|
| 266 | + { |
|
| 267 | + $this->finder->replaceNamespace($namespace, $hints); |
|
| 268 | 268 | |
| 269 | - return $this; |
|
| 270 | - } |
|
| 269 | + return $this; |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | - /** |
|
| 273 | - * Increment the rendering counter. |
|
| 274 | - * |
|
| 275 | - * @return void |
|
| 276 | - */ |
|
| 277 | - public function increment() |
|
| 278 | - { |
|
| 279 | - return $this->renderCount++; |
|
| 280 | - } |
|
| 272 | + /** |
|
| 273 | + * Increment the rendering counter. |
|
| 274 | + * |
|
| 275 | + * @return void |
|
| 276 | + */ |
|
| 277 | + public function increment() |
|
| 278 | + { |
|
| 279 | + return $this->renderCount++; |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - /** |
|
| 283 | - * Decrement the rendering counter. |
|
| 284 | - * |
|
| 285 | - * @return void |
|
| 286 | - */ |
|
| 287 | - public function decrement() |
|
| 288 | - { |
|
| 289 | - return $this->renderCount--; |
|
| 290 | - } |
|
| 282 | + /** |
|
| 283 | + * Decrement the rendering counter. |
|
| 284 | + * |
|
| 285 | + * @return void |
|
| 286 | + */ |
|
| 287 | + public function decrement() |
|
| 288 | + { |
|
| 289 | + return $this->renderCount--; |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * Check if there are no active render operations. |
|
| 294 | - * |
|
| 295 | - * @return bool |
|
| 296 | - */ |
|
| 297 | - public function doneRendering() |
|
| 298 | - { |
|
| 299 | - return $this->renderCount == 0; |
|
| 300 | - } |
|
| 292 | + /** |
|
| 293 | + * Check if there are no active render operations. |
|
| 294 | + * |
|
| 295 | + * @return bool |
|
| 296 | + */ |
|
| 297 | + public function doneRendering() |
|
| 298 | + { |
|
| 299 | + return $this->renderCount == 0; |
|
| 300 | + } |
|
| 301 | 301 | |
| 302 | - /** |
|
| 303 | - * Flush all of the parser state like sections. |
|
| 304 | - * |
|
| 305 | - * @return void |
|
| 306 | - */ |
|
| 307 | - public function flushState() |
|
| 308 | - { |
|
| 309 | - $this->renderCount = 0; |
|
| 302 | + /** |
|
| 303 | + * Flush all of the parser state like sections. |
|
| 304 | + * |
|
| 305 | + * @return void |
|
| 306 | + */ |
|
| 307 | + public function flushState() |
|
| 308 | + { |
|
| 309 | + $this->renderCount = 0; |
|
| 310 | 310 | |
| 311 | - $this->flushSections(); |
|
| 312 | - } |
|
| 311 | + $this->flushSections(); |
|
| 312 | + } |
|
| 313 | 313 | |
| 314 | - /** |
|
| 315 | - * Flush all of the section contents if done rendering. |
|
| 316 | - * |
|
| 317 | - * @return void |
|
| 318 | - */ |
|
| 319 | - public function flushStateIfDoneRendering() |
|
| 320 | - { |
|
| 321 | - if ($this->doneRendering()) |
|
| 322 | - { |
|
| 323 | - $this->flushState(); |
|
| 324 | - } |
|
| 325 | - } |
|
| 314 | + /** |
|
| 315 | + * Flush all of the section contents if done rendering. |
|
| 316 | + * |
|
| 317 | + * @return void |
|
| 318 | + */ |
|
| 319 | + public function flushStateIfDoneRendering() |
|
| 320 | + { |
|
| 321 | + if ($this->doneRendering()) |
|
| 322 | + { |
|
| 323 | + $this->flushState(); |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | 326 | |
| 327 | - /** |
|
| 328 | - * Get all of the shared data for the environment. |
|
| 329 | - * |
|
| 330 | - * @return void |
|
| 331 | - */ |
|
| 332 | - public function getShared() |
|
| 333 | - { |
|
| 334 | - return $this->shared; |
|
| 335 | - } |
|
| 327 | + /** |
|
| 328 | + * Get all of the shared data for the environment. |
|
| 329 | + * |
|
| 330 | + * @return void |
|
| 331 | + */ |
|
| 332 | + public function getShared() |
|
| 333 | + { |
|
| 334 | + return $this->shared; |
|
| 335 | + } |
|
| 336 | 336 | |
| 337 | - /** |
|
| 338 | - * Get the IoC container instance. |
|
| 339 | - * |
|
| 340 | - * @return \Syscodes\Contracts\Container\Container |
|
| 341 | - */ |
|
| 342 | - public function getContainer() |
|
| 343 | - { |
|
| 344 | - return $this->container; |
|
| 345 | - } |
|
| 337 | + /** |
|
| 338 | + * Get the IoC container instance. |
|
| 339 | + * |
|
| 340 | + * @return \Syscodes\Contracts\Container\Container |
|
| 341 | + */ |
|
| 342 | + public function getContainer() |
|
| 343 | + { |
|
| 344 | + return $this->container; |
|
| 345 | + } |
|
| 346 | 346 | |
| 347 | - /** |
|
| 348 | - * Set the IoC container instance. |
|
| 349 | - * |
|
| 350 | - * @param \Syscodes\Contracts\Container\Container $container |
|
| 351 | - * |
|
| 352 | - * @return void |
|
| 353 | - */ |
|
| 354 | - public function setContainer($container) |
|
| 355 | - { |
|
| 356 | - $this->container = $container; |
|
| 357 | - } |
|
| 347 | + /** |
|
| 348 | + * Set the IoC container instance. |
|
| 349 | + * |
|
| 350 | + * @param \Syscodes\Contracts\Container\Container $container |
|
| 351 | + * |
|
| 352 | + * @return void |
|
| 353 | + */ |
|
| 354 | + public function setContainer($container) |
|
| 355 | + { |
|
| 356 | + $this->container = $container; |
|
| 357 | + } |
|
| 358 | 358 | } |
| 359 | 359 | \ No newline at end of file |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | $this->finder->find($view); |
| 119 | 119 | } |
| 120 | - catch(InvalidArgumentException $e) |
|
| 120 | + catch (InvalidArgumentException $e) |
|
| 121 | 121 | { |
| 122 | 122 | return false; |
| 123 | 123 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ); |
| 144 | 144 | |
| 145 | 145 | // Loader class instance. |
| 146 | - return take($this->viewInstance($view, $path, $data), function ($view) { |
|
| 146 | + return take($this->viewInstance($view, $path, $data), function($view) { |
|
| 147 | 147 | $this->callCreator($view); |
| 148 | 148 | }); |
| 149 | 149 | } |
@@ -116,8 +116,7 @@ |
||
| 116 | 116 | try |
| 117 | 117 | { |
| 118 | 118 | $this->finder->find($view); |
| 119 | - } |
|
| 120 | - catch(InvalidArgumentException $e) |
|
| 119 | + } catch(InvalidArgumentException $e) |
|
| 121 | 120 | { |
| 122 | 121 | return false; |
| 123 | 122 | } |
@@ -170,7 +170,7 @@ |
||
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - throw new ViewException(__('view.notFound', ['file' => $name])); |
|
| 173 | + throw new ViewException(__('view.notFound', ['file' => $name])); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
@@ -182,7 +182,7 @@ |
||
| 182 | 182 | */ |
| 183 | 183 | protected function getFindViewFiles($name) |
| 184 | 184 | { |
| 185 | - return array_map(function ($extension) use ($name) { |
|
| 185 | + return array_map(function($extension) use ($name) { |
|
| 186 | 186 | return str_replace('.', DIRECTORY_SEPARATOR, $name).'.'.$extension; |
| 187 | 187 | }, $this->getExtensions()); |
| 188 | 188 | } |
@@ -97,7 +97,7 @@ |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | return $this->files->lastModified($path) >= |
| 100 | - $this->files->lastModified($compiled); |
|
| 100 | + $this->files->lastModified($compiled); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
@@ -42,8 +42,7 @@ |
||
| 42 | 42 | if (is_null($expression)) |
| 43 | 43 | { |
| 44 | 44 | return '<?php \$__env->beginTranslation(); ?>'; |
| 45 | - } |
|
| 46 | - elseif ($expression[1] === '[') |
|
| 45 | + } elseif ($expression[1] === '[') |
|
| 47 | 46 | { |
| 48 | 47 | return "<?php \$__env->beginTranslation{$expression}; ?>"; |
| 49 | 48 | } |