framework/base/Controller.php
public function createAction($id)
    {
        if ($id === '') {
            $id = $this->defaultAction;
        }

        $actionMap = $this->actions();
        if (isset($actionMap[$id])) {
            return Yii::createObject($actionMap[$id], [$id, $this]);
        } elseif (preg_match('/^[a-z0-9\\-_]+$/', $id) && strpos($id, '--') === false && trim($id, '-') === $id) {
            $methodName = 'action' . str_replace(' ', '', ucwords(str_replace('-', ' ', $id)));
            if (method_exists($this, $methodName)) {
                $method = new \ReflectionMethod($this, $methodName);
                if ($method->isPublic() && $method->getName() === $methodName) {
                    return new InlineAction($id, $this, $methodName);
                }
            }
        }

        return null;
    }
public function createAction($id)
    {
        if ($id === '') {
            $id = $this->defaultAction;
        }

        $actionMap = $this->actions();
        if (isset($actionMap[$id])) {
            return Yii::createObject($actionMap[$id], [$id, $this]);
        } elseif (preg_match('/^[a-z0-9\\-_]+$/', $id) && strpos($id, '--') === false && trim($id, '-') === $id) {
            $methodName = 'action' . str_replace(' ', '', ucwords(str_replace('-', ' ', $id)));
            if (method_exists($this, $methodName)) {
                $method = new \ReflectionMethod($this, $methodName);
                if ($method->isPublic() && $method->getName() === $methodName) {
                    return new InlineAction($id, $this, $methodName);
                }
            }
        }

        return null;
    }
public function createAction ( $ id ) { if ( $ id === '' ) { $ id = $ this -> defaultAction ; } $ actionMap = $ this -> actions ( ) ; if ( isset ( $ actionMap [ $ id ] ) ) { return Yii :: createObject ( $ actionMap [ $ id ] , [ $ id , $ this ] ) ; } elseif ( preg_match ( '/^[a-z0-9\\-_]+$/' , $ id ) && strpos ( $ id , '--' ) === false && trim ( $ id , '-' ) === $ id ) { $ methodName = 'action' . str_replace ( ' ' , '' , ucwords ( str_replace ( '-' , ' ' , $ id ) ) ) ; if ( method_exists ( $ this , $ methodName ) ) { $ method = new \ ReflectionMethod ( $ this , $ methodName ) ; if ( $ method -> isPublic ( ) && $ method -> getName ( ) === $ methodName ) { return new InlineAction ( $ id , $ this , $ methodName ) ; } } } return null ; }
Creates an action based on the given action ID.
The method first checks if the action ID has been declared in [[actions()]]. If so,
it will use the configuration declared there to create the action object.
If not, it will look for a controller method whose name is in the format of `actionXyz`
where `xyz` is the action ID. If found, an [[InlineAction]] representing that
method will be created and returned.
@param string $id the action ID.
@return Action|null the newly created action instance. Null if the ID doesn't resolve into any action.
Creates an action based on the given action ID . The method first checks if the action ID has been declared in [[ actions () ]] . If so it will use the configuration declared there to create the action object . If not it will look for a controller method whose name is in the format of actionXyz where xyz is the action ID . If found an [[ InlineAction ]] representing that method will be created and returned .