application/Libraries/Core.php
/**
     * Check if method specified is a route method
     * 
     * Route methods are tagged with @route
     * Use Reflection API to get Doc Comments
     * Parse Doc Comments with Regex to get @tags
     * Trim Whitespaces of tags
     * 
     * @param object $controller Controller Class containing method
     * @param string $method Name of method to check
     * @return bool Check if route tag is in array of @tags
     * 
     */
Check if method specified is a route method

Route methods are tagged with @route
Use Reflection API to get Doc Comments
Parse Doc Comments with Regex to get @tags
Trim Whitespaces of tags

@param object $controller Controller Class containing method
@param string $method Name of method to check
@return bool Check if route tag is in array of @tags
Check if method specified is a route method Route methods are tagged with @route Use Reflection API to get Doc Comments Parse Doc Comments with Regex to get @tags Trim Whitespaces of tags @param object $controller Controller Class containing method @param string $method Name of method to check @return bool Check if route tag is in array of @tags
private function isRoute(object $controller, string $method): bool {
        $class = new ReflectionClass($controller);
        $reflectedMethod = $class->getMethod($method);
        $docComments = $reflectedMethod->getDocComment(); 
        if(!$docComments) return false;
        preg_match_all('# @(.*?)\n#s', $docComments, $annotations);
        $arr0 = $annotations[0] ?? []; 
        foreach($arr0 as $key => $val)  $arr0[$key] = Str::trimWhiteSpaces($val); 
        return in_array('@route', $arr0);
    }
private function isRoute ( object $ controller , string $ method ) : bool { $ class = new ReflectionClass ( $ controller ) ; $ reflectedMethod = $ class -> getMethod ( $ method ) ; $ docComments = $ reflectedMethod -> getDocComment ( ) ; if ( ! $ docComments ) return false ; preg_match_all ( '# @(.*?)\n#s' , $ docComments , $ annotations ) ; $ arr0 = $ annotations [ 0 ] ?? [ ] ; foreach ( $ arr0 as $ key => $ val ) $ arr0 [ $ key ] = Str :: trimWhiteSpaces ( $ val ) ; return in_array ( '@route' , $ arr0 ) ; }
Check if method specified is a route method
Check if method specified is a route method
// Retrieving documentation comments // Check All @tags // Trim whitespaces from comments