Extracts the Fully Qualified Class name from the given PHP code

@return string FQN in the format "Some\Fully\Qualified\ClassName" or NULL if no class was detected
775169
public function extractFullyQualifiedClassName()
    {
        $fullyQualifiedClassName = $this->extractClassName();
        if ($fullyQualifiedClassName === null) {
            return null;
        }
        $namespace = $this->extractNamespace();
        if ($namespace !== null) {
            $fullyQualifiedClassName = $namespace . '\\' . $fullyQualifiedClassName;
        }
        return $fullyQualifiedClassName;
    }
1269674
public static function getSequenceName()
    {
        $cls = get_called_class();
        if (!array_key_exists($cls, self::$_sequence)) {
            return null;
        }
        return self::$_sequence[$cls];
    }
1106106
public function getCompiledFilenameFromClassname($fqcn)
    {
        $filename = $this->templateCompileDirectory.'/'.$fqcn.'.php';
        $filename = str_replace('\\', '/', $filename);

        return $filename;
    }
449461
public function fullyQualifiedClassName($className)
    {
        if ($className !== null && strpos($className, '\\') === false && strlen($this->namespace) > 0) {
            return $this->namespace.'\\'.$className;
        }

        return $className;
    }
1276288
protected function getClassName()
    {
        $className = $this->input->getOption('name');

        if (empty($className)) {
            $className = $this->model->getShortName() . $this->getClassNameSuffix();
        }

        return $className;
    }
385658
private static function getContainingClassFqn(Node $node)
    {
        $classNode = $node->getFirstAncestor(Node\Statement\ClassDeclaration::class);
        if ($classNode === null) {
            return null;
        }
        return (string)$classNode->getNamespacedName();
    }
698525
public function getPhpName()
    {
        if ($this->phpName === null) {
            $inputs = array();
            $inputs[] = $this->getStdSeparatedName();
            $inputs[] = $this->phpNamingMethod;
            try {
                $this->phpName = NameFactory::generateName(NameFactory::PHP_GENERATOR, $inputs);
            } catch (EngineException $e) {
                print $e->getMessage() . "\n";
                print $e->getTraceAsString();
            }
        }

        return $this->phpName;
    }
1059497
private function parseClassCode(string $code, string $className):array
    {
        $codeSansComments = $this->stripComments($code);
        $lines = array_map("trim", explode("\n", $codeSansComments));
        preg_match_all("/p[a-zA-Z]*\sfunction\s+([a-zA-Z\_]*)\(.*?\).*/ui", $code, $matches);

        if (!empty($matches[0])) {

            $functions = array_map(function ($item, $key) use ($lines, $matches, $className) {

                $startLineNumber = array_search($item, $lines);
                if ($startLineNumber) {
                    if (isset($matches[0][$key+1])) {
                        $endLineNumber =  array_search($matches[0][$key+1], $lines);
                    }
                    if (isset($endLineNumber) && is_int($endLineNumber)) {
                        $code = trim(implode("\n", array_slice( $lines, $startLineNumber, $endLineNumber - $startLineNumber )));
                    } else {
                        $code = trim(implode("\n", array_slice( $lines, $startLineNumber )));
                    }
                }

                return array(
                    "className" => $className,
                    "name" => $matches[1][$key],
                    "code" => isset($code)?$code:""
                );

            }, $matches[0], array_keys($matches[0]));

            return $functions;

        }

        return array();

    }
438681
private function getBeanRealCallRealClassName()
    {
        $nextTraceLine = $this->trace[$this->eachIndex - 1] ?? null;
        if(null === $nextTraceLine)
        {
            return null;
        }
        return $nextTraceLine['class'] ? BeanFactory::getObjectClass($nextTraceLine['class']) : null;
    }
811527
public function getQName()
	{
		// Use the cached name if there is one.
		if ( ! $this->qname )
		{
			if ( ! property_exists( $this, 'name' ) ) return null;
			$this->qname = $qname = new QName( $this->name['originalPrefix'], $this->name['namespace'], $this->name['name'] );
		}

		return $this->qname;
	}
283949
function getName()
  	{
  		$name = $this->_name;

  		if (empty($name)) {
  			$r = null;
  			if (! preg_match( '/Com(.*)/i', get_class( $this ), $r)) {
                throw new AnErrorException(
                    "Can't get or parse the class name ",
                    AnHttpResponse::INTERNAL_SERVER_ERROR
                );
  			}
  			$name = strtolower($r[1]);
  		}

  		return $name;
  	}
1057047
public function getClassNameForDomain()
    {
        $className = str_replace(array('-', ' '), '', ucwords(strtolower($this->getDomain())));

        if (is_numeric(mb_substr($className, 0, 1))) {
            $className = 'N'.$className;
        }

        return $className;
    }
1191315
private static function _extractClassName($cls)
    {
        $tokens = preg_split("/\\\\/", $cls);
        $size   = sizeof($tokens);
        if ($size < 2) {
            return $cls;
        }
        return $tokens[$size-1];
    }
1067155
public function GetDeclarationCode()
    {
        $code = "";
        
        if($this->is_const)
            $code .= "const ";
        
        $code .= $this->type;
        
        if($this->is_reference)
            $code .= "&";
        
        if($this->is_pointer)
        {
            for($i=0; $i<$this->indirection_level; $i++)
            {
                $code .= "*";
            }
        }
        
        $code .= " " . $this->name;
        
        if($this->is_array)
            $code .= "[]";
        
        if(trim($this->default_value) != "")
            $code .= " = " . $this->default_value;
    }
238327
public function getClass()
    {
        if (is_string($this->fn)) {
            return $this->fn;
        }
        $hash = sha1(mt_rand().microtime(true));
        return "sndsgd\\field\\rule\\Closure($hash)";
    }
531655
public function getMyType() {
        $className = get_class($this);
        $classParts = explode("\\", $className);
        $classSingle = $classParts[count($classParts) - 1];
        $classLowSingle = strtolower($classSingle);
        $type = str_replace("message", "", $classLowSingle);

        if (!$type) {
            return "unknown";
        } else {
            return $type;
        }
    }
1115166
private function extractClass(string $className): string
    {
        // If class name contain ":" symbol
        if (strpos($className, ':') !== false) {
            $classArray = explode(':', $className);
            $className = $classArray[0];
        }
        return $className;
    }