Вход Регистрация
Файл: vendor/laravel/framework/src/Illuminate/Support/functions.php
Строк: 259
<?php

namespace IlluminateSupport;

use 
CarbonCarbonInterface;
use 
CarbonCarbonInterval;
use 
IlluminateSupportDeferDeferredCallback;
use 
IlluminateSupportDeferDeferredCallbackCollection;
use 
IlluminateSupportFacadesDate;
use 
SymfonyComponentProcessPhpExecutableFinder;

if (! 
function_exists('IlluminateSupportdefer')) {
    
/**
     * Defer execution of the given callback.
     *
     * @param  callable|null  $callback
     * @param  string|null  $name
     * @param  bool  $always
     * @return ($callback is null ? IlluminateSupportDeferDeferredCallbackCollection : IlluminateSupportDeferDeferredCallback)
     */
    
function defer(?callable $callback null, ?string $name nullbool $always false): DeferredCallback|DeferredCallbackCollection
    
{
        if (
$callback === null) {
            return 
app(DeferredCallbackCollection::class);
        }

        return 
tap(
            new 
DeferredCallback($callback$name$always),
            
fn ($deferred) => app(DeferredCallbackCollection::class)[] = $deferred
        
);
    }
}

if (! 
function_exists('IlluminateSupportphp_binary')) {
    
/**
     * Determine the PHP Binary.
     */
    
function php_binary(): string
    
{
        return (new 
PhpExecutableFinder)->find(false) ?: 'php';
    }
}

if (! 
function_exists('IlluminateSupportartisan_binary')) {
    
/**
     * Determine the proper Artisan executable.
     */
    
function artisan_binary(): string
    
{
        return 
defined('ARTISAN_BINARY') ? ARTISAN_BINARY 'artisan';
    }
}

// Time functions...

if (! function_exists('IlluminateSupportnow')) {
    
/**
     * Create a new Carbon instance for the current time.
     *
     * @param  DateTimeZone|UnitEnum|string|null  $tz
     * @return IlluminateSupportCarbon
     */
    
function now($tz null): CarbonInterface
    
{
        return 
Date::now(enum_value($tz));
    }
}

if (! 
function_exists('IlluminateSupportmicroseconds')) {
    
/**
     * Get the current date / time plus the given number of microseconds.
     */
    
function microseconds(int|float $microseconds): CarbonInterval
    
{
        return 
CarbonInterval::microseconds($microseconds);
    }
}

if (! 
function_exists('IlluminateSupportmilliseconds')) {
    
/**
     * Get the current date / time plus the given number of milliseconds.
     */
    
function milliseconds(int|float $milliseconds): CarbonInterval
    
{
        return 
CarbonInterval::milliseconds($milliseconds);
    }
}

if (! 
function_exists('IlluminateSupportseconds')) {
    
/**
     * Get the current date / time plus the given number of seconds.
     */
    
function seconds(int|float $seconds): CarbonInterval
    
{
        return 
CarbonInterval::seconds($seconds);
    }
}

if (! 
function_exists('IlluminateSupportminutes')) {
    
/**
     * Get the current date / time plus the given number of minutes.
     */
    
function minutes(int|float $minutes): CarbonInterval
    
{
        return 
CarbonInterval::minutes($minutes);
    }
}

if (! 
function_exists('IlluminateSupporthours')) {
    
/**
     * Get the current date / time plus the given number of hours.
     */
    
function hours(int|float $hours): CarbonInterval
    
{
        return 
CarbonInterval::hours($hours);
    }
}

if (! 
function_exists('IlluminateSupportdays')) {
    
/**
     * Get the current date / time plus the given number of days.
     */
    
function days(int|float $days): CarbonInterval
    
{
        return 
CarbonInterval::days($days);
    }
}

if (! 
function_exists('IlluminateSupportweeks')) {
    
/**
     * Get the current date / time plus the given number of weeks.
     */
    
function weeks(int $weeks): CarbonInterval
    
{
        return 
CarbonInterval::weeks($weeks);
    }
}

if (! 
function_exists('IlluminateSupportmonths')) {
    
/**
     * Get the current date / time plus the given number of months.
     */
    
function months(int $months): CarbonInterval
    
{
        return 
CarbonInterval::months($months);
    }
}

if (! 
function_exists('IlluminateSupportyears')) {
    
/**
     * Get the current date / time plus the given number of years.
     */
    
function years(int $years): CarbonInterval
    
{
        return 
CarbonInterval::years($years);
    }
}
Онлайн: 0
Реклама