private function formatUsedClasses($baseNamespace, $usedClasses)
    {
        $result = [];
        foreach ($usedClasses as $usedClass) {
            // Do not import classes from same namespace
            $namespacePattern = str_replace('\\', '\\\\', "/{$baseNamespace}\\[a-zA-Z0-9_]*/");
            if (! preg_match($namespacePattern, $usedClass)) {
                $result[] = "use {$usedClass};";
            }
        }

        sort($result);

        return implode("\n", $result);
    }
private function formatUsedClasses($baseNamespace, $usedClasses)
    {
        $result = [];
        foreach ($usedClasses as $usedClass) {
            // Do not import classes from same namespace
            $namespacePattern = str_replace('\\', '\\\\', "/{$baseNamespace}\\[a-zA-Z0-9_]*/");
            if (! preg_match($namespacePattern, $usedClass)) {
                $result[] = "use {$usedClass};";
            }
        }

        sort($result);

        return implode("\n", $result);
    }
private function formatUsedClasses ( $ baseNamespace , $ usedClasses ) { $ result = [ ] ; foreach ( $ usedClasses as $ usedClass ) { // Do not import classes from same namespace $ namespacePattern = str_replace ( '\\' , '\\\\' , "/{$baseNamespace}\\[a-zA-Z0-9_]*/" ) ; if ( ! preg_match ( $ namespacePattern , $ usedClass ) ) { $ result [ ] = "use {$usedClass};" ; } } sort ( $ result ) ; return implode ( "\n" , $ result ) ; }
Returns imports section for model.

@param string $baseNamespace base namespace to avoid importing classes from same namespace
@param array $usedClasses Array of used in model classes

@return string
Returns imports section for model .