@param string $propertyFile

@return $this
@throws \Exception
772071
public function setPropertyFile($propertyFile)
    {
        if (!file_exists($this->getDirectory() . DIRECTORY_SEPARATOR . $propertyFile)) {
            throw new \Exception(Lang::get('property_file_missing'));
        }

        $this->propertyFile = $propertyFile;
    }
1173111
public static function createFromFile( $imageFile ){
        $imageFile = realpath( $imageFile );

        if ( ! file_exists( $imageFile ) ) {
            throw new \Exception( sprintf('Could not open image file "%s"', $imageFile) );
        }

        $imagick = new \Imagick( realpath($imageFile) );
        $animated = false;
        if ($imagick->getImageIterations() > 0) {
            $animated = true;
        }

        return new self(
            $imagick,
            $imageFile,
            $imagick->getImageWidth(),
            $imagick->getImageHeight(),
            $imagick->getImageFormat(),
            $animated
        );
    }
935492
public function withInitialValue($initialValue)
    {
        return new self($this->inputType, $this->objects, $this->propertyName, $initialValue);
    }
529302
private function resolveViewFile(string $viewFile): string
    {
        try {

            if (file_exists($viewFile)) {
                return $viewFile;
            }

            $this->checkTemplatesDirectoryExists();

            return $this->resolveTemplateFile($viewFile);

        } catch (\Exception $e) {
          throw new \RuntimeException($e->getMessage());
        } catch (\Throwable $t) {
            throw new \RuntimeException(
                sprintf(
                    'Template %s was not found. Looked in %s',
                    $viewFile,
                    implode(',', $this->templatesDirectories))
            );
        }
    }
47973
public function setProperty(&$object, $propertyName, $propertyValue)
    {
        $property = $this->getPropertyInstance($object, $propertyName);
        $property->setAccessible(true);
        $property->setValue($object, $propertyValue);
    }
