Skip to content

luisneto98/Wandarena

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wandarena

substituir o conteudo da classe sllim3anottation por:

<?php

namespace Slim3\Annotation;

use Slim\App;

class Slim3Annotation
{

    public static $cache_path;


    public static function create(App $application, string $pathController, string $pathCache) {
        $collector = new CollectorRoute();
        $arrayRoute = $collector->getControllers($pathController);
        $arrayRouteObject = $collector->castRoute($arrayRoute);
        self::injectRoute($application, $arrayRouteObject);
    }


    private static function injectRoute(App $application, array $arrayRouteObject) {
        foreach ($arrayRouteObject as $routeModel) {
            $route = $application->map([$routeModel->getVerb()], $routeModel->getRoute(), $routeModel->getClassName() . ':' . $routeModel->getMethodName());
            if ($routeModel->getAlias() != null) {
                $route->setName($routeModel->getAlias());
            }
            if ($routeModel->getClassMiddleware() != null) {
                $classMiddleware = $routeModel->getClassMiddleware();
                foreach ($classMiddleware as $middleware) {
                    $route->add(new $middleware());
                }
            }
        }
    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published