src/Plugin/FileSystemPluginLocator.php
public function haveTheFileImplementationOf($file, $implementation = 'PluginInterface') {
        $matches = array();
        $fp = fopen($file, 'r');
        while (!feof($fp)) {
            $line = stream_get_line($fp, 1000000, "\n");
            if (preg_match('/class\s+(\w+)(.*)\simplements\s+(\w+)(.*)?\{/', $line, $matches)) {
                if ($matches[3] === $implementation) {
                    return $matches[1]; //Return the class name
                }
            }
        }
        return false;
    }
public function haveTheFileImplementationOf($file, $implementation = 'PluginInterface') {
        $matches = array();
        $fp = fopen($file, 'r');
        while (!feof($fp)) {
            $line = stream_get_line($fp, 1000000, "\n");
            if (preg_match('/class\s+(\w+)(.*)\simplements\s+(\w+)(.*)?\{/', $line, $matches)) {
                if ($matches[3] === $implementation) {
                    return $matches[1]; //Return the class name
                }
            }
        }
        return false;
    }
Open the given path file and search for a plugin implementation. It returns
the class name in a positive case.

@param string $file
@param string $implementation
@return boolean|string