public function getControllerName($type = 'plural')
    {
        if ($type == 'singular') {
            // auto calc if not already set
            if ($this->singularName == null) {
                $className = get_called_class();
                $config = $this->getDI()->get('config');
                $className = str_replace($config['namespaces']['controllers'], '', $className);
                $className = str_replace('Controller', '', $className);
                $this->singularName = $className;
            }
            return $this->singularName;
        } elseif ($type == 'plural') {
            // auto calc most common plural
            if ($this->pluralName == null) {
                // this could be better, just adding an s by default
                $this->pluralName = $this->getControllerName('singular') . 's';
            }
            return $this->pluralName;
        }

        // todo throw error here
        return false;
    }
public function getControllerName($type = 'plural')
    {
        if ($type == 'singular') {
            // auto calc if not already set
            if ($this->singularName == null) {
                $className = get_called_class();
                $config = $this->getDI()->get('config');
                $className = str_replace($config['namespaces']['controllers'], '', $className);
                $className = str_replace('Controller', '', $className);
                $this->singularName = $className;
            }
            return $this->singularName;
        } elseif ($type == 'plural') {
            // auto calc most common plural
            if ($this->pluralName == null) {
                // this could be better, just adding an s by default
                $this->pluralName = $this->getControllerName('singular') . 's';
            }
            return $this->pluralName;
        }

        // todo throw error here
        return false;
    }
public function getControllerName ( $ type = 'plural' ) { if ( $ type == 'singular' ) { // auto calc if not already set if ( $ this -> singularName == null ) { $ className = get_called_class ( ) ; $ config = $ this -> getDI ( ) -> get ( 'config' ) ; $ className = str_replace ( $ config [ 'namespaces' ] [ 'controllers' ] , '' , $ className ) ; $ className = str_replace ( 'Controller' , '' , $ className ) ; $ this -> singularName = $ className ; } return $ this -> singularName ; } elseif ( $ type == 'plural' ) { // auto calc most common plural if ( $ this -> pluralName == null ) { // this could be better, just adding an s by default $ this -> pluralName = $ this -> getControllerName ( 'singular' ) . 's' ; } return $ this -> pluralName ; } // todo throw error here return false ; }
get the controllers singular or plural name

@param string $type
@return string|bool
get the controllers singular or plural name