_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q26600 | Model._formatDate | train | protected function _formatDate($field, &$attributes)
{
if ($this->timestamps && $field) {
switch ($this->dateFormat) {
case 'datetime':
$dateFormat = date("Y-m-d H:i:s");
break;
case 'unixtime':
... | php | {
"resource": ""
} |
q26601 | Model._addSoftDeletedCondition | train | protected function _addSoftDeletedCondition()
{
if ($this->_withoutSoftDeletedScope) {
// Reset SOFT_DELETED switch
$this->_withoutSoftDeletedScope = false;
}
elseif (static::SOFT_DELETED && isset($this->softDeletedFalseValue)) {
// Add condition
... | php | {
"resource": ""
} |
q26602 | Model.__isset | train | public function __isset($name) {
if (isset($this->_writeProperties[$name])) {
return true;
}
return isset($this->_readProperties[$name]);
} | php | {
"resource": ""
} |
q26603 | DescriptorAbstract.setLocation | train | public function setLocation(FileDescriptor $file, $line = 0)
{
$this->setFile($file);
$this->line = $line;
} | php | {
"resource": ""
} |
q26604 | DescriptorAbstract.getVersion | train | public function getVersion()
{
/** @var Collection $version */
$version = $this->getTags()->get('version', new Collection());
if ($version->count() !== 0) {
return $version;
}
$inheritedElement = $this->getInheritedElement();
if ($inheritedElement) {
... | php | {
"resource": ""
} |
q26605 | DescriptorAbstract.getCopyright | train | public function getCopyright()
{
/** @var Collection $copyright */
$copyright = $this->getTags()->get('copyright', new Collection());
if ($copyright->count() !== 0) {
return $copyright;
}
$inheritedElement = $this->getInheritedElement();
if ($inheritedEle... | php | {
"resource": ""
} |
q26606 | InternalTag.process | train | public function process(\DOMDocument $xml)
{
$ignoreQry = '//long-description[contains(., "{@internal")]';
$xpath = new \DOMXPath($xml);
$nodes = $xpath->query($ignoreQry);
// either replace it with nothing or with the 'stored' value
$replacement = $this->internalAllowed ? ... | php | {
"resource": ""
} |
q26607 | TableOfContents.offsetSet | train | public function offsetSet($index, $newval)
{
if (!$newval instanceof TableOfContents\File) {
throw new \InvalidArgumentException('A table of contents may only be filled with File objects');
}
$basename = basename($newval->getFilename());
if (strpos($basename, '.') !== fa... | php | {
"resource": ""
} |
q26608 | Twig.setExtension | train | public function setExtension(string $extension): void
{
if (!preg_match('/^[a-zA-Z0-9]{2,4}$/', $extension)) {
throw new InvalidArgumentException(
'Extension should be only be composed of alphanumeric characters'
. ' and should be at least 2 but no more than 4 cha... | php | {
"resource": ""
} |
q26609 | Twig.getTemplateFilename | train | protected function getTemplateFilename()
{
$filename = $this->name . '/layout.' . $this->extension . '.twig';
$template_path = $this->path . DIRECTORY_SEPARATOR . $filename;
if (!file_exists($template_path)) {
throw new \DomainException('Template file "' . $template_path . '" co... | php | {
"resource": ""
} |
q26610 | IgnoreTag.process | train | public function process(\DOMDocument $xml)
{
$ignoreQry = '//tag[@name=\'' . $this->tag . '\']';
$xpath = new \DOMXPath($xml);
$nodes = $xpath->query($ignoreQry);
/** @var \DOMElement $node */
foreach ($nodes as $node) {
$remove = $node->parentNode->parentNode;
... | php | {
"resource": ""
} |
q26611 | Dsn.parse | train | private function parse(string $dsn): void
{
$dsnParts = explode(';', $dsn);
$location = $dsnParts[0];
unset($dsnParts[0]);
$locationParts = parse_url($location);
if ($locationParts === false ||
(array_key_exists('scheme', $locationParts) && \strlen($locationParts... | php | {
"resource": ""
} |
q26612 | Dsn.parseScheme | train | private function parseScheme(array $locationParts): void
{
if (! $this->isValidScheme($locationParts['scheme'])) {
throw new InvalidArgumentException(
sprintf('"%s" is not a valid scheme.', $locationParts['scheme'])
);
}
$this->scheme = strtolower($lo... | php | {
"resource": ""
} |
q26613 | Dsn.isValidScheme | train | private function isValidScheme(string $scheme): bool
{
$validSchemes = ['file', 'git+http', 'git+https'];
return \in_array(\strtolower($scheme), $validSchemes, true);
} | php | {
"resource": ""
} |
q26614 | Dsn.parseHostAndPath | train | private function parseHostAndPath(array $locationParts): void
{
$path = $locationParts['path'] ?? '';
$host = $locationParts['host'] ?? '';
if ($this->getScheme() === 'file') {
$this->path = $host . $path;
} else {
$this->host = $host;
$this->path... | php | {
"resource": ""
} |
q26615 | Dsn.parsePort | train | private function parsePort(array $locationParts): void
{
if (! isset($locationParts['port'])) {
if ($this->getScheme() === 'git+http') {
$this->port = 80;
} elseif ($this->getScheme() === 'git+https') {
$this->port = 443;
} else {
... | php | {
"resource": ""
} |
q26616 | Dsn.parseQuery | train | private function parseQuery(array $locationParts): void
{
if (isset($locationParts['query'])) {
$queryParts = explode('&', $locationParts['query']);
foreach ($queryParts as $part) {
$option = $this->splitKeyValuePair($part);
$this->query[$option[0]] =... | php | {
"resource": ""
} |
q26617 | Dsn.parseParameters | train | private function parseParameters(array $dsnParts): void
{
foreach ($dsnParts as $part) {
$option = $this->splitKeyValuePair($part);
$this->parameters[$option[0]] = $option[1];
}
} | php | {
"resource": ""
} |
q26618 | Dsn.splitKeyValuePair | train | private function splitKeyValuePair(string $pair): array
{
$option = explode('=', $pair);
if (count($option) !== 2) {
throw new InvalidArgumentException(
sprintf('"%s" is not a valid query or parameter.', $pair)
);
}
return $option;
} | php | {
"resource": ""
} |
q26619 | Pathfinder.find | train | public function find($object, $query)
{
if ($query) {
$node = $this->walkObjectTree($object, $query);
if (!is_array($node) && (!$node instanceof \Traversable)) {
$node = [$node];
}
return $node;
}
return [$object];
} | php | {
"resource": ""
} |
q26620 | Transformer.setTarget | train | public function setTarget(string $target): void
{
$path = realpath($target);
if (false === $path) {
if (@mkdir($target, 0755, true)) {
$path = realpath($target);
} else {
throw new InvalidArgumentException(
'Target directory... | php | {
"resource": ""
} |
q26621 | BaseConverter.setOption | train | public function setOption(string $name, string $value): void
{
$this->options[$name] = $value;
} | php | {
"resource": ""
} |
q26622 | BaseConverter.getDestinationFilename | train | protected function getDestinationFilename(Metadata\TableOfContents\File $file): string
{
return $this->definition->getOutputFormat()->convertFilename($file->getRealPath());
} | php | {
"resource": ""
} |
q26623 | PropertyDescriptor.getInheritedElement | train | public function getInheritedElement()
{
/** @var ClassDescriptor|InterfaceDescriptor|null $associatedClass */
$associatedClass = $this->getParent();
if (($associatedClass instanceof ClassDescriptor || $associatedClass instanceof InterfaceDescriptor)
&& ($associatedClass->getPare... | php | {
"resource": ""
} |
q26624 | ConfigurationFactory.fromDefaultLocations | train | public function fromDefaultLocations(): Configuration
{
foreach ($this->defaultFiles as $file) {
try {
return $this->fromUri(new Uri($file));
} catch (\InvalidArgumentException $e) {
continue;
}
}
return new Configuration($... | php | {
"resource": ""
} |
q26625 | ConfigurationFactory.fromUri | train | public function fromUri(Uri $uri): Configuration
{
$filename = (string) $uri;
if (!file_exists($filename)) {
throw new \InvalidArgumentException(sprintf('File %s could not be found', $filename));
}
$xml = new \SimpleXMLElement($filename, 0, true);
foreach ($this... | php | {
"resource": ""
} |
q26626 | ConfigurationFactory.applyMiddleware | train | private function applyMiddleware(array $configuration): array
{
foreach ($this->middlewares as $middleware) {
$configuration = $middleware($configuration);
}
return $configuration;
} | php | {
"resource": ""
} |
q26627 | FileAssembler.addClasses | train | protected function addClasses(array $classes, FileDescriptor $fileDescriptor): void
{
foreach ($classes as $class) {
$classDescriptor = $this->getBuilder()->buildDescriptor($class);
if ($classDescriptor) {
$classDescriptor->setLocation($fileDescriptor, $class->getLoca... | php | {
"resource": ""
} |
q26628 | ProjectDescriptor.isVisibilityAllowed | train | public function isVisibilityAllowed($visibility)
{
$visibilityAllowed = $this->getSettings()
? $this->getSettings()->getVisibility()
: Settings::VISIBILITY_DEFAULT;
return (bool) ($visibilityAllowed & $visibility);
} | php | {
"resource": ""
} |
q26629 | Factory.get | train | public function get($input_format, $output_format)
{
return new Definition(
$this->format_collection[$input_format],
$this->format_collection[$output_format]
);
} | php | {
"resource": ""
} |
q26630 | ConstantDescriptor.setParent | train | public function setParent($parent)
{
if (!$parent instanceof ClassDescriptor && !$parent instanceof InterfaceDescriptor && $parent !== null) {
throw new \InvalidArgumentException('Constants can only have an interface or class as parent');
}
$fqsen = $parent !== null
... | php | {
"resource": ""
} |
q26631 | AssemblerFactory.register | train | public function register(callable $matcher, AssemblerInterface $assembler): void
{
$this->assemblers[] = new AssemblerMatcher($matcher, $assembler);
} | php | {
"resource": ""
} |
q26632 | AssemblerFactory.registerFallback | train | public function registerFallback(callable $matcher, AssemblerInterface $assembler): void
{
$this->fallbackAssemblers[] = new AssemblerMatcher($matcher, $assembler);
} | php | {
"resource": ""
} |
q26633 | MethodAssembler.addVariadicArgument | train | protected function addVariadicArgument(Method $data, MethodDescriptor $methodDescriptor): void
{
if (!$data->getDocBlock()) {
return;
}
$paramTags = $data->getDocBlock()->getTagsByName('param');
/** @var Param $lastParamTag */
$lastParamTag = end($paramTags);
... | php | {
"resource": ""
} |
q26634 | Collection.offsetSet | train | public function offsetSet($index, $newval)
{
if (!$newval instanceof WriterAbstract) {
throw new \InvalidArgumentException(
'The Writer Collection may only contain objects descending from WriterAbstract'
);
}
if (!preg_match('/^[a-zA-Z0-9\-\_\/]{3,}$/... | php | {
"resource": ""
} |
q26635 | Collection.offsetGet | train | public function offsetGet($index)
{
if (!$this->offsetExists($index)) {
throw new \InvalidArgumentException('Writer "' . $index . '" does not exist');
}
return parent::offsetGet($index);
} | php | {
"resource": ""
} |
q26636 | Document.logStats | train | public function logStats($fatal, Logger $logger)
{
if (!$this->getErrors() && !$fatal) {
return;
}
/** @var \Exception $error */
foreach ($this->getErrors() as $error) {
$logger->warning(' ' . $error->getMessage());
}
if ($fatal) {
... | php | {
"resource": ""
} |
q26637 | Statistics.appendPhpdocStatsElement | train | protected function appendPhpdocStatsElement(\DOMDocument $document)
{
$stats = $document->createElement('phpdoc-stats');
$stats->setAttribute('version', Application::VERSION());
$document->appendChild($stats);
return $document;
} | php | {
"resource": ""
} |
q26638 | Statistics.appendStatElement | train | protected function appendStatElement(\DOMDocument $document, ProjectDescriptor $project, $date)
{
$stat = $document->createDocumentFragment();
$stat->appendXML(
<<<STAT
<stat date="${date}">
<counters>
<files>{$this->getFilesCounter($project)}</files>
<deprecated>{$th... | php | {
"resource": ""
} |
q26639 | Statistics.getErrorCounter | train | protected function getErrorCounter(ProjectDescriptor $project)
{
$errorCounter = 0;
/* @var FileDescriptor $fileDescriptor */
foreach ($project->getFiles()->getAll() as $fileDescriptor) {
$errorCounter += count($fileDescriptor->getAllErrors()->getAll());
}
retur... | php | {
"resource": ""
} |
q26640 | Statistics.getMarkerCounter | train | protected function getMarkerCounter(ProjectDescriptor $project)
{
$markerCounter = 0;
/* @var $fileDescriptor FileDescriptor */
foreach ($project->getFiles()->getAll() as $fileDescriptor) {
$markerCounter += $fileDescriptor->getMarkers()->count();
}
return $mark... | php | {
"resource": ""
} |
q26641 | PropertyConverter.convert | train | public function convert(\DOMElement $parent, PropertyDescriptor $property)
{
$fullyQualifiedNamespaceName = $property->getNamespace() instanceof NamespaceDescriptor
? $property->getNamespace()->getFullyQualifiedStructuralElementName()
: $parent->getAttribute('namespace');
$c... | php | {
"resource": ""
} |
q26642 | Xsl.setProcessorParameters | train | public function setProcessorParameters(TransformationObject $transformation, $proc)
{
foreach ($this->xsl_variables as $key => $variable) {
// XSL does not allow both single and double quotes in a string
if ((strpos($variable, '"') !== false)
&& ((strpos($variable, "'... | php | {
"resource": ""
} |
q26643 | Xsl.getArtifactPath | train | private function getArtifactPath(Transformation $transformation)
{
return $transformation->getArtifact()
? $transformation->getTransformer()->getTarget() . DIRECTORY_SEPARATOR . $transformation->getArtifact()
: null;
} | php | {
"resource": ""
} |
q26644 | Settings.setValueAndCheckIfModified | train | protected function setValueAndCheckIfModified($propertyName, $value)
{
if ($this->{$propertyName} !== $value) {
$this->isModified = true;
}
$this->{$propertyName} = $value;
} | php | {
"resource": ""
} |
q26645 | Collection.load | train | public function load($nameOrPath)
{
$template = $this->factory->get($nameOrPath);
/** @var Transformation $transformation */
foreach ($template as $transformation) {
/** @var WriterAbstract $writer */
$writer = $this->writerCollection[$transformation->getWriter()];
... | php | {
"resource": ""
} |
q26646 | Collection.getTransformations | train | public function getTransformations()
{
$result = [];
foreach ($this as $template) {
foreach ($template as $transformation) {
$result[] = $transformation;
}
}
return $result;
} | php | {
"resource": ""
} |
q26647 | StripOnVisibility.filter | train | public function filter($value)
{
if ($value instanceof VisibilityInterface
&& !$this->builder->isVisibilityAllowed($value->getVisibility())
) {
return null;
}
return $value;
} | php | {
"resource": ""
} |
q26648 | ClassAssembler.addConstants | train | protected function addConstants(array $constants, ClassDescriptor $classDescriptor): void
{
foreach ($constants as $constant) {
$constantDescriptor = $this->getBuilder()->buildDescriptor($constant);
if ($constantDescriptor instanceof ConstantDescriptor) {
$constantDes... | php | {
"resource": ""
} |
q26649 | Finder.constructExamplePath | train | private function constructExamplePath(string $directory, string $file): string
{
return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file;
} | php | {
"resource": ""
} |
q26650 | Finder.getExamplePathFromSource | train | private function getExamplePathFromSource(string $file): string
{
return sprintf(
'%s%s%s',
trim($this->getSourceDirectory(), '\\/'),
DIRECTORY_SEPARATOR,
trim($file, '"')
);
} | php | {
"resource": ""
} |
q26651 | Queue.match | train | public function match($node)
{
/** @var RouterAbstract $router */
foreach (clone $this as $router) {
$rule = $router->match($node);
if ($rule) {
return $rule;
}
}
return null;
} | php | {
"resource": ""
} |
q26652 | DocBlockConverter.addTags | train | protected function addTags(\DOMElement $docBlock, $descriptor)
{
foreach ($descriptor->getTags() as $tagGroup) {
if (! $tagGroup) {
continue;
}
foreach ($tagGroup as $tag) {
$this->tagConverter->convert($docBlock, $tag);
}
... | php | {
"resource": ""
} |
q26653 | Factory.getAllNames | train | public function getAllNames()
{
/** @var \RecursiveDirectoryIterator $files */
$files = new \DirectoryIterator($this->getTemplatePath());
$template_names = [];
while ($files->valid()) {
$name = $files->getBasename();
// skip abstract files
if (!$... | php | {
"resource": ""
} |
q26654 | Factory.createTemplateFromXml | train | protected function createTemplateFromXml($xml)
{
/** @var Template $template */
$template = $this->serializer->deserialize($xml, 'phpDocumentor\Transformer\Template', 'xml');
$template->propagateParameters();
return $template;
} | php | {
"resource": ""
} |
q26655 | Parser.forceRebuildIfSettingsHaveModified | train | private function forceRebuildIfSettingsHaveModified(ProjectDescriptorBuilder $builder)
{
if ($builder->getProjectDescriptor()->getSettings()->isModified()) {
$this->setForced(true);
$this->log(
'One of the project\'s settings have changed, forcing a complete rebuild',... | php | {
"resource": ""
} |
q26656 | Parser.logAfterParsingAllFiles | train | private function logAfterParsingAllFiles()
{
if (!$this->stopwatch) {
return;
}
$event = $this->stopwatch->stop('parser.parse');
$this->log('Elapsed time to parse all files: ' . round($event->getDuration() / 1000, 2) . 's');
$this->log('Peak memory usage: ' . ro... | php | {
"resource": ""
} |
q26657 | LegacyNamespaceFilter.filter | train | public function filter($value)
{
if ($value) {
$namespace = $value->getNamespace() === '' ? '\\' . $this->namespacePrefix : $value->getNamespace();
$value->setNamespace($this->namespaceFromLegacyNamespace($namespace, $value->getName()));
$value->setName($this->classNameFr... | php | {
"resource": ""
} |
q26658 | LegacyNamespaceFilter.namespaceFromLegacyNamespace | train | private function namespaceFromLegacyNamespace($namespace, $className)
{
$qcn = str_replace('_', '\\', $className);
$lastBackslash = strrpos($qcn, '\\');
if ($lastBackslash) {
$namespace = rtrim($namespace, '\\') . '\\' . substr($qcn, 0, $lastBackslash);
}
return... | php | {
"resource": ""
} |
q26659 | LegacyNamespaceFilter.classNameFromLegacyNamespace | train | private function classNameFromLegacyNamespace($className)
{
$lastUnderscore = strrpos($className, '_');
if ($lastUnderscore) {
$className = substr($className, $lastUnderscore + 1);
}
return $className;
} | php | {
"resource": ""
} |
q26660 | ResolveInlineLinkAndSeeTags.execute | train | public function execute(ProjectDescriptor $project): void
{
/** @var Collection|DescriptorAbstract[] $elementCollection */
$this->elementCollection = $project->getIndexes()->get('elements');
foreach ($this->elementCollection as $descriptor) {
$this->resolveSeeAndLinkTags($descri... | php | {
"resource": ""
} |
q26661 | ResolveInlineLinkAndSeeTags.resolveElement | train | private function resolveElement(DescriptorAbstract $element, $link, ?string $description = null): string
{
$rule = $this->router->match($element);
if ($rule) {
$url = '..' . $rule->generate($element);
$link = $this->generateMarkdownLink($url, $description ?: (string) $link);... | php | {
"resource": ""
} |
q26662 | ResolveInlineLinkAndSeeTags.getLinkText | train | private function getLinkText(Tag $tagReflector): ?string
{
if ($tagReflector instanceof See) {
return (string) $tagReflector->getReference();
}
if ($tagReflector instanceof Link) {
return (string) $tagReflector->getLink();
}
return null;
} | php | {
"resource": ""
} |
q26663 | ProjectDescriptorBuilder.isVisibilityAllowed | train | public function isVisibilityAllowed($visibility)
{
switch ($visibility) {
case 'public':
$visibility = Settings::VISIBILITY_PUBLIC;
break;
case 'protected':
$visibility = Settings::VISIBILITY_PROTECTED;
break;
... | php | {
"resource": ""
} |
q26664 | Dispatcher.getInstance | train | public static function getInstance(string $name = 'default'): self
{
if (!isset(self::$instances[$name])) {
self::setInstance($name, new self());
}
return self::$instances[$name];
} | php | {
"resource": ""
} |
q26665 | Dispatcher.setInstance | train | public static function setInstance(string $name, self $instance): void
{
self::$instances[$name] = $instance;
} | php | {
"resource": ""
} |
q26666 | Twig.transform | train | public function transform(ProjectDescriptor $project, Transformation $transformation): void
{
$template_path = $this->getTemplatePath($transformation);
$finder = new Pathfinder();
$nodes = $finder->find($project, $transformation->getQuery());
foreach ($nodes as $node) {
... | php | {
"resource": ""
} |
q26667 | Twig.initializeEnvironment | train | protected function initializeEnvironment(
ProjectDescriptor $project,
Transformation $transformation,
string $destination
): Twig_Environment {
$callingTemplatePath = $this->getTemplatePath($transformation);
$baseTemplatesPath = $transformation->getTransformer()->getTemplate... | php | {
"resource": ""
} |
q26668 | Twig.addPhpDocumentorExtension | train | protected function addPhpDocumentorExtension(
ProjectDescriptor $project,
Transformation $transformation,
string $destination,
Twig_Environment $twigEnvironment
): void {
$base_extension = new Extension($project, $transformation);
$base_extension->setDestination(
... | php | {
"resource": ""
} |
q26669 | Twig.getTemplatePath | train | protected function getTemplatePath(Transformation $transformation): string
{
$parts = preg_split('[\\\\|/]', $transformation->getSource());
return $parts[0] . DIRECTORY_SEPARATOR . $parts[1];
} | php | {
"resource": ""
} |
q26670 | MethodConverter.convert | train | public function convert(\DOMElement $parent, MethodDescriptor $method)
{
$fullyQualifiedNamespaceName = $method->getNamespace() instanceof NamespaceDescriptor
? $method->getNamespace()->getFullyQualifiedStructuralElementName()
: $parent->getAttribute('namespace');
$child = n... | php | {
"resource": ""
} |
q26671 | FileDescriptor.getAllErrors | train | public function getAllErrors()
{
$errors = $this->getErrors();
$types = $this->getClasses()->merge($this->getInterfaces())->merge($this->getTraits());
$elements = $this->getFunctions()->merge($this->getConstants())->merge($types);
foreach ($elements as $element) {
if (... | php | {
"resource": ""
} |
q26672 | BaseConvertCommand.configure | train | protected function configure()
{
$this
->addOption(
'target',
't',
InputOption::VALUE_OPTIONAL,
'target location for output',
'build'
)
->addOption(
'input-format',
... | php | {
"resource": ""
} |
q26673 | BaseConvertCommand.getTemplate | train | protected function getTemplate(InputInterface $input)
{
$template = $this->getTemplateFactory()->get('twig');
$template->setName($input->getOption('template'));
return $template;
} | php | {
"resource": ""
} |
q26674 | BaseConvertCommand.getConverter | train | protected function getConverter(InputInterface $input)
{
return $this->getConverterFactory()->get($input->getOption('input-format'), $this->output_format);
} | php | {
"resource": ""
} |
q26675 | Discover.visitSection | train | protected function visitSection(\DOMNode $root, \ezcDocumentRstNode $node)
{
if ($node instanceof ezcDocumentRstSectionNode || $node instanceof ezcDocumentRstDocumentNode) {
if ($node->depth === 1) {
$toc = $this->getTableOfContents();
$file = $toc[$this->getFilen... | php | {
"resource": ""
} |
q26676 | Discover.addFileToLastHeading | train | public function addFileToLastHeading(TableOfContents\File $file)
{
$this->last_heading->addChild($file);
$file->setParent($this->last_heading);
} | php | {
"resource": ""
} |
q26677 | TraitAssembler.addProperties | train | protected function addProperties(array $properties, TraitDescriptor $traitDescriptor): void
{
foreach ($properties as $property) {
$propertyDescriptor = $this->getBuilder()->buildDescriptor($property);
if ($propertyDescriptor instanceof PropertyDescriptor) {
$property... | php | {
"resource": ""
} |
q26678 | Template.setVersion | train | public function setVersion(string $version)
{
if (!preg_match('/^\d+\.\d+\.\d+$/', $version)) {
throw new \InvalidArgumentException(
'Version number is invalid; ' . $version . ' does not match '
. 'x.x.x (where x is a number)'
);
}
$th... | php | {
"resource": ""
} |
q26679 | Template.offsetSet | train | public function offsetSet($offset, $value)
{
if (!$value instanceof Transformation) {
throw new \InvalidArgumentException(
'\phpDocumentor\Transformer\Template may only contain items of '
. 'type \phpDocumentor\Transformer\Transformation'
);
}
... | php | {
"resource": ""
} |
q26680 | Template.propagateParameters | train | public function propagateParameters()
{
foreach ($this->transformations as $transformation) {
$transformation->setParameters(array_merge($transformation->getParameters(), $this->getParameters()));
}
} | php | {
"resource": ""
} |
q26681 | Factory.get | train | public function get(string $input_format, string $output_format): ConverterInterface
{
$definition = $this->definition_factory->get($input_format, $output_format);
foreach ($this->converters as $class => $formats) {
if ([$input_format, $output_format] === $formats) {
$as... | php | {
"resource": ""
} |
q26682 | Factory.getSupportedInputFormats | train | public function getSupportedInputFormats(string $given_output_format): array
{
$result = [];
foreach ($this->converters as $formats) {
list($input_format, $output_format) = $formats;
if ($given_output_format === $output_format) {
$result[] = $input_format;
... | php | {
"resource": ""
} |
q26683 | Transformation.getSourceAsPath | train | public function getSourceAsPath(): string
{
// externally loaded templates set this parameter so that template
// resources may be placed in the same folder as the template.
if ($this->getParameter('template_path') !== null) {
$path = rtrim($this->getParameter('template_path')->g... | php | {
"resource": ""
} |
q26684 | ProjectDescriptorMapper.save | train | public function save(ProjectDescriptor $projectDescriptor): void
{
$keys = [];
$cache = $this->getCache();
foreach ($cache as $key) {
$keys[] = $key;
}
// store the settings for this Project Descriptor
$cache->setItem(self::KEY_SETTINGS, $projectDescript... | php | {
"resource": ""
} |
q26685 | Figure.toDocbook | train | public function toDocbook(\DOMDocument $document, \DOMElement $root)
{
$this->storeAsset();
parent::toDocbook($document, $root);
} | php | {
"resource": ""
} |
q26686 | Figure.storeAsset | train | protected function storeAsset()
{
if (!$this->visitor instanceof Discover) {
return;
}
$assets = $this->getAssetManager();
$project_root = $assets->getProjectRoot();
$asset_path = trim($this->node->parameters);
$file_path = $this->visitor->getDocument()->... | php | {
"resource": ""
} |
q26687 | ResolveInlineMarkers.execute | train | public function execute(ProjectDescriptor $project): void
{
$markerTerms = $project->getSettings()->getMarkers();
foreach ($project->getFiles() as $file) {
$marker_data = [];
$matches = [];
preg_match_all(
'~//[\s]*(' . implode('|', $markerTerms) ... | php | {
"resource": ""
} |
q26688 | Xml.transform | train | public function transform(ProjectDescriptor $project, Transformation $transformation)
{
$artifact = $this->getDestinationPath($transformation);
$this->checkForSpacesInPath($artifact);
$this->xml = new \DOMDocument('1.0', 'utf-8');
$this->xml->formatOutput = true;
$document_... | php | {
"resource": ""
} |
q26689 | Xml.finalize | train | protected function finalize(ProjectDescriptor $projectDescriptor)
{
// TODO: move all these behaviours to a central location for all template parsers
$behaviour = new AuthorTag();
$behaviour->process($this->xml);
$behaviour = new CoversTag();
$behaviour->process($this->xml);
... | php | {
"resource": ""
} |
q26690 | Xml.buildDeprecationList | train | protected function buildDeprecationList(\DOMDocument $dom)
{
$nodes = $this->getNodeListForTagBasedQuery($dom, 'deprecated');
$node = new \DOMElement('deprecated');
$dom->documentElement->appendChild($node);
$node->setAttribute('count', (string) $nodes->length);
} | php | {
"resource": ""
} |
q26691 | Xml.getNodeListForTagBasedQuery | train | protected function getNodeListForTagBasedQuery($dom, $marker)
{
$xpath = new \DOMXPath($dom);
$query = '/project/file/markers/' . $marker . '|';
$query .= '/project/file/docblock/tag[@name="' . $marker . '"]|';
$query .= '/project/file/class/docblock/tag[@name="' . $marker . '"]|';
... | php | {
"resource": ""
} |
q26692 | ToLatexCommand.configureConverterFromInputOptions | train | protected function configureConverterFromInputOptions($converter, $input)
{
if (!$converter instanceof ToLatexInterface) {
throw new \InvalidArgumentException(
'The converter used to process '
. $input->getOption('input-format') . ' should implement the '
... | php | {
"resource": ""
} |
q26693 | SpecificationFactory.create | train | public function create(array $paths, array $ignore, array $extensions): SpecificationInterface
{
$pathSpec = null;
foreach ($paths as $path) {
$pathSpec = $this->orSpec($this->inPath($path), $pathSpec);
}
$ignoreSpec = null;
if (isset($ignore['paths'])) {
... | php | {
"resource": ""
} |
q26694 | Version3.buildVersion | train | private function buildVersion(SimpleXMLElement $version): array
{
$apis = [];
$guides = [];
foreach ($version->children() as $child) {
switch ($child->getName()) {
case 'api':
$apis[] = $this->buildApi($child);
break;
... | php | {
"resource": ""
} |
q26695 | Version3.buildApi | train | private function buildApi(SimpleXMLElement $api): array
{
$extensions = [];
foreach ($api->extensions->children() as $extension) {
if ((string) $extension !== '') {
$extensions[] = (string) $extension;
}
}
$ignoreHidden = filter_var($api->igno... | php | {
"resource": ""
} |
q26696 | Version3.buildGuide | train | private function buildGuide(SimpleXMLElement $guide): array
{
return [
'format' => ((string) $guide->attributes()->format) ?: 'rst',
'source' => [
'dsn' => ((string) $guide->source->attributes()->dsn) ?: 'file://.',
'paths' => ((array) $guide->source->... | php | {
"resource": ""
} |
q26697 | Version3.validate | train | private function validate(SimpleXMLElement $phpDocumentor): void
{
libxml_clear_errors();
$priorSetting = libxml_use_internal_errors(true);
$dom = new \DOMDocument();
$domElement = dom_import_simplexml($phpDocumentor);
$domElement = $dom->importNode($domElement, true);
... | php | {
"resource": ""
} |
q26698 | Collection.get | train | public function get($index, $valueIfEmpty = null)
{
if (!$this->offsetExists($index) && $valueIfEmpty !== null) {
$this->offsetSet($index, $valueIfEmpty);
}
return $this->offsetGet($index);
} | php | {
"resource": ""
} |
q26699 | Collection.offsetSet | train | public function offsetSet($offset, $value)
{
if ($offset === '' || $offset === null) {
throw new \InvalidArgumentException('The key of a collection must always be set');
}
$this->items[$offset] = $value;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.