serial diff aggregation.

@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-serialdiff-aggregation.html

@param string      $name
@param string|null $bucketsPath

@return SerialDiff
968227
public function serial_diff(string $name, string $bucketsPath = null): SerialDiff
    {
        return new SerialDiff($name, $bucketsPath);
    }
186794
public static function statFolder($bucketName, $path)
    {
        $path = self::normalizerPath($path, true);

        return self::statBase($bucketName, $path);
    }
232664
private function createHeaders(BucketInterface $bucket, string $name, StreamInterface $stream): array
    {
        if (empty($mimetype = mimetype_from_filename($name))) {
            $mimetype = self::DEFAULT_MIMETYPE;
        };

        //Possible to add custom headers into the bucket
        $headers = $bucket->getOption('headers', []);

        if (!empty($maxAge = $bucket->getOption('maxAge', 0))) {
            //Shortcut
            $headers['Cache-control'] = 'max-age=' . $bucket->getOption('maxAge', 0) . ', public';
            $headers['Expires'] = gmdate(
                'D, d M Y H:i:s T',
                time() + $bucket->getOption('maxAge', 0)
            );
        }

        $stream->rewind();

        return $headers + [
                'Content-MD5'  => base64_encode(md5($stream->getContents(), true)),
                'Content-Type' => $mimetype
            ];
    }
558874
public function avg_bucket(string $name, string $bucketsPath = null): AvgBucket
    {
        return new AvgBucket($name, $bucketsPath);
    }
314082
public function lock(string $name, int $seconds = 0): Lock
    {
        return new CouchbaseLock($this->bucket, $this->prefix.$name, $seconds);
    }
173133
public static function appSign_once($path, $bucketName)
    {
        $appId = Conf::getAppId();
        $secretId = Conf::getSecretId();
        $secretKey = Conf::getSecretKey();

        if (preg_match('/^\//', $path) == 0) {
            $path = '/'.$path;
        }
        $fileId = '/'.$appId.'/'.$bucketName.$path;

        if (empty($secretId) || empty($secretKey) || empty($appId)) {
            return self::AUTH_SECRET_ID_KEY_ERROR;
        }

        return self::appSignBase($appId, $secretId, $secretKey, 0, $fileId, $bucketName);
    }
799348
protected function move($src, $dst, $name) {
		$stat = $this->stat($src);
		$stat['realpath'] = $src;
		$this->rmTmb($stat); // can not do rmTmb() after _move()
		$this->clearcache();
		
		if ($this->convEncOut($this->_move($this->convEncIn($src), $this->convEncIn($dst), $this->convEncIn($name)))) {
			$this->removed[] = $stat;

			return $this->joinPathCE($dst, $name);
		}

		return $this->setError(elFinder::ERROR_MOVE, $this->path($src));
	}
1174174
public function getChild(string $name): ?vfsStreamContent
    {
        $childName = $this->getRealChildName($name);
        foreach ($this->children as $child) {
            if ($child->getName() === $childName) {
                return $child;
            }

            if (!$child instanceof vfsStreamContainer) {
                continue;
            }

            if ($child->appliesTo($childName) && $child->hasChild($childName)) {
                return $child->getChild($childName);
            }
        }

        return null;
    }
635702
func (s *ExtendedStatsBucketAggregation) BucketsPath(bucketsPaths ...string) *ExtendedStatsBucketAggregation {
	s.bucketsPaths = append(s.bucketsPaths, bucketsPaths...)
	return s
}
164036
public function getFromPath($name = false, $path = false)
    {
        if ($path && $name) {
            $this->img       = $path . '/' . $name;
            $this->handle    = new Upload($this->img);
            $this->_new_name = $this->s3->sanitizeFilename(uniqid("", true) . $this->handle->file_src_name);
        }
    }
105434
public function openBucket(string $name): Bucket
    {
        $couchbase = $this->getCouchbase();
        if ($this->bucketPassword === '') {
            return $couchbase->openBucket($name);
        }

        return $couchbase->openBucket($name, $this->bucketPassword);
    }
134938
public static function Diff ($name = null) {
		$name = (is_null($name)) ? \ickx\fw2\core\log\Caller::GetClassMethod() : $name;
		$log = static::GetLog($name);
		if (is_null($log) || !isset($log['start']) || !isset($log['stop'])) {
			return null;
		}
		return $log['stop'] - $log['start'];
	}
1158220
public static function SplitDiff ($name = null) {
		$name = (is_null($name)) ? \ickx\fw2\core\log\Caller::GetClassMethod() : $name;
		return static::Split($name) - static::$_stopwatchLog[$name]['start'];
	}
13028
protected function getBucketIdFromName($name)
    {
        $buckets = $this->listBuckets();

        foreach ($buckets as $bucket) {
            if ($bucket->getName() === $name) {
                return $bucket->getId();
            }
        }

        return null;
    }
438243
public static function updateFolder($bucketName, $path, $bizAttr = null) {
        $path = self::normalizerPath($path, True);

        return self::updateBase($bucketName, $path, $bizAttr);
    }
571233
private static function generateResUrl($bucket, $dstPath) {
        $endPoint = Conf::API_COSAPI_END_POINT;
        $endPoint = str_replace('region', self::$region, $endPoint);

        return $endPoint . Conf::APP_ID . '/' . $bucket . $dstPath;
    }
642851
public function getEventScript($name)
    {
        $cacheKey = Cache::EVENT_SCRIPT_CACHE_PREFIX . $name;
        try {
            /** @var EventScript $model */
            $model = \Cache::rememberForever($cacheKey, function () use ($name) {
                if ($model = EventScript::whereName($name)->whereIsActive(true)->first()) {
                    if (!empty($model->storage_service_id) && !empty($model->storage_path)) {
                        try {
                            $serviceId = $model->storage_service_id;
                            $service = \ServiceManager::getServiceById($serviceId);
                            $storagePath = trim($model->storage_path, '/');
                            $scmRepo = $model->scm_repository;
                            $scmRef = $model->scm_reference;
                            if (empty($scmRef)) {
                                $scmRef = null;
                            }
                            $serviceName = $service->getName();
                            $typeGroup = $service->getServiceTypeInfo()->getGroup();

                            if ($typeGroup === ServiceTypeGroups::SCM) {
                                $result = \ServiceManager::handleRequest(
                                    $serviceName,
                                    Verbs::GET,
                                    '_repo/' . $scmRepo,
                                    ['path' => $storagePath, 'branch' => $scmRef, 'content' => 1]
                                );
                                $model->content = $result->getContent();
                            } else {
                                $result = \ServiceManager::handleRequest(
                                    $serviceName,
                                    Verbs::GET,
                                    $storagePath,
                                    ['include_properties' => 1, 'content' => 1]
                                );

                                $model->content = base64_decode(array_get($result->getContent(), 'content'));
                            }
                        } catch (\Exception $e) {
                            \Log::error('Failed to fetch remote script. ' . $e->getMessage());
                            throw $e;
                        }
                    }

                    return $model;
                }

                return ''; // so that we don't hit the database even after we know it isn't there
            });

            if (!empty($model)) { // see '' returned above
                return $model;
            }
        } catch (\Exception $ex) {
            \Log::error('Error occurred while loading event script. ' . $ex->getMessage());
        }

        return null;
    }