Neos\Flow\I18n\Cldr\CldrRepository::getModel PHP Метод

getModel() публичный Метод

Will return existing instance if a model for given $filename was already requested before. Returns FALSE when $filename doesn't point to existing file.
public getModel ( string $filename ) : CldrModel | boolean
$filename string Relative (from CLDR root) path to existing CLDR file
Результат CldrModel | boolean A CldrModel instance or FALSE on failure
    public function getModel($filename)
    {
        $filename = Files::concatenatePaths([$this->cldrBasePath, $filename . '.xml']);
        if (isset($this->models[$filename])) {
            return $this->models[$filename];
        }
        if (!is_file($filename)) {
            return false;
        }
        return $this->models[$filename] = new CldrModel([$filename]);
    }

Usage Example

 /**
  * @test
  */
 public function modelIsReturnedCorrectlyForSingleFile()
 {
     file_put_contents('vfs://Foo/Bar.xml', '');
     $result = $this->repository->getModel('Bar');
     $this->assertAttributeContains('vfs://Foo/Bar.xml', 'sourcePaths', $result);
     $result = $this->repository->getModel('NoSuchFile');
     $this->assertEquals(false, $result);
 }
All Usage Examples Of Neos\Flow\I18n\Cldr\CldrRepository::getModel