Passed
Push — master ( 9c20ed...2c5d5d )
by Fran
04:30
created

Router::searchAction()   C

Complexity

Conditions 8
Paths 8

Size

Total Lines 24
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 72

Importance

Changes 0
Metric Value
cc 8
eloc 17
nc 8
nop 1
dl 0
loc 24
ccs 0
cts 18
cp 0
crap 72
rs 5.7377
c 0
b 0
f 0
1
<?php
2
3
namespace PSFS\base;
4
5
use PSFS\base\config\Config;
6
use PSFS\base\exception\AccessDeniedException;
7
use PSFS\base\exception\ConfigException;
8
use PSFS\base\exception\RouterException;
9
use PSFS\base\types\helpers\AdminHelper;
10
use PSFS\base\types\helpers\GeneratorHelper;
11
use PSFS\base\types\helpers\I18nHelper;
12
use PSFS\base\types\helpers\RequestHelper;
13
use PSFS\base\types\helpers\RouterHelper;
14
use PSFS\base\types\helpers\SecurityHelper;
15
use PSFS\base\types\SingletonTrait;
16
use PSFS\controller\base\Admin;
17
use PSFS\services\AdminServices;
18
use Symfony\Component\Finder\Finder;
19
20
21
/**
22
 * Class Router
23
 * @package PSFS
24
 */
