src/CodeGeneration/NamespaceHelper.php
public function getNamespaceRootToDirectoryFromFqn(string $fqn, string $directory): ?string
    {
        $strPos = \strrpos(
            $fqn,
            $directory
        );
        if (false !== $strPos) {
            return $this->tidy(\substr($fqn, 0, $strPos + \strlen($directory)));
        }

        return null;
    }
public function getNamespaceRootToDirectoryFromFqn(string $fqn, string $directory): ?string
    {
        $strPos = \strrpos(
            $fqn,
            $directory
        );
        if (false !== $strPos) {
            return $this->tidy(\substr($fqn, 0, $strPos + \strlen($directory)));
        }

        return null;
    }
public function getNamespaceRootToDirectoryFromFqn ( string $ fqn , string $ directory ) : ? string { $ strPos = \ strrpos ( $ fqn , $ directory ) ; if ( false !== $ strPos ) { return $ this -> tidy ( \ substr ( $ fqn , 0 , $ strPos + \ strlen ( $ directory ) ) ) ; } return null ; }
Get the namespace root up to and including a specified directory

@param string $fqn
@param string $directory

@return null|string
Get the namespace root up to and including a specified directory