public static function checkWhetherFileContainsClass($filePath)
    {
        if (!self::exists($filePath)) {
            throw new FileNotFoundException('Cannot find source file: ' . $filePath);
        }
        $fp = fopen($filePath, 'r');
        $class = false;
        $buffer = '';
        $i = 0;
        while (!$class && !feof($fp)) {

            $buffer .= fread($fp, 512);
            $tokens = token_get_all($buffer);

            if (strpos($buffer, '{') === false) continue;

            for (; $i < count($tokens); $i++) {
                if ($tokens[$i][0] === T_CLASS) {
                    for ($j = $i + 1; $j < count($tokens); $j++) {
                        if ($tokens[$j] === '{') {
                            $class = $tokens[$i + 2][1];
                        }
                    }
                }
            }
        }
        return $class;
    }