25
class Router
26
{
27
28
    use SingletonTrait;
29
30
    protected $routing;
31
    protected $slugs;
32
    private $domains;
33
    /**
34
     * @var Finder $finder
35
     */
36
    private $finder;
37
    /**
38
     * @var \PSFS\base\Cache $cache
39
     */
40
    private $cache;
41
    /**
42
     * @var bool headersSent
43
     */
44
    protected $headersSent = false;
45
    /**
46
     * @var int
47
     */
48
    protected $cacheType = Cache::JSON;
49
50
    /**
51
     * Constructor Router
52
     * @throws ConfigException
53
     */
54 1
    public function __construct()
55
    {
56 1
        $this->finder = new Finder();
57 1
        $this->cache = Cache::getInstance();
58 1
        $this->init();
59 1
    }
60
61
    /**
62
     * Inicializador Router
63
     * @throws ConfigException
64
     */
65 1
    public function init()
66
    {
67 1
        list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json", $this->cacheType, TRUE);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 147 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
68 1
        $this->domains = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", $this->cacheType, TRUE);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 130 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
69 1
        if (empty($this->routing) || Config::getInstance()->getDebugMode()) {
70 1
            $this->debugLoad();
71 1
        }
72 1
        $this->checkExternalModules(false);
73 1
    }
74
75
    /**
76
     * Load routes and domains and store them
77
     */
78 1
    private function debugLoad() {
79 1
        Logger::log('Begin routes load', LOG_DEBUG);
80 1
        $this->hydrateRouting();
81 1
        $this->simpatize();
82 1
        Logger::log('End routes load', LOG_DEBUG);
83 1
    }
84
85
    /**
86
     * Método que deriva un error HTTP de página no encontrada
87
     *
88
     * @param \Exception $e
89
     *
90
     * @return string HTML
0 ignored issues
show
Documentation introduced by
Should the return type not be string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
91
     */
92 1
    public function httpNotFound(\Exception $e = NULL)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $e. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
93
    {
94
        Logger::log('Throw not found exception');
95
        if (NULL === $e) {
96
            Logger::log('Not found page throwed without previous exception', LOG_WARNING);
97
            $e = new \Exception(_('Page not found'), 404);
98
        }
99
        $template = Template::getInstance()->setStatus($e->getCode());
100
        if (preg_match('/json/i', Request::getInstance()->getServer('CONTENT_TYPE'))) {
101 1
            return $template->output(json_encode(array(
102
                "success" => FALSE,
103
                "error" => $e->getMessage(),
104
            )), 'application/json');
105
        } else {
106
            return $template->render('error.html.twig', array(
107
                'exception' => $e,
108
                'trace' => $e->getTraceAsString(),
109
                'error_page' => TRUE,
110
            ));
111
        }
112
    }
113
114
    /**
115
     * Método que devuelve las rutas
116
     * @return string|null
117
     */
118
    public function getSlugs()
119
    {
120
        return $this->slugs;
121
    }
122
123
    /**
124
     * @return mixed
125
     */
126 1
    public function getRoutes() {
127 1
        return $this->routing;
128
    }
129
130
    /**
131
     * Method that extract all routes in the platform
132
     * @return array
133
     */
134
    public function getAllRoutes()
135
    {
136
        $routes = [];
137
        foreach ($this->getRoutes() as $path => $route) {
138
            if (array_key_exists('slug', $route)) {
139
                $routes[$route['slug']] = $path;
140
            }
141
        }
142
        return $routes;
143
    }
144
145
    /**
146
     * Método que calcula el objeto a enrutar
147
     *
148
     * @param string|null $route
149
     *
150
     * @throws \Exception
151
     * @return string HTML
0 ignored issues
show
Documentation introduced by
Should the return type not be string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
152
     */
153
    public function execute($route)
154
    {
155
        Logger::log('Executing the request');
156
        try {
157
            //Check CORS for requests
158
            RequestHelper::checkCORS();
159
            // Checks restricted access
160
            SecurityHelper::checkRestrictedAccess($route);
161
            //Search action and execute
162
            $this->searchAction($route);
163
        } catch (AccessDeniedException $e) {
164
            Logger::log(_('Solicitamos credenciales de acceso a zona restringida'));
165
            return Admin::staticAdminLogon($route);
166
        } catch (RouterException $r) {
167
            Logger::log($r->getMessage(), LOG_WARNING);
168
        } catch (\Exception $e) {
169
            Logger::log($e->getMessage(), LOG_ERR);
170
            throw $e;
171
        }
172
173
        throw new RouterException(_("Página no encontrada"), 404);
174
    }
175
176
    /**
177
     * Método que busca el componente que ejecuta la ruta
178
     *
179
     * @param string $route
180
     *
181
     * @throws \PSFS\base\exception\RouterException
182
     */
183
    protected function searchAction($route)
184
    {
185
        Logger::log('Searching action to execute: ' . $route, LOG_INFO);
186
        //Revisamos si tenemos la ruta registrada
187
        $parts = parse_url($route);
188
        $path = (array_key_exists('path', $parts)) ? $parts['path'] : $route;
189
        $httpRequest = Request::getInstance()->getMethod();
190
        foreach ($this->routing as $pattern => $action) {
191
            list($httpMethod, $routePattern) = RouterHelper::extractHttpRoute($pattern);
192
            $matched = RouterHelper::matchRoutePattern($routePattern, $path);
193
            if ($matched && ($httpMethod === "ALL" || $httpRequest === $httpMethod) && RouterHelper::compareSlashes($routePattern, $path)) {
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 140 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
194
                $get = RouterHelper::extractComponents($route, $routePattern);
195
                /** @var $class \PSFS\base\types\Controller */
196
                $class = RouterHelper::getClassToCall($action);
197
                try {
198
                    $this->executeCachedRoute($route, $action, $class, $get);
199
                } catch (\Exception $e) {
200
                    Logger::log($e->getMessage(), LOG_ERR);
201
                    throw new RouterException($e->getMessage(), 404, $e);
202
                }
203
            }
204
        }
205
        throw new RouterException(_("Ruta no encontrada"));
206
    }
207
208
    /**
209
     * Método que manda las cabeceras de autenticación
210
     * @return string HTML
0 ignored issues
show
Documentation introduced by
Should the return type not be string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
211
     */
212
    protected function sentAuthHeader()
213
    {
214
        return AdminServices::getInstance()->setAdminHeaders();
215
    }
216
217
    /**
218
     * Method that check if the proyect has sub project to include
219
     * @param boolean $hydrateRoute
220
     */
221 1
    private function checkExternalModules($hydrateRoute = true)
222
    {
223 1
        $externalModules = Config::getParam('modules.extend');
224 1
        if (null !== $externalModules) {
225
            $externalModules = explode(',', $externalModules);
226
            foreach ($externalModules as &$module) {
227
                $module = preg_replace('/(\\\|\/)/', DIRECTORY_SEPARATOR, $module);
228
                $externalModulePath = VENDOR_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'src';
229
                if (file_exists($externalModulePath)) {
230
                    $externalModule = $this->finder->directories()->in($externalModulePath)->depth(0);
231
                    if (!empty($externalModule)) {
232
                        foreach ($externalModule as $modulePath) {
233
                            $extModule = $modulePath->getBasename();
234
                            $moduleAutoloader = realpath($externalModulePath . DIRECTORY_SEPARATOR . $extModule . DIRECTORY_SEPARATOR . 'autoload.php');
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 152 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
235
                            if (file_exists($moduleAutoloader)) {
236
                                @include $moduleAutoloader;
237
                                if ($hydrateRoute) {
238
                                    $this->routing = $this->inspectDir($externalModulePath . DIRECTORY_SEPARATOR . $extModule, '\\' . $extModule, $this->routing);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 162 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
239
                                }
240
                            }
241
                        }
242
                    }
243
                }
244
            }
245
        }
246 1
    }
247
248
    /**
249
     * Method that gather all the routes in the project
250
     */
251 1
    private function generateRouting()
252
    {
253 1
        $base = SOURCE_DIR;
254 1
        $modulesPath = realpath(CORE_DIR);
255 1
        $this->routing = $this->inspectDir($base, "PSFS", array());
256 1
        if (file_exists($modulesPath)) {
257
            $modules = $this->finder->directories()->in($modulesPath)->depth(0);
258
            foreach ($modules as $modulePath) {
259
                $module = $modulePath->getBasename();
260
                $this->routing = $this->inspectDir($modulesPath . DIRECTORY_SEPARATOR . $module, $module, $this->routing);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 122 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
261
            }
262
        }
263 1
        $this->checkExternalModules();
264 1
        $this->cache->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", $this->domains, Cache::JSON, TRUE);
265 1
    }
266
267
    /**
268
     * Método que regenera el fichero de rutas
269
     * @throws ConfigException
270
     */
271 1
    public function hydrateRouting()
272
    {
273 1
        $this->generateRouting();
274 1
        $home = Config::getInstance()->get('home_action');
275 1
        if (NULL !== $home || $home !== '') {
276 1
            $home_params = NULL;
277 1
            foreach ($this->routing as $pattern => $params) {
278 1
                list($method, $route) = RouterHelper::extractHttpRoute($pattern);
279 1
                if (preg_match("/" . preg_quote($route, "/") . "$/i", "/" . $home)) {
280
                    $home_params = $params;
281
                }
282 1
            }
283 1
            if (NULL !== $home_params) {
284
                $this->routing['/'] = $home_params;
285
            }
286 1
        }
287 1
    }
288
289
    /**
290
     * Método que inspecciona los directorios en busca de clases que registren rutas
291
     *
292
     * @param string $origen
293
     * @param string $namespace
294
     * @param array $routing
295
     *
296
     * @return array
297
     * @throws ConfigException
298
     */
299 1
    private function inspectDir($origen, $namespace = 'PSFS', $routing = [])
300
    {
301 1
        $files = $this->finder->files()->in($origen)->path('/(controller|api)/i')->depth(1)->name("*.php");
302 1
        foreach ($files as $file) {
303 1
            $filename = str_replace("/", '\\', str_replace($origen, '', $file->getPathname()));
304 1
            $routing = $this->addRouting($namespace . str_replace('.php', '', $filename), $routing, $namespace);
305 1
        }
306 1
        $this->finder = new Finder();
307
308 1
        return $routing;
309
    }
310
311
    /**
312
     * Checks that a namespace exists
313
     * @param string $namespace
314
     * @return bool
315
     */
316 1
    public static function exists($namespace)
317
    {
318 1
        return (class_exists($namespace) || interface_exists($namespace) || trait_exists($namespace));
319
    }
320
321
    /**
322
     * Método que añade nuevas rutas al array de referencia
323
     *
324
     * @param string $namespace
325
     * @param array $routing
326
     * @param string $module
327
     *
328
     * @return array
329
     * @throws ConfigException
330
     */
331 1
    private function addRouting($namespace, &$routing, $module = 'PSFS')
332
    {
333 1
        if (self::exists($namespace)) {
334 1
            $reflection = new \ReflectionClass($namespace);
335 1
            if (FALSE === $reflection->isAbstract() && FALSE === $reflection->isInterface()) {
336 1
                $this->extractDomain($reflection);
337 1
                $classComments = $reflection->getDocComment();
338 1
                preg_match('/@api\ (.*)\n/im', $classComments, $apiPath);
339 1
                $api = '';
340 1
                if (count($apiPath)) {
341
                    $api = array_key_exists(1, $apiPath) ? $apiPath[1] : $api;
342
                }
343 1
                foreach ($reflection->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
344 1
                    if (preg_match('/@route\ /i', $method->getDocComment())) {
345 1
                        list($route, $info) = RouterHelper::extractRouteInfo($method, str_replace('\\', '', $api), str_replace('\\', '', $module));
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 147 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
346
347 1
                        if (null !== $route && null !== $info) {
348 1
                            $info['class'] = $namespace;
349 1
                            $routing[$route] = $info;
350 1
                        }
351 1
                    }
352 1
                }
353 1
            }
354 1
        }
355
356 1
        return $routing;
357
    }
358
359
    /**
360
     * Método que extrae de la ReflectionClass los datos necesarios para componer los dominios en los templates
361
     *
362
     * @param \ReflectionClass $class
363
     *
364
     * @return Router
365
     * @throws ConfigException
366
     */
367 1
    protected function extractDomain(\ReflectionClass $class)
368
    {
369
        //Calculamos los dominios para las plantillas
370 1
        if ($class->hasConstant("DOMAIN") && !$class->isAbstract()) {
371 1
            if (!$this->domains) {
372 1
                $this->domains = [];
373 1
            }
374 1
            $domain = "@" . $class->getConstant("DOMAIN") . "/";
375 1
            if (!array_key_exists($domain, $this->domains)) {
376 1
                $this->domains[$domain] = RouterHelper::extractDomainInfo($class, $domain);
377 1
            }
378 1
        }
379
380 1
        return $this;
381
    }
382
383
    /**
384
     * Método que genera las urls amigables para usar dentro del framework
385
     * @return Router
386
     */
387 1
    public function simpatize()
388
    {
389 1
        $translationFileName = "translations" . DIRECTORY_SEPARATOR . "routes_translations.php";
390 1
        $absoluteTranslationFileName = CACHE_DIR . DIRECTORY_SEPARATOR . $translationFileName;
391 1
        $this->generateSlugs($absoluteTranslationFileName);
392 1
        GeneratorHelper::createDir(CONFIG_DIR);
393 1
        Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json", array($this->routing, $this->slugs), Cache::JSON, TRUE);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 144 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
394
395 1
        return $this;
396
    }
397
398
    /**
399
     * Método que devuelve una ruta del framework
400
     *
401
     * @param string $slug
402
     * @param boolean $absolute
403
     * @param array $params
404
     *
405
     * @return string|null
406
     * @throws RouterException
407
     */
408 1
    public function getRoute($slug = '', $absolute = FALSE, $params = [])
409
    {
410 1
        if (strlen($slug) === 0) {
411
            return ($absolute) ? Request::getInstance()->getRootUrl() . '/' : '/';
412
        }
413 1
        if (!is_array($this->slugs) || !array_key_exists($slug, $this->slugs)) {
414
            throw new RouterException(_("No existe la ruta especificada"));
415
        }
416 1
        $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->slugs[$slug] : $this->slugs[$slug];
417 1
        if (!empty($params)) foreach ($params as $key => $value) {
418
            $url = str_replace("{" . $key . "}", $value, $url);
419 1
        } elseif (!empty($this->routing[$this->slugs[$slug]]["default"])) {
420 1
            $url = ($absolute) ? Request::getInstance()->getRootUrl() . $this->routing[$this->slugs[$slug]]["default"] : $this->routing[$this->slugs[$slug]]["default"];
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 168 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
421 1
        }
422
423 1
        return preg_replace('/(GET|POST|PUT|DELETE|ALL)\#\|\#/', '', $url);
424
    }
425
426
    /**
427
     * Método que devuelve las rutas de administración
428
     * @deprecated
429
     * @return array
430
     */
431
    public function getAdminRoutes()
432
    {
433
        return AdminHelper::getAdminRoutes($this->routing);
434
    }
435
436
    /**
437
     * Método que devuelve le controlador del admin
438
     * @deprecated
439
     * @return Admin
440
     */
441
    public function getAdmin()
442
    {
443
        return Admin::getInstance();
444
    }
445
446
    /**
447
     * Método que extrae los dominios
448
     * @return array
449
     */
450
    public function getDomains()
451
    {
452
        return $this->domains ?: [];
453
    }
454
455
    /**
456
     * Método que ejecuta una acción del framework y revisa si lo tenemos cacheado ya o no
457
     *
458
     * @param string $route
459
     * @param array|null $action
460
     * @param types\Controller $class
461
     * @param array $params
0 ignored issues
show
Documentation introduced by
Should the type for parameter $params not be array|null? Also, consider making the array more specific, something like array<String>, or String[].

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive. In addition it looks for parameters that have the generic type array and suggests a stricter type like array<String>.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
462
     */
463
    protected function executeCachedRoute($route, $action, $class, $params = NULL)
464
    {
465
        Logger::log('Executing route ' . $route, LOG_INFO);
466
        Security::getInstance()->setSessionKey("__CACHE__", $action);
467
        $cache = Cache::needCache();
468
        $execute = TRUE;
469
        if (FALSE !== $cache && Config::getInstance()->getDebugMode() === FALSE) {
470
            $cacheDataName = $this->cache->getRequestCacheHash();
471
            $tmpDir = substr($cacheDataName, 0, 2) . DIRECTORY_SEPARATOR . substr($cacheDataName, 2, 2) . DIRECTORY_SEPARATOR;
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 126 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
472
            $cachedData = $this->cache->readFromCache("json" . DIRECTORY_SEPARATOR . $tmpDir . $cacheDataName,
473
                $cache, function () {
0 ignored issues
show
Bug introduced by
It seems like $cache defined by \PSFS\base\Cache::needCache() on line 467 can also be of type boolean; however, PSFS\base\Cache::readFromCache() does only seem to accept integer, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
474
                });
475
            if (NULL !== $cachedData) {
476
                $headers = $this->cache->readFromCache("json" . DIRECTORY_SEPARATOR . $tmpDir . $cacheDataName . ".headers",
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 124 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
477
                    $cache, function () {
0 ignored issues
show
Bug introduced by
It seems like $cache defined by \PSFS\base\Cache::needCache() on line 467 can also be of type boolean; however, PSFS\base\Cache::readFromCache() does only seem to accept integer, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
478
                    }, Cache::JSON);
479
                Template::getInstance()->renderCache($cachedData, $headers);
480
                $execute = FALSE;
481
            }
482
        }
483
        if ($execute) {
484
            Logger::log(_('Start executing action'), LOG_DEBUG);
485
            if (false === call_user_func_array(array($class, $action['method']), $params)) {
486
                Logger::log(_('An error ocurred trying to execute the action'), LOG_ERR, [error_get_last()]);
487
            }
488
        }
489
    }
490
491
    /**
492
     * Parse slugs to create translations
493
     *
494
     * @param string $absoluteTranslationFileName
495
     */
496 1
    private function generateSlugs($absoluteTranslationFileName)
497
    {
498 1
        $translations = I18nHelper::generateTranslationsFile($absoluteTranslationFileName);
499 1
        foreach ($this->routing as $key => &$info) {
500 1
            $keyParts = $key;
501 1
            if (FALSE === strstr("#|#", $key)) {
502 1
                $keyParts = explode("#|#", $key);
503 1
                $keyParts = array_key_exists(1, $keyParts) ? $keyParts[1] : '';
504 1
            }
505 1
            $slug = RouterHelper::slugify($keyParts);
506 1
            if (NULL !== $slug && !array_key_exists($slug, $translations)) {
507 1
                $translations[$slug] = $key;
508 1
                file_put_contents($absoluteTranslationFileName, "\$translations[\"{$slug}\"] = _(\"{$slug}\");\n", FILE_APPEND);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 128 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
509 1
            }
510 1
            $this->slugs[$slug] = $key;
511 1
            $info["slug"] = $slug;
512 1
        }
513 1
    }
514
515
}
516