Add time in composer.

@param array  $composer The composer
@param string $path     The path
@param string $rev      The rev

@return array The composer
177427
protected function addComposerTime(array $composer, $path, $rev)
    {
        if (!isset($composer['time'])) {
            $output = $this->execute($this->getSvnCredetials('svn info'), $this->baseUrl.$path.$rev);

            foreach ($this->process->splitLines($output) as $line) {
                if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
                    $date = new \DateTime($match[1], new \DateTimeZone('UTC'));
                    $composer['time'] = $date->format('Y-m-d H:i:s');

                    break;
                }
            }
        }

        return $composer;
    }
933718
public static function getDate($path)
    {
        if ($path[0] != "/") {
            $path = Env::path($path, Env::PATH_DOCUMENT_ROOT);
        }

        if (!$exif = exif_read_data($path)) {
            return;
        }

        if (empty($exif["DateTime"])) {
            return;
        }

        if (!$date = strtotime($exif["DateTime"])) {
            return;
        }

        return $date;
    }
919550
public function addParsedFile($path)
    {
        if (isset($path) && file_exists($path)) {
            $this->parsedFiles[realpath($path)] = filemtime($path);
        }
    }
1040676
public function Prepend ($path = '', $async = FALSE, $defer = FALSE, $doNotMinify = FALSE, $external = FALSE) {
		$item = $this->_completeItem($path, $async, $defer, $doNotMinify, $external);
		$actualGroupItems = & $this->_getScriptsGroupContainer($this->actualGroupName);
		array_unshift($actualGroupItems, $item);
		return $this;
	}
1085953
private function createRequest($path, $responseFormat = OAuthResponse::FORMAT_JSON)
    {
        $request = new OAuthRequest();
        $request->setBaseUrl($this->getUrl());
        $request->setPath($path);
        $request->setMethod(OAuthRequest::METHOD_POST);
        $request->setResponseFormat($responseFormat);

        return $request;
    }
1123258
public function getTimestamp($path)
    {
        $stat = $this->getMetadata($path);

        return isset($stat['ctime']) ? ['timestamp' => $stat['ctime']] : false;
    }
1281946
public function revisionAtTimestamp($timestamp)
    {
        $revision = $this->revisions()
                         ->where('created_at', '<=', Carbon::parse($timestamp))
                         ->first();

        return $this->wrapRevision($revision);
    }
874391
private static function getComposerHome(Composer $composer)
    {
        return null !== $composer->getConfig() && $composer->getConfig()->has('home')
            ? $composer->getConfig()->get('home')
            : '';
    }
634401
public function cache($path, $input, callable $rendered, &$success = null)
    {
        $cacheFolder = $this->getCacheDirectory();
        $destination = $path;

        if (!$this->isCacheUpToDate($destination, $input)) {
            if (!is_writable($cacheFolder)) {
                throw new RuntimeException(sprintf('Cache directory must be writable. "%s" is not.', $cacheFolder), 6);
            }

            $compiler = $this->getRenderer()->getCompiler();
            $fullPath = $compiler->locate($path) ?: $path;
            $output = $rendered($fullPath, $input);
            $importsPaths = $compiler->getImportPaths($fullPath);

            $success = $this->cacheFileContents(
                $destination,
                $output,
                $importsPaths
            );
        }

        return $destination;
    }
320109
public function getCommitsSince($rev)
    {
        $log = $this->execute("hg log -r tip:{$rev} --config ui.verbose=false");
        $this->repository_type = 'hg';

        return $this->parseLog($log);
    }
345094
private function loadCacheLifetime($path, \DOMXPath $xpath)
    {
        $nodeList = $xpath->query($path);

        if (!$nodeList->length) {
            return [
                'type' => CacheLifetimeResolverInterface::TYPE_SECONDS,
                'value' => 0,
            ];
        }

        // get first node
        $node = $nodeList->item(0);

        $type = $node->getAttribute('type');
        if ('' === $type) {
            $type = CacheLifetimeResolverInterface::TYPE_SECONDS;
        }

        $value = $node->nodeValue;
        if (!$this->cacheLifetimeResolver->supports($type, $value)) {
            throw new \InvalidArgumentException(
                sprintf('CacheLifetime "%s" with type "%s" not supported.', $value, $type)
            );
        }

        return [
            'type' => $type,
            'value' => $value,
        ];
    }
