public static function shortName($class, $type, $suffix = '')
    {
        $class = str_replace('\\', '/', $class);
        $type = '/' . $type . '/';

        $pos = strrpos($class, $type);
        $pluginName = substr($class, 0, $pos);
        $name = substr($class, $pos + strlen($type));

        if ($suffix) {
            $name = substr($name, 0, -strlen($suffix));
        }

        $nonPluginNamespaces = [
            'Cake',
            str_replace('\\', '/', Configure::read('App.namespace'))
        ];
        if (in_array($pluginName, $nonPluginNamespaces)) {
            return $name;
        }

        return $pluginName . '.' . $name;
    }
public static function shortName($class, $type, $suffix = '')
    {
        $class = str_replace('\\', '/', $class);
        $type = '/' . $type . '/';

        $pos = strrpos($class, $type);
        $pluginName = substr($class, 0, $pos);
        $name = substr($class, $pos + strlen($type));

        if ($suffix) {
            $name = substr($name, 0, -strlen($suffix));
        }

        $nonPluginNamespaces = [
            'Cake',
            str_replace('\\', '/', Configure::read('App.namespace'))
        ];
        if (in_array($pluginName, $nonPluginNamespaces)) {
            return $name;
        }

        return $pluginName . '.' . $name;
    }
public static function shortName ( $ class , $ type , $ suffix = '' ) { $ class = str_replace ( '\\' , '/' , $ class ) ; $ type = '/' . $ type . '/' ; $ pos = strrpos ( $ class , $ type ) ; $ pluginName = substr ( $ class , 0 , $ pos ) ; $ name = substr ( $ class , $ pos + strlen ( $ type ) ) ; if ( $ suffix ) { $ name = substr ( $ name , 0 , - strlen ( $ suffix ) ) ; } $ nonPluginNamespaces = [ 'Cake' , str_replace ( '\\' , '/' , Configure :: read ( 'App.namespace' ) ) ] ; if ( in_array ( $ pluginName , $ nonPluginNamespaces ) ) { return $ name ; } return $ pluginName . '.' . $ name ; }
Returns the plugin split name of a class

Examples:

```
App::shortName(
'SomeVendor\SomePlugin\Controller\Component\TestComponent',
'Controller/Component',
'Component'
)
```

Returns: SomeVendor/SomePlugin.Test

```
App::shortName(
'SomeVendor\SomePlugin\Controller\Component\Subfolder\TestComponent',
'Controller/Component',
'Component'
)
```

Returns: SomeVendor/SomePlugin.Subfolder/Test

```
App::shortName(
'Cake\Controller\Component\AuthComponent',
'Controller/Component',
'Component'
)
```

Returns: Auth

@param string $class Class name
@param string $type Type of class
@param string $suffix Class name suffix
@return string Plugin split name of class
Returns the plugin split name of a class