Example #1
0
 /**
  * Construit un nouveau dictionnaire
  * @param Configuration $configuration La configuration globale de l'application
  * @param Language $language La langue du dictionnaire
  * @throws InvalidArgumentException
  * @throws LoadFileException
  */
 public function __construct(Configuration $configuration, Language $language)
 {
     if ($configuration == NULL) {
         throw new InvalidArgumentException('$configuration arg cannot be null');
     }
     if ($language == NULL) {
         throw new InvalidArgumentException('$language arg cannot be null');
     }
     $filepath = $configuration->get('dictionaries:path') . DIRECTORY_SEPARATOR . $language . '.txt';
     if (!is_readable($filepath)) {
         throw new LoadFileException('Cannot read the file ' . $filepath);
     }
     $this->language = $language;
     $this->content = file_get_contents($filepath);
 }