models/Route.php
protected function getActionRoutes($controller, &$result)
    {
        $token = "Get actions of controller '" . $controller->uniqueId . "'";
        Yii::beginProfile($token, __METHOD__);
        try {
            $prefix = '/' . $controller->uniqueId . '/';
            foreach ($controller->actions() as $id => $value) {
                $result[$prefix . $id] = $prefix . $id;
            }
            $class = new \ReflectionClass($controller);
            foreach ($class->getMethods() as $method) {
                $name = $method->getName();
                if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0 && $name !== 'actions') {
                    $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', substr($name, 6)));
                    $id = $prefix . ltrim(str_replace(' ', '-', $name), '-');
                    $result[$id] = $id;
                }
            }
        } catch (\Exception $exc) {
            Yii::error($exc->getMessage(), __METHOD__);
        }
        Yii::endProfile($token, __METHOD__);
    }
protected function getActionRoutes($controller, &$result)
    {
        $token = "Get actions of controller '" . $controller->uniqueId . "'";
        Yii::beginProfile($token, __METHOD__);
        try {
            $prefix = '/' . $controller->uniqueId . '/';
            foreach ($controller->actions() as $id => $value) {
                $result[$prefix . $id] = $prefix . $id;
            }
            $class = new \ReflectionClass($controller);
            foreach ($class->getMethods() as $method) {
                $name = $method->getName();
                if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0 && $name !== 'actions') {
                    $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', substr($name, 6)));
                    $id = $prefix . ltrim(str_replace(' ', '-', $name), '-');
                    $result[$id] = $id;
                }
            }
        } catch (\Exception $exc) {
            Yii::error($exc->getMessage(), __METHOD__);
        }
        Yii::endProfile($token, __METHOD__);
    }
protected function getActionRoutes ( $ controller , & $ result ) { $ token = "Get actions of controller '" . $ controller -> uniqueId . "'" ; Yii :: beginProfile ( $ token , __METHOD__ ) ; try { $ prefix = '/' . $ controller -> uniqueId . '/' ; foreach ( $ controller -> actions ( ) as $ id => $ value ) { $ result [ $ prefix . $ id ] = $ prefix . $ id ; } $ class = new \ ReflectionClass ( $ controller ) ; foreach ( $ class -> getMethods ( ) as $ method ) { $ name = $ method -> getName ( ) ; if ( $ method -> isPublic ( ) && ! $ method -> isStatic ( ) && strpos ( $ name , 'action' ) === 0 && $ name !== 'actions' ) { $ name = strtolower ( preg_replace ( '/(?<![A-Z])[A-Z]/' , ' \0' , substr ( $ name , 6 ) ) ) ; $ id = $ prefix . ltrim ( str_replace ( ' ' , '-' , $ name ) , '-' ) ; $ result [ $ id ] = $ id ; } } } catch ( \ Exception $ exc ) { Yii :: error ( $ exc -> getMessage ( ) , __METHOD__ ) ; } Yii :: endProfile ( $ token , __METHOD__ ) ; }
Get route of action
@param \yii\base\Controller $controller
@param array $result all controller action.
Get route of action