@param string $dst
@param string $format
@param int    $quality

@return bool
@throws RuntimeException
773352
public function save($dst, $format = 'jpeg', $quality = 80): bool
    {
        $this->check();

        if (!$this->actionsPossible()) {
            throw new RuntimeException('Actions can not be applied.');
        }

        if (!$this->apply()) {
            return false;
        }

        switch (strtolower($format)) {
            case 'jpg':
            case 'jpeg':
                return imagejpeg($this->image_resource, $dst, $quality);

            case 'gif':
                return imagegif($this->image_resource, $dst);

            case 'png':
                return imagepng($this->image_resource, $dst, abs($quality / 10 - 10));

        }

        return false;
    }
1197393
public static function write($dst, $content, $mode=null, $append=false) {
		if($mode === null)
			$mode = static::OVERRIDE;

		if($mode & static::RENAME)
			$dst = static::getNewFilename($dst);
		elseif($mode & static::OVERRIDE)
			static::delete($dst);
		elseif(file_exists($dst))
			return false;

		static::mkdir(dirname($dst));
		$r = file_put_contents($dst, $content, $append ? FILE_APPEND:0);

		if($r !== false)
			return $dst;
		return false;
	}
199243
public static function verifyDateTime(string $datetime, string $format): bool
    {
        $formatted = DateTime::createFromFormat($format, $datetime);

        $errors = DateTime::getLastErrors();

        if (!empty($errors['warning_count'])) {
            return false;
        }

        return $formatted !== false;
    }
1306763
public function rename($dst, $mode=null) {
		if(!$this->src || $this->isAt($dst)) return;
		$filename = \Asgard\File\FileSystem::rename($this->src, $dst, $mode);
		if(!$filename)
			return false;
		$this->src = realpath($filename);
		$this->name = null;
		return $dst;
	}
603069
public function renameRow(string $src, string $dst): bool
    {
        if ($this->hasKey($dst)) {
            throw new \RuntimeException("Cannot rename object: key '{$dst}' is already taken");
        }

        if (!$this->hasKey($src)) {
            return false;
        }

        return $this->moveFolder($this->getMediaPath($src), $this->getMediaPath($dst));
    }
438163
public function copy($dst, $mode=null) {
		$dst = \Asgard\File\FileSystem::copy($this->src, $dst, $mode);
		if($dst) {
			$copy = clone $this;
			$copy->setSrc($dst);
			return $copy;
		}
		return false;
	}
82512
public function renameRow(string $src, string $dst): bool
    {
        if (null === $this->data) {
            $this->buildIndex();
        }

        if ($this->hasKey($dst)) {
            throw new \RuntimeException("Cannot rename object: key '{$dst}' is already taken");
        }

        if (!$this->hasKey($src)) {
            return false;
        }

        // Change single key in the array without changing the order or value.
        $keys = array_keys($this->data);
        $keys[array_search($src, $keys, true)] = $dst;

        $this->data = array_combine($keys, $this->data);

        return true;
    }
81812
public function save($filename = '', $quality = 100, $format = '')
    {
        if (empty($filename)) {
            $filename = $this->filename;
        }

        if (empty($format)) {
            $format = $this->format;
        }

        $arguments = array($this->image, $filename);

        if (in_array($format, array('jpg', 'jpeg'))) {
            $format = 'jpeg';
            imageinterlace($this->image, true);
            $arguments = array($this->image, $filename, round($quality));
        } else if ($format === 'png') {
            $arguments = array($this->image, $filename, round(9 * $quality / 100));
        }

        return $this->callFunction('image', $format, $arguments);
    }
1000750
public function compose(string $format, array $compose = [], string $method = 'compose')
    {
        if (! \in_array($format, $this->formats)) {
            return $this->composeError(null, [], 406);
        } elseif (! \method_exists($this, $method.\ucwords($format))) {
            throw new RuntimeException('Call to undefine method ['.$method.\ucwords($format).'].');
        }

        $config = $compose['on'][$format] ?? [];

        $config['view'] = $compose['view'];

        return $this->{$method.\ucwords($format)}(
            $this->prepareDataValue($config, $compose['data']),
            $compose['status'],
            $config
        );
    }
314914
protected function checkFormatSupport(Format\FormatInterface $format)
    {
        $samples = $format->getSamples();

        if (false === array_key_exists(Format\FormatInterface::SAMPLE_REGULAR, $samples)) {
            return false;
        }

        if (false === file_exists($samples[Format\FormatInterface::SAMPLE_REGULAR])) {
            return false;
        }

        $exitCode = $this->executeCommand('7z t '.$samples[Format\FormatInterface::SAMPLE_REGULAR]);

        return 0 === $exitCode;
    }
717796
public function format($format = 'date', $timestamp = null)
    {
        $timestamp = is_numeric($timestamp) ? '@'.intval($timestamp) : $timestamp;
        $timestamp = is_a($timestamp, 'DateTime') ? $timestamp : new DateTime($timestamp);

        $key = $this->getTranslationKey("date.formats.{$format}");
        $format = $this->translator->has($key) ? $this->translator->get($key) : null;

        if (is_null($format)) {
            throw new \InvalidArgumentException('Date format is invalid or does not exists in current language');
        }

        return strftime($format, $timestamp->format('U'));
    }
1165282
public static function createFromFormat( $format, $time, $timezone = null )
    {

        $dateTime = \DateTime::createFromFormat(
            $format,
            $time,
            self::fixTimezone( $timezone )
        );

        if( !( $dateTime instanceof \DateTime ) ){
            return null;
        }

        return new DateTime(
            $dateTime->format( \DateTime::ISO8601 ),
            self::fixTimezone( $timezone )
        );

    }
1296812
public function setFormat($format) {

        $this->checkInArray($format, GDAXConstants::$reportFormatValues);
        $this->format = $format;
        return $this;

    }
605471
public static function createFromFormat($time, $format = null)
    {
        if (self::isNull($format)) {
            $format = self::$defaultFormat;
        }

        try {
            $date = \DateTime::createFromFormat($format, $time);
            if (!$date) {
                throw new DateTimeObjectException(DateTimeObjectException::MSG_UNABLE_TO_CREATE_FROM_FORMAT);
            }
        } catch (\Exception $e) {
            throw new DateTimeObjectException(DateTimeObjectException::MSG_UNABLE_TO_CREATE_FROM_FORMAT);
        }

        try {
            $dt = new DateTimeObject();
            $dt->setTimestamp($date->getTimestamp());
            $dt->setFormat($format);
        } catch (\Exception $e) {
            throw new DateTimeObjectException(DateTimeObjectException::MSG_UNABLE_TO_CREATE_FROM_FORMAT);
        }

        return $dt;
    }
284603
public static function siretToSiren($siret, bool $format = false): string
    {
        $value = (string) (int) $siret;
        if (!self::isSiret($value)) {
            return '';
        }
        return $format 
             ? preg_replace('/^([0-9]{3})([0-9]{3})([0-9]{3})([0-9]{5})$/', '$1 $2 $3', $value)
             : substr($value, 0, 9);
    }
929780
public function setFormat($format)
    {
        $this->format = $format;
        if ($this->format === self::FORMAT_UNIX) {
            $this->newline = "\n";
        } elseif ($this->format === self::FORMAT_DOS) {
            $this->newline = "\r\n";
        }
    }
874570
public function isFormatNumber($format = null)
    {
        if (null !== $format) {
            $this->formatNumber = (bool) $format;
        }

        return $this->formatNumber;
    }