_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q258200 | ShopPackageInstaller.copySetupFiles | test | private function copySetupFiles($packagePath)
{
$packageDirectoryOfShopSource = $this->getPackageDirectoryOfShopSource($packagePath);
$installationDirectoryOfShopSource = $this->getTargetDirectoryOfShopSource();
$shopConfigFileName = Path::join($installationDirectoryOfShopSource, self::SHOP... | php | {
"resource": ""
} |
q258201 | ShopPackageInstaller.isConfigFileNotConfiguredOrMissing | test | private function isConfigFileNotConfiguredOrMissing($shopConfigFileName)
{
if (!file_exists($shopConfigFileName)) {
return true;
}
$shopConfigFileContents = file_get_contents($shopConfigFileName);
$wordsIndicatingNotConfigured = [
'<dbHost>',
'<db... | php | {
"resource": ""
} |
q258202 | ShopPackageInstaller.copyFilesFromSourceToInstallationByFilter | test | private function copyFilesFromSourceToInstallationByFilter($packagePath, $filter)
{
$sourceDirectory = $this->getPackageDirectoryOfShopSource($packagePath);
$filteredFiles = $this->getFilteredFiles($sourceDirectory, $filter);
foreach ($filteredFiles as $packageFilePath) {
... | php | {
"resource": ""
} |
q258203 | ShopPackageInstaller.getFilteredFiles | test | private function getFilteredFiles($directory, $filter)
{
$glob = Path::join($directory, $filter);
return new GlobIterator($glob);
} | php | {
"resource": ""
} |
q258204 | ShopPackageInstaller.getAbsoluteFilePathFromInstallation | test | private function getAbsoluteFilePathFromInstallation(
$sourcePackageDirectory,
$absolutePathToFileFromPackage
) {
$installationDirectoryOfShopSource = $this->getTargetDirectoryOfShopSource();
$relativePathOfSourceFromPackage = Path::makeRelative(
$absolutePathToFileFromP... | php | {
"resource": ""
} |
q258205 | ThemePackageInstaller.update | test | public function update($packagePath)
{
$this->writeUpdatingMessage($this->getPackageTypeDescription());
$question = 'All files in the following directories will be overwritten:' . PHP_EOL .
'- ' . $this->formThemeTargetPath() . PHP_EOL .
'- ' . Path::join($thi... | php | {
"resource": ""
} |
q258206 | ModulePackageInstaller.copyPackage | test | protected function copyPackage($packagePath)
{
$filtersToApply = [
$this->getBlacklistFilterValue(),
$this->getVCSFilter(),
];
CopyGlobFilteredFileManager::copy(
$this->formSourcePath($packagePath),
$this->formTargetPath(),
$this->... | php | {
"resource": ""
} |
q258207 | ModulePackageInstaller.formSourcePath | test | protected function formSourcePath($packagePath)
{
$sourceDirectory = $this->getExtraParameterValueByKey(static::EXTRA_PARAMETER_KEY_SOURCE);
return !empty($sourceDirectory)?
Path::join($packagePath, $sourceDirectory):
$packagePath;
} | php | {
"resource": ""
} |
q258208 | VfsFileStructureOperator.nest | test | public static function nest($flatFileSystemStructure = null)
{
if (null !== $flatFileSystemStructure && false === is_array($flatFileSystemStructure)) {
throw new \InvalidArgumentException("Given input argument must be an array.");
}
if (null === $flatFileSystemStructure) {
... | php | {
"resource": ""
} |
q258209 | CopyGlobFilteredFileManager.getFlatFileListIterator | test | private static function getFlatFileListIterator($sourcePath)
{
$recursiveFileIterator = new \RecursiveDirectoryIterator($sourcePath, \FilesystemIterator::SKIP_DOTS);
$flatFileListIterator = new \RecursiveIteratorIterator($recursiveFileIterator);
return $flatFileListIterator;
} | php | {
"resource": ""
} |
q258210 | CopyGlobFilteredFileManager.copyDirectory | test | private static function copyDirectory($sourcePath, $destinationPath, $globExpressionList)
{
$filesystem = new Filesystem();
$flatFileListIterator = self::getFlatFileListIterator($sourcePath);
$filteredFileListIterator = new BlacklistFilterIterator(
$flatFileListIterator,
... | php | {
"resource": ""
} |
q258211 | CopyGlobFilteredFileManager.copyFile | test | private static function copyFile($sourcePathOfFile, $destinationPath, $globExpressionList)
{
$filesystem = new Filesystem();
$relativeSourcePath = self::getRelativePathForSingleFile($sourcePathOfFile);
if (!GlobMatcher::matchAny($relativeSourcePath, $globExpressionList)) {
$fil... | php | {
"resource": ""
} |
q258212 | Installer.generateModels | test | public static function generateModels(array $config)
{
$schemas = ArrayHelper::getValue($config, 'schemas', []);
$namespace = ArrayHelper::getValue($config, 'namespace', 'simialbi\yii2\schemaorg\models');
$folder = ArrayHelper::getValue($config, 'folder', sprintf(
'%1$s%2$ssimial... | php | {
"resource": ""
} |
q258213 | ModelsController.traverseClasses | test | private function traverseClasses(array &$classes, $allClasses = null)
{
if ($allClasses === null) {
$allClasses = $classes;
}
foreach ($classes as &$class) {
$parentClasses = ArrayHelper::remove($class, 'rdfs:subClassOf', []);
if (ArrayHelper::isAssociati... | php | {
"resource": ""
} |
q258214 | Model.toJsonLDArray | test | public function toJsonLDArray($fields = [], $expand = [], $recursive = true)
{
return array_merge([
'@context' => 'http://schema.org'
], $this->toArray($fields, $expand, $recursive));
} | php | {
"resource": ""
} |
q258215 | JsonLDHelper.addBreadCrumbList | test | public static function addBreadCrumbList()
{
if (!class_exists('\simialbi\yii2\schemaorg\models\BreadcrumbList')) {
return;
}
$view = Yii::$app->view;
/* @var $breadcrumbList \simialbi\yii2\schemaorg\models\Model */
$breadcrumbs = ArrayHelper::getValue($view->pa... | php | {
"resource": ""
} |
q258216 | JsonLDHelper.render | test | public static function render()
{
if (!empty(self::$_models)) {
foreach (self::$_models as $model) {
try {
echo Html::script(Json::encode($model->toJsonLDArray()), ['type' => 'application/ld+json']) . "\n";
} catch (InvalidArgumentException $e)... | php | {
"resource": ""
} |
q258217 | ToInlineStyleEmailConverter.setHTMLByView | test | public function setHTMLByView($view, array $parameters = array())
{
if (!$this->container) {
throw new MissingTemplatingEngineException("To use this function, a Container object must be passed to the constructor (@service_container service)");
}
/** @var EngineInterface $engine *... | php | {
"resource": ""
} |
q258218 | ToInlineStyleEmailConverter.generateStyledHTML | test | public function generateStyledHTML()
{
if (is_null($this->html)) {
throw new MissingParamException("The HTML must be set");
}
if (!is_string($this->html)) {
throw new MissingParamException("The HTML must be a valid string");
}
if (is_null($this->css)... | php | {
"resource": ""
} |
q258219 | InlineCssParser.resolvePath | test | private function resolvePath($path)
{
try {
return $this->locator->locate($path, $this->webRoot);
} catch (\InvalidArgumentException $e) {
// happens when path is not bundle relative
return $this->webRoot . '/' . $path;
}
} | php | {
"resource": ""
} |
q258220 | OnlySubsetsInList.expected | test | protected function expected(array $actual): bool
{
return collect($this->expected)->contains(function ($expected) use ($actual) {
return $this->compare($expected, $actual);
});
} | php | {
"resource": ""
} |
q258221 | OnlySubsetsInList.exists | test | protected function exists(array $expected, $actual): bool
{
if (!is_array($actual)) {
return false;
}
return collect($actual)->contains(function ($item) use ($expected) {
return $this->compare($expected, $item);
});
} | php | {
"resource": ""
} |
q258222 | HttpAssert.assertStatusCode | test | public static function assertStatusCode(
$status,
int $expected,
$content = null,
string $message = ''
): void
{
PHPUnitAssert::assertThat(
$status,
new HttpStatusIs($expected, $content),
$message
);
} | php | {
"resource": ""
} |
q258223 | HttpAssert.assertContent | test | public static function assertContent(
$type,
$content,
$expected = self::JSON_API_MEDIA_TYPE,
string $message = ''
): Document
{
PHPUnitAssert::assertSame($type, $expected, $message ?: "Expecting content with media type {$expected}.");
PHPUnitAssert::assertNotEmpt... | php | {
"resource": ""
} |
q258224 | HttpAssert.assertJson | test | public static function assertJson(
$status,
$contentType,
$content,
int $expected = self::STATUS_OK,
string $message = ''
): Document
{
self::assertStatusCode($status, $expected, $content, $message);
return self::assertContent($contentType, $content, self... | php | {
"resource": ""
} |
q258225 | HttpAssert.assertJsonApi | test | public static function assertJsonApi(
$status,
$contentType,
$content,
int $expected = self::STATUS_OK,
string $message = ''
): Document
{
self::assertStatusCode($status, $expected, $content, $message);
return self::assertContent($contentType, $content, s... | php | {
"resource": ""
} |
q258226 | HttpAssert.assertFetchedOne | test | public static function assertFetchedOne(
$status,
$contentType,
$content,
array $expected,
bool $strict = true,
string $message = ''
): Document
{
return self::assertJsonApi($status, $contentType, $content, self::STATUS_OK, $message)
->assertHa... | php | {
"resource": ""
} |
q258227 | HttpAssert.assertFetchedExact | test | public static function assertFetchedExact(
$status,
$contentType,
$content,
array $expected,
bool $strict = true,
string $message = ''
): Document
{
return self::assertJsonApi($status, $contentType, $content, self::STATUS_OK, $message)
->assert... | php | {
"resource": ""
} |
q258228 | HttpAssert.assertFetchedManyInOrder | test | public static function assertFetchedManyInOrder(
$status,
$contentType,
$content,
array $expected,
bool $strict = true,
string $message = ''
): Document
{
if (empty($expected)) {
return self::assertFetchedNone($strict, $contentType, $content, $... | php | {
"resource": ""
} |
q258229 | HttpAssert.assertFetchedToMany | test | public static function assertFetchedToMany(
$status,
$contentType,
$content,
array $expected,
bool $strict = true,
string $message = ''
): Document
{
if (empty($expected)) {
return self::assertFetchedNone($strict, $contentType, $content, $messa... | php | {
"resource": ""
} |
q258230 | HttpAssert.assertFetchedToManyInOrder | test | public static function assertFetchedToManyInOrder(
$status,
$contentType,
$content,
array $expected,
bool $strict = true,
string $message = ''
): Document
{
if (empty($expected)) {
return self::assertFetchedNone($strict, $contentType, $content,... | php | {
"resource": ""
} |
q258231 | HttpAssert.assertCreatedWithClientId | test | public static function assertCreatedWithClientId(
$status,
$contentType,
$content,
$location,
string $expectedLocation,
array $expected,
bool $strict = true,
string $message = ''
): Document
{
$expectedId = $expected['id'] ?? null;
... | php | {
"resource": ""
} |
q258232 | HttpAssert.assertNoContent | test | public static function assertNoContent($status, string $content = null, string $message = ''): void
{
self::assertStatusCode($status, self::STATUS_NO_CONTENT, $content, $message);
PHPUnitAssert::assertEmpty($content, $message ?: 'Expecting HTTP body content to be empty.');
} | php | {
"resource": ""
} |
q258233 | HttpAssert.assertExactMetaWithoutData | test | public static function assertExactMetaWithoutData(
$status,
$contentType,
$content,
array $expected,
bool $strict = true,
string $message = ''
): Document
{
return self::assertJsonApi($status, $contentType, $content, self::STATUS_OK, $message)
... | php | {
"resource": ""
} |
q258234 | HttpAssert.assertExactErrorStatus | test | public static function assertExactErrorStatus(
$status,
$contentType,
$content,
array $error,
bool $strict = true,
string $message = ''
): Document
{
$expectedStatus = $error['status'] ?? null;
if (!$expectedStatus) {
throw new \Invali... | php | {
"resource": ""
} |
q258235 | HttpAssert.assertHasExactError | test | public static function assertHasExactError(
$status,
$contentType,
$content,
int $expectedStatus,
array $error,
bool $strict = true,
string $message = ''
): Document
{
if (empty($error)) {
$error = ['status' => (string) $status];
... | php | {
"resource": ""
} |
q258236 | HttpAssert.assertErrors | test | public static function assertErrors(
$status,
$contentType,
$content,
int $expectedStatus,
array $errors,
bool $strict = true,
string $message = ''
): Document
{
return self::assertJsonApi($status, $contentType, $content, $expectedStatus, $message)... | php | {
"resource": ""
} |
q258237 | HasHttpAssertions.getDocument | test | public function getDocument(): Document
{
if (!$this->document) {
$this->document = HttpAssert::assertContent(
$this->getContentType(),
$this->getContent()
);
}
return $this->document;
} | php | {
"resource": ""
} |
q258238 | HasHttpAssertions.willSeeType | test | public function willSeeType(string $type): self
{
if (empty($type)) {
throw new \InvalidArgumentException('Expected type must be a non-empty string.');
}
$this->expectedType = $type;
return $this;
} | php | {
"resource": ""
} |
q258239 | HasHttpAssertions.assertFetchedOneExact | test | public function assertFetchedOneExact($expected, bool $strict = true): self
{
$this->document = HttpAssert::assertFetchedExact(
$this->getStatusCode(),
$this->getContentType(),
$this->getContent(),
$this->identifier($expected),
$strict
);
... | php | {
"resource": ""
} |
q258240 | HasHttpAssertions.assertUpdated | test | public function assertUpdated(array $expected = null, bool $strict = true): self
{
if (is_null($expected)) {
return $this->assertNoContent();
}
return $this->assertFetchedOne($expected, $strict);
} | php | {
"resource": ""
} |
q258241 | HasHttpAssertions.assertDeleted | test | public function assertDeleted(array $expected = null, bool $strict = true): self
{
if (is_null($expected)) {
return $this->assertNoContent();
}
return $this->assertMetaWithoutData($expected, $strict);
} | php | {
"resource": ""
} |
q258242 | HasHttpAssertions.assertIsIncluded | test | public function assertIsIncluded(string $type, $id): self
{
$identifier = $this->identifier(compact('type', 'id'));
$this->getDocument()->assertIncludedContainsResource(
$identifier['type'],
$identifier['id']
);
return $this;
} | php | {
"resource": ""
} |
q258243 | HasHttpAssertions.assertIncludes | test | public function assertIncludes($expected, bool $strict = true): self
{
$this->getDocument()->assertIncludedContainsHash(
$this->identifier($expected),
$strict
);
return $this;
} | php | {
"resource": ""
} |
q258244 | HasHttpAssertions.assertMeta | test | public function assertMeta(array $expected, bool $strict = true): self
{
$this->getDocument()->assertMeta($expected, $strict);
return $this;
} | php | {
"resource": ""
} |
q258245 | HasHttpAssertions.assertExactMeta | test | public function assertExactMeta(array $expected, bool $strict = true): self
{
$this->getDocument()->assertExactMeta($expected, $strict);
return $this;
} | php | {
"resource": ""
} |
q258246 | HasHttpAssertions.assertExactLinks | test | public function assertExactLinks(array $expected, bool $strict = true): self
{
$this->getDocument()->assertExactLinks($expected, $strict);
return $this;
} | php | {
"resource": ""
} |
q258247 | HasHttpAssertions.assertExactErrors | test | public function assertExactErrors(int $status, array $errors, bool $strict = true): self
{
$this->document = HttpAssert::assertExactErrors(
$this->getStatusCode(),
$this->getContentType(),
$this->getContent(),
$status,
$errors,
$strict
... | php | {
"resource": ""
} |
q258248 | Assert.assertResource | test | public static function assertResource(
$document,
string $type,
string $id,
string $pointer = '/data',
string $message = ''
): void
{
self::assertHash($document, compact('type', 'id'), $pointer, true, $message);
} | php | {
"resource": ""
} |
q258249 | Assert.assertIdentifier | test | public static function assertIdentifier(
$document,
string $type,
string $id,
string $pointer = '/data',
string $message = ''
): void
{
$expected = compact('type', 'id');
PHPUnitAssert::assertThat(
$document,
new IdentifierInDocume... | php | {
"resource": ""
} |
q258250 | Assert.assertExact | test | public static function assertExact(
$document,
$expected,
string $pointer = '/data',
bool $strict = true,
string $message = ''
): void
{
PHPUnitAssert::assertThat(
$document,
new ExactInDocument($expected, $pointer, $strict),
$m... | php | {
"resource": ""
} |
q258251 | Assert.assertNotExact | test | public static function assertNotExact(
$document,
$expected,
string $pointer = '/data',
bool $strict = true,
string $message = ''
): void
{
$constraint = new LogicalNot(
new ExactInDocument($expected, $pointer, $strict)
);
PHPUnitAsser... | php | {
"resource": ""
} |
q258252 | Assert.assertList | test | public static function assertList(
$document,
array $expected,
string $pointer = '/data',
bool $strict = true,
string $message = ''
): void
{
PHPUnitAssert::assertThat(
$document,
new OnlySubsetsInList($expected, $pointer, $strict),
... | php | {
"resource": ""
} |
q258253 | Assert.assertExactList | test | public static function assertExactList(
$document,
array $expected,
string $pointer = '/data',
bool $strict = true,
string $message = ''
): void
{
PHPUnitAssert::assertThat(
$document,
new OnlyExactInList($expected, $pointer, $strict),
... | php | {
"resource": ""
} |
q258254 | Assert.assertListInOrder | test | public static function assertListInOrder(
$document,
array $expected,
string $pointer = '/data',
bool $strict = true,
string $message = ''
): void
{
PHPUnitAssert::assertThat(
$document,
new SubsetInDocument($expected, $pointer, $strict),
... | php | {
"resource": ""
} |
q258255 | Assert.assertExactListInOrder | test | public static function assertExactListInOrder(
$document,
array $expected,
string $pointer = '/data',
bool $strict = true,
string $message = ''
): void
{
self::assertExact($document, $expected, $pointer, $strict, $message);
} | php | {
"resource": ""
} |
q258256 | Assert.assertIdentifiersList | test | public static function assertIdentifiersList(
$document,
array $expected,
string $pointer = '/data',
bool $strict = true,
string $message = ''
): void
{
PHPUnitAssert::assertThat(
$document,
new OnlyIdentifiersInList($expected, $pointer, $s... | php | {
"resource": ""
} |
q258257 | Assert.assertIdentifiersListInOrder | test | public static function assertIdentifiersListInOrder(
$document,
array $expected,
string $pointer = '/data',
bool $strict = true,
string $message = ''
): void
{
PHPUnitAssert::assertThat(
$document,
new IdentifiersInDocument($expected, $poin... | php | {
"resource": ""
} |
q258258 | Assert.assertListContainsResource | test | public static function assertListContainsResource(
$document,
string $type,
string $id,
string $pointer = '/data',
string $message = ''
): void
{
$expected = compact('type', 'id');
self::assertListContainsHash($document, $expected, $pointer, true, $messag... | php | {
"resource": ""
} |
q258259 | Assert.assertListContainsHash | test | public static function assertListContainsHash(
$document,
array $expected,
string $pointer = '/data',
bool $strict = true,
string $message = ''
): void
{
PHPUnitAssert::assertThat(
$document,
new SubsetInList($expected, $pointer, $strict),
... | php | {
"resource": ""
} |
q258260 | Assert.assertListContainsExact | test | public static function assertListContainsExact(
$document,
array $expected,
string $pointer = '/data',
bool $strict = true,
string $message = ''
): void
{
PHPUnitAssert::assertThat(
$document,
new ExactInList($expected, $pointer, $strict),
... | php | {
"resource": ""
} |
q258261 | Assert.assertIncludedContainsHash | test | public static function assertIncludedContainsHash(
$document,
array $expected,
bool $strict = true,
string $message = ''
): void
{
self::assertListContainsHash($document, $expected, '/included', $strict, $message);
} | php | {
"resource": ""
} |
q258262 | Assert.assertExactError | test | public static function assertExactError($document, array $error, bool $strict = true, string $message = ''): void
{
self::assertExactList($document, [$error], '/errors', $strict, $message);
} | php | {
"resource": ""
} |
q258263 | Assert.assertHasError | test | public static function assertHasError($document, array $error, bool $strict = true, string $message = ''): void
{
self::assertListContainsHash($document, $error, '/errors', $strict, $message);
} | php | {
"resource": ""
} |
q258264 | Assert.assertHasExactError | test | public static function assertHasExactError(
$document,
array $error,
bool $strict = true,
string $message = ''
): void
{
self::assertListContainsExact($document, $error, '/errors', $strict, $message);
} | php | {
"resource": ""
} |
q258265 | Document.create | test | public static function create($content): ?self
{
if (is_string($content)) {
return self::fromString($content);
}
return $content ? self::cast($content) : null;
} | php | {
"resource": ""
} |
q258266 | Document.cast | test | public static function cast($document): self
{
if ($document instanceof self) {
return $document;
}
if (is_string($document)) {
return self::decode($document);
}
return self::fromIterable($document);
} | php | {
"resource": ""
} |
q258267 | Document.fromString | test | public static function fromString(string $json): ?self
{
$document = \json_decode($json, true);
if (JSON_ERROR_NONE !== \json_last_error() || !\is_array($document)) {
return null;
}
return new self($document);
} | php | {
"resource": ""
} |
q258268 | Document.decode | test | public static function decode(string $json): self
{
if (!$document = self::fromString($json)) {
throw new \InvalidArgumentException('Invalid JSON string.');
}
return $document;
} | php | {
"resource": ""
} |
q258269 | Document.get | test | public function get(string $pointer, $default = null)
{
if (!$path = Compare::path($pointer)) {
return $this->document;
}
return Arr::get($this->document, $path, $default);
} | php | {
"resource": ""
} |
q258270 | Document.has | test | public function has(string ...$pointers): bool
{
$paths = collect($pointers)->map(function ($pointer) {
return Compare::path($pointer);
})->filter()->all();
return Arr::has($this->document, $paths);
} | php | {
"resource": ""
} |
q258271 | Document.assertExists | test | public function assertExists($pointers, string $message = ''): self
{
$missing = collect((array) $pointers)->reject(function ($pointer) {
return $this->has($pointer);
})->implode(', ');
PHPUnitAssert::assertEmpty($missing, $message ?: "Members [{$missing}] do not exist.");
... | php | {
"resource": ""
} |
q258272 | Document.assertNotExists | test | public function assertNotExists($pointers, string $message = ''): self
{
$unexpected = collect((array) $pointers)->filter(function ($pointer) {
return $this->has($pointer);
})->implode(', ');
PHPUnitAssert::assertEmpty($unexpected, $message ?: "Members [{$unexpected}] exist.");
... | php | {
"resource": ""
} |
q258273 | Compare.exact | test | public static function exact($expected, $actual, bool $strict = true): bool
{
$expected = self::normalize($expected);
$actual = self::normalize($actual);
if ($strict) {
return $expected === $actual;
}
return $expected == $actual;
} | php | {
"resource": ""
} |
q258274 | Compare.subset | test | public static function subset(array $expected, $actual, bool $strict = true): bool
{
if (!is_array($actual)) {
return false;
}
$patched = self::patch($actual, $expected);
return self::exact($patched, $actual, $strict);
} | php | {
"resource": ""
} |
q258275 | Compare.resourceIdentifier | test | public static function resourceIdentifier($value): bool
{
if (!is_array($value)) {
return false;
}
$members = collect($value);
return $members->has('type') &&
$members->has('id') &&
!$members->has('attributes') &&
!$members->has('rela... | php | {
"resource": ""
} |
q258276 | Compare.sort | test | public static function sort(array $value): array
{
if (self::hash($value)) {
ksort($value);
}
return collect($value)->map(function ($item) {
return self::normalize($item);
})->all();
} | php | {
"resource": ""
} |
q258277 | Compare.identifiable | test | public static function identifiable($value): bool
{
return $value instanceof UrlRoutable ||
is_string($value) ||
is_int($value) ||
self::hash($value);
} | php | {
"resource": ""
} |
q258278 | ListFilesIterator.sendRequest | test | protected function sendRequest()
{
if ($this->nextToken) {
$this->command->set('page', $this->nextToken);
}
$result = $this->command->execute();
$currentToken = $result['paging']['page'];
$this->nextToken = $result['paging']['pages'] > $currentToken ? ++$currentT... | php | {
"resource": ""
} |
q258279 | Iterocitor.tell | test | public function tell($user, $text)
{
return $this->say($this->sequencer->format('@'.$user).' '.$text);
} | php | {
"resource": ""
} |
q258280 | Iterocitor.reply | test | public function reply($user, $text)
{
if ($user instanceof CommandInterface) {
$sequence = $this->sequencer->command($user);
return $this->say($sequence['user'].' '.$text);
}
return $this->tell($user, $text);
} | php | {
"resource": ""
} |
q258281 | OptionsResolver.setTypesAllowed | test | public function setTypesAllowed($allowedTypes = null)
{
if (!$this->isLatest()) {
return $this->setAllowedTypes($allowedTypes);
}
foreach ($allowedTypes as $option => $typesAllowed) {
$this->setAllowedTypes($option, $typesAllowed);
}
return $this;
... | php | {
"resource": ""
} |
q258282 | HtmlOutput.write | test | public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
{
if (!is_array($messages))
{
$messages = array($messages);
}
foreach ($messages as $message)
{
$this->buffer .= $this->parse($message);
if ($newline)
{
$this->buffer .= "\n";
}
}
} | php | {
"resource": ""
} |
q258283 | Output.writelnIfDebug | test | public function writelnIfDebug($message)
{
if ($this->debug)
{
$this->debugMessages[] = new Message(Output::DEBUG, $message, null);
}
} | php | {
"resource": ""
} |
q258284 | Output.addMessage | test | public function addMessage($type, $message, FileInterface $file = null)
{
switch ($type)
{
case Output::FATAL:
$this->fatal++;
break;
case Output::ERROR:
$this->error++;
break;
case Output::WARNING:
$this->warning++;
break;
case Output::NOTICE:
$this->notice++;
break;
... | php | {
"resource": ""
} |
q258285 | Output.getMessageCount | test | public function getMessageCount($type)
{
switch ($type)
{
case Output::FATAL:
return $this->fatal;
case Output::ERROR:
return $this->error;
case Output::WARNING:
return $this->warning;
case Output::NOTICE:
return $this->notice;
}
} | php | {
"resource": ""
} |
q258286 | php_exporter.get_vars_from_single_line_array | test | public function get_vars_from_single_line_array($line, $throw_multiline = true)
{
$match = array();
preg_match('#^\$vars = (?:(\[)|array\()\'([a-z0-9_\' ,]+)\'(?(1)\]|\));$#i', $line, $match);
if (isset($match[2]))
{
$vars_array = explode("', '", $match[2]);
if ($throw_multiline && sizeof($vars_array) >... | php | {
"resource": ""
} |
q258287 | php_exporter.get_vars_from_multi_line_array | test | public function get_vars_from_multi_line_array()
{
$current_vars_line = 2;
$var_lines = array();
while (!in_array(ltrim($this->file_lines[$this->current_event_line - $current_vars_line], "\t"), ['$vars = array(', '$vars = [']))
{
$var_lines[] = substr(trim($this->file_lines[$this->current_event_line... | php | {
"resource": ""
} |
q258288 | php_exporter.validate_vars_docblock_array | test | public function validate_vars_docblock_array($vars_array, $vars_docblock)
{
$vars_array = array_unique($vars_array);
$vars_docblock = array_unique($vars_docblock);
$sizeof_vars_array = sizeof($vars_array);
if ($sizeof_vars_array !== sizeof($vars_docblock) || $sizeof_vars_array !== sizeof(array_inte... | php | {
"resource": ""
} |
q258289 | AllTrait.all | test | public function all($strategy = null)
{
if ($this instanceof \Iterator) {
$strategy = conversions\mixed_to_value_getter($strategy);
foreach ($this as $item) {
$tempVarPhp54 = call_user_func($strategy, $item);
if (empty($tempVarPhp54)) {
... | php | {
"resource": ""
} |
q258290 | AccumulateTrait.accumulate | test | public function accumulate($closure = 'add')
{
if ($this instanceof \Iterator) {
return new AccumulateIterator(
$this,
$closure instanceof \Closure ? $closure : reductions\get_reduction($closure)
);
}
return null;
} | php | {
"resource": ""
} |
q258291 | SortedIterator.mergeSort | test | protected function mergeSort(array &$array, \Closure $cmp_function)
{
// Arrays of size < 2 require no action.
if (count($array) < 2) {
return;
}
// Split the array in half
$halfway = count($array) / 2;
$array1 = array_slice($array, 0, $halfway);
... | php | {
"resource": ""
} |
q258292 | ToArrayTrait.toArray | test | public function toArray()
{
if ($this instanceof \Traversable) {
$array = iterator_to_array($this);
array_walk(
$array,
function (&$value) {
if ($value instanceof FiniteIterableInterface) {
$value = $value->t... | php | {
"resource": ""
} |
q258293 | KeysTrait.keys | test | public function keys()
{
$keys = [];
if ($this instanceof \Traversable) {
foreach ($this as $key => $value) {
$keys [] = $key;
}
}
return $keys;
} | php | {
"resource": ""
} |
q258294 | ZipTrait.zip | test | public function zip(/* $iterable, $iterable2, ... */)
{
if ($this instanceof \Iterator) {
$iterables = array_map(
'\Zicht\Itertools\conversions\mixed_to_iterator',
func_get_args()
);
$reflectorClass = new \ReflectionClass('\Zicht\Itertools\... | php | {
"resource": ""
} |
q258295 | ValuesTrait.values | test | public function values()
{
$values = [];
if ($this instanceof \Traversable) {
foreach ($this as $key => $value) {
$values [] = $value instanceof FiniteIterableInterface ? $value->values() : $value;
}
}
return $values;
} | php | {
"resource": ""
} |
q258296 | ReduceTrait.reduce | test | public function reduce($closure = 'add', $initializer = null)
{
if ($this instanceof \Iterator) {
$closure = $closure instanceof \Closure ? $closure : Itertools\reductions\get_reduction($closure);
$this->rewind();
if (null === $initializer) {
if ($this->v... | php | {
"resource": ""
} |
q258297 | MapIterator.genericKeysToKey | test | protected function genericKeysToKey($keysAndValues)
{
$keys = array_splice($keysAndValues, 0, count($keysAndValues) / 2);
if (count($keys) == 1) {
return $keys[0];
}
$value = $keys[0];
foreach ($keys as $key) {
if ($key !== $value) {
... | php | {
"resource": ""
} |
q258298 | GroupByTrait.groupBy | test | public function groupBy($strategy, $sort = true)
{
if (!is_bool($sort)) {
throw new \InvalidArgumentException('Argument $sort must be a boolean');
}
if ($this instanceof \Iterator) {
return new GroupbyIterator(
conversions\mixed_to_value_getter($strat... | php | {
"resource": ""
} |
q258299 | Extension.reduce | test | public function reduce($iterable, $closure = 'add', $initializer = null)
{
return Itertools\reduce($iterable, $closure, $initializer);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.