src/Textpattern/Composer/Installer/Plugin/Manifest.php
protected function isManifest($file)
    {
        if (is_file($file) && is_readable($file)) {
            if ($contents = file_get_contents($file)) {
                $this->manifest = @json_decode($contents);

                if ($this->manifest && isset($this->manifest->name) && is_string($this->manifest->name)) {
                    $this->manifest->name = basename($this->manifest->name);

                    if ($this->manifest->name === basename(dirname($file))) {
                        return (bool) preg_match($this->pluginNamePattern, $this->manifest->name);
                    }
                }
            }
        }

        return false;
    }
protected function isManifest($file)
    {
        if (is_file($file) && is_readable($file)) {
            if ($contents = file_get_contents($file)) {
                $this->manifest = @json_decode($contents);

                if ($this->manifest && isset($this->manifest->name) && is_string($this->manifest->name)) {
                    $this->manifest->name = basename($this->manifest->name);

                    if ($this->manifest->name === basename(dirname($file))) {
                        return (bool) preg_match($this->pluginNamePattern, $this->manifest->name);
                    }
                }
            }
        }

        return false;
    }
protected function isManifest ( $ file ) { if ( is_file ( $ file ) && is_readable ( $ file ) ) { if ( $ contents = file_get_contents ( $ file ) ) { $ this -> manifest = @ json_decode ( $ contents ) ; if ( $ this -> manifest && isset ( $ this -> manifest -> name ) && is_string ( $ this -> manifest -> name ) ) { $ this -> manifest -> name = basename ( $ this -> manifest -> name ) ; if ( $ this -> manifest -> name === basename ( dirname ( $ file ) ) ) { return ( bool ) preg_match ( $ this -> pluginNamePattern , $ this -> manifest -> name ) ; } } } } return false ; }
Whether a file is a valid plugin manifest.

This function makes sure the file contains JSON, the name property
follows plugin naming convention and the parent directory is the same
as the name property.

A valid plugin name follows the pattern {pfx}_{pluginName}, where the
{pfx} is the plugin author prefix and the {pluginName} is the name of
the plugin consisting of up to 64 ASCII letter and numbers.

@param  string $file Full resolved pathname to the file
@return bool   TRUE if valid, FALSE otherwise
Whether a file is a valid plugin manifest .