Jarves\Translation\Utils::extractLanguage PHP Method

extractLanguage() public method

public extractLanguage ( $bundleName )
    public function extractLanguage($bundleName)
    {
        //        $root = realpath($this->getJarves()->getRootDir() . '/../');
        $bundleDir = $this->getJarves()->getBundleDir($bundleName);
        $translations = [];
        $translations = array_merge($translations, $this->readDirectory($bundleDir . 'Resources/views'));
        //        $files = Finder::create()
        //            ->files()
        //            ->in($root . '/' . $bundleDir)
        //            ->name('*.php');
        //
        //        foreach ($files as $file) {
        //            $classPlain = file_get_contents($file);
        //            if (preg_match('/ extends ObjectCrud/', $classPlain)) {
        //                preg_match('/^\s*\t*class ([a-z0-9_]+)/mi', $classPlain, $className);
        //                if (isset($className[1]) && $className[1]) {
        //                    preg_match('/\s*\t*namespace ([a-zA-Z0-9_\\\\]+)/', $classPlain, $namespace);
        //                    $className = (count($namespace) > 1 ? $namespace[1] . '\\' : '') . $className[1];
        //                    $classReflection = new \ReflectionClass($className);
        //
        //                    if ($classReflection->isSubclassOf('Jarves\Admin\ObjectCrud')) {
        //                        $tempObj = new $className();
        //
        //                        if ($tempObj instanceof ContainerAwareInterface) {
        //                            $tempObj->setContainer($this->getJarves()->getContainer());
        //                        }
        //
        //                        try {
        //                            $tempObj->initialize();
        //                            if ($tempObj->getColumns()) {
        //                                self::extractFrameworkFields($tempObj->getColumns());
        //                            }
        //                            if ($tempObj->getInitializedFields()) {
        //                                self::extractFrameworkFields($tempObj->getFields());
        //                            }
        //                        } catch (\Exception $e) {
        //                            throw new \Exception(sprintf('Could not extract field from ' . $className), 0, $e);
        //                        }
        //                    }
        ////                    if ($tempObj->tabFields) {
        ////                        foreach ($tempObj->tabFields as $key => $fields) {
        ////                            $GLOBALS['moduleTempLangs'][$key] = $key;
        ////                            self::extractFrameworkFields($fields);
        ////                        }
        ////                    }
        //                }
        //            }
        //        }
        unset($translations['']);
        return $translations;
    }