395990
static public function file($value, $message = null, $propertyPath = null)
        {
            static::string($value, $message);
            static::notEmpty($value, $message);

            if ( ! is_file($value)) {
                $message = $message ?: sprintf(
                    'File "%s" was expected to exist.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::INVALID_FILE, $propertyPath);
            }
        }
404456
protected function copyFile($sourceFile, $destFile) {
        $status = copy($sourceFile, $destFile);

        if ($status === false) {
            throw new Exception(sprintf(
                'Unable to copy file "%s" to "%s"',
                $sourceFile,
                $destFile
            ), ExitApp::RUNTIME_ERROR);
        }

        return $this;
    }
1233537
public function withNotNull()
    {
        /**
         * @var PropertyContract[] $propertiesWithNotNull
         */
        $propertiesWithNotNull = $this::$schema->getPropertiesWithNotNullConstraint();
        if (!$propertiesWithNotNull) {
            return $this;
        }

        foreach ($propertiesWithNotNull as $property) {
            if (is_null($this->{$property->getProperty()})) {
                throw new Exception("Propriedade obrigatória não pode ser nula [ " . $property->getAlias() . " ]", 400);
            }
        }

        return $this;
    }
570040
protected LinkedHashMap<Pattern, String> load(File propertyFile) {
    LinkedHashMap<Pattern, String> result = new LinkedHashMap<Pattern, String>();
    BufferedReader reader = null;
    try {
      reader =
          new BufferedReader(new InputStreamReader(new FileInputStream(propertyFile), "UTF-8"));
      String line;
      while ((line = reader.readLine()) != null) {
        if (line.length() == 0) {
          continue;
        }
        char firstChar = line.charAt(0);
        if (firstChar == '#' || firstChar == '!') {
          continue;
        }
        int pos = line.indexOf('=');
        if (pos < 0) {
          continue;
        }
        String key = line.substring(0, pos);
        String value = line.substring(pos + 1, line.length());
        int pos2 = line.indexOf('@');
        if (pos2 == 0) {
          key = key.substring(1);
        } else if (pos2 > 0) {
          key = Pattern.quote(key.substring(0, pos2)) + key.substring(pos2);
        }
        result.put(Pattern.compile(key), value);
      }
    } catch (IOException e) {
      throw new GenException(Message.DOMAGEN9001, e, e);
    } finally {
      IOUtil.close(reader);
    }
    return result;
  }
628319
public function addProperties($properties)
    {
        if (empty($properties) || !count((array)$properties)) {
            throw new \Exception('Empty properties given');
        }

        if (!is_array($properties) && !is_object($properties)) {
            throw new \Exception('Expected array or object');
        }

        foreach ($properties as $key => $property) {
            $this->addProperty($key, $property);
        }

        return $this;
    }
913761
public function image(string $imageFile, array $attributes = null) : self
    {
        if ($this->validate and ! $imageFile) {
            throw new Exception("Open Graph: Invalid image URL (empty)");
        }

        if (strpos($imageFile, '://') === false and function_exists('asset')) {
            $imageFile = asset($imageFile);
        }

        if ($this->validate and ! filter_var($imageFile, FILTER_VALIDATE_URL)) {
            throw new Exception("Open Graph: Invalid image URL '{$imageFile}'");
        }

        $this->tags[] = $this->createTag('image', $imageFile);

        if ($attributes) {
            $valid = [
                'secure_url',
                'type',
                'width',
                'height',
            ];

            $this->attributes('image', $attributes, $valid);
        }

        return $this;
    }
981924
private static function _createJpeg( $imageFile ){
        $gd = @imagecreatefromjpeg( $imageFile );

        if(!$gd){
            throw new \Exception( sprintf('Could not open "%s". Not a valid %s file.', $imageFile, ImageType::JPEG ) );
        }

        return new self( $gd, $imageFile, imagesx( $gd ), imagesy( $gd ), ImageType::JPEG );
    }
323502
public function setObject($key, $value)
    {
        if (!settype($value, 'object')) {
            $errMsg = 'Ошибка при конвертации к типу object';
            throw new Exception\PropertyException($errMsg);
        }
        $this->set(self::OBJECT, $key, $value);

        return $this;
    }
129978
private function set($object, $propertyName, $propertyValue)
    {
        $reflectionUser = new \ReflectionClass($object);

        $reflectionProperty = $reflectionUser->getProperty($propertyName);
        $reflectionProperty->setAccessible(true);
        $reflectionProperty->setValue($object, $propertyValue);

        return $object;
    }
76183
public function delete(string $remoteFile)
    {
        if (!@ftp_delete($this->ftp, $remoteFile)) {
            throw new Exception(sprintf("Cannot delete file %s", $remoteFile));
        }

        return $this;
    }
79730
private function _createFile($pFile)
    {
        $pathInfo = pathinfo($pFile);

        $dir = $pathInfo['dirname'];
        if (! DirecoryData::create($dir)) {
            throw new Exception("Unable to create the cache directory '$dir'");
        }

        if (! is_readable($pFile) and ! FileData::create($pFile, self::DEFAULT_CONTENT)) {
            throw new Exception("Unable to create the cache file '$pFile'");
        }

        return $this;
    }
487176
public function setCacheFile(string $cacheFile) : Router
    {
        if ($cacheFile == '') {
            $this->cacheFile = false;

            return $this;
        }

        $spl    = new \SplFileInfo($cacheFile);
        $splDir = $spl->getPathInfo();
        if (! $splDir->isWritable()) {
            throw new \RuntimeException(
                'Cache file directory is not writable',
                E_WARNING
            );
        }
        if ($spl->getRealPath() && ! $spl->isFile()) {
            throw new \RuntimeException(
                sprintf(
                    'Cache file is not a file %s given',
                    $spl->getType()
                ),
                E_WARNING
            );
        }

        if (! $spl->getRealPath()) {
            $spl = new \SplFileInfo($splDir->getRealPath() . DIRECTORY_SEPARATOR . $spl->getBasename());
        }

        $this->cacheFile = $spl->__toString();
        unset($spl, $splDir);

        return $this;
    }