!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/wataxi.picotech.app/public_html/vendor/cmixin/business-time/src/BusinessTime/   drwxr-xr-x
Free 28.63 GB of 117.98 GB (24.27%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     DiffCalculator.php (3.23 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace BusinessTime;

use 
BusinessTime\Exceptions\InvalidArgumentException;
use 
Carbon\Carbon;
use 
Carbon\CarbonInterface;
use 
Carbon\CarbonInterval;
use 
Spatie\OpeningHours\OpeningHours;

class 
DiffCalculator
{
    
/**
     * @var string
     */
    
protected $unit;

    
/**
     * @var bool
     */
    
protected $open;

    
/**
     * @var bool
     */
    
protected $absolute;

    
/**
     * @var bool
     */
    
protected $holidaysAreClosed;

    
/**
     * @var bool
     */
    
protected $useDst;

    
/**
     * @var string
     */
    
protected $methodPrefix;

    public function 
__construct(string $unitstring $methodPrefix 'floatDiffIn')
    {
        
$this->unit ucfirst(Carbon::pluralUnit($unit));
        
$this->methodPrefix $methodPrefix;
    }

    public function 
setFlags(bool $openbool $absolutebool $holidaysAreClosedbool $useDst)
    {
        
$this->open $open;
        
$this->absolute $absolute;
        
$this->holidaysAreClosed $holidaysAreClosed;
        
$this->useDst $useDst;
    }

    public function 
calculateDiff(CarbonInterface $startCarbonInterface $end)
    {
        if (
$this->unit === 'Intervals') {
            
$this->unit 'Seconds';

            return 
CarbonInterval::createFromFormat(
                
's.u',
                
number_format($this->calculateFloatDiff($start$end), 6'.''')
            )->
cascade();
        }

        return 
$this->calculateFloatDiff($start$end);
    }

    public function 
calculateFloatDiff(CarbonInterface $startCarbonInterface $end): float
    
{
        if (
$end $start) {
            return (
$this->absolute : -1) * $this->calculateFloatDiff($end$start);
        }

        
$time 0;
        
$floatDiff $this->methodPrefix.($this->useDst '' 'Real').$this->unit;
        
$isWrongState 'is'.($this->holidaysAreClosed 'Business' '').($this->open 'Closed' 'Open');
        
$nextWrongState 'next'.($this->holidaysAreClosed 'Business' '').($this->open 'Close' 'Open');
        
$nextCorrectState 'next'.($this->holidaysAreClosed 'Business' '').($this->open 'Open' 'Close');
        
$hours $this->getOpeningHours($start);
        
$date $this->copy($start);

        while (
$date $end) {
            if (
$date->$isWrongState()) {
                
$date $this->withOpeningHours($date->$nextCorrectState(), $hours);

                continue;
            }

            
$nextDate $this->withOpeningHours($this->copy($date)->$nextWrongState(), $hours);
            
$time += $date->$floatDiff(min($end$nextDate));
            
$date $nextDate;
        }

        return 
$time;
    }

    protected function 
copy(CarbonInterface $date): CarbonInterface
    
{
        return 
$this->withOpeningHours($date->copy(), $this->getOpeningHours($date));
    }

    protected function 
withOpeningHours(CarbonInterface $date, ?OpeningHours $hours): CarbonInterface
    
{
        if (
$hours) {
            return 
$date->setOpeningHours($hours);
        }

        return 
$date;
    }

    protected function 
getOpeningHours(CarbonInterface $date): ?OpeningHours
    
{
        try {
            return 
$date->getOpeningHours(MixinBase::LOCAL_MODE);
        } catch (
InvalidArgumentException $exception) {
            return 
null;
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0065 ]--