763267
private function loadFormatsFromFile($path, array &$formats)
    {
        $folder = dirname($path);
        $file = basename($path);

        $locator = new FileLocator($folder);

        $xmlLoader10 = new XmlFormatLoader10($locator);
        $xmlLoader11 = new XmlFormatLoader11($locator);
        $xmlLoader10->setGlobalOptions($this->globalOptions);
        $xmlLoader11->setGlobalOptions($this->globalOptions);

        $resolver = new LoaderResolver([$xmlLoader10, $xmlLoader11]);
        $loader = new DelegatingLoader($resolver);

        $fileFormats = $loader->load($file);
        foreach ($fileFormats as $format) {
            if (array_key_exists($format['key'], $formats) && $formats[$format['key']] !== $format) {
                throw new InvalidArgumentException(
                    sprintf('Media format with key "%s" already exists!', $format['key'])
                );
            }

            $formats[$format['key']] = $format;
        }
    }
814219
public function Add( $duration )
	{
		if ( ! $duration instanceof DurationValue )
		{
			throw new \InvalidArgumentException();
		}

		// $durationFactor = $duration->Value->invert ? -1 : 1;
		// $thisFactor = $this->Value->invert ? -1 : 1;

		// $thisSeconds = new DecimalValue( $this->Value->days * 86400 + $this->Value->h * 3600 + $this->Value->i * 60 + $this->Value->s );
		// $thisSeconds = $thisSeconds->Add( "0." . $this->Value->microseconds );
		// $thisSeconds = $thisSeconds->Mul( $thisFactor );
		// $durationSeconds = new DecimalValue( $duration->Value->days * 86400 + $duration->Value->h * 3600 + $duration->Value->i * 60 + $duration->Value->s );
		// $durationSeconds = $durationSeconds->Add( "0." . $duration->microseconds );
		// $durationSeconds = $thisSeconds->Mul( $durationFactor );

		$thisSeconds = $this->getTotalSeconds();
		$durationSeconds = $duration->getTotalSeconds();

		/**
		 * @var DecimalValue $interval
		 */
		$interval = $thisSeconds->Add( $durationSeconds );
		$hasValue = $interval->CompareTo( 0 ) != 0;
		$invert = 0 > $interval->CompareTo( 0 ) == -1;
		$interval = $interval->getAbs();

		$days = $interval->Div( 86400 )->getIntegerPart();
		$interval = $interval->Sub( $days * 86400 );
		$h = $interval->Div( 3600 )->getIntegerPart();
		$interval = $interval->Sub( $h * 3600 );
		$i = $interval->Div( 60 )->getIntegerPart();
		$interval->Sub( $i * 60 );
		$interval = $interval->Sub( $i * 60 );
		$s = $interval->getIntegerPart();
		$microseconds = $interval->getDecimalPart();

		$specString = "P%02sDT%02sH%02sM%02sS";
		$interval = sprintf( $specString, $days, $h, $i, $s );

		$di = new \DateInterval( $interval );
		$di->hasValue = $hasValue;
		$di->invert = $invert;
		$di->microseconds = $microseconds;
		$this->Value = $di;

		// if ( $hasValue )
		// {
		// 	$this->type =  XPATH20_DURATION_TYPE_DAYTIME;
        //
		// }

	}
706216
public function log($path, $revision = null, $limit = null)
    {
        $this->fetch();

        if ('' === $path) {
            $path = '.';
        }

        return $this->execute('log', array(
//                 '-r' => $revision ? $revision : false,
                '-n' => $limit ? $limit : false,
                '--pretty=' => self::PRETTY_FORMAT,
                $path
                )
        );
    }
1097714
static function GetLastModified($path)
    {
        $ts = @\filemtime($path);
        if ($ts !== false)
            return Date::FromTimeStamp($ts);
        
        return null;
    }
185264
public static function dirMTime($path)
    {
        clearstatcache();
        return max(
            array_map(
                function ($f) {
                    return filemtime($f);
                },
                self::listDirRecursive($path)
            ),
            filemtime($path)
        );
    }
638358
public static function createFromFormat( $format, $time, $timezone = null ) {

		/** @var \DateTimeInterface $created */
		$created = empty( $timezone ) ?
			parent::createFromFormat( $format, $time ) :
			parent::createFromFormat( $format, $time, $timezone );

		if ( false === $created ) {
			return false;
		}

		$wp_date_time = new static( '@' . $created->getTimestamp() );

		return $wp_date_time->setTimezone( $created->getTimezone() );
	}