Neos.Neos/Classes/Routing/BackendModuleRoutePartHandler.php
protected function matchValue($value)
    {
        $format = pathinfo($value, PATHINFO_EXTENSION);
        if ($format !== '') {
            $value = substr($value, 0, strlen($value) - strlen($format) - 1);
        }
        $segments = Arrays::trimExplode('/', $value);

        $currentModuleBase = $this->settings['modules'];
        if ($segments === [] || !isset($currentModuleBase[$segments[0]])) {
            return self::MATCHRESULT_NOSUCHMODULE;
        }

        $modulePath = [];
        $level = 0;
        $moduleConfiguration = null;
        $moduleController = null;
        $moduleAction = 'index';
        foreach ($segments as $segment) {
            if (isset($currentModuleBase[$segment])) {
                $modulePath[] = $segment;
                $moduleConfiguration = $currentModuleBase[$segment];

                if (isset($moduleConfiguration['controller'])) {
                    $moduleController = $moduleConfiguration['controller'];
                } else {
                    $moduleController = null;
                }

                if (isset($moduleConfiguration['submodules'])) {
                    $currentModuleBase = $moduleConfiguration['submodules'];
                } else {
                    $currentModuleBase = [];
                }
            } else {
                if ($level === count($segments) - 1) {
                    $moduleMethods = array_change_key_case(array_flip(get_class_methods($moduleController)), CASE_LOWER);
                    if (array_key_exists($segment . 'action', $moduleMethods)) {
                        $moduleAction = $segment;
                        break;
                    }
                }
                return self::MATCHRESULT_NOSUCHMODULE;
            }
            $level++;
        }

        if ($moduleController === null) {
            return self::MATCHRESULT_NOCONTROLLER;
        }

        $this->value = [
            'module' => implode('/', $modulePath),
            'controller' => $moduleController,
            'action' => $moduleAction
        ];

        if ($format !== '') {
            $this->value['format'] = $format;
        }

        return self::MATCHRESULT_FOUND;
    }
protected function matchValue($value)
    {
        $format = pathinfo($value, PATHINFO_EXTENSION);
        if ($format !== '') {
            $value = substr($value, 0, strlen($value) - strlen($format) - 1);
        }
        $segments = Arrays::trimExplode('/', $value);

        $currentModuleBase = $this->settings['modules'];
        if ($segments === [] || !isset($currentModuleBase[$segments[0]])) {
            return self::MATCHRESULT_NOSUCHMODULE;
        }

        $modulePath = [];
        $level = 0;
        $moduleConfiguration = null;
        $moduleController = null;
        $moduleAction = 'index';
        foreach ($segments as $segment) {
            if (isset($currentModuleBase[$segment])) {
                $modulePath[] = $segment;
                $moduleConfiguration = $currentModuleBase[$segment];

                if (isset($moduleConfiguration['controller'])) {
                    $moduleController = $moduleConfiguration['controller'];
                } else {
                    $moduleController = null;
                }

                if (isset($moduleConfiguration['submodules'])) {
                    $currentModuleBase = $moduleConfiguration['submodules'];
                } else {
                    $currentModuleBase = [];
                }
            } else {
                if ($level === count($segments) - 1) {
                    $moduleMethods = array_change_key_case(array_flip(get_class_methods($moduleController)), CASE_LOWER);
                    if (array_key_exists($segment . 'action', $moduleMethods)) {
                        $moduleAction = $segment;
                        break;
                    }
                }
                return self::MATCHRESULT_NOSUCHMODULE;
            }
            $level++;
        }

        if ($moduleController === null) {
            return self::MATCHRESULT_NOCONTROLLER;
        }

        $this->value = [
            'module' => implode('/', $modulePath),
            'controller' => $moduleController,
            'action' => $moduleAction
        ];

        if ($format !== '') {
            $this->value['format'] = $format;
        }

        return self::MATCHRESULT_FOUND;
    }
protected function matchValue ( $ value ) { $ format = pathinfo ( $ value , PATHINFO_EXTENSION ) ; if ( $ format !== '' ) { $ value = substr ( $ value , 0 , strlen ( $ value ) - strlen ( $ format ) - 1 ) ; } $ segments = Arrays :: trimExplode ( '/' , $ value ) ; $ currentModuleBase = $ this -> settings [ 'modules' ] ; if ( $ segments === [ ] || ! isset ( $ currentModuleBase [ $ segments [ 0 ] ] ) ) { return self :: MATCHRESULT_NOSUCHMODULE ; } $ modulePath = [ ] ; $ level = 0 ; $ moduleConfiguration = null ; $ moduleController = null ; $ moduleAction = 'index' ; foreach ( $ segments as $ segment ) { if ( isset ( $ currentModuleBase [ $ segment ] ) ) { $ modulePath [ ] = $ segment ; $ moduleConfiguration = $ currentModuleBase [ $ segment ] ; if ( isset ( $ moduleConfiguration [ 'controller' ] ) ) { $ moduleController = $ moduleConfiguration [ 'controller' ] ; } else { $ moduleController = null ; } if ( isset ( $ moduleConfiguration [ 'submodules' ] ) ) { $ currentModuleBase = $ moduleConfiguration [ 'submodules' ] ; } else { $ currentModuleBase = [ ] ; } } else { if ( $ level === count ( $ segments ) - 1 ) { $ moduleMethods = array_change_key_case ( array_flip ( get_class_methods ( $ moduleController ) ) , CASE_LOWER ) ; if ( array_key_exists ( $ segment . 'action' , $ moduleMethods ) ) { $ moduleAction = $ segment ; break ; } } return self :: MATCHRESULT_NOSUCHMODULE ; } $ level ++ ; } if ( $ moduleController === null ) { return self :: MATCHRESULT_NOCONTROLLER ; } $ this -> value = [ 'module' => implode ( '/' , $ modulePath ) , 'controller' => $ moduleController , 'action' => $ moduleAction ] ; if ( $ format !== '' ) { $ this -> value [ 'format' ] = $ format ; } return self :: MATCHRESULT_FOUND ; }
Iterate through the segments of the current request path
find the corresponding module configuration and set controller & action
accordingly

@param string $value
@return boolean|integer
Iterate through the segments of the current request path find the corresponding module configuration and set controller & action accordingly