_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q262400 | PluginInstaller.getRootPackage | test | protected static function getRootPackage(\Composer\Composer $composer)
{
$rootPackage = $composer->getPackage();
if ($rootPackage) {
while ($rootPackage instanceof \Composer\Package\AliasPackage) {
$rootPackage = $rootPackage->getAliasOf();
}
}
... | php | {
"resource": ""
} |
q262401 | PluginInstaller.getInstallPath | test | public function getInstallPath(\Composer\Package\PackageInterface $package)
{
$packageType = $package->getType();
$installDir = $this->initializeInstallDir($packageType);
$installName = static::getInstallName($package, $this->rootPackage);
return $installDir . '/' . $installName;
... | php | {
"resource": ""
} |
q262402 | PluginInstaller.initializeInstallDir | test | protected function initializeInstallDir($packageType)
{
$installDir = '';
$rootPackageExtra = $this->rootPackage ? $this->rootPackage->getExtra() : null;
if (!empty($rootPackageExtra[$packageType . '-dir'])) {
$installDir = rtrim($rootPackageExtra[$packageType . '-dir'], '/\\');... | php | {
"resource": ""
} |
q262403 | LayoutDcaListener.generatePalette | test | public function generatePalette(): void
{
// @codingStandardsIgnoreStart
// TODO: How to handle editAll actions?
// @codingStandardsIgnoreEnd
if (Input::get('table') != 'tl_layout' || Input::get('act') != 'edit') {
return;
}
$layout = LayoutModel::findBy... | php | {
"resource": ""
} |
q262404 | LayoutDcaListener.getMetaPaletteOfPalette | test | protected function getMetaPaletteOfPalette(string $table, string $name = 'default'): array
{
$palette = $GLOBALS['TL_DCA'][$table]['palettes'][$name];
$metaPalette = array();
$legends = explode(';', $palette);
foreach ($legends as $legend) {
$fields = explode(','... | php | {
"resource": ""
} |
q262405 | LeavingContextFailed.inContext | test | public static function inContext(Context $context, $code = 0, Throwable $previous = null): self
{
return new static(
sprintf('Leaving context "%s" failed. Context stack is empty', $context->__toString()),
$code,
$previous
);
} | php | {
"resource": ""
} |
q262406 | ConfigSubscriber.enterThemeContext | test | public function enterThemeContext(InitializeLayout $event): void
{
$event->getEnvironment()->enterContext(ThemeContext::forTheme((int) $event->getLayoutModel()->pid));
} | php | {
"resource": ""
} |
q262407 | ConfigSubscriber.buildContextConfig | test | public function buildContextConfig(BuildContextConfig $command): void
{
$context = $command->getContext();
if ($context instanceof ApplicationContext) {
$command->setConfig($this->config);
}
} | php | {
"resource": ""
} |
q262408 | ColorRotate.getColor | test | public function getColor(string $identifier): string
{
if (!isset($this->cache[$identifier])) {
$this->cache[$identifier] = $this->rotateColor();
}
return $this->cache[$identifier];
} | php | {
"resource": ""
} |
q262409 | ColorRotate.rotateColor | test | private function rotateColor(): string
{
$color = $this->convertHSVtoRGB($this->rotatingColor, $this->saturation, $this->value);
$this->rotatingColor += .3;
if ($this->rotatingColor > 1) {
$this->rotatingColor -= 1;
}
return $color;
} | php | {
"resource": ""
} |
q262410 | ColorRotate.convertHSVtoRGB | test | private function convertHSVtoRGB(float $hue, float $saturation, float $value): string
{
// First
$hue *= 6;
// Second
$i = floor($hue);
$f = ($hue - $i);
// Third
$m = ($value * (1 - $saturation));
$n = ($value * (1 - $saturation * $f));
$k =... | php | {
"resource": ""
} |
q262411 | Environment.enterContext | test | public function enterContext(Context $context): void
{
// Already in the context.
if ($this->context && $this->context->match($context)) {
return;
}
$this->switchContext($context, true);
} | php | {
"resource": ""
} |
q262412 | Environment.leaveContext | test | public function leaveContext(?Context $currentContext = null): void
{
if (!$this->context) {
throw LeavingContextFailed::noContext();
}
// Not in expected context. Just quit.
if ($currentContext && !$currentContext->match($this->context)) {
return;
}
... | php | {
"resource": ""
} |
q262413 | Environment.switchContext | test | private function switchContext(Context $context, bool $keepCurrentInStack = false): void
{
$command = new BuildContextConfig($this, $context, $this->config);
$this->messageBus->dispatch($command::NAME, $command);
if ($command->getConfig()) {
$this->config = $command->getConfig()... | php | {
"resource": ""
} |
q262414 | ConfigPass.loadConfigFromBundles | test | private function loadConfigFromBundles(ContainerBuilder $container)
{
$config = [];
foreach ($container->getParameter('kernel.bundles') as $bundleClass) {
$refClass = new \ReflectionClass($bundleClass);
$bundleDir = dirname($refClass->getFileName());
$configFi... | php | {
"resource": ""
} |
q262415 | ConfigPass.setConfigTypesArgument | test | private function setConfigTypesArgument(ContainerBuilder $container): void
{
if (!$container->has('contao_bootstrap.config.type_manager')) {
return;
}
$definition = $container->findDefinition('contao_bootstrap.config.type_manager');
$taggedServiceIds = $container->... | php | {
"resource": ""
} |
q262416 | ModuleDcaListener.getTemplates | test | public function getTemplates(DataContainer $dataContainer): array
{
$config = array();
$prefix = '';
// MCW compatibility
if ($dataContainer instanceof MultiColumnWizard) {
$field = $dataContainer->strField;
$table = $dataContainer->strTable;
} else {... | php | {
"resource": ""
} |
q262417 | ModuleDcaListener.pagePicker | test | public function pagePicker(DataContainer $dataContainer): string
{
$template = ' <a href="contao/page.php?do=%s&table=%s&field=%s&value=%s" title="%s"';
$template .= ' onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':765,\'title\':\'%s\'';
$template .= ',\... | php | {
"resource": ""
} |
q262418 | ModuleDcaListener.getAllArticles | test | public function getAllArticles(): array
{
$user = BackendUser::getInstance();
$pids = array();
$articles = array();
// Limit pages to the user's pagemounts
if ($user->isAdmin) {
$objArticle = Database::getInstance()->execute(
'SELECT a.id,... | php | {
"resource": ""
} |
q262419 | ModuleDcaListener.getAllModules | test | public function getAllModules(): array
{
$modules = array();
$query = 'SELECT m.id, m.name, t.name AS theme FROM tl_module m LEFT JOIN tl_theme t ON m.pid=t.id';
if (Input::get('table') == 'tl_module' && \Input::get('act') == 'edit') {
$query .= ' WHERE m.id != ?';
}
... | php | {
"resource": ""
} |
q262420 | TemplateParseListener.prepare | test | public function prepare(Template $template): void
{
if ($this->preRenderFilter->supports($template)) {
$this->preRenderFilter->filter($template);
}
} | php | {
"resource": ""
} |
q262421 | TemplateParseListener.parse | test | public function parse(string $buffer, string $templateName): string
{
if ($this->postRenderFilter->supports($templateName)) {
$buffer = $this->postRenderFilter->filter($buffer, $templateName);
}
return $buffer;
} | php | {
"resource": ""
} |
q262422 | TemplateFilterPass.registerTaggedServices | test | private function registerTaggedServices(
ContainerBuilder $container,
string $definitionId,
string $tagName,
$argumentIndex = 0
): bool {
if (!$container->has($definitionId)) {
return false;
}
$definition = $container->findDefinition($defini... | php | {
"resource": ""
} |
q262423 | HookListener.initializeEnvironment | test | protected function initializeEnvironment(): void
{
$event = new InitializeEnvironment($this->environment);
$this->eventDispatcher->dispatch($event::NAME, $event);
} | php | {
"resource": ""
} |
q262424 | HookListener.initializeLayout | test | public function initializeLayout(\PageModel $page, \LayoutModel $layout): void
{
$environment = $this->environment;
$environment->setLayout($layout);
$environment->setEnabled($layout->layoutType == 'bootstrap');
$event = new InitializeLayout($environment, $layout, $page);
$t... | php | {
"resource": ""
} |
q262425 | PhpInterface.addChild | test | public function addChild($child): AbstractElement
{
if ($child instanceof PhpMethod) {
$child->setHasBody(false);
}
return parent::addChild($child);
} | php | {
"resource": ""
} |
q262426 | Compiler.compile | test | public function compile($input, $path = null)
{
//Compiler reset
$this->files = $path ? [$path] : [];
$this->mixins = [];
$this->calledMixins = [];
$this->blocks = [];
$this->level = 0;
$this->iteratorId = 0;
$this->forceInline = false;
//Par... | php | {
"resource": ""
} |
q262427 | Compiler.compileNode | test | protected function compileNode(Node $node)
{
$method = 'compile'.ucfirst($node->type);
if (!method_exists($this, $method))
$this->throwException(
"No handler $method found for $node->type found. It seems you have customized nodes. You need to ".
"extend ... | php | {
"resource": ""
} |
q262428 | Compiler.throwException | test | protected function throwException($message, Node $relatedNode = null)
{
if ($relatedNode)
$message .= "\n(".$relatedNode->type
.' at '.$relatedNode->line
.':'.$relatedNode->offset.')';
if (!empty($this->files))
$message .= "\nError occured in... | php | {
"resource": ""
} |
q262429 | DoctrineExtractor.getPhpType | test | private function getPhpType($doctrineType)
{
switch ($doctrineType) {
case 'smallint':
// No break
case 'bigint':
// No break
case 'integer':
return Type::BUILTIN_TYPE_INT;
case 'decimal':
return... | php | {
"resource": ""
} |
q262430 | PhpDocExtractor.getFileReflector | test | private function getFileReflector(\ReflectionClass $reflectionClass)
{
if (!($fileName = $reflectionClass->getFileName()) || 'hh' === pathinfo($fileName, PATHINFO_EXTENSION)) {
return;
}
if (isset(self::$fileReflectors[$fileName])) {
return self::$fileReflectors[$fil... | php | {
"resource": ""
} |
q262431 | PhpDocExtractor.getDocBlock | test | private function getDocBlock($class, $property)
{
$propertyHash = sprintf('%s::%s', $class, $property);
if (isset(self::$docBlocks[$propertyHash])) {
return self::$docBlocks[$propertyHash];
}
$ucFirstProperty = ucfirst($property);
switch (true) {
ca... | php | {
"resource": ""
} |
q262432 | PhpDocExtractor.getDocBlockFromProperty | test | private function getDocBlockFromProperty($class, $property)
{
// Use a ReflectionProperty instead of $class to get the parent class if applicable
try {
$reflectionProperty = new \ReflectionProperty($class, $property);
} catch (\ReflectionException $reflectionException) {
... | php | {
"resource": ""
} |
q262433 | PhpDocExtractor.getDocBlockFromMethod | test | private function getDocBlockFromMethod($class, $ucFirstProperty, $type)
{
$prefixes = $type === self::ACCESSOR ? ReflectionExtractor::$accessorPrefixes : ReflectionExtractor::$mutatorPrefixes;
foreach ($prefixes as $prefix) {
$methodName = $prefix.$ucFirstProperty;
try {
... | php | {
"resource": ""
} |
q262434 | PhpDocExtractor.getPhpTypeAndClass | test | private function getPhpTypeAndClass($docType)
{
if (in_array($docType, Type::$builtinTypes)) {
return array($docType, null);
}
return array('object', substr($docType, 1));
} | php | {
"resource": ""
} |
q262435 | Wallhaven.login | test | public function login($username, $password)
{
if (empty($username) || empty($password)) {
throw new LoginException("Incorrect username or password.");
}
$this->initClient(true);
$login = $this->client->post(self::URL_LOGIN, [
'form_params' => [
... | php | {
"resource": ""
} |
q262436 | Wallhaven.initClient | test | private function initClient($withCookies = false)
{
if ($withCookies) {
$jar = new CookieJar();
$this->client = new Client(
[
'base_uri' => self::URL_HOME,
'cookies' => $jar
]);
} else {
$th... | php | {
"resource": ""
} |
q262437 | Wallhaven.getToken | test | private function getToken()
{
$body = $this->client->get('/')->getBody()->getContents();
$dom = new Dom();
$dom->load($body);
$token = $dom->find('input[name="_token"]')[0]->value;
if (empty($token)) {
throw new LoginException("Cannot find login token on Wallha... | php | {
"resource": ""
} |
q262438 | Wallhaven.search | test | public function search(
$query,
$categories = Category::ALL,
$purity = Purity::SFW,
$sorting = Sorting::RELEVANCE,
$order = Order::DESC,
$resolutions = [],
$ratios = [],
$page = 1
) {
$result = $this->client->get(self::URL_SEARCH, [
... | php | {
"resource": ""
} |
q262439 | PropertyInfo.extract | test | private function extract(array $extractors, $method, array $arguments)
{
foreach ($extractors as $extractor) {
$value = call_user_func_array(array($extractor, $method), $arguments);
if (null !== $value) {
return $value;
}
}
} | php | {
"resource": ""
} |
q262440 | Wallpaper.getTags | test | public function getTags()
{
if ($this->cacheEnabled && $this->tags !== null) {
return $this->tags;
}
$dom = $this->getDom();
$this->tags = [];
foreach ($dom->find('a.tagname') as $e) {
$this->tags[] = $e->text;
}
return $this->tags;... | php | {
"resource": ""
} |
q262441 | Wallpaper.download | test | public function download($directory)
{
if (!file_exists($directory)) {
if (!@mkdir($directory, null, true)) {
throw new DownloadException("The download directory cannot be created.");
}
}
$url = $this->getImageUrl();
$this->client->get($url, ... | php | {
"resource": ""
} |
q262442 | Filter.getWallpapers | test | public function getWallpapers()
{
$wallpapers = new WallpaperList();
for ($i = 1; $i <= $this->pages; ++$i) {
$wallpapers->addAll($this->wallhaven->search(
$this->keywords,
$this->categories,
$this->purity,
$this->sorting,
... | php | {
"resource": ""
} |
q262443 | WallpaperList.downloadAll | test | public function downloadAll($directory)
{
if (!file_exists($directory)) {
if (!@mkdir($directory, null, true)) {
throw new DownloadException("The download directory cannot be created.");
}
}
$client = new Client();
$requests = [];
for... | php | {
"resource": ""
} |
q262444 | ReflectionExtractor.extractFromMutator | test | private function extractFromMutator($class, $property)
{
list($reflectionMethod, $prefix) = $this->getMutatorMethod($class, $property);
if (null === $reflectionMethod) {
return;
}
$reflectionParameters = $reflectionMethod->getParameters();
$reflectionParameter = ... | php | {
"resource": ""
} |
q262445 | ReflectionExtractor.extractFromAccessor | test | private function extractFromAccessor($class, $property)
{
list($reflectionMethod, $prefix) = $this->getAccessorMethod($class, $property);
if (null === $reflectionMethod) {
return;
}
if (method_exists($reflectionMethod, 'getReturnType') && $reflectionType = $reflectionMet... | php | {
"resource": ""
} |
q262446 | ReflectionExtractor.extractFromReflectionType | test | private function extractFromReflectionType(\ReflectionType $reflectionType)
{
$phpTypeOrClass = (string) $reflectionType;
$nullable = $reflectionType->allowsNull();
if ($reflectionType->isBuiltin()) {
if (Type::BUILTIN_TYPE_ARRAY === $phpTypeOrClass) {
$type = ne... | php | {
"resource": ""
} |
q262447 | ReflectionExtractor.isPublicProperty | test | private function isPublicProperty($class, $property)
{
try {
$reflectionProperty = new \ReflectionProperty($class, $property);
return $reflectionProperty->isPublic();
} catch (\ReflectionException $reflectionExcetion) {
// Return false if the property doesn't exi... | php | {
"resource": ""
} |
q262448 | ReflectionExtractor.getAccessorMethod | test | private function getAccessorMethod($class, $property)
{
$ucProperty = ucfirst($property);
foreach (self::$accessorPrefixes as $prefix) {
try {
$reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty);
if (0 === $reflectionMethod->getNumberO... | php | {
"resource": ""
} |
q262449 | ReflectionExtractor.getMutatorMethod | test | private function getMutatorMethod($class, $property)
{
$ucProperty = ucfirst($property);
foreach (self::$mutatorPrefixes as $prefix) {
try {
$reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty);
// Parameter can be optional to allow thi... | php | {
"resource": ""
} |
q262450 | ReflectionExtractor.getPropertyName | test | private function getPropertyName($methodName)
{
$pattern = implode('|', array_merge(self::$accessorPrefixes, self::$mutatorPrefixes));
if (preg_match('/^('.$pattern.')(.+)$/i', $methodName, $matches)) {
return $matches[2];
}
} | php | {
"resource": ""
} |
q262451 | LaravelExtension.load | test | public function load(ServiceContainer $container)
{
// Create & store Laravel wrapper
$container->setShared(
'laravel',
function (ServiceContainer $c) {
$config = $c->getParam('laravel_extension');
$laravel = new Laravel(
... | php | {
"resource": ""
} |
q262452 | Laravel.createApplication | test | protected function createApplication()
{
putenv('APP_ENV=' . $this->getEnv());
if (!is_a($this->appClassName, App::class, true)) {
throw new Exception("Instance of Pixelindustries\\PhpspecTestbench\\App expected, got {$this->appClassName}.");
}
return (new $this->appCla... | php | {
"resource": ""
} |
q262453 | IniModifier.setValue | test | public function setValue($name, $value, $section = 0, $key = null)
{
if (!preg_match('/^[^\\[\\]]*$/', $name)) {
throw new IniInvalidArgumentException("Invalid value name $name");
}
if (is_array($value)) {
if ($key !== null) {
throw new IniInvalidArgu... | php | {
"resource": ""
} |
q262454 | IniModifier.setValues | test | public function setValues($values, $section = 0)
{
foreach ($values as $name => $val) {
$this->setValue($name, $val, $section);
}
} | php | {
"resource": ""
} |
q262455 | IniModifier.removeSection | test | public function removeSection($section = 0, $removePreviousComment = true)
{
if ($section === 0 || !isset($this->content[$section])) {
return;
}
if ($removePreviousComment) {
// retrieve the previous section
$previousSection = -1;
foreach ($th... | php | {
"resource": ""
} |
q262456 | IniModifier.mergeSection | test | public function mergeSection($sectionSource, $sectionTarget)
{
if (!isset($this->content[$sectionTarget])) {
return $this->renameSection($sectionSource, $sectionTarget);
}
if (!isset($this->content[$sectionSource])) {
return false;
}
$this->mergeValue... | php | {
"resource": ""
} |
q262457 | IniModifier.renameValue | test | public function renameValue($name, $newName, $section = 0)
{
if (!isset($this->content[$section])) {
return false;
}
foreach ($this->content[$section] as $k => $item) {
if ($item[0] != self::TK_VALUE && $item[0] != self::TK_ARR_VALUE) {
continue;
... | php | {
"resource": ""
} |
q262458 | IniModifier.renameSection | test | public function renameSection($oldName, $newName)
{
if (!isset($this->content[$oldName])) {
return false;
}
if (isset($this->content[$newName])) {
return $this->mergeSection($oldName, $newName);
}
$newcontent = array();
foreach ($this->conten... | php | {
"resource": ""
} |
q262459 | Util.read | test | public static function read($filename, $asObject = false)
{
if (file_exists($filename)) {
if ($asObject) {
return (object) parse_ini_file($filename, true, INI_SCANNER_TYPED);
} else {
return parse_ini_file($filename, true, INI_SCANNER_TYPED);
... | php | {
"resource": ""
} |
q262460 | Util.readAndMergeObject | test | public static function readAndMergeObject($filename, $content, $flags = 0,
$ignoredSection = array())
{
if (!file_exists($filename)) {
return false;
}
$newContent = @parse_ini_file($filename, true, INI_SCANNER_TYPED);
if ($ne... | php | {
"resource": ""
} |
q262461 | Util.mergeIniObjectContents | test | public static function mergeIniObjectContents(
$baseContent,
$contentToImport,
$flags = 0,
$ignoredSection = array()
)
{
$contentToImport = (array) $contentToImport;
foreach ($contentToImport as $k => $v) {
if (!isset($baseContent->$k)) {
... | php | {
"resource": ""
} |
q262462 | Util._iniValue | test | private static function _iniValue($key, $value)
{
if (is_array($value)) {
$res = '';
foreach ($value as $v) {
$res .= self::_iniValue($key.'[]', $v);
}
return $res;
} elseif ($value == ''
|| is_numeric($value)
... | php | {
"resource": ""
} |
q262463 | IniModifierArray.setValue | test | public function setValue($name, $value, $section = 0, $key = null)
{
if ($this->lastModifier instanceof IniModifierInterface) {
$this->lastModifier->setValue($name, $value, $section, $key);
} else {
trigger_error('The top ini content is not alterable', E_USER_WARNING);
... | php | {
"resource": ""
} |
q262464 | IniModifierArray.setValues | test | public function setValues($values, $section = 0)
{
if ($this->lastModifier instanceof IniModifierInterface) {
$this->lastModifier->setValues($values, $section);
} else {
trigger_error('The top ini content is not alterable', E_USER_WARNING);
}
} | php | {
"resource": ""
} |
q262465 | IniModifierArray.getValues | test | public function getValues($section = 0)
{
$finalValues = array();
foreach ($this->modifiers as $mod) {
$values = $mod->getValues($section);
if (!count($values)) {
continue;
}
if (!count($finalValues)) {
$finalValues = $v... | php | {
"resource": ""
} |
q262466 | IniModifierArray.removeValue | test | public function removeValue($name, $section = 0, $key = null, $removePreviousComment = true)
{
foreach ($this->modifiers as $mod) {
if ($mod instanceof IniModifierInterface) {
$mod->removeValue($name, $section, $key, $removePreviousComment);
}
}
} | php | {
"resource": ""
} |
q262467 | IniModifierArray.removeSection | test | public function removeSection($section = 0, $removePreviousComment = true)
{
foreach ($this->modifiers as $mod) {
if ($mod instanceof IniModifierInterface) {
$mod->removeSection($section, $removePreviousComment);
}
}
} | php | {
"resource": ""
} |
q262468 | MultiIniModifier.setValue | test | public function setValue($name, $value, $section = 0, $key = null)
{
$this->overrider->setValue($name, $value, $section, $key);
} | php | {
"resource": ""
} |
q262469 | MultiIniModifier.setValueOnMaster | test | public function setValueOnMaster($name, $value, $section = 0, $key = null)
{
if (!$this->master instanceof IniModifierInterface) {
throw new IniException('Cannot set value on master which is only an ini reader');
}
$this->master->setValue($name, $value, $section, $key);
} | php | {
"resource": ""
} |
q262470 | MultiIniModifier.setValuesOnMaster | test | public function setValuesOnMaster($values, $section = 0)
{
if (!$this->master instanceof IniModifierInterface) {
throw new IniException('Cannot set value on master which is only an ini reader');
}
$this->master->setValues($values, $section);
} | php | {
"resource": ""
} |
q262471 | MultiIniModifier.getValueOnMaster | test | public function getValueOnMaster($name, $section = 0, $key = null)
{
return $this->master->getValue($name, $section, $key);
} | php | {
"resource": ""
} |
q262472 | MultiIniModifier.getValues | test | public function getValues($section = 0)
{
$masterValues = $this->master->getValues($section);
$overValues = $this->overrider->getValues($section);
foreach ($overValues as $key => &$value) {
if (!isset($masterValues[$key])) {
$masterValues[$key] = $value;
... | php | {
"resource": ""
} |
q262473 | MultiIniModifier.removeValue | test | public function removeValue($name, $section = 0, $key = null, $removePreviousComment = true)
{
if ($this->master instanceof IniModifierInterface) {
$this->master->removeValue($name, $section, $key, $removePreviousComment);
}
$this->overrider->removeValue($name, $section, $key, $r... | php | {
"resource": ""
} |
q262474 | MultiIniModifier.removeValueOnMaster | test | public function removeValueOnMaster($name, $section = 0, $key = null, $removePreviousComment = true)
{
if (!$this->master instanceof IniModifierInterface) {
throw new IniException('Cannot remove value on master which is only an ini reader');
}
$this->master->removeValue($name, $s... | php | {
"resource": ""
} |
q262475 | MultiIniModifier.isSection | test | public function isSection($name)
{
return $this->overrider->isSection($name) || $this->master->isSection($name);
} | php | {
"resource": ""
} |
q262476 | IniReader.getValues | test | public function getValues($section = 0)
{
if (!isset($this->content[$section])) {
return array();
}
$values = array();
foreach ($this->content[$section] as $k => $item) {
if ($item[0] != self::TK_VALUE && $item[0] != self::TK_ARR_VALUE) {
conti... | php | {
"resource": ""
} |
q262477 | StandardLoaderFactory.createFileLoader | test | public function createFileLoader($type, ContainerBuilder $container, $path)
{
$className = $this->getClassNameByShortType($type);
return new $className($container, new FileLocator($path));
} | php | {
"resource": ""
} |
q262478 | StandardLoaderFactory.getClassNameByShortType | test | protected function getClassNameByShortType($type)
{
if (!isset($this->shortTypeToClassMapping[$type])) {
throw UnknownFormatException::create($type);
}
return $this->shortTypeToClassMapping[$type];
} | php | {
"resource": ""
} |
q262479 | SecureCookie.make | test | public function make($name, $value, $minutes = null, $path = null, $domain = null, $secure = false, $httponly = true)
{
// Calculate a hash for the data and append it to the end of the data string
$hash = hash_hmac($this->hash_algo, $value, $this->hash_secret);
$value .= $hash;
$minu... | php | {
"resource": ""
} |
q262480 | ConvertCommand.execute | test | protected function execute(InputInterface $input, OutputInterface $output)
{
$fileToConvert = $this->determineFile($output, $input->getArgument('file'));
$newFormat = $input->getArgument('format');
$newConfig = $this
->getContainer()
->get('tuck_converter.config_form... | php | {
"resource": ""
} |
q262481 | ConvertCommand.determineFile | test | protected function determineFile(OutputInterface $output, $givenFileName)
{
if (is_file($givenFileName)) {
return new \SplFileInfo($givenFileName);
}
return $this->chooseFileInDirectory(
$output,
$this->chooseBundle($output)->getPath().'/Resources/config/... | php | {
"resource": ""
} |
q262482 | ConvertCommand.chooseBundle | test | protected function chooseBundle(OutputInterface $output)
{
$bundles = $this->getContainer()->get('kernel')->getBundles();
$selectedBundle = $this->getHelperSet()->get('dialog')->ask(
$output,
'<info>Which bundle\'s config would you like to convert? </info>',
null... | php | {
"resource": ""
} |
q262483 | ConvertCommand.writeToFile | test | protected function writeToFile(OutputInterface $output, SplFileInfo $originalFile, $newConfig, $newFormat)
{
$proposedLocation = $originalFile->getPath().'/services.'.$newFormat;
$location = $this->getHelperSet()->get('dialog')->ask(
$output,
"<info>Where should the new confi... | php | {
"resource": ""
} |
q262484 | StandardDumperFactory.createDumper | test | public function createDumper($type, ContainerBuilder $container)
{
$className = $this->getClassNameByShortType($type);
return new $className($container);
} | php | {
"resource": ""
} |
q262485 | ConfigFormatConverter.convertString | test | public function convertString($content, $oldFormat, $newFormat)
{
$tempFile = $this->tempFileFactory->createFile($content, $oldFormat);
try {
$output = $this->convertFile($tempFile, $newFormat);
} catch (\Exception $e) {
// Cleanup the temp file, even with a failure
... | php | {
"resource": ""
} |
q262486 | Cookie.read | test | public function read($session_id) {
// Check for the existance of a cookie with the name of the session id
// Make sure that the cookie is atleast the size of our hash, otherwise it's invalid
// Return an empty string if it's invalid.
if (! $this->storage->has($session_id)) return '';
try {
... | php | {
"resource": ""
} |
q262487 | RouteListCommand.getRoutes | test | protected function getRoutes(): array
{
$routes = [];
foreach ($this->routes as $route) {
if (($routeInfo = $this->getRouteInformation($route)) !== null) {
$routes[] = $routeInfo;
}
}
if ($sort = $this->option('sort')) {
$routes =... | php | {
"resource": ""
} |
q262488 | RouteListCommand.sort | test | protected static function sort(array $array, callable $callback): array
{
$results = [];
foreach ($array as $key => $value) {
$results[$key] = $callback($value, $key);
}
\asort($results, \SORT_REGULAR);
foreach (\array_keys($results) as $key) {
$res... | php | {
"resource": ""
} |
q262489 | LimitStream.setOffset | test | public function setOffset(int $offset): void
{
$current = $this->stream->tell();
if ($current !== $offset) {
// If the stream cannot seek to the offset position, then read to it
if ($this->stream->isSeekable()) {
$this->stream->seek($offset);
} el... | php | {
"resource": ""
} |
q262490 | View.gatherData | test | protected function gatherData(): array
{
$data = \array_merge($this->factory->getShared(), $this->data);
foreach ($data as $key => $value) {
if ($value instanceof Renderable) {
$data[$key] = $value->render();
} elseif ($value instanceof Closure) {
... | php | {
"resource": ""
} |
q262491 | OptionDumpCommand.putContentToFile | test | private function putContentToFile(string $file, string $content, string $key): void
{
if ($this->hasOption('overwrite') || ! \file_exists($file)) {
\file_put_contents($file, $content);
} else {
if ($this->hasOption('merge')) {
$confirmed = true;
} ... | php | {
"resource": ""
} |
q262492 | OptionDumpCommand.getConfigReader | test | private function getConfigReader(): OptionsReader
{
$command = $this;
return new class($command) extends OptionsReader {
/**
* A OptionDumpCommand instance.
*
* @var \Viserio\Component\OptionsResolver\Command\OptionDumpCommand
*/
... | php | {
"resource": ""
} |
q262493 | MiddlewareBasedDispatcher.runRoute | test | protected function runRoute(RouteContract $route, ServerRequestInterface $request): ResponseInterface
{
$pipeline = new Pipeline();
if ($this->container !== null) {
$pipeline->setContainer($this->container);
}
return $pipeline->send($request)
->through($this... | php | {
"resource": ""
} |
q262494 | MiddlewareBasedDispatcher.gatherRouteMiddleware | test | protected function gatherRouteMiddleware(RouteContract $route): array
{
$middleware = [];
self::map($route->gatherMiddleware(), function ($nameOrObject) use (&$middleware, $route): void {
$bypass = $route->gatherDisabledMiddleware();
if (\is_object($nameOrObject) && ! isset... | php | {
"resource": ""
} |
q262495 | MiddlewareBasedDispatcher.flatten | test | protected static function flatten(array $array): array
{
$flattened = [];
foreach ($array as $key => $value) {
if (\is_array($value)) {
$flattened = \array_merge($flattened, static::flatten($value));
} else {
$flattened[] = $value;
... | php | {
"resource": ""
} |
q262496 | LoadConfiguration.loadConfigurationFiles | test | protected static function loadConfigurationFiles(KernelContract $kernel, RepositoryContract $config): void
{
foreach (static::getFiles($kernel->getConfigPath('packages'), self::CONFIG_EXTS) as $path) {
$config->import($path);
}
foreach (static::getFiles($kernel->getConfigPath(),... | php | {
"resource": ""
} |
q262497 | Pipeline.getSlice | test | protected function getSlice(): Closure
{
return function ($stack, $stage) {
return function ($traveler) use ($stack, $stage) {
// If the $stage is an instance of a Closure, we will just call it directly.
if ($stage instanceof Closure) {
return ... | php | {
"resource": ""
} |
q262498 | Pipeline.parseStageString | test | protected function parseStageString(string $stage): array
{
[$name, $parameters] = \array_pad(\explode(':', $stage, 2), 2, []);
if (\is_string($parameters)) {
$parameters = \explode(',', $parameters);
}
return [$name, $parameters];
} | php | {
"resource": ""
} |
q262499 | Application.call | test | public function call(string $command, array $parameters = [], ?OutputInterface $outputBuffer = null): int
{
if (\is_subclass_of($command, SymfonyCommand::class)) {
/** @var \Symfony\Component\Console\Command\Command $symfonyCommand */
$symfonyCommand = $command;
if (($co... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.