repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
liip/LiipImagineBundle | Binary/Loader/StreamLoader.php | StreamLoader.find | public function find($path)
{
$name = $this->wrapperPrefix.$path;
/*
* This looks strange, but at least in PHP 5.3.8 it will raise an E_WARNING if the 4th parameter is null.
* fopen() will be called only once with the correct arguments.
*
* The error suppression ... | php | public function find($path)
{
$name = $this->wrapperPrefix.$path;
/*
* This looks strange, but at least in PHP 5.3.8 it will raise an E_WARNING if the 4th parameter is null.
* fopen() will be called only once with the correct arguments.
*
* The error suppression ... | [
"public",
"function",
"find",
"(",
"$",
"path",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"wrapperPrefix",
".",
"$",
"path",
";",
"/*\n * This looks strange, but at least in PHP 5.3.8 it will raise an E_WARNING if the 4th parameter is null.\n * fopen() will... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Loader/StreamLoader.php#L52-L81 |
liip/LiipImagineBundle | Controller/ImagineController.php | ImagineController.filterAction | public function filterAction(Request $request, $path, $filter)
{
$path = PathHelper::urlPathToFilePath($path);
$resolver = $request->get('resolver');
try {
return new RedirectResponse($this->filterService->getUrlOfFilteredImage($path, $filter, $resolver), 301);
} catch (... | php | public function filterAction(Request $request, $path, $filter)
{
$path = PathHelper::urlPathToFilePath($path);
$resolver = $request->get('resolver');
try {
return new RedirectResponse($this->filterService->getUrlOfFilteredImage($path, $filter, $resolver), 301);
} catch (... | [
"public",
"function",
"filterAction",
"(",
"Request",
"$",
"request",
",",
"$",
"path",
",",
"$",
"filter",
")",
"{",
"$",
"path",
"=",
"PathHelper",
"::",
"urlPathToFilePath",
"(",
"$",
"path",
")",
";",
"$",
"resolver",
"=",
"$",
"request",
"->",
"ge... | This action applies a given filter to a given image, saves the image and redirects the browser to the stored
image.
The resulting image is cached so subsequent requests will redirect to the cached image instead applying the
filter and storing the image again.
@param Request $request
@param string $path
@param string... | [
"This",
"action",
"applies",
"a",
"given",
"filter",
"to",
"a",
"given",
"image",
"saves",
"the",
"image",
"and",
"redirects",
"the",
"browser",
"to",
"the",
"stored",
"image",
"."
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Controller/ImagineController.php#L71-L89 |
liip/LiipImagineBundle | Controller/ImagineController.php | ImagineController.filterRuntimeAction | public function filterRuntimeAction(Request $request, $hash, $path, $filter)
{
$resolver = $request->get('resolver');
$runtimeConfig = $request->query->get('filters', []);
if (!\is_array($runtimeConfig)) {
throw new NotFoundHttpException(sprintf('Filters must be an array. Value ... | php | public function filterRuntimeAction(Request $request, $hash, $path, $filter)
{
$resolver = $request->get('resolver');
$runtimeConfig = $request->query->get('filters', []);
if (!\is_array($runtimeConfig)) {
throw new NotFoundHttpException(sprintf('Filters must be an array. Value ... | [
"public",
"function",
"filterRuntimeAction",
"(",
"Request",
"$",
"request",
",",
"$",
"hash",
",",
"$",
"path",
",",
"$",
"filter",
")",
"{",
"$",
"resolver",
"=",
"$",
"request",
"->",
"get",
"(",
"'resolver'",
")",
";",
"$",
"runtimeConfig",
"=",
"$... | This action applies a given filter -merged with additional runtime filters- to a given image, saves the image and
redirects the browser to the stored image.
The resulting image is cached so subsequent requests will redirect to the cached image instead applying the
filter and storing the image again.
@param Request $r... | [
"This",
"action",
"applies",
"a",
"given",
"filter",
"-",
"merged",
"with",
"additional",
"runtime",
"filters",
"-",
"to",
"a",
"given",
"image",
"saves",
"the",
"image",
"and",
"redirects",
"the",
"browser",
"to",
"the",
"stored",
"image",
"."
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Controller/ImagineController.php#L109-L140 |
liip/LiipImagineBundle | DependencyInjection/Compiler/MetadataReaderCompilerPass.php | MetadataReaderCompilerPass.process | public function process(ContainerBuilder $container): void
{
if (!$this->isExifExtensionLoaded() && $this->isExifMetadataReaderSet($container)) {
$container->setDefinition(self::$metadataReaderServiceId, new Definition(self::$metadataReaderDefaultClass));
$message = 'Replaced the "%s... | php | public function process(ContainerBuilder $container): void
{
if (!$this->isExifExtensionLoaded() && $this->isExifMetadataReaderSet($container)) {
$container->setDefinition(self::$metadataReaderServiceId, new Definition(self::$metadataReaderDefaultClass));
$message = 'Replaced the "%s... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isExifExtensionLoaded",
"(",
")",
"&&",
"$",
"this",
"->",
"isExifMetadataReaderSet",
"(",
"$",
"container",
")",
")",
"{... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Compiler/MetadataReaderCompilerPass.php#L40-L49 |
liip/LiipImagineBundle | DependencyInjection/Compiler/MetadataReaderCompilerPass.php | MetadataReaderCompilerPass.isExifMetadataReaderSet | private function isExifMetadataReaderSet(ContainerBuilder $container): bool
{
return $container->getDefinition(self::$metadataReaderServiceId)->getClass() === self::$metadataReaderExifClass;
} | php | private function isExifMetadataReaderSet(ContainerBuilder $container): bool
{
return $container->getDefinition(self::$metadataReaderServiceId)->getClass() === self::$metadataReaderExifClass;
} | [
"private",
"function",
"isExifMetadataReaderSet",
"(",
"ContainerBuilder",
"$",
"container",
")",
":",
"bool",
"{",
"return",
"$",
"container",
"->",
"getDefinition",
"(",
"self",
"::",
"$",
"metadataReaderServiceId",
")",
"->",
"getClass",
"(",
")",
"===",
"sel... | @param ContainerBuilder $container
@return bool | [
"@param",
"ContainerBuilder",
"$container"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Compiler/MetadataReaderCompilerPass.php#L64-L67 |
liip/LiipImagineBundle | Imagine/Filter/Loader/BackgroundFilterLoader.php | BackgroundFilterLoader.load | public function load(ImageInterface $image, array $options = [])
{
$background = $image->palette()->color(
isset($options['color']) ? $options['color'] : '#fff',
isset($options['transparency']) ? $options['transparency'] : null
);
$topLeft = new Point(0, 0);
$... | php | public function load(ImageInterface $image, array $options = [])
{
$background = $image->palette()->color(
isset($options['color']) ? $options['color'] : '#fff',
isset($options['transparency']) ? $options['transparency'] : null
);
$topLeft = new Point(0, 0);
$... | [
"public",
"function",
"load",
"(",
"ImageInterface",
"$",
"image",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"background",
"=",
"$",
"image",
"->",
"palette",
"(",
")",
"->",
"color",
"(",
"isset",
"(",
"$",
"options",
"[",
"'color'... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/BackgroundFilterLoader.php#L34-L97 |
liip/LiipImagineBundle | Factory/Config/Filter/ScaleFactory.php | ScaleFactory.create | public function create(array $options): FilterInterface
{
$dimensions = $this->sizeFactory->createFromOptions($options, 'dim');
$to = isset($options['to']) ? (float) $options['to'] : null;
return new Scale($dimensions, $to);
} | php | public function create(array $options): FilterInterface
{
$dimensions = $this->sizeFactory->createFromOptions($options, 'dim');
$to = isset($options['to']) ? (float) $options['to'] : null;
return new Scale($dimensions, $to);
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"options",
")",
":",
"FilterInterface",
"{",
"$",
"dimensions",
"=",
"$",
"this",
"->",
"sizeFactory",
"->",
"createFromOptions",
"(",
"$",
"options",
",",
"'dim'",
")",
";",
"$",
"to",
"=",
"isset",
"("... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Factory/Config/Filter/ScaleFactory.php#L46-L52 |
liip/LiipImagineBundle | Binary/Locator/FileSystemLocator.php | FileSystemLocator.locate | public function locate(string $path): string
{
if (null !== $absolute = $this->locateUsingRootPlaceholder($path)) {
return $this->sanitizeAbsolutePath($absolute);
}
if (null !== $absolute = $this->locateUsingRootPathsSearch($path)) {
return $this->sanitizeAbsolutePat... | php | public function locate(string $path): string
{
if (null !== $absolute = $this->locateUsingRootPlaceholder($path)) {
return $this->sanitizeAbsolutePath($absolute);
}
if (null !== $absolute = $this->locateUsingRootPathsSearch($path)) {
return $this->sanitizeAbsolutePat... | [
"public",
"function",
"locate",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"if",
"(",
"null",
"!==",
"$",
"absolute",
"=",
"$",
"this",
"->",
"locateUsingRootPlaceholder",
"(",
"$",
"path",
")",
")",
"{",
"return",
"$",
"this",
"->",
"sanitiz... | @param string $path
@throws NotLoadableException
@return string | [
"@param",
"string",
"$path"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Locator/FileSystemLocator.php#L41-L53 |
liip/LiipImagineBundle | Binary/Locator/FileSystemLocator.php | FileSystemLocator.generateAbsolutePath | protected function generateAbsolutePath(string $root, string $path): ?string
{
if (false !== $absolute = realpath($root.DIRECTORY_SEPARATOR.$path)) {
return $absolute;
}
return null;
} | php | protected function generateAbsolutePath(string $root, string $path): ?string
{
if (false !== $absolute = realpath($root.DIRECTORY_SEPARATOR.$path)) {
return $absolute;
}
return null;
} | [
"protected",
"function",
"generateAbsolutePath",
"(",
"string",
"$",
"root",
",",
"string",
"$",
"path",
")",
":",
"?",
"string",
"{",
"if",
"(",
"false",
"!==",
"$",
"absolute",
"=",
"realpath",
"(",
"$",
"root",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"p... | @param string $root
@param string $path
@return string|null | [
"@param",
"string",
"$root",
"@param",
"string",
"$path"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Locator/FileSystemLocator.php#L61-L68 |
liip/LiipImagineBundle | Binary/Locator/FileSystemLocator.php | FileSystemLocator.locateUsingRootPathsSearch | private function locateUsingRootPathsSearch(string $path): ?string
{
foreach ($this->roots as $root) {
if (null !== $absolute = $this->generateAbsolutePath($root, $path)) {
return $absolute;
}
}
return null;
} | php | private function locateUsingRootPathsSearch(string $path): ?string
{
foreach ($this->roots as $root) {
if (null !== $absolute = $this->generateAbsolutePath($root, $path)) {
return $absolute;
}
}
return null;
} | [
"private",
"function",
"locateUsingRootPathsSearch",
"(",
"string",
"$",
"path",
")",
":",
"?",
"string",
"{",
"foreach",
"(",
"$",
"this",
"->",
"roots",
"as",
"$",
"root",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"absolute",
"=",
"$",
"this",
"->",
... | @param string $path
@return string|null | [
"@param",
"string",
"$path"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Locator/FileSystemLocator.php#L75-L84 |
liip/LiipImagineBundle | Binary/Locator/FileSystemLocator.php | FileSystemLocator.locateUsingRootPlaceholder | private function locateUsingRootPlaceholder(string $path): ?string
{
if (0 !== mb_strpos($path, '@') || 1 !== preg_match('{^@(?<name>[^:]+):(?<path>.+)$}', $path, $match)) {
return null;
}
if (isset($this->roots[$match['name']])) {
return $this->generateAbsolutePath(... | php | private function locateUsingRootPlaceholder(string $path): ?string
{
if (0 !== mb_strpos($path, '@') || 1 !== preg_match('{^@(?<name>[^:]+):(?<path>.+)$}', $path, $match)) {
return null;
}
if (isset($this->roots[$match['name']])) {
return $this->generateAbsolutePath(... | [
"private",
"function",
"locateUsingRootPlaceholder",
"(",
"string",
"$",
"path",
")",
":",
"?",
"string",
"{",
"if",
"(",
"0",
"!==",
"mb_strpos",
"(",
"$",
"path",
",",
"'@'",
")",
"||",
"1",
"!==",
"preg_match",
"(",
"'{^@(?<name>[^:]+):(?<path>.+)$}'",
",... | @param string $path
@return string|null | [
"@param",
"string",
"$path"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Locator/FileSystemLocator.php#L91-L103 |
liip/LiipImagineBundle | Binary/Locator/FileSystemLocator.php | FileSystemLocator.sanitizeRootPath | private function sanitizeRootPath(string $path): string
{
if (!empty($path) && false !== $real = realpath($path)) {
return $real;
}
throw new InvalidArgumentException(sprintf('Root image path not resolvable "%s"', $path));
} | php | private function sanitizeRootPath(string $path): string
{
if (!empty($path) && false !== $real = realpath($path)) {
return $real;
}
throw new InvalidArgumentException(sprintf('Root image path not resolvable "%s"', $path));
} | [
"private",
"function",
"sanitizeRootPath",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"path",
")",
"&&",
"false",
"!==",
"$",
"real",
"=",
"realpath",
"(",
"$",
"path",
")",
")",
"{",
"return",
"$",
"rea... | @param string $path
@throws InvalidArgumentException
@return string | [
"@param",
"string",
"$path"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Locator/FileSystemLocator.php#L112-L119 |
liip/LiipImagineBundle | Binary/Locator/FileSystemLocator.php | FileSystemLocator.sanitizeAbsolutePath | private function sanitizeAbsolutePath(string $path): string
{
$roots = array_filter($this->roots, function (string $root) use ($path): bool {
return 0 === mb_strpos($path, $root);
});
if (0 === \count($roots)) {
throw new NotLoadableException(
sprintf... | php | private function sanitizeAbsolutePath(string $path): string
{
$roots = array_filter($this->roots, function (string $root) use ($path): bool {
return 0 === mb_strpos($path, $root);
});
if (0 === \count($roots)) {
throw new NotLoadableException(
sprintf... | [
"private",
"function",
"sanitizeAbsolutePath",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"$",
"roots",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"roots",
",",
"function",
"(",
"string",
"$",
"root",
")",
"use",
"(",
"$",
"path",
")",
":",... | @param string $path
@throws NotLoadableException
@return string | [
"@param",
"string",
"$path"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Locator/FileSystemLocator.php#L128-L145 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/NoCacheWebPathResolver.php | NoCacheWebPathResolver.resolve | public function resolve($path, $filter)
{
return sprintf('%s://%s/%s',
$this->requestContext->getScheme(),
$this->requestContext->getHost(),
ltrim(PathHelper::filePathToUrlPath($path), '/')
);
} | php | public function resolve($path, $filter)
{
return sprintf('%s://%s/%s',
$this->requestContext->getScheme(),
$this->requestContext->getHost(),
ltrim(PathHelper::filePathToUrlPath($path), '/')
);
} | [
"public",
"function",
"resolve",
"(",
"$",
"path",
",",
"$",
"filter",
")",
"{",
"return",
"sprintf",
"(",
"'%s://%s/%s'",
",",
"$",
"this",
"->",
"requestContext",
"->",
"getScheme",
"(",
")",
",",
"$",
"this",
"->",
"requestContext",
"->",
"getHost",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/NoCacheWebPathResolver.php#L44-L51 |
liip/LiipImagineBundle | Imagine/Filter/PostProcessor/PngquantPostProcessor.php | PngquantPostProcessor.process | public function process(BinaryInterface $binary, array $options = []): BinaryInterface
{
$type = mb_strtolower($binary->getMimeType());
if (!\in_array($type, ['image/png'], true)) {
return $binary;
}
$processArguments = [$this->pngquantBin];
// Specify quality.
... | php | public function process(BinaryInterface $binary, array $options = []): BinaryInterface
{
$type = mb_strtolower($binary->getMimeType());
if (!\in_array($type, ['image/png'], true)) {
return $binary;
}
$processArguments = [$this->pngquantBin];
// Specify quality.
... | [
"public",
"function",
"process",
"(",
"BinaryInterface",
"$",
"binary",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
":",
"BinaryInterface",
"{",
"$",
"type",
"=",
"mb_strtolower",
"(",
"$",
"binary",
"->",
"getMimeType",
"(",
")",
")",
";",
"if",
... | @param BinaryInterface $binary
@throws ProcessFailedException
@return BinaryInterface | [
"@param",
"BinaryInterface",
"$binary"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/PostProcessor/PngquantPostProcessor.php#L71-L99 |
liip/LiipImagineBundle | Async/ResolveCacheProcessor.php | ResolveCacheProcessor.process | public function process(PsrMessage $psrMessage, PsrContext $psrContext)
{
try {
$message = ResolveCache::jsonDeserialize($psrMessage->getBody());
$filters = $message->getFilters() ?: array_keys($this->filterManager->getFilterConfiguration()->all());
$path = $message->get... | php | public function process(PsrMessage $psrMessage, PsrContext $psrContext)
{
try {
$message = ResolveCache::jsonDeserialize($psrMessage->getBody());
$filters = $message->getFilters() ?: array_keys($this->filterManager->getFilterConfiguration()->all());
$path = $message->get... | [
"public",
"function",
"process",
"(",
"PsrMessage",
"$",
"psrMessage",
",",
"PsrContext",
"$",
"psrContext",
")",
"{",
"try",
"{",
"$",
"message",
"=",
"ResolveCache",
"::",
"jsonDeserialize",
"(",
"$",
"psrMessage",
"->",
"getBody",
"(",
")",
")",
";",
"$... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Async/ResolveCacheProcessor.php#L60-L88 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/AmazonS3Resolver.php | AmazonS3Resolver.store | public function store(BinaryInterface $binary, $path, $filter)
{
$objectPath = $this->getObjectPath($path, $filter);
$storageResponse = $this->storage->create_object($this->bucket, $objectPath, [
'body' => $binary->getContent(),
'contentType' => $binary->getMimeType(),
... | php | public function store(BinaryInterface $binary, $path, $filter)
{
$objectPath = $this->getObjectPath($path, $filter);
$storageResponse = $this->storage->create_object($this->bucket, $objectPath, [
'body' => $binary->getContent(),
'contentType' => $binary->getMimeType(),
... | [
"public",
"function",
"store",
"(",
"BinaryInterface",
"$",
"binary",
",",
"$",
"path",
",",
"$",
"filter",
")",
"{",
"$",
"objectPath",
"=",
"$",
"this",
"->",
"getObjectPath",
"(",
"$",
"path",
",",
"$",
"filter",
")",
";",
"$",
"storageResponse",
"=... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/AmazonS3Resolver.php#L88-L108 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/AmazonS3Resolver.php | AmazonS3Resolver.remove | public function remove(array $paths, array $filters)
{
if (empty($paths) && empty($filters)) {
return;
}
if (empty($paths)) {
if (!$this->storage->delete_all_objects($this->bucket, sprintf('/%s/i', implode('|', $filters)))) {
$this->logError('The obje... | php | public function remove(array $paths, array $filters)
{
if (empty($paths) && empty($filters)) {
return;
}
if (empty($paths)) {
if (!$this->storage->delete_all_objects($this->bucket, sprintf('/%s/i', implode('|', $filters)))) {
$this->logError('The obje... | [
"public",
"function",
"remove",
"(",
"array",
"$",
"paths",
",",
"array",
"$",
"filters",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"paths",
")",
"&&",
"empty",
"(",
"$",
"filters",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/AmazonS3Resolver.php#L113-L146 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/AmazonS3Resolver.php | AmazonS3Resolver.getObjectUrl | protected function getObjectUrl($path)
{
return $this->storage->get_object_url($this->bucket, $path, 0, $this->objUrlOptions);
} | php | protected function getObjectUrl($path)
{
return $this->storage->get_object_url($this->bucket, $path, 0, $this->objUrlOptions);
} | [
"protected",
"function",
"getObjectUrl",
"(",
"$",
"path",
")",
"{",
"return",
"$",
"this",
"->",
"storage",
"->",
"get_object_url",
"(",
"$",
"this",
"->",
"bucket",
",",
"$",
"path",
",",
"0",
",",
"$",
"this",
"->",
"objUrlOptions",
")",
";",
"}"
] | Returns the URL for an object saved on Amazon S3.
@param string $path
@return string | [
"Returns",
"the",
"URL",
"for",
"an",
"object",
"saved",
"on",
"Amazon",
"S3",
"."
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/AmazonS3Resolver.php#L187-L190 |
liip/LiipImagineBundle | Binary/Loader/FlysystemLoader.php | FlysystemLoader.find | public function find($path)
{
if (false === $this->filesystem->has($path)) {
throw new NotLoadableException(sprintf('Source image "%s" not found.', $path));
}
$mimeType = $this->filesystem->getMimetype($path);
return new Binary(
$this->filesystem->read($path... | php | public function find($path)
{
if (false === $this->filesystem->has($path)) {
throw new NotLoadableException(sprintf('Source image "%s" not found.', $path));
}
$mimeType = $this->filesystem->getMimetype($path);
return new Binary(
$this->filesystem->read($path... | [
"public",
"function",
"find",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"filesystem",
"->",
"has",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"NotLoadableException",
"(",
"sprintf",
"(",
"'Source image \"%s\" not found... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Loader/FlysystemLoader.php#L42-L55 |
liip/LiipImagineBundle | Binary/Loader/AbstractDoctrineLoader.php | AbstractDoctrineLoader.find | public function find($path)
{
$image = $this->manager->find($this->class, $this->mapPathToId($path));
if (!$image) {
// try to find the image without extension
$info = pathinfo($path);
$name = $info['dirname'].'/'.$info['filename'];
$image = $this->m... | php | public function find($path)
{
$image = $this->manager->find($this->class, $this->mapPathToId($path));
if (!$image) {
// try to find the image without extension
$info = pathinfo($path);
$name = $info['dirname'].'/'.$info['filename'];
$image = $this->m... | [
"public",
"function",
"find",
"(",
"$",
"path",
")",
"{",
"$",
"image",
"=",
"$",
"this",
"->",
"manager",
"->",
"find",
"(",
"$",
"this",
"->",
"class",
",",
"$",
"this",
"->",
"mapPathToId",
"(",
"$",
"path",
")",
")",
";",
"if",
"(",
"!",
"$... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Loader/AbstractDoctrineLoader.php#L42-L59 |
liip/LiipImagineBundle | DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('liip_imagine');
$rootNode = method_exists(TreeBuilder::class, 'getRootNode')
? $treeBuilder->getRootNode()
: $treeBuilder->root('liip_imagine');
$resolversPrototypeNode = $rootNode
-... | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('liip_imagine');
$rootNode = method_exists(TreeBuilder::class, 'getRootNode')
? $treeBuilder->getRootNode()
: $treeBuilder->root('liip_imagine');
$resolversPrototypeNode = $rootNode
-... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
"'liip_imagine'",
")",
";",
"$",
"rootNode",
"=",
"method_exists",
"(",
"TreeBuilder",
"::",
"class",
",",
"'getRootNode'",
")",
"?",
"$",
"treeBui... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Configuration.php#L46-L160 |
liip/LiipImagineBundle | DependencyInjection/LiipImagineExtension.php | LiipImagineExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$config = $this->processConfiguration(
$this->getConfiguration($configs, $container),
$configs
);
$container->setParameter('liip_imagine.resolvers', $config['resolvers']);
$container->setPara... | php | public function load(array $configs, ContainerBuilder $container)
{
$config = $this->processConfiguration(
$this->getConfiguration($configs, $container),
$configs
);
$container->setParameter('liip_imagine.resolvers', $config['resolvers']);
$container->setPara... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"processConfiguration",
"(",
"$",
"this",
"->",
"getConfiguration",
"(",
"$",
"configs",
",",
"$",
"cont... | @see \Symfony\Component\DependencyInjection\Extension.ExtensionInterface::load()
@param array $configs
@param ContainerBuilder $container | [
"@see",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"DependencyInjection",
"\\",
"Extension",
".",
"ExtensionInterface",
"::",
"load",
"()"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/LiipImagineExtension.php#L67-L109 |
liip/LiipImagineBundle | Imagine/Filter/RelativeResize.php | RelativeResize.apply | public function apply(ImageInterface $image)
{
return $image->resize(\call_user_func([$image->getSize(), $this->method], $this->parameter));
} | php | public function apply(ImageInterface $image)
{
return $image->resize(\call_user_func([$image->getSize(), $this->method], $this->parameter));
} | [
"public",
"function",
"apply",
"(",
"ImageInterface",
"$",
"image",
")",
"{",
"return",
"$",
"image",
"->",
"resize",
"(",
"\\",
"call_user_func",
"(",
"[",
"$",
"image",
"->",
"getSize",
"(",
")",
",",
"$",
"this",
"->",
"method",
"]",
",",
"$",
"th... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/RelativeResize.php#L49-L52 |
liip/LiipImagineBundle | DependencyInjection/Factory/Resolver/WebPathResolverFactory.php | WebPathResolverFactory.addConfiguration | public function addConfiguration(ArrayNodeDefinition $builder)
{
$builder
->children()
->scalarNode('web_root')
->defaultValue(SymfonyFramework::getContainerResolvableRootWebPath())
->cannotBeEmpty()
->end()
... | php | public function addConfiguration(ArrayNodeDefinition $builder)
{
$builder
->children()
->scalarNode('web_root')
->defaultValue(SymfonyFramework::getContainerResolvableRootWebPath())
->cannotBeEmpty()
->end()
... | [
"public",
"function",
"addConfiguration",
"(",
"ArrayNodeDefinition",
"$",
"builder",
")",
"{",
"$",
"builder",
"->",
"children",
"(",
")",
"->",
"scalarNode",
"(",
"'web_root'",
")",
"->",
"defaultValue",
"(",
"SymfonyFramework",
"::",
"getContainerResolvableRootWe... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Resolver/WebPathResolverFactory.php#L49-L62 |
liip/LiipImagineBundle | Imagine/Cache/Signer.php | Signer.sign | public function sign($path, array $runtimeConfig = null)
{
if ($runtimeConfig) {
array_walk_recursive($runtimeConfig, function (&$value) {
$value = (string) $value;
});
}
return mb_substr(preg_replace('/[^a-zA-Z0-9-_]/', '', base64_encode(hash_hmac('s... | php | public function sign($path, array $runtimeConfig = null)
{
if ($runtimeConfig) {
array_walk_recursive($runtimeConfig, function (&$value) {
$value = (string) $value;
});
}
return mb_substr(preg_replace('/[^a-zA-Z0-9-_]/', '', base64_encode(hash_hmac('s... | [
"public",
"function",
"sign",
"(",
"$",
"path",
",",
"array",
"$",
"runtimeConfig",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"runtimeConfig",
")",
"{",
"array_walk_recursive",
"(",
"$",
"runtimeConfig",
",",
"function",
"(",
"&",
"$",
"value",
")",
"{",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Signer.php#L32-L41 |
liip/LiipImagineBundle | Imagine/Cache/Signer.php | Signer.check | public function check($hash, $path, array $runtimeConfig = null)
{
return $hash === $this->sign($path, $runtimeConfig);
} | php | public function check($hash, $path, array $runtimeConfig = null)
{
return $hash === $this->sign($path, $runtimeConfig);
} | [
"public",
"function",
"check",
"(",
"$",
"hash",
",",
"$",
"path",
",",
"array",
"$",
"runtimeConfig",
"=",
"null",
")",
"{",
"return",
"$",
"hash",
"===",
"$",
"this",
"->",
"sign",
"(",
"$",
"path",
",",
"$",
"runtimeConfig",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Signer.php#L46-L49 |
liip/LiipImagineBundle | Binary/Loader/ChainLoader.php | ChainLoader.find | public function find($path)
{
$exceptions = [];
foreach ($this->loaders as $loader) {
try {
return $loader->find($path);
} catch (\Exception $e) {
$exceptions[$e->getMessage()] = $loader;
}
}
throw new NotLoadableE... | php | public function find($path)
{
$exceptions = [];
foreach ($this->loaders as $loader) {
try {
return $loader->find($path);
} catch (\Exception $e) {
$exceptions[$e->getMessage()] = $loader;
}
}
throw new NotLoadableE... | [
"public",
"function",
"find",
"(",
"$",
"path",
")",
"{",
"$",
"exceptions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loaders",
"as",
"$",
"loader",
")",
"{",
"try",
"{",
"return",
"$",
"loader",
"->",
"find",
"(",
"$",
"path",
")"... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Loader/ChainLoader.php#L36-L49 |
liip/LiipImagineBundle | Binary/Loader/ChainLoader.php | ChainLoader.getLoaderExceptionMessage | private static function getLoaderExceptionMessage(string $path, array $exceptions, array $loaders): string
{
array_walk($loaders, function (LoaderInterface &$loader, string $name): void {
$loader = sprintf('%s=[%s]', (new \ReflectionObject($loader))->getShortName(), $name);
});
... | php | private static function getLoaderExceptionMessage(string $path, array $exceptions, array $loaders): string
{
array_walk($loaders, function (LoaderInterface &$loader, string $name): void {
$loader = sprintf('%s=[%s]', (new \ReflectionObject($loader))->getShortName(), $name);
});
... | [
"private",
"static",
"function",
"getLoaderExceptionMessage",
"(",
"string",
"$",
"path",
",",
"array",
"$",
"exceptions",
",",
"array",
"$",
"loaders",
")",
":",
"string",
"{",
"array_walk",
"(",
"$",
"loaders",
",",
"function",
"(",
"LoaderInterface",
"&",
... | @param string $path
@param \Exception[] $exceptions
@param array $loaders
@return string | [
"@param",
"string",
"$path",
"@param",
"\\",
"Exception",
"[]",
"$exceptions",
"@param",
"array",
"$loaders"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Binary/Loader/ChainLoader.php#L58-L74 |
liip/LiipImagineBundle | Async/ResolveCache.php | ResolveCache.jsonDeserialize | public static function jsonDeserialize(string $json): self
{
$data = array_replace(['path' => null, 'filters' => null, 'force' => false], JSON::decode($json));
if (!$data['path']) {
throw new LogicException('The message does not contain "path" but it is required.');
}
i... | php | public static function jsonDeserialize(string $json): self
{
$data = array_replace(['path' => null, 'filters' => null, 'force' => false], JSON::decode($json));
if (!$data['path']) {
throw new LogicException('The message does not contain "path" but it is required.');
}
i... | [
"public",
"static",
"function",
"jsonDeserialize",
"(",
"string",
"$",
"json",
")",
":",
"self",
"{",
"$",
"data",
"=",
"array_replace",
"(",
"[",
"'path'",
"=>",
"null",
",",
"'filters'",
"=>",
"null",
",",
"'force'",
"=>",
"false",
"]",
",",
"JSON",
... | @param string $json
@return self | [
"@param",
"string",
"$json"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Async/ResolveCache.php#L83-L96 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/CacheResolver.php | CacheResolver.isStored | public function isStored($path, $filter)
{
$cacheKey = $this->generateCacheKey($path, $filter);
return
$this->cache->contains($cacheKey) ||
$this->resolver->isStored($path, $filter);
} | php | public function isStored($path, $filter)
{
$cacheKey = $this->generateCacheKey($path, $filter);
return
$this->cache->contains($cacheKey) ||
$this->resolver->isStored($path, $filter);
} | [
"public",
"function",
"isStored",
"(",
"$",
"path",
",",
"$",
"filter",
")",
"{",
"$",
"cacheKey",
"=",
"$",
"this",
"->",
"generateCacheKey",
"(",
"$",
"path",
",",
"$",
"filter",
")",
";",
"return",
"$",
"this",
"->",
"cache",
"->",
"contains",
"("... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/CacheResolver.php#L67-L74 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/CacheResolver.php | CacheResolver.resolve | public function resolve($path, $filter)
{
$key = $this->generateCacheKey($path, $filter);
if ($this->cache->contains($key)) {
return $this->cache->fetch($key);
}
$resolved = $this->resolver->resolve($path, $filter);
$this->saveToCache($key, $resolved);
... | php | public function resolve($path, $filter)
{
$key = $this->generateCacheKey($path, $filter);
if ($this->cache->contains($key)) {
return $this->cache->fetch($key);
}
$resolved = $this->resolver->resolve($path, $filter);
$this->saveToCache($key, $resolved);
... | [
"public",
"function",
"resolve",
"(",
"$",
"path",
",",
"$",
"filter",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"generateCacheKey",
"(",
"$",
"path",
",",
"$",
"filter",
")",
";",
"if",
"(",
"$",
"this",
"->",
"cache",
"->",
"contains",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/CacheResolver.php#L79-L91 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/CacheResolver.php | CacheResolver.remove | public function remove(array $paths, array $filters)
{
$this->resolver->remove($paths, $filters);
foreach ($filters as $filter) {
if (empty($paths)) {
$this->removePathAndFilter(null, $filter);
} else {
foreach ($paths as $path) {
... | php | public function remove(array $paths, array $filters)
{
$this->resolver->remove($paths, $filters);
foreach ($filters as $filter) {
if (empty($paths)) {
$this->removePathAndFilter(null, $filter);
} else {
foreach ($paths as $path) {
... | [
"public",
"function",
"remove",
"(",
"array",
"$",
"paths",
",",
"array",
"$",
"filters",
")",
"{",
"$",
"this",
"->",
"resolver",
"->",
"remove",
"(",
"$",
"paths",
",",
"$",
"filters",
")",
";",
"foreach",
"(",
"$",
"filters",
"as",
"$",
"filter",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/CacheResolver.php#L104-L117 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/CacheResolver.php | CacheResolver.generateCacheKey | public function generateCacheKey($path, $filter)
{
return implode('.', [
$this->sanitizeCacheKeyPart($this->options['global_prefix']),
$this->sanitizeCacheKeyPart($this->options['prefix']),
$this->sanitizeCacheKeyPart($filter),
$this->sanitizeCacheKeyPart($pat... | php | public function generateCacheKey($path, $filter)
{
return implode('.', [
$this->sanitizeCacheKeyPart($this->options['global_prefix']),
$this->sanitizeCacheKeyPart($this->options['prefix']),
$this->sanitizeCacheKeyPart($filter),
$this->sanitizeCacheKeyPart($pat... | [
"public",
"function",
"generateCacheKey",
"(",
"$",
"path",
",",
"$",
"filter",
")",
"{",
"return",
"implode",
"(",
"'.'",
",",
"[",
"$",
"this",
"->",
"sanitizeCacheKeyPart",
"(",
"$",
"this",
"->",
"options",
"[",
"'global_prefix'",
"]",
")",
",",
"$",... | Generate a unique cache key based on the given parameters.
When overriding this method, ensure generateIndexKey is adjusted accordingly.
@param string $path The image path in use
@param string $filter The filter in use
@return string | [
"Generate",
"a",
"unique",
"cache",
"key",
"based",
"on",
"the",
"given",
"parameters",
"."
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/CacheResolver.php#L129-L137 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/CacheResolver.php | CacheResolver.generateIndexKey | protected function generateIndexKey($cacheKey)
{
$cacheKeyStack = explode('.', $cacheKey);
return implode('.', [
$this->sanitizeCacheKeyPart($this->options['global_prefix']),
$this->sanitizeCacheKeyPart($this->options['prefix']),
$this->sanitizeCacheKeyPart($this... | php | protected function generateIndexKey($cacheKey)
{
$cacheKeyStack = explode('.', $cacheKey);
return implode('.', [
$this->sanitizeCacheKeyPart($this->options['global_prefix']),
$this->sanitizeCacheKeyPart($this->options['prefix']),
$this->sanitizeCacheKeyPart($this... | [
"protected",
"function",
"generateIndexKey",
"(",
"$",
"cacheKey",
")",
"{",
"$",
"cacheKeyStack",
"=",
"explode",
"(",
"'.'",
",",
"$",
"cacheKey",
")",
";",
"return",
"implode",
"(",
"'.'",
",",
"[",
"$",
"this",
"->",
"sanitizeCacheKeyPart",
"(",
"$",
... | Generate the index key for the given cacheKey.
The index contains a list of cache keys related to an image and a filter.
@param string $cacheKey
@return string | [
"Generate",
"the",
"index",
"key",
"for",
"the",
"given",
"cacheKey",
"."
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/CacheResolver.php#L178-L188 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/CacheResolver.php | CacheResolver.saveToCache | protected function saveToCache($cacheKey, $content)
{
// Create or update the index list containing all cache keys for a given image and filter pairing.
$indexKey = $this->generateIndexKey($cacheKey);
if ($this->cache->contains($indexKey)) {
$index = (array) $this->cache->fetch($... | php | protected function saveToCache($cacheKey, $content)
{
// Create or update the index list containing all cache keys for a given image and filter pairing.
$indexKey = $this->generateIndexKey($cacheKey);
if ($this->cache->contains($indexKey)) {
$index = (array) $this->cache->fetch($... | [
"protected",
"function",
"saveToCache",
"(",
"$",
"cacheKey",
",",
"$",
"content",
")",
"{",
"// Create or update the index list containing all cache keys for a given image and filter pairing.",
"$",
"indexKey",
"=",
"$",
"this",
"->",
"generateIndexKey",
"(",
"$",
"cacheKe... | Save the given content to the cache and update the cache index.
@param string $cacheKey
@param mixed $content
@return bool | [
"Save",
"the",
"given",
"content",
"to",
"the",
"cache",
"and",
"update",
"the",
"cache",
"index",
"."
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/CacheResolver.php#L208-L233 |
liip/LiipImagineBundle | Imagine/Filter/FilterManager.php | FilterManager.addLoader | public function addLoader(string $filter, LoaderInterface $loader): void
{
$this->loaders[$filter] = $loader;
} | php | public function addLoader(string $filter, LoaderInterface $loader): void
{
$this->loaders[$filter] = $loader;
} | [
"public",
"function",
"addLoader",
"(",
"string",
"$",
"filter",
",",
"LoaderInterface",
"$",
"loader",
")",
":",
"void",
"{",
"$",
"this",
"->",
"loaders",
"[",
"$",
"filter",
"]",
"=",
"$",
"loader",
";",
"}"
] | Adds a loader to handle the given filter.
@param string $filter
@param LoaderInterface $loader | [
"Adds",
"a",
"loader",
"to",
"handle",
"the",
"given",
"filter",
"."
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/FilterManager.php#L68-L71 |
liip/LiipImagineBundle | Imagine/Filter/FilterManager.php | FilterManager.addPostProcessor | public function addPostProcessor(string $name, PostProcessorInterface $postProcessor): void
{
$this->postProcessors[$name] = $postProcessor;
} | php | public function addPostProcessor(string $name, PostProcessorInterface $postProcessor): void
{
$this->postProcessors[$name] = $postProcessor;
} | [
"public",
"function",
"addPostProcessor",
"(",
"string",
"$",
"name",
",",
"PostProcessorInterface",
"$",
"postProcessor",
")",
":",
"void",
"{",
"$",
"this",
"->",
"postProcessors",
"[",
"$",
"name",
"]",
"=",
"$",
"postProcessor",
";",
"}"
] | Adds a post-processor to handle binaries.
@param string $name
@param PostProcessorInterface $postProcessor | [
"Adds",
"a",
"post",
"-",
"processor",
"to",
"handle",
"binaries",
"."
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/FilterManager.php#L79-L82 |
liip/LiipImagineBundle | Imagine/Filter/FilterManager.php | FilterManager.apply | public function apply(BinaryInterface $binary, array $config): BinaryInterface
{
$config += [
'quality' => 100,
'animated' => false,
];
return $this->applyPostProcessors($this->applyFilters($binary, $config), $config);
} | php | public function apply(BinaryInterface $binary, array $config): BinaryInterface
{
$config += [
'quality' => 100,
'animated' => false,
];
return $this->applyPostProcessors($this->applyFilters($binary, $config), $config);
} | [
"public",
"function",
"apply",
"(",
"BinaryInterface",
"$",
"binary",
",",
"array",
"$",
"config",
")",
":",
"BinaryInterface",
"{",
"$",
"config",
"+=",
"[",
"'quality'",
"=>",
"100",
",",
"'animated'",
"=>",
"false",
",",
"]",
";",
"return",
"$",
"this... | @param BinaryInterface $binary
@param array $config
@throws \InvalidArgumentException
@return BinaryInterface | [
"@param",
"BinaryInterface",
"$binary",
"@param",
"array",
"$config"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/FilterManager.php#L100-L108 |
liip/LiipImagineBundle | Imagine/Filter/FilterManager.php | FilterManager.applyFilters | public function applyFilters(BinaryInterface $binary, array $config): BinaryInterface
{
if ($binary instanceof FileBinaryInterface) {
$image = $this->imagine->open($binary->getPath());
} else {
$image = $this->imagine->load($binary->getContent());
}
foreach (... | php | public function applyFilters(BinaryInterface $binary, array $config): BinaryInterface
{
if ($binary instanceof FileBinaryInterface) {
$image = $this->imagine->open($binary->getPath());
} else {
$image = $this->imagine->load($binary->getContent());
}
foreach (... | [
"public",
"function",
"applyFilters",
"(",
"BinaryInterface",
"$",
"binary",
",",
"array",
"$",
"config",
")",
":",
"BinaryInterface",
"{",
"if",
"(",
"$",
"binary",
"instanceof",
"FileBinaryInterface",
")",
"{",
"$",
"image",
"=",
"$",
"this",
"->",
"imagin... | @param BinaryInterface $binary
@param array $config
@return BinaryInterface | [
"@param",
"BinaryInterface",
"$binary",
"@param",
"array",
"$config"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/FilterManager.php#L116-L134 |
liip/LiipImagineBundle | Imagine/Filter/FilterManager.php | FilterManager.applyFilter | public function applyFilter(BinaryInterface $binary, $filter, array $runtimeConfig = [])
{
$config = array_replace_recursive(
$this->getFilterConfiguration()->get($filter),
$runtimeConfig
);
return $this->apply($binary, $config);
} | php | public function applyFilter(BinaryInterface $binary, $filter, array $runtimeConfig = [])
{
$config = array_replace_recursive(
$this->getFilterConfiguration()->get($filter),
$runtimeConfig
);
return $this->apply($binary, $config);
} | [
"public",
"function",
"applyFilter",
"(",
"BinaryInterface",
"$",
"binary",
",",
"$",
"filter",
",",
"array",
"$",
"runtimeConfig",
"=",
"[",
"]",
")",
"{",
"$",
"config",
"=",
"array_replace_recursive",
"(",
"$",
"this",
"->",
"getFilterConfiguration",
"(",
... | Apply the provided filter set on the given binary.
@param BinaryInterface $binary
@param string $filter
@param array $runtimeConfig
@throws \InvalidArgumentException
@return BinaryInterface | [
"Apply",
"the",
"provided",
"filter",
"set",
"on",
"the",
"given",
"binary",
"."
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/FilterManager.php#L147-L155 |
liip/LiipImagineBundle | Imagine/Filter/FilterManager.php | FilterManager.applyPostProcessors | public function applyPostProcessors(BinaryInterface $binary, array $config): BinaryInterface
{
foreach ($this->sanitizePostProcessors($config['post_processors'] ?? []) as $name => $options) {
$binary = $this->postProcessors[$name]->process($binary, $options);
}
return $binary;
... | php | public function applyPostProcessors(BinaryInterface $binary, array $config): BinaryInterface
{
foreach ($this->sanitizePostProcessors($config['post_processors'] ?? []) as $name => $options) {
$binary = $this->postProcessors[$name]->process($binary, $options);
}
return $binary;
... | [
"public",
"function",
"applyPostProcessors",
"(",
"BinaryInterface",
"$",
"binary",
",",
"array",
"$",
"config",
")",
":",
"BinaryInterface",
"{",
"foreach",
"(",
"$",
"this",
"->",
"sanitizePostProcessors",
"(",
"$",
"config",
"[",
"'post_processors'",
"]",
"??... | @param BinaryInterface $binary
@param array $config
@throws \InvalidArgumentException
@return BinaryInterface | [
"@param",
"BinaryInterface",
"$binary",
"@param",
"array",
"$config"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/FilterManager.php#L165-L172 |
liip/LiipImagineBundle | Imagine/Filter/FilterManager.php | FilterManager.exportConfiguredImageBinary | private function exportConfiguredImageBinary(BinaryInterface $binary, ImageInterface $image, array $config): BinaryInterface
{
$options = [
'quality' => $config['quality'],
];
if (isset($config['jpeg_quality'])) {
$options['jpeg_quality'] = $config['jpeg_quality'];
... | php | private function exportConfiguredImageBinary(BinaryInterface $binary, ImageInterface $image, array $config): BinaryInterface
{
$options = [
'quality' => $config['quality'],
];
if (isset($config['jpeg_quality'])) {
$options['jpeg_quality'] = $config['jpeg_quality'];
... | [
"private",
"function",
"exportConfiguredImageBinary",
"(",
"BinaryInterface",
"$",
"binary",
",",
"ImageInterface",
"$",
"image",
",",
"array",
"$",
"config",
")",
":",
"BinaryInterface",
"{",
"$",
"options",
"=",
"[",
"'quality'",
"=>",
"$",
"config",
"[",
"'... | @param BinaryInterface $binary
@param ImageInterface $image
@param array $config
@return BinaryInterface | [
"@param",
"BinaryInterface",
"$binary",
"@param",
"ImageInterface",
"$image",
"@param",
"array",
"$config"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/FilterManager.php#L181-L211 |
liip/LiipImagineBundle | Imagine/Filter/FilterManager.php | FilterManager.sanitizeFilters | private function sanitizeFilters(array $filters): array
{
$sanitized = array_filter($filters, function (string $name): bool {
return isset($this->loaders[$name]);
}, ARRAY_FILTER_USE_KEY);
if (\count($filters) !== \count($sanitized)) {
throw new \InvalidArgumentExcep... | php | private function sanitizeFilters(array $filters): array
{
$sanitized = array_filter($filters, function (string $name): bool {
return isset($this->loaders[$name]);
}, ARRAY_FILTER_USE_KEY);
if (\count($filters) !== \count($sanitized)) {
throw new \InvalidArgumentExcep... | [
"private",
"function",
"sanitizeFilters",
"(",
"array",
"$",
"filters",
")",
":",
"array",
"{",
"$",
"sanitized",
"=",
"array_filter",
"(",
"$",
"filters",
",",
"function",
"(",
"string",
"$",
"name",
")",
":",
"bool",
"{",
"return",
"isset",
"(",
"$",
... | @param array $filters
@return array | [
"@param",
"array",
"$filters"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/FilterManager.php#L218-L231 |
liip/LiipImagineBundle | Imagine/Filter/FilterManager.php | FilterManager.sanitizePostProcessors | private function sanitizePostProcessors(array $processors): array
{
$sanitized = array_filter($processors, function (string $name): bool {
return isset($this->postProcessors[$name]);
}, ARRAY_FILTER_USE_KEY);
if (\count($processors) !== \count($sanitized)) {
throw ne... | php | private function sanitizePostProcessors(array $processors): array
{
$sanitized = array_filter($processors, function (string $name): bool {
return isset($this->postProcessors[$name]);
}, ARRAY_FILTER_USE_KEY);
if (\count($processors) !== \count($sanitized)) {
throw ne... | [
"private",
"function",
"sanitizePostProcessors",
"(",
"array",
"$",
"processors",
")",
":",
"array",
"{",
"$",
"sanitized",
"=",
"array_filter",
"(",
"$",
"processors",
",",
"function",
"(",
"string",
"$",
"name",
")",
":",
"bool",
"{",
"return",
"isset",
... | @param array $processors
@return array | [
"@param",
"array",
"$processors"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/FilterManager.php#L238-L251 |
liip/LiipImagineBundle | Imagine/Filter/Loader/RotateFilterLoader.php | RotateFilterLoader.load | public function load(ImageInterface $image, array $options = [])
{
$angle = isset($options['angle']) ? (int) $options['angle'] : 0;
return 0 === $angle ? $image : $image->rotate($angle);
} | php | public function load(ImageInterface $image, array $options = [])
{
$angle = isset($options['angle']) ? (int) $options['angle'] : 0;
return 0 === $angle ? $image : $image->rotate($angle);
} | [
"public",
"function",
"load",
"(",
"ImageInterface",
"$",
"image",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"angle",
"=",
"isset",
"(",
"$",
"options",
"[",
"'angle'",
"]",
")",
"?",
"(",
"int",
")",
"$",
"options",
"[",
"'angle'... | Loads and applies a filter on the given image.
@param ImageInterface $image
@param array $options
@return ManipulatorInterface | [
"Loads",
"and",
"applies",
"a",
"filter",
"on",
"the",
"given",
"image",
"."
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/RotateFilterLoader.php#L32-L37 |
liip/LiipImagineBundle | DependencyInjection/Factory/Resolver/AwsS3ResolverFactory.php | AwsS3ResolverFactory.create | public function create(ContainerBuilder $container, $resolverName, array $config)
{
$awsS3ClientId = 'liip_imagine.cache.resolver.'.$resolverName.'.client';
$awsS3ClientDefinition = new Definition('Aws\S3\S3Client');
$awsS3ClientDefinition->setFactory(['Aws\S3\S3Client', 'factory']);
... | php | public function create(ContainerBuilder $container, $resolverName, array $config)
{
$awsS3ClientId = 'liip_imagine.cache.resolver.'.$resolverName.'.client';
$awsS3ClientDefinition = new Definition('Aws\S3\S3Client');
$awsS3ClientDefinition->setFactory(['Aws\S3\S3Client', 'factory']);
... | [
"public",
"function",
"create",
"(",
"ContainerBuilder",
"$",
"container",
",",
"$",
"resolverName",
",",
"array",
"$",
"config",
")",
"{",
"$",
"awsS3ClientId",
"=",
"'liip_imagine.cache.resolver.'",
".",
"$",
"resolverName",
".",
"'.client'",
";",
"$",
"awsS3C... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Resolver/AwsS3ResolverFactory.php#L24-L75 |
liip/LiipImagineBundle | DependencyInjection/Factory/Resolver/AwsS3ResolverFactory.php | AwsS3ResolverFactory.addConfiguration | public function addConfiguration(ArrayNodeDefinition $builder)
{
$builder
->children()
->scalarNode('bucket')
->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('cache')
->defaultValue(... | php | public function addConfiguration(ArrayNodeDefinition $builder)
{
$builder
->children()
->scalarNode('bucket')
->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('cache')
->defaultValue(... | [
"public",
"function",
"addConfiguration",
"(",
"ArrayNodeDefinition",
"$",
"builder",
")",
"{",
"$",
"builder",
"->",
"children",
"(",
")",
"->",
"scalarNode",
"(",
"'bucket'",
")",
"->",
"isRequired",
"(",
")",
"->",
"cannotBeEmpty",
"(",
")",
"->",
"end",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Factory/Resolver/AwsS3ResolverFactory.php#L88-L129 |
liip/LiipImagineBundle | LiipImagineBundle.php | LiipImagineBundle.build | public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new DriverCompilerPass());
$container->addCompilerPass(new LoadersCompilerPass());
$container->addCompilerPass(new FiltersCompilerPass());
$container->addCompilerPass(... | php | public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new DriverCompilerPass());
$container->addCompilerPass(new LoadersCompilerPass());
$container->addCompilerPass(new FiltersCompilerPass());
$container->addCompilerPass(... | [
"public",
"function",
"build",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"parent",
"::",
"build",
"(",
"$",
"container",
")",
";",
"$",
"container",
"->",
"addCompilerPass",
"(",
"new",
"DriverCompilerPass",
"(",
")",
")",
";",
"$",
"container",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/LiipImagineBundle.php#L38-L66 |
liip/LiipImagineBundle | DependencyInjection/Compiler/FiltersCompilerPass.php | FiltersCompilerPass.process | public function process(ContainerBuilder $container)
{
$tags = $container->findTaggedServiceIds('liip_imagine.filter.loader');
if (\count($tags) > 0 && $container->hasDefinition('liip_imagine.filter.manager')) {
$manager = $container->getDefinition('liip_imagine.filter.manager');
... | php | public function process(ContainerBuilder $container)
{
$tags = $container->findTaggedServiceIds('liip_imagine.filter.loader');
if (\count($tags) > 0 && $container->hasDefinition('liip_imagine.filter.manager')) {
$manager = $container->getDefinition('liip_imagine.filter.manager');
... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"tags",
"=",
"$",
"container",
"->",
"findTaggedServiceIds",
"(",
"'liip_imagine.filter.loader'",
")",
";",
"if",
"(",
"\\",
"count",
"(",
"$",
"tags",
")",
">",
"0",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/DependencyInjection/Compiler/FiltersCompilerPass.php#L22-L34 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/WebPathResolver.php | WebPathResolver.resolve | public function resolve($path, $filter)
{
return sprintf('%s/%s',
$this->getBaseUrl(),
$this->getFileUrl($path, $filter)
);
} | php | public function resolve($path, $filter)
{
return sprintf('%s/%s',
$this->getBaseUrl(),
$this->getFileUrl($path, $filter)
);
} | [
"public",
"function",
"resolve",
"(",
"$",
"path",
",",
"$",
"filter",
")",
"{",
"return",
"sprintf",
"(",
"'%s/%s'",
",",
"$",
"this",
"->",
"getBaseUrl",
"(",
")",
",",
"$",
"this",
"->",
"getFileUrl",
"(",
"$",
"path",
",",
"$",
"filter",
")",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/WebPathResolver.php#L69-L75 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/WebPathResolver.php | WebPathResolver.store | public function store(BinaryInterface $binary, $path, $filter)
{
$this->filesystem->dumpFile(
$this->getFilePath($path, $filter),
$binary->getContent()
);
} | php | public function store(BinaryInterface $binary, $path, $filter)
{
$this->filesystem->dumpFile(
$this->getFilePath($path, $filter),
$binary->getContent()
);
} | [
"public",
"function",
"store",
"(",
"BinaryInterface",
"$",
"binary",
",",
"$",
"path",
",",
"$",
"filter",
")",
"{",
"$",
"this",
"->",
"filesystem",
"->",
"dumpFile",
"(",
"$",
"this",
"->",
"getFilePath",
"(",
"$",
"path",
",",
"$",
"filter",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/WebPathResolver.php#L88-L94 |
liip/LiipImagineBundle | Imagine/Cache/Resolver/WebPathResolver.php | WebPathResolver.remove | public function remove(array $paths, array $filters)
{
if (empty($paths) && empty($filters)) {
return;
}
if (empty($paths)) {
$filtersCacheDir = [];
foreach ($filters as $filter) {
$filtersCacheDir[] = $this->cacheRoot.'/'.$filter;
... | php | public function remove(array $paths, array $filters)
{
if (empty($paths) && empty($filters)) {
return;
}
if (empty($paths)) {
$filtersCacheDir = [];
foreach ($filters as $filter) {
$filtersCacheDir[] = $this->cacheRoot.'/'.$filter;
... | [
"public",
"function",
"remove",
"(",
"array",
"$",
"paths",
",",
"array",
"$",
"filters",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"paths",
")",
"&&",
"empty",
"(",
"$",
"filters",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Cache/Resolver/WebPathResolver.php#L99-L121 |
liip/LiipImagineBundle | Imagine/Filter/Loader/RelativeResizeFilterLoader.php | RelativeResizeFilterLoader.load | public function load(ImageInterface $image, array $options = [])
{
foreach ($options as $method => $parameter) {
$filter = new RelativeResize($method, $parameter);
return $filter->apply($image);
}
throw new InvalidArgumentException('Expected method/parameter pair, n... | php | public function load(ImageInterface $image, array $options = [])
{
foreach ($options as $method => $parameter) {
$filter = new RelativeResize($method, $parameter);
return $filter->apply($image);
}
throw new InvalidArgumentException('Expected method/parameter pair, n... | [
"public",
"function",
"load",
"(",
"ImageInterface",
"$",
"image",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"method",
"=>",
"$",
"parameter",
")",
"{",
"$",
"filter",
"=",
"new",
"RelativeResize"... | {@inheritdoc} | [
"{"
] | train | https://github.com/liip/LiipImagineBundle/blob/6b5995dff0167ab7507e33bb0552b2db7964905c/Imagine/Filter/Loader/RelativeResizeFilterLoader.php#L28-L37 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/CacheManager.php | CacheManager.getInstance | public static function getInstance(string $driver = self::AUTOMATIC_DRIVER_CLASS, $config = null, string $instanceId = null): ExtendedCacheItemPoolInterface
{
$config = self::validateConfig($config);
$driver = self::standardizeDriverName($driver);
if (!$driver || $driver === self::AUTOMATIC... | php | public static function getInstance(string $driver = self::AUTOMATIC_DRIVER_CLASS, $config = null, string $instanceId = null): ExtendedCacheItemPoolInterface
{
$config = self::validateConfig($config);
$driver = self::standardizeDriverName($driver);
if (!$driver || $driver === self::AUTOMATIC... | [
"public",
"static",
"function",
"getInstance",
"(",
"string",
"$",
"driver",
"=",
"self",
"::",
"AUTOMATIC_DRIVER_CLASS",
",",
"$",
"config",
"=",
"null",
",",
"string",
"$",
"instanceId",
"=",
"null",
")",
":",
"ExtendedCacheItemPoolInterface",
"{",
"$",
"con... | @param string $driver
@param array|ConfigurationOption $config
@param string $instanceId
@return ExtendedCacheItemPoolInterface
@throws PhpfastcacheDriverCheckException
@throws PhpfastcacheInvalidConfigurationException
@throws PhpfastcacheDriverNotFoundException
@throws PhpfastcacheInvalidArgumentException
@throws Ph... | [
"@param",
"string",
"$driver",
"@param",
"array|ConfigurationOption",
"$config",
"@param",
"string",
"$instanceId"
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/CacheManager.php#L113-L149 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/CacheManager.php | CacheManager.getInstanceById | public static function getInstanceById(string $instanceId): ExtendedCacheItemPoolInterface
{
if (isset(self::$instances[$instanceId])) {
return self::$instances[$instanceId];
}
throw new PhpfastcacheInstanceNotFoundException(\sprintf('Instance ID %s not found', $instanceId));
... | php | public static function getInstanceById(string $instanceId): ExtendedCacheItemPoolInterface
{
if (isset(self::$instances[$instanceId])) {
return self::$instances[$instanceId];
}
throw new PhpfastcacheInstanceNotFoundException(\sprintf('Instance ID %s not found', $instanceId));
... | [
"public",
"static",
"function",
"getInstanceById",
"(",
"string",
"$",
"instanceId",
")",
":",
"ExtendedCacheItemPoolInterface",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"instances",
"[",
"$",
"instanceId",
"]",
")",
")",
"{",
"return",
"self",
"::",... | @param string $instanceId
@return ExtendedCacheItemPoolInterface
@throws PhpfastcacheInvalidArgumentException
@throws PhpfastcacheInstanceNotFoundException | [
"@param",
"string",
"$instanceId"
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/CacheManager.php#L186-L193 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/CacheManager.php | CacheManager.getDriverList | public static function getDriverList(bool $FQCNAsKey = false): array
{
static $driverList;
if (self::getDefaultNamespacePath() === self::getNamespacePath()) {
if ($driverList === null) {
$prefix = self::CORE_DRIVER_NAMESPACE;
$classMap = self::createClass... | php | public static function getDriverList(bool $FQCNAsKey = false): array
{
static $driverList;
if (self::getDefaultNamespacePath() === self::getNamespacePath()) {
if ($driverList === null) {
$prefix = self::CORE_DRIVER_NAMESPACE;
$classMap = self::createClass... | [
"public",
"static",
"function",
"getDriverList",
"(",
"bool",
"$",
"FQCNAsKey",
"=",
"false",
")",
":",
"array",
"{",
"static",
"$",
"driverList",
";",
"if",
"(",
"self",
"::",
"getDefaultNamespacePath",
"(",
")",
"===",
"self",
"::",
"getNamespacePath",
"("... | Return the list of available drivers Capitalized
with optional FQCN as key
@param bool $FQCNAsKey Describe keys with Full Qualified Class Name
@return string[]
@throws PhpfastcacheUnsupportedOperationException | [
"Return",
"the",
"list",
"of",
"available",
"drivers",
"Capitalized",
"with",
"optional",
"FQCN",
"as",
"key"
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/CacheManager.php#L395-L428 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Api.php | Api.getChangelog | public static function getChangelog(): string
{
$changelogFilename = __DIR__ . '/../../CHANGELOG_API.md';
if (\file_exists($changelogFilename)) {
$string = \str_replace(["\r\n", "\r"], "\n", \trim(\file_get_contents($changelogFilename)));
if ($string) {
return... | php | public static function getChangelog(): string
{
$changelogFilename = __DIR__ . '/../../CHANGELOG_API.md';
if (\file_exists($changelogFilename)) {
$string = \str_replace(["\r\n", "\r"], "\n", \trim(\file_get_contents($changelogFilename)));
if ($string) {
return... | [
"public",
"static",
"function",
"getChangelog",
"(",
")",
":",
"string",
"{",
"$",
"changelogFilename",
"=",
"__DIR__",
".",
"'/../../CHANGELOG_API.md'",
";",
"if",
"(",
"\\",
"file_exists",
"(",
"$",
"changelogFilename",
")",
")",
"{",
"$",
"string",
"=",
"... | Return the API changelog, as a string.
@return string
@throws PhpfastcacheLogicException
@throws PhpfastcacheIOException | [
"Return",
"the",
"API",
"changelog",
"as",
"a",
"string",
"."
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Api.php#L131-L142 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Drivers/Mongodb/Driver.php | Driver.collectionExists | protected function collectionExists($collectionName): bool
{
foreach ($this->database->listCollections() as $collection) {
if ($collection->getName() === $collectionName) {
return true;
}
}
return false;
} | php | protected function collectionExists($collectionName): bool
{
foreach ($this->database->listCollections() as $collection) {
if ($collection->getName() === $collectionName) {
return true;
}
}
return false;
} | [
"protected",
"function",
"collectionExists",
"(",
"$",
"collectionName",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"database",
"->",
"listCollections",
"(",
")",
"as",
"$",
"collection",
")",
"{",
"if",
"(",
"$",
"collection",
"->",
"getNam... | Checks if a collection name exists on the Mongo database.
@param string $collectionName The collection name to check.
@return bool True if the collection exists, false if not. | [
"Checks",
"if",
"a",
"collection",
"name",
"exists",
"on",
"the",
"Mongo",
"database",
"."
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Drivers/Mongodb/Driver.php#L209-L218 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Drivers/Mongodb/Driver.php | Driver.buildConnectionURI | protected function buildConnectionURI($databaseName = ''): string
{
$servers = $this->getConfig()->getServers();
$options = $this->getConfig()->getOptions();
$host = $this->getConfig()->getHost();
$port = $this->getConfig()->getPort();
$username = $this->getConfig()->getUser... | php | protected function buildConnectionURI($databaseName = ''): string
{
$servers = $this->getConfig()->getServers();
$options = $this->getConfig()->getOptions();
$host = $this->getConfig()->getHost();
$port = $this->getConfig()->getPort();
$username = $this->getConfig()->getUser... | [
"protected",
"function",
"buildConnectionURI",
"(",
"$",
"databaseName",
"=",
"''",
")",
":",
"string",
"{",
"$",
"servers",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
"->",
"getServers",
"(",
")",
";",
"$",
"options",
"=",
"$",
"this",
"->",
"getC... | Builds the connection URI from the given parameters.
@param string $databaseName
@return string The connection URI. | [
"Builds",
"the",
"connection",
"URI",
"from",
"the",
"given",
"parameters",
"."
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Drivers/Mongodb/Driver.php#L226-L254 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Drivers/Sqlite/Driver.php | Driver.initDB | public function initDB(\PDO $db)
{
$db->exec('drop table if exists "caching"');
$db->exec('CREATE TABLE "caching" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "keyword" VARCHAR UNIQUE, "object" BLOB, "exp" INTEGER)');
$db->exec('CREATE UNIQUE INDEX "cleanup" ON "caching" ("keyword","exp")');
... | php | public function initDB(\PDO $db)
{
$db->exec('drop table if exists "caching"');
$db->exec('CREATE TABLE "caching" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "keyword" VARCHAR UNIQUE, "object" BLOB, "exp" INTEGER)');
$db->exec('CREATE UNIQUE INDEX "cleanup" ON "caching" ("keyword","exp")');
... | [
"public",
"function",
"initDB",
"(",
"\\",
"PDO",
"$",
"db",
")",
"{",
"$",
"db",
"->",
"exec",
"(",
"'drop table if exists \"caching\"'",
")",
";",
"$",
"db",
"->",
"exec",
"(",
"'CREATE TABLE \"caching\" (\"id\" INTEGER PRIMARY KEY AUTOINCREMENT, \"keyword\" VARCHAR U... | INIT NEW DB
@param \PDO $db | [
"INIT",
"NEW",
"DB"
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Drivers/Sqlite/Driver.php#L218-L225 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Drivers/Sqlite/Driver.php | Driver.initIndexing | public function initIndexing(\PDO $db)
{
// delete everything before reset indexing
$dir = opendir($this->SqliteDir);
while ($file = readdir($dir)) {
if ($file != '.' && $file != '..' && $file != 'indexing' && $file != 'dbfastcache') {
unlink($this->SqliteDir . '... | php | public function initIndexing(\PDO $db)
{
// delete everything before reset indexing
$dir = opendir($this->SqliteDir);
while ($file = readdir($dir)) {
if ($file != '.' && $file != '..' && $file != 'indexing' && $file != 'dbfastcache') {
unlink($this->SqliteDir . '... | [
"public",
"function",
"initIndexing",
"(",
"\\",
"PDO",
"$",
"db",
")",
"{",
"// delete everything before reset indexing",
"$",
"dir",
"=",
"opendir",
"(",
"$",
"this",
"->",
"SqliteDir",
")",
";",
"while",
"(",
"$",
"file",
"=",
"readdir",
"(",
"$",
"dir"... | INIT Indexing DB
@param \PDO $db | [
"INIT",
"Indexing",
"DB"
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Drivers/Sqlite/Driver.php#L231-L247 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Drivers/Sqlite/Driver.php | Driver.indexing | public function indexing($keyword)
{
if ($this->indexing == null) {
$tableCreated = false;
if (!\file_exists($this->SqliteDir . '/indexing')) {
$tableCreated = true;
}
$PDO = new PDO("sqlite:" . $this->SqliteDir . '/' . self::INDEXING_FILE);
... | php | public function indexing($keyword)
{
if ($this->indexing == null) {
$tableCreated = false;
if (!\file_exists($this->SqliteDir . '/indexing')) {
$tableCreated = true;
}
$PDO = new PDO("sqlite:" . $this->SqliteDir . '/' . self::INDEXING_FILE);
... | [
"public",
"function",
"indexing",
"(",
"$",
"keyword",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"indexing",
"==",
"null",
")",
"{",
"$",
"tableCreated",
"=",
"false",
";",
"if",
"(",
"!",
"\\",
"file_exists",
"(",
"$",
"this",
"->",
"SqliteDir",
".",
... | INIT Instant DB
Return Database of Keyword
@param $keyword
@return int | [
"INIT",
"Instant",
"DB",
"Return",
"Database",
"of",
"Keyword"
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Drivers/Sqlite/Driver.php#L255-L318 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Util/Directory.php | Directory.dirSize | public static function dirSize(string $directory, bool $includeDirAllocSize = false): int
{
$size = 0;
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file) {
/**
* @var \SplFileInfo $file
*/
if ($file->isFile()... | php | public static function dirSize(string $directory, bool $includeDirAllocSize = false): int
{
$size = 0;
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file) {
/**
* @var \SplFileInfo $file
*/
if ($file->isFile()... | [
"public",
"static",
"function",
"dirSize",
"(",
"string",
"$",
"directory",
",",
"bool",
"$",
"includeDirAllocSize",
"=",
"false",
")",
":",
"int",
"{",
"$",
"size",
"=",
"0",
";",
"foreach",
"(",
"new",
"RecursiveIteratorIterator",
"(",
"new",
"RecursiveDir... | Get the directory size
@param string $directory
@param bool $includeDirAllocSize
@return integer | [
"Get",
"the",
"directory",
"size"
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Util/Directory.php#L34-L51 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Util/Directory.php | Directory.rrmdir | public static function rrmdir(string $source, bool $removeOnlyChildren = false): bool
{
if (empty($source) || \file_exists($source) === false) {
return false;
}
if (\is_file($source) || \is_link($source)) {
\clearstatcache(true, $source);
return \unlink($... | php | public static function rrmdir(string $source, bool $removeOnlyChildren = false): bool
{
if (empty($source) || \file_exists($source) === false) {
return false;
}
if (\is_file($source) || \is_link($source)) {
\clearstatcache(true, $source);
return \unlink($... | [
"public",
"static",
"function",
"rrmdir",
"(",
"string",
"$",
"source",
",",
"bool",
"$",
"removeOnlyChildren",
"=",
"false",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"source",
")",
"||",
"\\",
"file_exists",
"(",
"$",
"source",
")",
"===",... | Recursively delete a directory and all of it's contents - e.g.the equivalent of `rm -r` on the command-line.
Consistent with `rmdir()` and `unlink()`, an E_WARNING level error will be generated on failure.
@param string $source absolute path to directory or file to delete.
@param bool $removeOnlyChildren set to true w... | [
"Recursively",
"delete",
"a",
"directory",
"and",
"all",
"of",
"it",
"s",
"contents",
"-",
"e",
".",
"g",
".",
"the",
"equivalent",
"of",
"rm",
"-",
"r",
"on",
"the",
"command",
"-",
"line",
".",
"Consistent",
"with",
"rmdir",
"()",
"and",
"unlink",
... | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Util/Directory.php#L82-L119 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Util/Directory.php | Directory.getAbsolutePath | public static function getAbsolutePath(string $path): string
{
$parts = \preg_split('~[/\\\\]+~', $path, 0, \PREG_SPLIT_NO_EMPTY);
$absolutes = [];
foreach ($parts as $part) {
if ('.' === $part) {
continue;
}
if ('..' === $part) {
... | php | public static function getAbsolutePath(string $path): string
{
$parts = \preg_split('~[/\\\\]+~', $path, 0, \PREG_SPLIT_NO_EMPTY);
$absolutes = [];
foreach ($parts as $part) {
if ('.' === $part) {
continue;
}
if ('..' === $part) {
... | [
"public",
"static",
"function",
"getAbsolutePath",
"(",
"string",
"$",
"path",
")",
":",
"string",
"{",
"$",
"parts",
"=",
"\\",
"preg_split",
"(",
"'~[/\\\\\\\\]+~'",
",",
"$",
"path",
",",
"0",
",",
"\\",
"PREG_SPLIT_NO_EMPTY",
")",
";",
"$",
"absolutes"... | Alias of realpath() but work
on non-existing files
@param string $path
@return string | [
"Alias",
"of",
"realpath",
"()",
"but",
"work",
"on",
"non",
"-",
"existing",
"files"
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Util/Directory.php#L128-L149 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Core/Pool/IO/IOHelperTrait.php | IOHelperTrait.getStats | public function getStats(): DriverStatistic
{
$stat = new DriverStatistic();
$path = $this->getFilePath(false);
if (!\is_dir($path)) {
throw new PhpfastcacheIOException("Can't read PATH:" . $path);
}
$stat->setData(\implode(', ', \array_keys($this->itemInstances... | php | public function getStats(): DriverStatistic
{
$stat = new DriverStatistic();
$path = $this->getFilePath(false);
if (!\is_dir($path)) {
throw new PhpfastcacheIOException("Can't read PATH:" . $path);
}
$stat->setData(\implode(', ', \array_keys($this->itemInstances... | [
"public",
"function",
"getStats",
"(",
")",
":",
"DriverStatistic",
"{",
"$",
"stat",
"=",
"new",
"DriverStatistic",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"getFilePath",
"(",
"false",
")",
";",
"if",
"(",
"!",
"\\",
"is_dir",
"(",
"$",
... | Provide a generic getStats() method
for files-based drivers
@return DriverStatistic
@throws \Phpfastcache\Exceptions\PhpfastcacheIOException | [
"Provide",
"a",
"generic",
"getStats",
"()",
"method",
"for",
"files",
"-",
"based",
"drivers"
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Core/Pool/IO/IOHelperTrait.php#L335-L352 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Core/Pool/ExtendedCacheItemPoolTrait.php | ExtendedCacheItemPoolTrait.isAttached | public function isAttached(CacheItemInterface $item)
{
if (isset($this->itemInstances[$item->getKey()])) {
return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[$item->getKey()]);
}
return null;
} | php | public function isAttached(CacheItemInterface $item)
{
if (isset($this->itemInstances[$item->getKey()])) {
return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[$item->getKey()]);
}
return null;
} | [
"public",
"function",
"isAttached",
"(",
"CacheItemInterface",
"$",
"item",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"itemInstances",
"[",
"$",
"item",
"->",
"getKey",
"(",
")",
"]",
")",
")",
"{",
"return",
"\\",
"spl_object_hash",
"(",
"... | Returns true if the item exists, is attached and the Spl Hash matches
Returns false if the item exists, is attached and the Spl Hash mismatches
Returns null if the item does not exists
@param \Psr\Cache\CacheItemInterface $item
@return bool|null | [
"Returns",
"true",
"if",
"the",
"item",
"exists",
"is",
"attached",
"and",
"the",
"Spl",
"Hash",
"matches",
"Returns",
"false",
"if",
"the",
"item",
"exists",
"is",
"attached",
"and",
"the",
"Spl",
"Hash",
"mismatches",
"Returns",
"null",
"if",
"the",
"ite... | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Core/Pool/ExtendedCacheItemPoolTrait.php#L443-L449 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Core/Item/ItemExtendedTrait.php | ItemExtendedTrait.getLength | public function getLength(): int
{
switch (\gettype($this->data)) {
case 'array':
case 'object':
if (\is_array($this->data) || $this->data instanceof \Countable) {
return \count($this->data);
}
break;
ca... | php | public function getLength(): int
{
switch (\gettype($this->data)) {
case 'array':
case 'object':
if (\is_array($this->data) || $this->data instanceof \Countable) {
return \count($this->data);
}
break;
ca... | [
"public",
"function",
"getLength",
"(",
")",
":",
"int",
"{",
"switch",
"(",
"\\",
"gettype",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"case",
"'array'",
":",
"case",
"'object'",
":",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"this",
"->",
"data... | Return the data length:
Either the string length if it's a string (binary mode)
# or the number of element (count) if it's an array
# or the number returned by count() if it's an object implementing \Countable interface
# -1 for anything else
@return int | [
"Return",
"the",
"data",
"length",
":",
"Either",
"the",
"string",
"length",
"if",
"it",
"s",
"a",
"string",
"(",
"binary",
"mode",
")",
"#",
"or",
"the",
"number",
"of",
"element",
"(",
"count",
")",
"if",
"it",
"s",
"an",
"array",
"#",
"or",
"the... | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Core/Item/ItemExtendedTrait.php#L221-L237 |
PHPSocialNetwork/phpfastcache | lib/Phpfastcache/Core/Item/ItemExtendedTrait.php | ItemExtendedTrait.getDataAsJsonString | public function getDataAsJsonString($option = 0, $depth = 512): string
{
$data = $this->get();
if (\is_object($data) || \is_array($data)) {
$data = \json_encode($data, $option, $depth);
} else {
$data = \json_encode([$data], $option, $depth);
}
retur... | php | public function getDataAsJsonString($option = 0, $depth = 512): string
{
$data = $this->get();
if (\is_object($data) || \is_array($data)) {
$data = \json_encode($data, $option, $depth);
} else {
$data = \json_encode([$data], $option, $depth);
}
retur... | [
"public",
"function",
"getDataAsJsonString",
"(",
"$",
"option",
"=",
"0",
",",
"$",
"depth",
"=",
"512",
")",
":",
"string",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"get",
"(",
")",
";",
"if",
"(",
"\\",
"is_object",
"(",
"$",
"data",
")",
"||... | Return the data as a well-formatted string.
Any scalar value will be casted to an array
@param int $option \json_encode() options
@param int $depth \json_encode() depth
@return string | [
"Return",
"the",
"data",
"as",
"a",
"well",
"-",
"formatted",
"string",
".",
"Any",
"scalar",
"value",
"will",
"be",
"casted",
"to",
"an",
"array"
] | train | https://github.com/PHPSocialNetwork/phpfastcache/blob/231af06e5e61e3fbad100ef5c778a53c270d0e6b/lib/Phpfastcache/Core/Item/ItemExtendedTrait.php#L421-L432 |
Jimdo/prometheus_client_php | src/Prometheus/Storage/InMemory.php | InMemory.histogramBucketValueKey | private function histogramBucketValueKey(array $data, $bucket)
{
return implode(':', [
$data['type'],
$data['name'],
$this->encodeLabelValues($data['labelValues']),
$bucket
]);
} | php | private function histogramBucketValueKey(array $data, $bucket)
{
return implode(':', [
$data['type'],
$data['name'],
$this->encodeLabelValues($data['labelValues']),
$bucket
]);
} | [
"private",
"function",
"histogramBucketValueKey",
"(",
"array",
"$",
"data",
",",
"$",
"bucket",
")",
"{",
"return",
"implode",
"(",
"':'",
",",
"[",
"$",
"data",
"[",
"'type'",
"]",
",",
"$",
"data",
"[",
"'name'",
"]",
",",
"$",
"this",
"->",
"enco... | @param array $data
@param $bucket
@return string | [
"@param",
"array",
"$data"
] | train | https://github.com/Jimdo/prometheus_client_php/blob/01c89375e484a55683c65fc2056cfd0869461748/src/Prometheus/Storage/InMemory.php#L214-L222 |
Jimdo/prometheus_client_php | src/Prometheus/PushGateway.php | PushGateway.push | public function push(CollectorRegistry $collectorRegistry, $job, $groupingKey = null)
{
$this->doRequest($collectorRegistry, $job, $groupingKey, 'put');
} | php | public function push(CollectorRegistry $collectorRegistry, $job, $groupingKey = null)
{
$this->doRequest($collectorRegistry, $job, $groupingKey, 'put');
} | [
"public",
"function",
"push",
"(",
"CollectorRegistry",
"$",
"collectorRegistry",
",",
"$",
"job",
",",
"$",
"groupingKey",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"doRequest",
"(",
"$",
"collectorRegistry",
",",
"$",
"job",
",",
"$",
"groupingKey",
",",... | Pushes all metrics in a Collector, replacing all those with the same job.
Uses HTTP PUT.
@param CollectorRegistry $collectorRegistry
@param $job
@param $groupingKey | [
"Pushes",
"all",
"metrics",
"in",
"a",
"Collector",
"replacing",
"all",
"those",
"with",
"the",
"same",
"job",
".",
"Uses",
"HTTP",
"PUT",
"."
] | train | https://github.com/Jimdo/prometheus_client_php/blob/01c89375e484a55683c65fc2056cfd0869461748/src/Prometheus/PushGateway.php#L29-L32 |
Jimdo/prometheus_client_php | src/Prometheus/PushGateway.php | PushGateway.pushAdd | public function pushAdd(CollectorRegistry $collectorRegistry, $job, $groupingKey = null)
{
$this->doRequest($collectorRegistry, $job, $groupingKey, 'post');
} | php | public function pushAdd(CollectorRegistry $collectorRegistry, $job, $groupingKey = null)
{
$this->doRequest($collectorRegistry, $job, $groupingKey, 'post');
} | [
"public",
"function",
"pushAdd",
"(",
"CollectorRegistry",
"$",
"collectorRegistry",
",",
"$",
"job",
",",
"$",
"groupingKey",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"doRequest",
"(",
"$",
"collectorRegistry",
",",
"$",
"job",
",",
"$",
"groupingKey",
"... | Pushes all metrics in a Collector, replacing only previously pushed metrics of the same name and job.
Uses HTTP POST.
@param CollectorRegistry $collectorRegistry
@param $job
@param $groupingKey | [
"Pushes",
"all",
"metrics",
"in",
"a",
"Collector",
"replacing",
"only",
"previously",
"pushed",
"metrics",
"of",
"the",
"same",
"name",
"and",
"job",
".",
"Uses",
"HTTP",
"POST",
"."
] | train | https://github.com/Jimdo/prometheus_client_php/blob/01c89375e484a55683c65fc2056cfd0869461748/src/Prometheus/PushGateway.php#L41-L44 |
composer/installers | src/Composer/Installers/MajimaInstaller.php | MajimaInstaller.correctPluginName | private function correctPluginName($vars)
{
$camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
return strtoupper($matches[0][1]);
}, $vars['name']);
$vars['name'] = ucfirst($camelCasedName);
return $vars;
} | php | private function correctPluginName($vars)
{
$camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) {
return strtoupper($matches[0][1]);
}, $vars['name']);
$vars['name'] = ucfirst($camelCasedName);
return $vars;
} | [
"private",
"function",
"correctPluginName",
"(",
"$",
"vars",
")",
"{",
"$",
"camelCasedName",
"=",
"preg_replace_callback",
"(",
"'/(-[a-z])/'",
",",
"function",
"(",
"$",
"matches",
")",
"{",
"return",
"strtoupper",
"(",
"$",
"matches",
"[",
"0",
"]",
"[",... | Change hyphenated names to camelcase
@param array $vars
@return array | [
"Change",
"hyphenated",
"names",
"to",
"camelcase"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/MajimaInstaller.php#L29-L36 |
composer/installers | src/Composer/Installers/PlentymarketsInstaller.php | PlentymarketsInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
$vars['name'] = explode("-", $vars['name']);
foreach ($vars['name'] as $key => $name) {
$vars['name'][$key] = ucfirst($vars['name'][$key]);
if (strcasecmp($name, "Plugin") == 0) {
unset($vars['name'][$key]);
... | php | public function inflectPackageVars($vars)
{
$vars['name'] = explode("-", $vars['name']);
foreach ($vars['name'] as $key => $name) {
$vars['name'][$key] = ucfirst($vars['name'][$key]);
if (strcasecmp($name, "Plugin") == 0) {
unset($vars['name'][$key]);
... | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"$",
"vars",
"[",
"'name'",
"]",
"=",
"explode",
"(",
"\"-\"",
",",
"$",
"vars",
"[",
"'name'",
"]",
")",
";",
"foreach",
"(",
"$",
"vars",
"[",
"'name'",
"]",
"as",
"$",
"key"... | Remove hyphen, "plugin" and format to camelcase
@param array $vars
@return array | [
"Remove",
"hyphen",
"plugin",
"and",
"format",
"to",
"camelcase",
"@param",
"array",
"$vars"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/PlentymarketsInstaller.php#L16-L28 |
composer/installers | src/Composer/Installers/MicroweberInstaller.php | MicroweberInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
if ($vars['type'] === 'microweber-template') {
return $this->inflectTemplateVars($vars);
}
if ($vars['type'] === 'microweber-templates') {
return $this->inflectTemplatesVars($vars);
}
if ($vars['type'] === 'm... | php | public function inflectPackageVars($vars)
{
if ($vars['type'] === 'microweber-template') {
return $this->inflectTemplateVars($vars);
}
if ($vars['type'] === 'microweber-templates') {
return $this->inflectTemplatesVars($vars);
}
if ($vars['type'] === 'm... | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"if",
"(",
"$",
"vars",
"[",
"'type'",
"]",
"===",
"'microweber-template'",
")",
"{",
"return",
"$",
"this",
"->",
"inflectTemplateVars",
"(",
"$",
"vars",
")",
";",
"}",
"if",
"(",
... | Format package name.
For package type microweber-module, cut off a trailing '-module' if present
For package type microweber-template, cut off a trailing '-template' if present. | [
"Format",
"package",
"name",
"."
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/MicroweberInstaller.php#L23-L51 |
composer/installers | src/Composer/Installers/SilverStripeInstaller.php | SilverStripeInstaller.getInstallPath | public function getInstallPath(PackageInterface $package, $frameworkType = '')
{
if (
$package->getName() == 'silverstripe/framework'
&& preg_match('/^\d+\.\d+\.\d+/', $package->getVersion())
&& version_compare($package->getVersion(), '2.999.999') < 0
) {
... | php | public function getInstallPath(PackageInterface $package, $frameworkType = '')
{
if (
$package->getName() == 'silverstripe/framework'
&& preg_match('/^\d+\.\d+\.\d+/', $package->getVersion())
&& version_compare($package->getVersion(), '2.999.999') < 0
) {
... | [
"public",
"function",
"getInstallPath",
"(",
"PackageInterface",
"$",
"package",
",",
"$",
"frameworkType",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"package",
"->",
"getName",
"(",
")",
"==",
"'silverstripe/framework'",
"&&",
"preg_match",
"(",
"'/^\\d+\\.\\d+\\.\\... | Return the install path based on package type.
Relies on built-in BaseInstaller behaviour with one exception: silverstripe/framework
must be installed to 'sapphire' and not 'framework' if the version is <3.0.0
@param PackageInterface $package
@param string $frameworkType
@return string | [
"Return",
"the",
"install",
"path",
"based",
"on",
"package",
"type",
"."
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/SilverStripeInstaller.php#L23-L34 |
composer/installers | src/Composer/Installers/DokuWikiInstaller.php | DokuWikiInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
if ($vars['type'] === 'dokuwiki-plugin') {
return $this->inflectPluginVars($vars);
}
if ($vars['type'] === 'dokuwiki-template') {
return $this->inflectTemplateVars($vars);
}
return $vars;
} | php | public function inflectPackageVars($vars)
{
if ($vars['type'] === 'dokuwiki-plugin') {
return $this->inflectPluginVars($vars);
}
if ($vars['type'] === 'dokuwiki-template') {
return $this->inflectTemplateVars($vars);
}
return $vars;
} | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"if",
"(",
"$",
"vars",
"[",
"'type'",
"]",
"===",
"'dokuwiki-plugin'",
")",
"{",
"return",
"$",
"this",
"->",
"inflectPluginVars",
"(",
"$",
"vars",
")",
";",
"}",
"if",
"(",
"$",... | Format package name.
For package type dokuwiki-plugin, cut off a trailing '-plugin',
or leading dokuwiki_ if present.
For package type dokuwiki-template, cut off a trailing '-template' if present. | [
"Format",
"package",
"name",
"."
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/DokuWikiInstaller.php#L20-L32 |
composer/installers | src/Composer/Installers/BitrixInstaller.php | BitrixInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
if ($this->composer->getPackage()) {
$extra = $this->composer->getPackage()->getExtra();
if (isset($extra['bitrix-dir'])) {
$vars['bitrix_dir'] = $extra['bitrix-dir'];
}
}
if (!isset($vars['bitr... | php | public function inflectPackageVars($vars)
{
if ($this->composer->getPackage()) {
$extra = $this->composer->getPackage()->getExtra();
if (isset($extra['bitrix-dir'])) {
$vars['bitrix_dir'] = $extra['bitrix-dir'];
}
}
if (!isset($vars['bitr... | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"composer",
"->",
"getPackage",
"(",
")",
")",
"{",
"$",
"extra",
"=",
"$",
"this",
"->",
"composer",
"->",
"getPackage",
"(",
")",
"->",
"getExtra",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/BitrixInstaller.php#L45-L60 |
composer/installers | src/Composer/Installers/BitrixInstaller.php | BitrixInstaller.templatePath | protected function templatePath($path, array $vars = array())
{
$templatePath = parent::templatePath($path, $vars);
$this->checkDuplicates($templatePath, $vars);
return $templatePath;
} | php | protected function templatePath($path, array $vars = array())
{
$templatePath = parent::templatePath($path, $vars);
$this->checkDuplicates($templatePath, $vars);
return $templatePath;
} | [
"protected",
"function",
"templatePath",
"(",
"$",
"path",
",",
"array",
"$",
"vars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"templatePath",
"=",
"parent",
"::",
"templatePath",
"(",
"$",
"path",
",",
"$",
"vars",
")",
";",
"$",
"this",
"->",
"checkD... | {@inheritdoc} | [
"{"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/BitrixInstaller.php#L65-L71 |
composer/installers | src/Composer/Installers/BitrixInstaller.php | BitrixInstaller.checkDuplicates | protected function checkDuplicates($path, array $vars = array())
{
$packageType = substr($vars['type'], strlen('bitrix') + 1);
$localDir = explode('/', $vars['bitrix_dir']);
array_pop($localDir);
$localDir[] = 'local';
$localDir = implode('/', $localDir);
$oldPath = ... | php | protected function checkDuplicates($path, array $vars = array())
{
$packageType = substr($vars['type'], strlen('bitrix') + 1);
$localDir = explode('/', $vars['bitrix_dir']);
array_pop($localDir);
$localDir[] = 'local';
$localDir = implode('/', $localDir);
$oldPath = ... | [
"protected",
"function",
"checkDuplicates",
"(",
"$",
"path",
",",
"array",
"$",
"vars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"packageType",
"=",
"substr",
"(",
"$",
"vars",
"[",
"'type'",
"]",
",",
"strlen",
"(",
"'bitrix'",
")",
"+",
"1",
")",
... | Duplicates search packages.
@param string $path
@param array $vars | [
"Duplicates",
"search",
"packages",
"."
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/BitrixInstaller.php#L79-L125 |
composer/installers | src/Composer/Installers/OntoWikiInstaller.php | OntoWikiInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
$vars['name'] = strtolower($vars['name']);
$vars['name'] = preg_replace('/.ontowiki$/', '', $vars['name']);
$vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
$vars['name'] = preg_replace('/-translation$/', '', $vars['name']);
... | php | public function inflectPackageVars($vars)
{
$vars['name'] = strtolower($vars['name']);
$vars['name'] = preg_replace('/.ontowiki$/', '', $vars['name']);
$vars['name'] = preg_replace('/-theme$/', '', $vars['name']);
$vars['name'] = preg_replace('/-translation$/', '', $vars['name']);
... | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"$",
"vars",
"[",
"'name'",
"]",
"=",
"strtolower",
"(",
"$",
"vars",
"[",
"'name'",
"]",
")",
";",
"$",
"vars",
"[",
"'name'",
"]",
"=",
"preg_replace",
"(",
"'/.ontowiki$/'",
","... | Format package name to lower case and remove ".ontowiki" suffix | [
"Format",
"package",
"name",
"to",
"lower",
"case",
"and",
"remove",
".",
"ontowiki",
"suffix"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/OntoWikiInstaller.php#L15-L23 |
composer/installers | src/Composer/Installers/MauticInstaller.php | MauticInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
if ($vars['type'] == 'mautic-plugin') {
$vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
return strtoupper($matches[0][1]);
}, ucfirst($vars['name']));
}
return $vars;
} | php | public function inflectPackageVars($vars)
{
if ($vars['type'] == 'mautic-plugin') {
$vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) {
return strtoupper($matches[0][1]);
}, ucfirst($vars['name']));
}
return $vars;
} | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"if",
"(",
"$",
"vars",
"[",
"'type'",
"]",
"==",
"'mautic-plugin'",
")",
"{",
"$",
"vars",
"[",
"'name'",
"]",
"=",
"preg_replace_callback",
"(",
"'/(-[a-z])/'",
",",
"function",
"(",... | Format package name of mautic-plugins to CamelCase | [
"Format",
"package",
"name",
"of",
"mautic",
"-",
"plugins",
"to",
"CamelCase"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/MauticInstaller.php#L14-L23 |
composer/installers | src/Composer/Installers/GravInstaller.php | GravInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
$restrictedWords = implode('|', array_keys($this->locations));
$vars['name'] = strtolower($vars['name']);
$vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui',
'$1',
... | php | public function inflectPackageVars($vars)
{
$restrictedWords = implode('|', array_keys($this->locations));
$vars['name'] = strtolower($vars['name']);
$vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui',
'$1',
... | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"$",
"restrictedWords",
"=",
"implode",
"(",
"'|'",
",",
"array_keys",
"(",
"$",
"this",
"->",
"locations",
")",
")",
";",
"$",
"vars",
"[",
"'name'",
"]",
"=",
"strtolower",
"(",
... | Format package name
@param array $vars
@return array | [
"Format",
"package",
"name"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/GravInstaller.php#L18-L29 |
composer/installers | src/Composer/Installers/CakePHPInstaller.php | CakePHPInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
if ($this->matchesCakeVersion('>=', '3.0.0')) {
return $vars;
}
$nameParts = explode('/', $vars['name']);
foreach ($nameParts as &$value) {
$value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
... | php | public function inflectPackageVars($vars)
{
if ($this->matchesCakeVersion('>=', '3.0.0')) {
return $vars;
}
$nameParts = explode('/', $vars['name']);
foreach ($nameParts as &$value) {
$value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value));
... | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"matchesCakeVersion",
"(",
"'>='",
",",
"'3.0.0'",
")",
")",
"{",
"return",
"$",
"vars",
";",
"}",
"$",
"nameParts",
"=",
"explode",
"(",
"'/'",
",",
... | Format package name to CamelCase | [
"Format",
"package",
"name",
"to",
"CamelCase"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/CakePHPInstaller.php#L15-L30 |
composer/installers | src/Composer/Installers/CakePHPInstaller.php | CakePHPInstaller.getLocations | public function getLocations()
{
if ($this->matchesCakeVersion('>=', '3.0.0')) {
$this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
}
return $this->locations;
} | php | public function getLocations()
{
if ($this->matchesCakeVersion('>=', '3.0.0')) {
$this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
}
return $this->locations;
} | [
"public",
"function",
"getLocations",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"matchesCakeVersion",
"(",
"'>='",
",",
"'3.0.0'",
")",
")",
"{",
"$",
"this",
"->",
"locations",
"[",
"'plugin'",
"]",
"=",
"$",
"this",
"->",
"composer",
"->",
"getCon... | Change the default plugin location when cakephp >= 3.0 | [
"Change",
"the",
"default",
"plugin",
"location",
"when",
"cakephp",
">",
"=",
"3",
".",
"0"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/CakePHPInstaller.php#L35-L41 |
composer/installers | src/Composer/Installers/CakePHPInstaller.php | CakePHPInstaller.matchesCakeVersion | protected function matchesCakeVersion($matcher, $version)
{
if (class_exists('Composer\Semver\Constraint\MultiConstraint')) {
$multiClass = 'Composer\Semver\Constraint\MultiConstraint';
$constraintClass = 'Composer\Semver\Constraint\Constraint';
} else {
$multiCla... | php | protected function matchesCakeVersion($matcher, $version)
{
if (class_exists('Composer\Semver\Constraint\MultiConstraint')) {
$multiClass = 'Composer\Semver\Constraint\MultiConstraint';
$constraintClass = 'Composer\Semver\Constraint\Constraint';
} else {
$multiCla... | [
"protected",
"function",
"matchesCakeVersion",
"(",
"$",
"matcher",
",",
"$",
"version",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'Composer\\Semver\\Constraint\\MultiConstraint'",
")",
")",
"{",
"$",
"multiClass",
"=",
"'Composer\\Semver\\Constraint\\MultiConstraint'",
... | Check if CakePHP version matches against a version
@param string $matcher
@param string $version
@return bool | [
"Check",
"if",
"CakePHP",
"version",
"matches",
"against",
"a",
"version"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/CakePHPInstaller.php#L50-L81 |
composer/installers | src/Composer/Installers/CroogoInstaller.php | CroogoInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
$vars['name'] = strtolower(str_replace(array('-', '_'), ' ', $vars['name']));
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
return $vars;
} | php | public function inflectPackageVars($vars)
{
$vars['name'] = strtolower(str_replace(array('-', '_'), ' ', $vars['name']));
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
return $vars;
} | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"$",
"vars",
"[",
"'name'",
"]",
"=",
"strtolower",
"(",
"str_replace",
"(",
"array",
"(",
"'-'",
",",
"'_'",
")",
",",
"' '",
",",
"$",
"vars",
"[",
"'name'",
"]",
")",
")",
"... | Format package name to CamelCase | [
"Format",
"package",
"name",
"to",
"CamelCase"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/CroogoInstaller.php#L14-L20 |
composer/installers | src/Composer/Installers/OxidInstaller.php | OxidInstaller.getInstallPath | public function getInstallPath(PackageInterface $package, $frameworkType = '')
{
$installPath = parent::getInstallPath($package, $frameworkType);
$type = $this->package->getType();
if ($type === 'oxid-module') {
$this->prepareVendorDirectory($installPath);
}
return $installPath;
} | php | public function getInstallPath(PackageInterface $package, $frameworkType = '')
{
$installPath = parent::getInstallPath($package, $frameworkType);
$type = $this->package->getType();
if ($type === 'oxid-module') {
$this->prepareVendorDirectory($installPath);
}
return $installPath;
} | [
"public",
"function",
"getInstallPath",
"(",
"PackageInterface",
"$",
"package",
",",
"$",
"frameworkType",
"=",
"''",
")",
"{",
"$",
"installPath",
"=",
"parent",
"::",
"getInstallPath",
"(",
"$",
"package",
",",
"$",
"frameworkType",
")",
";",
"$",
"type",... | getInstallPath
@param PackageInterface $package
@param string $frameworkType
@return void | [
"getInstallPath"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/OxidInstaller.php#L23-L31 |
composer/installers | src/Composer/Installers/OxidInstaller.php | OxidInstaller.prepareVendorDirectory | protected function prepareVendorDirectory($installPath)
{
$matches = '';
$hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
if (!$hasVendorDirectory) {
return;
}
$vendorDirectory = $matches['vendor'];
$vendorPath = getcwd() . '/modules/' . $vendorDirectory;
if (!file_exis... | php | protected function prepareVendorDirectory($installPath)
{
$matches = '';
$hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
if (!$hasVendorDirectory) {
return;
}
$vendorDirectory = $matches['vendor'];
$vendorPath = getcwd() . '/modules/' . $vendorDirectory;
if (!file_exis... | [
"protected",
"function",
"prepareVendorDirectory",
"(",
"$",
"installPath",
")",
"{",
"$",
"matches",
"=",
"''",
";",
"$",
"hasVendorDirectory",
"=",
"preg_match",
"(",
"self",
"::",
"VENDOR_PATTERN",
",",
"$",
"installPath",
",",
"$",
"matches",
")",
";",
"... | prepareVendorDirectory
Makes sure there is a vendormetadata.php file inside
the vendor folder if there is a vendor folder.
@param string $installPath
@return void | [
"prepareVendorDirectory"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/OxidInstaller.php#L42-L58 |
composer/installers | src/Composer/Installers/TYPO3FlowInstaller.php | TYPO3FlowInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
$autoload = $this->package->getAutoload();
if (isset($autoload['psr-0']) && is_array($autoload['psr-0'])) {
$namespace = key($autoload['psr-0']);
$vars['name'] = str_replace('\\', '.', $namespace);
}
if (isset($autol... | php | public function inflectPackageVars($vars)
{
$autoload = $this->package->getAutoload();
if (isset($autoload['psr-0']) && is_array($autoload['psr-0'])) {
$namespace = key($autoload['psr-0']);
$vars['name'] = str_replace('\\', '.', $namespace);
}
if (isset($autol... | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"$",
"autoload",
"=",
"$",
"this",
"->",
"package",
"->",
"getAutoload",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"autoload",
"[",
"'psr-0'",
"]",
")",
"&&",
"is_array",
"(",
... | Modify the package name to be a TYPO3 Flow style key.
@param array $vars
@return array | [
"Modify",
"the",
"package",
"name",
"to",
"be",
"a",
"TYPO3",
"Flow",
"style",
"key",
"."
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/TYPO3FlowInstaller.php#L24-L37 |
composer/installers | src/Composer/Installers/OctoberInstaller.php | OctoberInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
if ($vars['type'] === 'october-plugin') {
return $this->inflectPluginVars($vars);
}
if ($vars['type'] === 'october-theme') {
return $this->inflectThemeVars($vars);
}
return $vars;
} | php | public function inflectPackageVars($vars)
{
if ($vars['type'] === 'october-plugin') {
return $this->inflectPluginVars($vars);
}
if ($vars['type'] === 'october-theme') {
return $this->inflectThemeVars($vars);
}
return $vars;
} | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"if",
"(",
"$",
"vars",
"[",
"'type'",
"]",
"===",
"'october-plugin'",
")",
"{",
"return",
"$",
"this",
"->",
"inflectPluginVars",
"(",
"$",
"vars",
")",
";",
"}",
"if",
"(",
"$",
... | Format package name.
For package type october-plugin, cut off a trailing '-plugin' if present.
For package type october-theme, cut off a trailing '-theme' if present. | [
"Format",
"package",
"name",
"."
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/OctoberInstaller.php#L20-L31 |
composer/installers | src/Composer/Installers/SyDESInstaller.php | SyDESInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
if ($vars['type'] == 'sydes-module') {
return $this->inflectModuleVars($vars);
}
if ($vars['type'] === 'sydes-theme') {
return $this->inflectThemeVars($vars);
}
return $vars;
} | php | public function inflectPackageVars($vars)
{
if ($vars['type'] == 'sydes-module') {
return $this->inflectModuleVars($vars);
}
if ($vars['type'] === 'sydes-theme') {
return $this->inflectThemeVars($vars);
}
return $vars;
} | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"if",
"(",
"$",
"vars",
"[",
"'type'",
"]",
"==",
"'sydes-module'",
")",
"{",
"return",
"$",
"this",
"->",
"inflectModuleVars",
"(",
"$",
"vars",
")",
";",
"}",
"if",
"(",
"$",
"... | Format module name.
Strip `sydes-` prefix and a trailing '-theme' or '-module' from package name if present.
@param array @vars
@return array | [
"Format",
"module",
"name",
"."
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/SyDESInstaller.php#L20-L31 |
composer/installers | src/Composer/Installers/Installer.php | Installer.supports | public function supports($packageType)
{
$frameworkType = $this->findFrameworkType($packageType);
if ($frameworkType === false) {
return false;
}
$locationPattern = $this->getLocationPattern($frameworkType);
return preg_match('#' . $frameworkType . '-' . $locat... | php | public function supports($packageType)
{
$frameworkType = $this->findFrameworkType($packageType);
if ($frameworkType === false) {
return false;
}
$locationPattern = $this->getLocationPattern($frameworkType);
return preg_match('#' . $frameworkType . '-' . $locat... | [
"public",
"function",
"supports",
"(",
"$",
"packageType",
")",
"{",
"$",
"frameworkType",
"=",
"$",
"this",
"->",
"findFrameworkType",
"(",
"$",
"packageType",
")",
";",
"if",
"(",
"$",
"frameworkType",
"===",
"false",
")",
"{",
"return",
"false",
";",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/Installer.php#L166-L177 |
composer/installers | src/Composer/Installers/Installer.php | Installer.findFrameworkType | protected function findFrameworkType($type)
{
$frameworkType = false;
krsort($this->supportedTypes);
foreach ($this->supportedTypes as $key => $val) {
if ($key === substr($type, 0, strlen($key))) {
$frameworkType = substr($type, 0, strlen($key));
... | php | protected function findFrameworkType($type)
{
$frameworkType = false;
krsort($this->supportedTypes);
foreach ($this->supportedTypes as $key => $val) {
if ($key === substr($type, 0, strlen($key))) {
$frameworkType = substr($type, 0, strlen($key));
... | [
"protected",
"function",
"findFrameworkType",
"(",
"$",
"type",
")",
"{",
"$",
"frameworkType",
"=",
"false",
";",
"krsort",
"(",
"$",
"this",
"->",
"supportedTypes",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"supportedTypes",
"as",
"$",
"key",
"=>",
... | Finds a supported framework type if it exists and returns it
@param string $type
@return string | [
"Finds",
"a",
"supported",
"framework",
"type",
"if",
"it",
"exists",
"and",
"returns",
"it"
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/Installer.php#L185-L199 |
composer/installers | src/Composer/Installers/Installer.php | Installer.removeDisabledInstallers | protected function removeDisabledInstallers()
{
$extra = $this->composer->getPackage()->getExtra();
if (!isset($extra['installer-disable']) || $extra['installer-disable'] === false) {
// No installers are disabled
return;
}
// Get installers to disable
... | php | protected function removeDisabledInstallers()
{
$extra = $this->composer->getPackage()->getExtra();
if (!isset($extra['installer-disable']) || $extra['installer-disable'] === false) {
// No installers are disabled
return;
}
// Get installers to disable
... | [
"protected",
"function",
"removeDisabledInstallers",
"(",
")",
"{",
"$",
"extra",
"=",
"$",
"this",
"->",
"composer",
"->",
"getPackage",
"(",
")",
"->",
"getExtra",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"extra",
"[",
"'installer-disable'",
"... | Look for installers set to be disabled in composer's extra config and
remove them from the list of supported installers.
Globals:
- true, "all", and "*" - disable all installers.
- false - enable all installers (useful with
wikimedia/composer-merge-plugin or similar)
@return void | [
"Look",
"for",
"installers",
"set",
"to",
"be",
"disabled",
"in",
"composer",
"s",
"extra",
"config",
"and",
"remove",
"them",
"from",
"the",
"list",
"of",
"supported",
"installers",
"."
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/Installer.php#L243-L274 |
composer/installers | src/Composer/Installers/MediaWikiInstaller.php | MediaWikiInstaller.inflectPackageVars | public function inflectPackageVars($vars)
{
if ($vars['type'] === 'mediawiki-extension') {
return $this->inflectExtensionVars($vars);
}
if ($vars['type'] === 'mediawiki-skin') {
return $this->inflectSkinVars($vars);
}
return $vars;
} | php | public function inflectPackageVars($vars)
{
if ($vars['type'] === 'mediawiki-extension') {
return $this->inflectExtensionVars($vars);
}
if ($vars['type'] === 'mediawiki-skin') {
return $this->inflectSkinVars($vars);
}
return $vars;
} | [
"public",
"function",
"inflectPackageVars",
"(",
"$",
"vars",
")",
"{",
"if",
"(",
"$",
"vars",
"[",
"'type'",
"]",
"===",
"'mediawiki-extension'",
")",
"{",
"return",
"$",
"this",
"->",
"inflectExtensionVars",
"(",
"$",
"vars",
")",
";",
"}",
"if",
"(",... | Format package name.
For package type mediawiki-extension, cut off a trailing '-extension' if present and transform
to CamelCase keeping existing uppercase chars.
For package type mediawiki-skin, cut off a trailing '-skin' if present. | [
"Format",
"package",
"name",
"."
] | train | https://github.com/composer/installers/blob/61958ce74200a663b429df947b7dfaae2f09f001/src/Composer/Installers/MediaWikiInstaller.php#L21-L33 |
antonioribeiro/countries | src/update/Currencies.php | Currencies.update | public function update()
{
$this->helper->progress('--- Currencies');
$this->helper->eraseDataDir($dataDir = '/currencies/default');
$currencies = $this->helper->loadJsonFiles($directory = $this->helper->dataDir('third-party/world-currencies/package/src'));
if ($currencies->isEmpt... | php | public function update()
{
$this->helper->progress('--- Currencies');
$this->helper->eraseDataDir($dataDir = '/currencies/default');
$currencies = $this->helper->loadJsonFiles($directory = $this->helper->dataDir('third-party/world-currencies/package/src'));
if ($currencies->isEmpt... | [
"public",
"function",
"update",
"(",
")",
"{",
"$",
"this",
"->",
"helper",
"->",
"progress",
"(",
"'--- Currencies'",
")",
";",
"$",
"this",
"->",
"helper",
"->",
"eraseDataDir",
"(",
"$",
"dataDir",
"=",
"'/currencies/default'",
")",
";",
"$",
"currencie... | Update all currencies.
@throws Exception | [
"Update",
"all",
"currencies",
"."
] | train | https://github.com/antonioribeiro/countries/blob/45f10dde1b4214f2f4c447ba2f3a2b48c0ff0c4a/src/update/Currencies.php#L38-L74 |
antonioribeiro/countries | src/package/Services/Countries.php | Countries.instantiateCache | protected function instantiateCache(Cache $cache = null)
{
if (is_null($this->cache) || ! is_null($cache)) {
$this->cache = ! is_null($cache)
? $cache
: new Cache($this->config);
}
return $this->cache;
} | php | protected function instantiateCache(Cache $cache = null)
{
if (is_null($this->cache) || ! is_null($cache)) {
$this->cache = ! is_null($cache)
? $cache
: new Cache($this->config);
}
return $this->cache;
} | [
"protected",
"function",
"instantiateCache",
"(",
"Cache",
"$",
"cache",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"cache",
")",
"||",
"!",
"is_null",
"(",
"$",
"cache",
")",
")",
"{",
"$",
"this",
"->",
"cache",
"=",
"!"... | Instantiate cache.
@param Cache|null $cache
@return Cache | [
"Instantiate",
"cache",
"."
] | train | https://github.com/antonioribeiro/countries/blob/45f10dde1b4214f2f4c447ba2f3a2b48c0ff0c4a/src/package/Services/Countries.php#L179-L188 |
antonioribeiro/countries | src/package/Services/Countries.php | Countries.instantiateConfig | protected function instantiateConfig($config = null)
{
if (is_null($this->config) || ! is_null($config)) {
$this->config = ! is_null($config)
? $config
: new Config($this->helper);
}
return $this->config;
} | php | protected function instantiateConfig($config = null)
{
if (is_null($this->config) || ! is_null($config)) {
$this->config = ! is_null($config)
? $config
: new Config($this->helper);
}
return $this->config;
} | [
"protected",
"function",
"instantiateConfig",
"(",
"$",
"config",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"config",
")",
"||",
"!",
"is_null",
"(",
"$",
"config",
")",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"!",
"i... | Instantiate config.
@param object|null $config
@return Config | [
"Instantiate",
"config",
"."
] | train | https://github.com/antonioribeiro/countries/blob/45f10dde1b4214f2f4c447ba2f3a2b48c0ff0c4a/src/package/Services/Countries.php#L196-L205 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.