Xpressengine\Plugin\PluginRegister::split PHP Méthode

split() protected méthode

주어진 id를 name, plugin, type, target로 구분한다.
protected split ( string $id ) : string
$id string component id
Résultat string
    protected function split($id)
    {
        $parts = explode(self::NAME_DELIMITER, $id);
        if (count($parts) < 2) {
            throw new Exceptions\InvalidComponentIdException(['error' => '"name" not found.']);
        }
        $name = $parts[count($parts) - 1];
        $parts = explode(self::KEY_DELIMITER, substr($id, 0, strrpos($id, self::NAME_DELIMITER . $name)));
        $plugin = null;
        if (count($parts) === 1) {
            $type = $parts[0];
        } else {
            $plugin = $parts[count($parts) - 1];
            $type = $parts[count($parts) - 2];
        }
        if ($type === false) {
            throw new Exceptions\InvalidComponentIdException(['error' => '"type" not found.']);
        }
        $target = '';
        if ($plugin !== null) {
            $target = substr($id, 0, strrpos($id, self::KEY_DELIMITER . $type . self::KEY_DELIMITER . $plugin . self::NAME_DELIMITER . $name));
        }
        return compact('name', 'plugin', 'type', 'target');
    }