repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
oat-sa/extension-tao-itemqti | model/portableElement/parser/itemParser/PortableElementItemParser.php | PortableElementItemParser.parsePortableElement | protected function parsePortableElement(PortableElementModel $model, Element $portableElement)
{
$typeId = $portableElement->getTypeIdentifier();
$libs = [];
$librariesFiles = [];
$entryPoint = [];
//Adjust file resource entries where {QTI_NS}/xxx/yyy is equivalent to {QTI_N... | php | protected function parsePortableElement(PortableElementModel $model, Element $portableElement)
{
$typeId = $portableElement->getTypeIdentifier();
$libs = [];
$librariesFiles = [];
$entryPoint = [];
//Adjust file resource entries where {QTI_NS}/xxx/yyy is equivalent to {QTI_N... | [
"protected",
"function",
"parsePortableElement",
"(",
"PortableElementModel",
"$",
"model",
",",
"Element",
"$",
"portableElement",
")",
"{",
"$",
"typeId",
"=",
"$",
"portableElement",
"->",
"getTypeIdentifier",
"(",
")",
";",
"$",
"libs",
"=",
"[",
"]",
";",... | Parse individual portable element into the given portable model
@param PortableElementModel $model
@param Element $portableElement
@throws \common_Exception
@throws PortableElementInconsistencyModelException | [
"Parse",
"individual",
"portable",
"element",
"into",
"the",
"given",
"portable",
"model"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/parser/itemParser/PortableElementItemParser.php#L200-L338 |
oat-sa/extension-tao-itemqti | model/portableElement/parser/itemParser/PortableElementItemParser.php | PortableElementItemParser.importPortableElements | public function importPortableElements()
{
if (count($this->importingFiles) != count($this->requiredFiles)) {
throw new \common_Exception('Needed files are missing during Portable Element asset files '.print_r($this->requiredFiles, true). ' '.print_r($this->importingFiles, true));
}
... | php | public function importPortableElements()
{
if (count($this->importingFiles) != count($this->requiredFiles)) {
throw new \common_Exception('Needed files are missing during Portable Element asset files '.print_r($this->requiredFiles, true). ' '.print_r($this->importingFiles, true));
}
... | [
"public",
"function",
"importPortableElements",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"importingFiles",
")",
"!=",
"count",
"(",
"$",
"this",
"->",
"requiredFiles",
")",
")",
"{",
"throw",
"new",
"\\",
"common_Exception",
"(",
"'Needed... | Do the import of portable elements | [
"Do",
"the",
"import",
"of",
"portable",
"elements"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/parser/itemParser/PortableElementItemParser.php#L376-L400 |
oat-sa/extension-tao-itemqti | model/portableElement/parser/itemParser/PortableElementItemParser.php | PortableElementItemParser.replaceLibAliases | private function replaceLibAliases(PortableElementObject $object){
$id = $object->getTypeIdentifier();
$object->setRuntimeKey('libraries', array_map(function($lib) use ($id) {
if(preg_match('/^'.$id.'/', $lib)){
return $lib.'.js';
}
return $lib;
... | php | private function replaceLibAliases(PortableElementObject $object){
$id = $object->getTypeIdentifier();
$object->setRuntimeKey('libraries', array_map(function($lib) use ($id) {
if(preg_match('/^'.$id.'/', $lib)){
return $lib.'.js';
}
return $lib;
... | [
"private",
"function",
"replaceLibAliases",
"(",
"PortableElementObject",
"$",
"object",
")",
"{",
"$",
"id",
"=",
"$",
"object",
"->",
"getTypeIdentifier",
"(",
")",
";",
"$",
"object",
"->",
"setRuntimeKey",
"(",
"'libraries'",
",",
"array_map",
"(",
"functi... | Replace the libs aliases with their relative url before saving into the registry
This format is consistent with the format of TAO portable package manifest
@param PortableElementObject $object
@return PortableElementObject | [
"Replace",
"the",
"libs",
"aliases",
"with",
"their",
"relative",
"url",
"before",
"saving",
"into",
"the",
"registry",
"This",
"format",
"is",
"consistent",
"with",
"the",
"format",
"of",
"TAO",
"portable",
"package",
"manifest"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/parser/itemParser/PortableElementItemParser.php#L409-L420 |
oat-sa/extension-tao-itemqti | model/Listener/ItemUpdater.php | ItemUpdater.catchItemRdfUpdatedEvent | public static function catchItemRdfUpdatedEvent(ItemRdfUpdatedEvent $event) {
$rdfItem = new core_kernel_classes_Resource($event->getItemUri());
$type = $rdfItem->getProperty(taoItems_models_classes_ItemsService::PROPERTY_ITEM_MODEL);
/*@var $directory \oat\oatbox\filesystem\Directory */
... | php | public static function catchItemRdfUpdatedEvent(ItemRdfUpdatedEvent $event) {
$rdfItem = new core_kernel_classes_Resource($event->getItemUri());
$type = $rdfItem->getProperty(taoItems_models_classes_ItemsService::PROPERTY_ITEM_MODEL);
/*@var $directory \oat\oatbox\filesystem\Directory */
... | [
"public",
"static",
"function",
"catchItemRdfUpdatedEvent",
"(",
"ItemRdfUpdatedEvent",
"$",
"event",
")",
"{",
"$",
"rdfItem",
"=",
"new",
"core_kernel_classes_Resource",
"(",
"$",
"event",
"->",
"getItemUri",
"(",
")",
")",
";",
"$",
"type",
"=",
"$",
"rdfIt... | synchronise item label
@param ItemRdfUpdatedEvent $event | [
"synchronise",
"item",
"label"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/Listener/ItemUpdater.php#L40-L57 |
oat-sa/extension-tao-itemqti | model/qti/metadata/imsManifest/ImsManifestMapping.php | ImsManifestMapping.setNamespace | public function setNamespace($namespace)
{
if (is_string($namespace) === false) {
$msg = "The namespace argument must be a string.";
throw new InvalidArgumentException($msg);
} elseif ($namespace === '') {
$msg = "The namespace argument must be a non-empty string.... | php | public function setNamespace($namespace)
{
if (is_string($namespace) === false) {
$msg = "The namespace argument must be a string.";
throw new InvalidArgumentException($msg);
} elseif ($namespace === '') {
$msg = "The namespace argument must be a non-empty string.... | [
"public",
"function",
"setNamespace",
"(",
"$",
"namespace",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"namespace",
")",
"===",
"false",
")",
"{",
"$",
"msg",
"=",
"\"The namespace argument must be a string.\"",
";",
"throw",
"new",
"InvalidArgumentException",
... | Set the XML namespace of the mapping.
@param string $namespace An XML namespace e.g. "http://www.imsglobal.org/xsd/imsmd_v1p2p2".
@throws InvalidArgumentException If $namespace is not a string or an empty string. | [
"Set",
"the",
"XML",
"namespace",
"of",
"the",
"mapping",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/imsManifest/ImsManifestMapping.php#L82-L93 |
oat-sa/extension-tao-itemqti | model/qti/metadata/imsManifest/ImsManifestMapping.php | ImsManifestMapping.setPrefix | public function setPrefix($prefix)
{
if (is_string($prefix) === false) {
$msg = "The prefix argument must be a string.";
throw new InvalidArgumentException($msg);
} elseif ($prefix === '') {
$msg = "The prefix argument must be a non-empty string.";
thr... | php | public function setPrefix($prefix)
{
if (is_string($prefix) === false) {
$msg = "The prefix argument must be a string.";
throw new InvalidArgumentException($msg);
} elseif ($prefix === '') {
$msg = "The prefix argument must be a non-empty string.";
thr... | [
"public",
"function",
"setPrefix",
"(",
"$",
"prefix",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"prefix",
")",
"===",
"false",
")",
"{",
"$",
"msg",
"=",
"\"The prefix argument must be a string.\"",
";",
"throw",
"new",
"InvalidArgumentException",
"(",
"$",... | Set the XML prefix of the mapping.
@param string $prefix An XML prefix e.g. "imsmd".
@throws InvalidArgumentException If $prefix is not a string or an empty string. | [
"Set",
"the",
"XML",
"prefix",
"of",
"the",
"mapping",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/imsManifest/ImsManifestMapping.php#L111-L122 |
oat-sa/extension-tao-itemqti | model/qti/metadata/imsManifest/ImsManifestMapping.php | ImsManifestMapping.setSchemaLocation | public function setSchemaLocation($schemaLocation)
{
if (is_string($schemaLocation) === false) {
$msg = "The schemaLocation argument must be a string.";
throw new InvalidArgumentException($msg);
} elseif ($schemaLocation === '') {
$msg = "The schemaLocation argume... | php | public function setSchemaLocation($schemaLocation)
{
if (is_string($schemaLocation) === false) {
$msg = "The schemaLocation argument must be a string.";
throw new InvalidArgumentException($msg);
} elseif ($schemaLocation === '') {
$msg = "The schemaLocation argume... | [
"public",
"function",
"setSchemaLocation",
"(",
"$",
"schemaLocation",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"schemaLocation",
")",
"===",
"false",
")",
"{",
"$",
"msg",
"=",
"\"The schemaLocation argument must be a string.\"",
";",
"throw",
"new",
"InvalidA... | Set the XSD (XML Schema Definition) schema location of the mapping.
@param string $schemaLocation A schema location e.g. "http://www.imsglobal.org/xsd/imsmd_v1p2p2.xsd".
@throws InvalidArgumentException If $schemaLocatuion is not a string or an empty string. | [
"Set",
"the",
"XSD",
"(",
"XML",
"Schema",
"Definition",
")",
"schema",
"location",
"of",
"the",
"mapping",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/imsManifest/ImsManifestMapping.php#L140-L151 |
oat-sa/extension-tao-itemqti | model/flyExporter/simpleExporter/ItemExporter.php | ItemExporter.export | public function export(array $items = null)
{
if (empty($items)) {
$items = $this->getItems();
}
$data = $this->getDataByItems($items);
return $this->save($this->headers, $data);
} | php | public function export(array $items = null)
{
if (empty($items)) {
$items = $this->getItems();
}
$data = $this->getDataByItems($items);
return $this->save($this->headers, $data);
} | [
"public",
"function",
"export",
"(",
"array",
"$",
"items",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"items",
")",
")",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"getItems",
"(",
")",
";",
"}",
"$",
"data",
"=",
"$",
"this",
"->",
... | @inheritdoc
@throws ExtractorException
@param \core_kernel_classes_Resource[] $items
@return string | [
"@inheritdoc"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/simpleExporter/ItemExporter.php#L111-L120 |
oat-sa/extension-tao-itemqti | model/flyExporter/simpleExporter/ItemExporter.php | ItemExporter.getDataByItems | public function getDataByItems(array $items)
{
$output = [];
foreach ($items as $item) {
try {
$output[] = $this->getDataByItem($item);
} catch (ExtractorException $e) {
\common_Logger::e('ERROR on item ' . $item->getUri() . ' : ' . $e->getMess... | php | public function getDataByItems(array $items)
{
$output = [];
foreach ($items as $item) {
try {
$output[] = $this->getDataByItem($item);
} catch (ExtractorException $e) {
\common_Logger::e('ERROR on item ' . $item->getUri() . ' : ' . $e->getMess... | [
"public",
"function",
"getDataByItems",
"(",
"array",
"$",
"items",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item",
")",
"{",
"try",
"{",
"$",
"output",
"[",
"]",
"=",
"$",
"this",
"->",
"getDataByItem"... | Loop all items and call extract function
@param array $items
@return array
@throws ExtractorException | [
"Loop",
"all",
"items",
"and",
"call",
"extract",
"function"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/simpleExporter/ItemExporter.php#L129-L145 |
oat-sa/extension-tao-itemqti | model/flyExporter/simpleExporter/ItemExporter.php | ItemExporter.getDataByItem | public function getDataByItem(\core_kernel_classes_Resource $item)
{
foreach ($this->columns as $column => $config) {
/** @var Extractor $extractor */
$extractor = $this->extractors[$config['extractor']];
if (isset($config['parameters'])) {
$parameters = $... | php | public function getDataByItem(\core_kernel_classes_Resource $item)
{
foreach ($this->columns as $column => $config) {
/** @var Extractor $extractor */
$extractor = $this->extractors[$config['extractor']];
if (isset($config['parameters'])) {
$parameters = $... | [
"public",
"function",
"getDataByItem",
"(",
"\\",
"core_kernel_classes_Resource",
"$",
"item",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column",
"=>",
"$",
"config",
")",
"{",
"/** @var Extractor $extractor */",
"$",
"extractor",
"=",
... | Loop foreach columns and extract data thought extractors
@param \core_kernel_classes_Resource $item
@return array | [
"Loop",
"foreach",
"columns",
"and",
"extract",
"data",
"thought",
"extractors"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/simpleExporter/ItemExporter.php#L153-L189 |
oat-sa/extension-tao-itemqti | model/flyExporter/simpleExporter/ItemExporter.php | ItemExporter.save | public function save(array $headers, array $data)
{
$output = $contents = [];
$enclosure = $this->getCsvEnclosure();
$delimiter = $this->getCsvDelimiter();
$contents[] = $enclosure
. implode($enclosure . $delimiter . $enclosure, $headers)
. $enclosure;
... | php | public function save(array $headers, array $data)
{
$output = $contents = [];
$enclosure = $this->getCsvEnclosure();
$delimiter = $this->getCsvDelimiter();
$contents[] = $enclosure
. implode($enclosure . $delimiter . $enclosure, $headers)
. $enclosure;
... | [
"public",
"function",
"save",
"(",
"array",
"$",
"headers",
",",
"array",
"$",
"data",
")",
"{",
"$",
"output",
"=",
"$",
"contents",
"=",
"[",
"]",
";",
"$",
"enclosure",
"=",
"$",
"this",
"->",
"getCsvEnclosure",
"(",
")",
";",
"$",
"delimiter",
... | Save data to file
@param array $headers
@param array $data
@return string | [
"Save",
"data",
"to",
"file"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/simpleExporter/ItemExporter.php#L198-L232 |
oat-sa/extension-tao-itemqti | model/flyExporter/simpleExporter/ItemExporter.php | ItemExporter.getCsvEnclosure | protected function getCsvEnclosure()
{
if ($this->hasOption(self::CSV_ENCLOSURE_OPTION)) {
return $this->getOption(self::CSV_ENCLOSURE_OPTION);
}
return self::CSV_ENCLOSURE;
} | php | protected function getCsvEnclosure()
{
if ($this->hasOption(self::CSV_ENCLOSURE_OPTION)) {
return $this->getOption(self::CSV_ENCLOSURE_OPTION);
}
return self::CSV_ENCLOSURE;
} | [
"protected",
"function",
"getCsvEnclosure",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasOption",
"(",
"self",
"::",
"CSV_ENCLOSURE_OPTION",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getOption",
"(",
"self",
"::",
"CSV_ENCLOSURE_OPTION",
")",
";",
"... | Get the CSV enclosure from config, if not set use default value
@return string | [
"Get",
"the",
"CSV",
"enclosure",
"from",
"config",
"if",
"not",
"set",
"use",
"default",
"value"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/simpleExporter/ItemExporter.php#L285-L292 |
oat-sa/extension-tao-itemqti | model/flyExporter/simpleExporter/ItemExporter.php | ItemExporter.getCsvDelimiter | protected function getCsvDelimiter()
{
if ($this->hasOption(self::CSV_DELIMITER_OPTION)) {
return $this->getOption(self::CSV_DELIMITER_OPTION);
}
return self::CSV_DELIMITER;
} | php | protected function getCsvDelimiter()
{
if ($this->hasOption(self::CSV_DELIMITER_OPTION)) {
return $this->getOption(self::CSV_DELIMITER_OPTION);
}
return self::CSV_DELIMITER;
} | [
"protected",
"function",
"getCsvDelimiter",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasOption",
"(",
"self",
"::",
"CSV_DELIMITER_OPTION",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getOption",
"(",
"self",
"::",
"CSV_DELIMITER_OPTION",
")",
";",
"... | Get the CSV delimiter from config, if not set use default value
@return string | [
"Get",
"the",
"CSV",
"delimiter",
"from",
"config",
"if",
"not",
"set",
"use",
"default",
"value"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/flyExporter/simpleExporter/ItemExporter.php#L299-L306 |
oat-sa/extension-tao-itemqti | model/qti/metadata/imsManifest/classificationMetadata/ClassificationSourceMetadataValue.php | ClassificationSourceMetadataValue.getSourcePath | static public function getSourcePath()
{
return [
LomMetadata::LOM_NAMESPACE . '#lom',
LomMetadata::LOM_NAMESPACE . '#classification',
LomMetadata::LOM_NAMESPACE . '#taxonPath',
LomMetadata::LOM_NAMESPACE . '#source',
LomMetadata::LOM_NAMESPACE . '... | php | static public function getSourcePath()
{
return [
LomMetadata::LOM_NAMESPACE . '#lom',
LomMetadata::LOM_NAMESPACE . '#classification',
LomMetadata::LOM_NAMESPACE . '#taxonPath',
LomMetadata::LOM_NAMESPACE . '#source',
LomMetadata::LOM_NAMESPACE . '... | [
"static",
"public",
"function",
"getSourcePath",
"(",
")",
"{",
"return",
"[",
"LomMetadata",
"::",
"LOM_NAMESPACE",
".",
"'#lom'",
",",
"LomMetadata",
"::",
"LOM_NAMESPACE",
".",
"'#classification'",
",",
"LomMetadata",
"::",
"LOM_NAMESPACE",
".",
"'#taxonPath'",
... | Get the default classification source path | [
"Get",
"the",
"default",
"classification",
"source",
"path"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/imsManifest/classificationMetadata/ClassificationSourceMetadataValue.php#L43-L52 |
oat-sa/extension-tao-itemqti | model/pack/QtiItemPacker.php | QtiItemPacker.packItem | public function packItem(core_kernel_classes_Resource $item, $lang, Directory $directory)
{
//use the QtiParser to transform the QTI XML into an assoc array representation
$content = $this->getXmlByItem($item, $lang);
//load content
$qtiParser = new QtiParser($content);
//val... | php | public function packItem(core_kernel_classes_Resource $item, $lang, Directory $directory)
{
//use the QtiParser to transform the QTI XML into an assoc array representation
$content = $this->getXmlByItem($item, $lang);
//load content
$qtiParser = new QtiParser($content);
//val... | [
"public",
"function",
"packItem",
"(",
"core_kernel_classes_Resource",
"$",
"item",
",",
"$",
"lang",
",",
"Directory",
"$",
"directory",
")",
"{",
"//use the QtiParser to transform the QTI XML into an assoc array representation",
"$",
"content",
"=",
"$",
"this",
"->",
... | packItem implementation for QTI
@inheritdoc
@see {@link ItemPacker}
@throws InvalidArgumentException
@throws common_Exception | [
"packItem",
"implementation",
"for",
"QTI"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/pack/QtiItemPacker.php#L67-L84 |
oat-sa/extension-tao-itemqti | model/QtiItemCompiler.php | QtiItemCompiler.compile | public function compile()
{
$report = $this->internalCompile();
if ($report->getType() == common_report_Report::TYPE_SUCCESS) {
// replace instances with service
list($item, $publicDirectory, $privateDirectory) = $report->getData();
$report->setData($this->createQ... | php | public function compile()
{
$report = $this->internalCompile();
if ($report->getType() == common_report_Report::TYPE_SUCCESS) {
// replace instances with service
list($item, $publicDirectory, $privateDirectory) = $report->getData();
$report->setData($this->createQ... | [
"public",
"function",
"compile",
"(",
")",
"{",
"$",
"report",
"=",
"$",
"this",
"->",
"internalCompile",
"(",
")",
";",
"if",
"(",
"$",
"report",
"->",
"getType",
"(",
")",
"==",
"common_report_Report",
"::",
"TYPE_SUCCESS",
")",
"{",
"// replace instance... | {@inheritDoc}
@see \tao_models_classes_Compiler::compile() | [
"{"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/QtiItemCompiler.php#L61-L70 |
oat-sa/extension-tao-itemqti | model/QtiItemCompiler.php | QtiItemCompiler.internalCompile | protected function internalCompile()
{
$item = $this->getResource();
$publicDirectory = $this->spawnPublicDirectory();
$privateDirectory = $this->spawnPrivateDirectory();
$report = new common_report_Report(common_report_Report::TYPE_SUCCESS, __('Published %s', $item->getLabel()));
... | php | protected function internalCompile()
{
$item = $this->getResource();
$publicDirectory = $this->spawnPublicDirectory();
$privateDirectory = $this->spawnPrivateDirectory();
$report = new common_report_Report(common_report_Report::TYPE_SUCCESS, __('Published %s', $item->getLabel()));
... | [
"protected",
"function",
"internalCompile",
"(",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"getResource",
"(",
")",
";",
"$",
"publicDirectory",
"=",
"$",
"this",
"->",
"spawnPublicDirectory",
"(",
")",
";",
"$",
"privateDirectory",
"=",
"$",
"this",
... | Compile qti item
@throws taoItems_models_classes_CompilationFailedException
@return common_report_Report | [
"Compile",
"qti",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/QtiItemCompiler.php#L78-L101 |
oat-sa/extension-tao-itemqti | model/QtiItemCompiler.php | QtiItemCompiler.createQtiService | protected function createQtiService(
core_kernel_classes_Resource $item,
tao_models_classes_service_StorageDirectory $publicDirectory,
tao_models_classes_service_StorageDirectory $privateDirectory
) {
$service = new tao_models_classes_service_ServiceCall(new core_kernel_classes_Reso... | php | protected function createQtiService(
core_kernel_classes_Resource $item,
tao_models_classes_service_StorageDirectory $publicDirectory,
tao_models_classes_service_StorageDirectory $privateDirectory
) {
$service = new tao_models_classes_service_ServiceCall(new core_kernel_classes_Reso... | [
"protected",
"function",
"createQtiService",
"(",
"core_kernel_classes_Resource",
"$",
"item",
",",
"tao_models_classes_service_StorageDirectory",
"$",
"publicDirectory",
",",
"tao_models_classes_service_StorageDirectory",
"$",
"privateDirectory",
")",
"{",
"$",
"service",
"=",... | Create a servicecall that runs the prepared qti item
@param core_kernel_classes_Resource $item
@param tao_models_classes_service_StorageDirectory $publicDirectory
@param tao_models_classes_service_StorageDirectory $privateDirectory
@return tao_models_classes_service_ServiceCall | [
"Create",
"a",
"servicecall",
"that",
"runs",
"the",
"prepared",
"qti",
"item"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/QtiItemCompiler.php#L111-L134 |
oat-sa/extension-tao-itemqti | model/QtiItemCompiler.php | QtiItemCompiler.deployQtiItem | protected function deployQtiItem(
core_kernel_classes_Resource $item,
$language,
tao_models_classes_service_StorageDirectory $publicDirectory,
tao_models_classes_service_StorageDirectory $privateDirectory
)
{
$itemService = taoItems_models_classes_ItemsService::singleton(... | php | protected function deployQtiItem(
core_kernel_classes_Resource $item,
$language,
tao_models_classes_service_StorageDirectory $publicDirectory,
tao_models_classes_service_StorageDirectory $privateDirectory
)
{
$itemService = taoItems_models_classes_ItemsService::singleton(... | [
"protected",
"function",
"deployQtiItem",
"(",
"core_kernel_classes_Resource",
"$",
"item",
",",
"$",
"language",
",",
"tao_models_classes_service_StorageDirectory",
"$",
"publicDirectory",
",",
"tao_models_classes_service_StorageDirectory",
"$",
"privateDirectory",
")",
"{",
... | Desploy all the required files into the provided directories
@param core_kernel_classes_Resource $item
@param string $language
@param tao_models_classes_service_StorageDirectory $publicDirectory
@param tao_models_classes_service_StorageDirectory $privateDirectory
@return common_report_Report | [
"Desploy",
"all",
"the",
"required",
"files",
"into",
"the",
"provided",
"directories"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/QtiItemCompiler.php#L145-L216 |
oat-sa/extension-tao-itemqti | controller/QtiCssAuthoring.php | QtiCssAuthoring.save | public function save() {
if (!tao_helpers_Request::isAjax()) {
throw new common_exception_IsAjaxAction(__METHOD__);
}
if (!$this->hasRequestParameter('uri')) {
throw new common_exception_MissingParameter('uri', __METHOD__);
}
if (!$this->hasRequestParamete... | php | public function save() {
if (!tao_helpers_Request::isAjax()) {
throw new common_exception_IsAjaxAction(__METHOD__);
}
if (!$this->hasRequestParameter('uri')) {
throw new common_exception_MissingParameter('uri', __METHOD__);
}
if (!$this->hasRequestParamete... | [
"public",
"function",
"save",
"(",
")",
"{",
"if",
"(",
"!",
"tao_helpers_Request",
"::",
"isAjax",
"(",
")",
")",
"{",
"throw",
"new",
"common_exception_IsAjaxAction",
"(",
"__METHOD__",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRequestParamet... | Save custom CSS as file
@throws \common_exception_IsAjaxAction | [
"Save",
"custom",
"CSS",
"as",
"file"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/QtiCssAuthoring.php#L46-L69 |
oat-sa/extension-tao-itemqti | controller/QtiCssAuthoring.php | QtiCssAuthoring.load | public function load() {
if (!$this->hasRequestParameter('uri')) {
throw new common_exception_MissingParameter('uri', __METHOD__);
}
if (!$this->hasRequestParameter('stylesheetUri')) {
throw new common_exception_MissingParameter('stylesheetUri', __METHOD__);
}
... | php | public function load() {
if (!$this->hasRequestParameter('uri')) {
throw new common_exception_MissingParameter('uri', __METHOD__);
}
if (!$this->hasRequestParameter('stylesheetUri')) {
throw new common_exception_MissingParameter('stylesheetUri', __METHOD__);
}
... | [
"public",
"function",
"load",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRequestParameter",
"(",
"'uri'",
")",
")",
"{",
"throw",
"new",
"common_exception_MissingParameter",
"(",
"'uri'",
",",
"__METHOD__",
")",
";",
"}",
"if",
"(",
"!",
"$",
... | Load the custom styles as JSON
@throws \common_exception_IsAjaxAction
@throws \common_exception_MissingParameter | [
"Load",
"the",
"custom",
"styles",
"as",
"JSON"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/QtiCssAuthoring.php#L77-L100 |
oat-sa/extension-tao-itemqti | controller/QtiCssAuthoring.php | QtiCssAuthoring.getCssArray | private function getCssArray() {
if (!$this->hasRequestParameter('cssJson')) {
throw new common_exception_MissingParameter('cssJson', __CLASS__.'::'.\Context::getInstance()->getActionName());
}
$cssArr = json_decode($_POST['cssJson'], true);
if(!is_array($cssArr)) {
... | php | private function getCssArray() {
if (!$this->hasRequestParameter('cssJson')) {
throw new common_exception_MissingParameter('cssJson', __CLASS__.'::'.\Context::getInstance()->getActionName());
}
$cssArr = json_decode($_POST['cssJson'], true);
if(!is_array($cssArr)) {
... | [
"private",
"function",
"getCssArray",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRequestParameter",
"(",
"'cssJson'",
")",
")",
"{",
"throw",
"new",
"common_exception_MissingParameter",
"(",
"'cssJson'",
",",
"__CLASS__",
".",
"'::'",
".",
"\\",
"... | Convert CSS JSON to array
@return mixed
@throws \common_exception_MissingParameter
@throws \common_exception_InvalidArgumentType | [
"Convert",
"CSS",
"JSON",
"to",
"array"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/QtiCssAuthoring.php#L109-L119 |
oat-sa/extension-tao-itemqti | controller/QtiCssAuthoring.php | QtiCssAuthoring.download | public function download(){
if (!$this->hasRequestParameter('uri')) {
throw new common_exception_MissingParameter('uri', __METHOD__);
}
if (!$this->hasRequestParameter('stylesheetUri')) {
throw new common_exception_MissingParameter('stylesheetUri', __METHOD__);
}... | php | public function download(){
if (!$this->hasRequestParameter('uri')) {
throw new common_exception_MissingParameter('uri', __METHOD__);
}
if (!$this->hasRequestParameter('stylesheetUri')) {
throw new common_exception_MissingParameter('stylesheetUri', __METHOD__);
}... | [
"public",
"function",
"download",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasRequestParameter",
"(",
"'uri'",
")",
")",
"{",
"throw",
"new",
"common_exception_MissingParameter",
"(",
"'uri'",
",",
"__METHOD__",
")",
";",
"}",
"if",
"(",
"!",
"... | Download custom styles | [
"Download",
"custom",
"styles"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/QtiCssAuthoring.php#L124-L150 |
oat-sa/extension-tao-itemqti | model/qti/metadata/simple/SimpleMetadataValue.php | SimpleMetadataValue.setResourceIdentifier | public function setResourceIdentifier($resourceIdentifier)
{
if (is_string($resourceIdentifier) === false) {
$msg = "The resourceIdentifier argument must be a string.";
throw new InvalidArgumentException($msg);
} elseif ($resourceIdentifier === '') {
$msg = "The r... | php | public function setResourceIdentifier($resourceIdentifier)
{
if (is_string($resourceIdentifier) === false) {
$msg = "The resourceIdentifier argument must be a string.";
throw new InvalidArgumentException($msg);
} elseif ($resourceIdentifier === '') {
$msg = "The r... | [
"public",
"function",
"setResourceIdentifier",
"(",
"$",
"resourceIdentifier",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"resourceIdentifier",
")",
"===",
"false",
")",
"{",
"$",
"msg",
"=",
"\"The resourceIdentifier argument must be a string.\"",
";",
"throw",
"n... | Set the identifier of the resource the MetadataValue describes.
@param string $resourceIdentifier An identifier.
@throws InvalidArgumentException If $resourceIdentifier is not a string or an empty string. | [
"Set",
"the",
"identifier",
"of",
"the",
"resource",
"the",
"MetadataValue",
"describes",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/simple/SimpleMetadataValue.php#L84-L95 |
oat-sa/extension-tao-itemqti | model/qti/metadata/simple/SimpleMetadataValue.php | SimpleMetadataValue.setPath | public function setPath(array $path)
{
if (count($path) === 0) {
$msg = "The path argument must be a non-empty array.";
throw new InvalidArgumentException($msg);
} else {
$this->path = $path;
}
} | php | public function setPath(array $path)
{
if (count($path) === 0) {
$msg = "The path argument must be a non-empty array.";
throw new InvalidArgumentException($msg);
} else {
$this->path = $path;
}
} | [
"public",
"function",
"setPath",
"(",
"array",
"$",
"path",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"path",
")",
"===",
"0",
")",
"{",
"$",
"msg",
"=",
"\"The path argument must be a non-empty array.\"",
";",
"throw",
"new",
"InvalidArgumentException",
"(",
... | Set the descriptive path of the MetadataValue.
@param array $path An array of Path Components.
@throws InvalidArgumentException If $path is an empty array. | [
"Set",
"the",
"descriptive",
"path",
"of",
"the",
"MetadataValue",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/simple/SimpleMetadataValue.php#L111-L119 |
oat-sa/extension-tao-itemqti | model/qti/metadata/AbstractMetadataService.php | AbstractMetadataService.extract | public function extract($source)
{
$metadata = [[]];
foreach ($this->getExtractors() as $extractor) {
$metadata[] = $extractor->extract($source);
}
$metadata = array_merge_recursive(...$metadata);
\common_Logger::d(__('%s metadata values found in source by extract... | php | public function extract($source)
{
$metadata = [[]];
foreach ($this->getExtractors() as $extractor) {
$metadata[] = $extractor->extract($source);
}
$metadata = array_merge_recursive(...$metadata);
\common_Logger::d(__('%s metadata values found in source by extract... | [
"public",
"function",
"extract",
"(",
"$",
"source",
")",
"{",
"$",
"metadata",
"=",
"[",
"[",
"]",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getExtractors",
"(",
")",
"as",
"$",
"extractor",
")",
"{",
"$",
"metadata",
"[",
"]",
"=",
"$",
"ex... | Extract metadata value of a given $source
Extract metadata values by calling each extractors
@param $source
@return array | [
"Extract",
"metadata",
"value",
"of",
"a",
"given",
"$source"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/AbstractMetadataService.php#L67-L77 |
oat-sa/extension-tao-itemqti | model/qti/metadata/AbstractMetadataService.php | AbstractMetadataService.inject | public function inject($identifier, $target)
{
if ($this->hasMetadataValue($identifier)) {
\common_Logger::i(__('Preparing Metadata Values for target "%s"...', $identifier));
$values = $this->getMetadataValue($identifier);
foreach ($this->getInjectors() as $injector) {
... | php | public function inject($identifier, $target)
{
if ($this->hasMetadataValue($identifier)) {
\common_Logger::i(__('Preparing Metadata Values for target "%s"...', $identifier));
$values = $this->getMetadataValue($identifier);
foreach ($this->getInjectors() as $injector) {
... | [
"public",
"function",
"inject",
"(",
"$",
"identifier",
",",
"$",
"target",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasMetadataValue",
"(",
"$",
"identifier",
")",
")",
"{",
"\\",
"common_Logger",
"::",
"i",
"(",
"__",
"(",
"'Preparing Metadata Values for... | Inject metadata value for an identifier through injectors
Inject metadata value for an identifier by calling each injectors
Injectors need $target for injection
@param $identifier
@param $target | [
"Inject",
"metadata",
"value",
"for",
"an",
"identifier",
"through",
"injectors"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/AbstractMetadataService.php#L88-L100 |
oat-sa/extension-tao-itemqti | model/qti/metadata/AbstractMetadataService.php | AbstractMetadataService.register | public function register($key, $name)
{
if (empty($key) || empty($name)) {
throw new \InvalidArgumentException(__('Register method expects $key and $name parameters'));
}
if (is_object($name)) {
$name = get_class($name);
}
switch ($key) {
... | php | public function register($key, $name)
{
if (empty($key) || empty($name)) {
throw new \InvalidArgumentException(__('Register method expects $key and $name parameters'));
}
if (is_object($name)) {
$name = get_class($name);
}
switch ($key) {
... | [
"public",
"function",
"register",
"(",
"$",
"key",
",",
"$",
"name",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"key",
")",
"||",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"__",
"(",
"'Register meth... | Register an importer instance
Register an instance e.q. Injectors, Extractors, Guardians or LooUpClass
Respective interface is checked
Throw exception if call if not correctly formed
@param $key
@param $name
@return bool
@throws \InvalidArgumentException
@throws \common_Exception | [
"Register",
"an",
"importer",
"instance"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/AbstractMetadataService.php#L115-L137 |
oat-sa/extension-tao-itemqti | model/qti/metadata/AbstractMetadataService.php | AbstractMetadataService.unregister | public function unregister($key, $name)
{
if (empty($key) || empty($name)) {
throw new \common_Exception();
}
if (is_object($name)) {
$name = get_class($name);
}
switch ($key) {
case self::EXTRACTOR_KEY:
$this->unregisterI... | php | public function unregister($key, $name)
{
if (empty($key) || empty($name)) {
throw new \common_Exception();
}
if (is_object($name)) {
$name = get_class($name);
}
switch ($key) {
case self::EXTRACTOR_KEY:
$this->unregisterI... | [
"public",
"function",
"unregister",
"(",
"$",
"key",
",",
"$",
"name",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"key",
")",
"||",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"common_Exception",
"(",
")",
";",
"}",
"if",
"(",
... | Unregister a instance of metadataService config
Unregister an instance with helper method unregisterInstance
@param string $key The config key where unregister instance
@param string $name The instance name to unregister
@throws \common_Exception If method is call with empty argument | [
"Unregister",
"a",
"instance",
"of",
"metadataService",
"config"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/AbstractMetadataService.php#L148-L167 |
oat-sa/extension-tao-itemqti | model/qti/metadata/AbstractMetadataService.php | AbstractMetadataService.registerInstance | protected function registerInstance($key, $name, $interface)
{
if (is_a($name, $interface, true)) {
$instances = $this->getOption($key);
if ($instances === null || array_search($name, $instances) === false) {
$instances[] = $name;
$this->setOption($key... | php | protected function registerInstance($key, $name, $interface)
{
if (is_a($name, $interface, true)) {
$instances = $this->getOption($key);
if ($instances === null || array_search($name, $instances) === false) {
$instances[] = $name;
$this->setOption($key... | [
"protected",
"function",
"registerInstance",
"(",
"$",
"key",
",",
"$",
"name",
",",
"$",
"interface",
")",
"{",
"if",
"(",
"is_a",
"(",
"$",
"name",
",",
"$",
"interface",
",",
"true",
")",
")",
"{",
"$",
"instances",
"=",
"$",
"this",
"->",
"getO... | Register an instance
Register a $name instance into $key config
$key class has to implements $interface
@param $key
@param $name
@param $interface | [
"Register",
"an",
"instance"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/AbstractMetadataService.php#L208-L218 |
oat-sa/extension-tao-itemqti | model/qti/metadata/AbstractMetadataService.php | AbstractMetadataService.unregisterInstance | protected function unregisterInstance($key, $name)
{
if ($this->hasOption($key)) {
$instances = $this->getOption($key);
if (($index = array_search($name, $instances)) !== false) {
unset($instances[$index]);
$this->setOption($key, $instances);
... | php | protected function unregisterInstance($key, $name)
{
if ($this->hasOption($key)) {
$instances = $this->getOption($key);
if (($index = array_search($name, $instances)) !== false) {
unset($instances[$index]);
$this->setOption($key, $instances);
... | [
"protected",
"function",
"unregisterInstance",
"(",
"$",
"key",
",",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasOption",
"(",
"$",
"key",
")",
")",
"{",
"$",
"instances",
"=",
"$",
"this",
"->",
"getOption",
"(",
"$",
"key",
")",
";",... | Unregister an instance
Unregister a $name instance into $key config
@param $key
@param $name | [
"Unregister",
"an",
"instance"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/AbstractMetadataService.php#L228-L239 |
oat-sa/extension-tao-itemqti | model/qti/metadata/AbstractMetadataService.php | AbstractMetadataService.getMetadataValue | public function getMetadataValue($identifier)
{
$metadata = $this->getMetadataValues();
return isset($metadata[$identifier]) ? $metadata[$identifier] : null;
} | php | public function getMetadataValue($identifier)
{
$metadata = $this->getMetadataValues();
return isset($metadata[$identifier]) ? $metadata[$identifier] : null;
} | [
"public",
"function",
"getMetadataValue",
"(",
"$",
"identifier",
")",
"{",
"$",
"metadata",
"=",
"$",
"this",
"->",
"getMetadataValues",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"metadata",
"[",
"$",
"identifier",
"]",
")",
"?",
"$",
"metadata",
"[",... | Return the associated value of metadata $identifier or null if not exists
@param $identifier
@return mixed|null | [
"Return",
"the",
"associated",
"value",
"of",
"metadata",
"$identifier",
"or",
"null",
"if",
"not",
"exists"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/AbstractMetadataService.php#L258-L262 |
oat-sa/extension-tao-itemqti | model/qti/metadata/AbstractMetadataService.php | AbstractMetadataService.getInstances | protected function getInstances($id, $interface)
{
if (isset($this->instances[$id])) {
return $this->instances[$id];
}
$this->instances[$id] = [];
if (! $this->hasOption($id)) {
return $this->instances[$id];
} else {
foreach ($this->getOp... | php | protected function getInstances($id, $interface)
{
if (isset($this->instances[$id])) {
return $this->instances[$id];
}
$this->instances[$id] = [];
if (! $this->hasOption($id)) {
return $this->instances[$id];
} else {
foreach ($this->getOp... | [
"protected",
"function",
"getInstances",
"(",
"$",
"id",
",",
"$",
"interface",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"instances",
"[",
"$",
"id",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"instances",
"[",
"$",
"id",
"]",
... | Return config instances
Retrieve instances stored into config
Config $key is scan to take only instances with given $interface
@param $id
@param $interface
@return mixed | [
"Return",
"config",
"instances"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/AbstractMetadataService.php#L283-L301 |
oat-sa/extension-tao-itemqti | model/portableElement/model/PortableModelRegistry.php | PortableModelRegistry.getModel | public function getModel($modelId)
{
if (!$this->isRegistered($modelId)) {
throw new PortableModelMissing($modelId);
}
return $this->getModelFromConfig($this->get($modelId));
} | php | public function getModel($modelId)
{
if (!$this->isRegistered($modelId)) {
throw new PortableModelMissing($modelId);
}
return $this->getModelFromConfig($this->get($modelId));
} | [
"public",
"function",
"getModel",
"(",
"$",
"modelId",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isRegistered",
"(",
"$",
"modelId",
")",
")",
"{",
"throw",
"new",
"PortableModelMissing",
"(",
"$",
"modelId",
")",
";",
"}",
"return",
"$",
"this",
... | Return model associated to the given string value
@param string $modelId
@return PortableElementModel
@throws PortableElementInconsistencyModelException | [
"Return",
"model",
"associated",
"to",
"the",
"given",
"string",
"value"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/model/PortableModelRegistry.php#L59-L65 |
oat-sa/extension-tao-itemqti | model/portableElement/model/PortableModelRegistry.php | PortableModelRegistry.getModels | public function getModels()
{
$models = $this->getMap();
foreach ($models as $key => $config) {
$models[$key] = $this->getModelFromConfig($config);
}
return $models;
} | php | public function getModels()
{
$models = $this->getMap();
foreach ($models as $key => $config) {
$models[$key] = $this->getModelFromConfig($config);
}
return $models;
} | [
"public",
"function",
"getModels",
"(",
")",
"{",
"$",
"models",
"=",
"$",
"this",
"->",
"getMap",
"(",
")",
";",
"foreach",
"(",
"$",
"models",
"as",
"$",
"key",
"=>",
"$",
"config",
")",
"{",
"$",
"models",
"[",
"$",
"key",
"]",
"=",
"$",
"th... | Return all configured models
@return PortableElementModel[]
@throws PortableElementInconsistencyModelException | [
"Return",
"all",
"configured",
"models"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/model/PortableModelRegistry.php#L85-L92 |
oat-sa/extension-tao-itemqti | model/Export/ExportForm.php | ExportForm.initForm | public function initForm()
{
$this->form = new tao_helpers_form_xhtml_Form('export');
$this->form->setDecorators(array(
'element' => new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div')),
'group' => new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', 'cssClass' => 'form-g... | php | public function initForm()
{
$this->form = new tao_helpers_form_xhtml_Form('export');
$this->form->setDecorators(array(
'element' => new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div')),
'group' => new tao_helpers_form_xhtml_TagWrapper(array('tag' => 'div', 'cssClass' => 'form-g... | [
"public",
"function",
"initForm",
"(",
")",
"{",
"$",
"this",
"->",
"form",
"=",
"new",
"tao_helpers_form_xhtml_Form",
"(",
"'export'",
")",
";",
"$",
"this",
"->",
"form",
"->",
"setDecorators",
"(",
"array",
"(",
"'element'",
"=>",
"new",
"tao_helpers_form... | Short description of method initForm
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@return mixed | [
"Short",
"description",
"of",
"method",
"initForm"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/Export/ExportForm.php#L61-L80 |
oat-sa/extension-tao-itemqti | model/Export/ExportForm.php | ExportForm.initElements | public function initElements()
{
$itemService = taoItems_models_classes_ItemsService::singleton();
$fileName = '';
$options = array();
$disabledOptions = array();
if(isset($this->data['instance'])){
$item = $this->data['instance'];
if($item instanceof core_kernel_classes_Resource... | php | public function initElements()
{
$itemService = taoItems_models_classes_ItemsService::singleton();
$fileName = '';
$options = array();
$disabledOptions = array();
if(isset($this->data['instance'])){
$item = $this->data['instance'];
if($item instanceof core_kernel_classes_Resource... | [
"public",
"function",
"initElements",
"(",
")",
"{",
"$",
"itemService",
"=",
"taoItems_models_classes_ItemsService",
"::",
"singleton",
"(",
")",
";",
"$",
"fileName",
"=",
"''",
";",
"$",
"options",
"=",
"array",
"(",
")",
";",
"$",
"disabledOptions",
"=",... | overriden
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@return mixed | [
"overriden"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/Export/ExportForm.php#L89-L158 |
oat-sa/extension-tao-itemqti | model/portableElement/element/PortableElementObject.php | PortableElementObject.exchangeArray | public function exchangeArray(array $data)
{
$attributes = array_keys($this->toArray());
foreach ($attributes as $field) {
if (isset($data[$field])) {
$this->$field = $data[$field];
}
}
return $this;
} | php | public function exchangeArray(array $data)
{
$attributes = array_keys($this->toArray());
foreach ($attributes as $field) {
if (isset($data[$field])) {
$this->$field = $data[$field];
}
}
return $this;
} | [
"public",
"function",
"exchangeArray",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"attributes",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"toArray",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"isse... | Populate $this object from array
@param array $data
@return $this | [
"Populate",
"$this",
"object",
"from",
"array"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/element/PortableElementObject.php#L72-L81 |
oat-sa/extension-tao-itemqti | model/portableElement/element/PortableElementObject.php | PortableElementObject.toArray | public function toArray($selectionGroup=false)
{
$array = get_object_vars($this);
if (is_array($selectionGroup)) {
return array_intersect_key($array, array_flip($selectionGroup));
}
unset($array['model']);
return $array;
} | php | public function toArray($selectionGroup=false)
{
$array = get_object_vars($this);
if (is_array($selectionGroup)) {
return array_intersect_key($array, array_flip($selectionGroup));
}
unset($array['model']);
return $array;
} | [
"public",
"function",
"toArray",
"(",
"$",
"selectionGroup",
"=",
"false",
")",
"{",
"$",
"array",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"selectionGroup",
")",
")",
"{",
"return",
"array_intersect_key",
"(",
... | Return an array representation of $this object
Should be filtered by $selectionGroup
@param bool $selectionGroup
@return array | [
"Return",
"an",
"array",
"representation",
"of",
"$this",
"object",
"Should",
"be",
"filtered",
"by",
"$selectionGroup"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/element/PortableElementObject.php#L90-L98 |
oat-sa/extension-tao-itemqti | model/portableElement/element/PortableElementObject.php | PortableElementObject.getRuntimePath | public function getRuntimePath()
{
$paths = [];
foreach ($this->getRuntime() as $key => $value) {
if (in_array($key, ['hook', 'libraries', 'stylesheets', 'mediaFiles', 'icon', 'src'])) {
$paths[$key] = preg_replace('/^' . $this->getTypeIdentifier() . '/', '.', $value);
... | php | public function getRuntimePath()
{
$paths = [];
foreach ($this->getRuntime() as $key => $value) {
if (in_array($key, ['hook', 'libraries', 'stylesheets', 'mediaFiles', 'icon', 'src'])) {
$paths[$key] = preg_replace('/^' . $this->getTypeIdentifier() . '/', '.', $value);
... | [
"public",
"function",
"getRuntimePath",
"(",
")",
"{",
"$",
"paths",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getRuntime",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"key",
",",
"[",
... | Return runtime files with relative path
@return array | [
"Return",
"runtime",
"files",
"with",
"relative",
"path"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/element/PortableElementObject.php#L283-L292 |
oat-sa/extension-tao-itemqti | model/portableElement/element/PortableElementObject.php | PortableElementObject.getRuntimeAliases | public function getRuntimeAliases()
{
$paths = [];
foreach ($this->getRuntime() as $key => $value) {
if (in_array($key, ['hook', 'libraries', 'stylesheets', 'mediaFiles', 'icon', 'src'])) {
$paths[$key] = preg_replace('/^(.\/)(.*)/', $this->getTypeIdentifier() . "/$2", $t... | php | public function getRuntimeAliases()
{
$paths = [];
foreach ($this->getRuntime() as $key => $value) {
if (in_array($key, ['hook', 'libraries', 'stylesheets', 'mediaFiles', 'icon', 'src'])) {
$paths[$key] = preg_replace('/^(.\/)(.*)/', $this->getTypeIdentifier() . "/$2", $t... | [
"public",
"function",
"getRuntimeAliases",
"(",
")",
"{",
"$",
"paths",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getRuntime",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"key",
",",
"[... | Return creator files with relative aliases
@return array | [
"Return",
"creator",
"files",
"with",
"relative",
"aliases"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/element/PortableElementObject.php#L299-L308 |
oat-sa/extension-tao-itemqti | model/portableElement/element/PortableElementObject.php | PortableElementObject.getCreatorPath | public function getCreatorPath()
{
$paths = [];
foreach ($this->getCreator() as $key => $value) {
if (in_array($key, ['hook', 'libraries', 'stylesheets', 'mediaFiles', 'icon', 'src'])) {
$paths[$key] = preg_replace('/^' . $this->getTypeIdentifier() . '/', '.', $value);
... | php | public function getCreatorPath()
{
$paths = [];
foreach ($this->getCreator() as $key => $value) {
if (in_array($key, ['hook', 'libraries', 'stylesheets', 'mediaFiles', 'icon', 'src'])) {
$paths[$key] = preg_replace('/^' . $this->getTypeIdentifier() . '/', '.', $value);
... | [
"public",
"function",
"getCreatorPath",
"(",
")",
"{",
"$",
"paths",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getCreator",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"key",
",",
"[",
... | Return creator files with relative path
@return array | [
"Return",
"creator",
"files",
"with",
"relative",
"path"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/element/PortableElementObject.php#L315-L324 |
oat-sa/extension-tao-itemqti | model/portableElement/element/PortableElementObject.php | PortableElementObject.getCreatorAliases | public function getCreatorAliases()
{
$paths = [];
foreach ($this->getCreator() as $key => $value) {
if (in_array($key, ['hook', 'libraries', 'stylesheets', 'mediaFiles', 'icon', 'src'])) {
$paths[$key] = preg_replace('/^(.\/)(.*)/', $this->getTypeIdentifier() . "/$2", $t... | php | public function getCreatorAliases()
{
$paths = [];
foreach ($this->getCreator() as $key => $value) {
if (in_array($key, ['hook', 'libraries', 'stylesheets', 'mediaFiles', 'icon', 'src'])) {
$paths[$key] = preg_replace('/^(.\/)(.*)/', $this->getTypeIdentifier() . "/$2", $t... | [
"public",
"function",
"getCreatorAliases",
"(",
")",
"{",
"$",
"paths",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getCreator",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"key",
",",
"[... | Return creator files with relative aliases
@return array | [
"Return",
"creator",
"files",
"with",
"relative",
"aliases"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/portableElement/element/PortableElementObject.php#L331-L340 |
oat-sa/extension-tao-itemqti | model/qti/metadata/MetadataRegistry.php | MetadataRegistry.getMapping | public function getMapping()
{
$instances = $this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->getOptions();
$mapping = [];
foreach ($instances as $key => $helpers) {
if (! isset($mapping[$key])) {
... | php | public function getMapping()
{
$instances = $this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->getOptions();
$mapping = [];
foreach ($instances as $key => $helpers) {
if (! isset($mapping[$key])) {
... | [
"public",
"function",
"getMapping",
"(",
")",
"{",
"$",
"instances",
"=",
"$",
"this",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"MetadataService",
"::",
"SERVICE_ID",
")",
"->",
"getImporter",
"(",
")",
"->",
"getOptions",
"(",
")",
";",
"$... | @deprecated Use MetadataService->getImporter() instead to have access to specific instance of metadataImporter
Get the class mapping of Extractor/Injector classes.
@return array An associative array with two main keys. The 'injectors' and 'extractors' and 'guardians' keys refer to sub-arrays containing respectively c... | [
"@deprecated",
"Use",
"MetadataService",
"-",
">",
"getImporter",
"()",
"instead",
"to",
"have",
"access",
"to",
"specific",
"instance",
"of",
"metadataImporter"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/MetadataRegistry.php#L93-L111 |
oat-sa/extension-tao-itemqti | model/qti/metadata/MetadataRegistry.php | MetadataRegistry.setMapping | protected function setMapping(array $mapping)
{
/** @var MetadataService $metadataService */
$metadataService = $this->getServiceManager()->get(MetadataService::SERVICE_ID);
$importer = $metadataService->getImporter();
$importer->setOptions($mapping);
$metadataService->setO... | php | protected function setMapping(array $mapping)
{
/** @var MetadataService $metadataService */
$metadataService = $this->getServiceManager()->get(MetadataService::SERVICE_ID);
$importer = $metadataService->getImporter();
$importer->setOptions($mapping);
$metadataService->setO... | [
"protected",
"function",
"setMapping",
"(",
"array",
"$",
"mapping",
")",
"{",
"/** @var MetadataService $metadataService */",
"$",
"metadataService",
"=",
"$",
"this",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"MetadataService",
"::",
"SERVICE_ID",
")"... | @deprecated use MetadataService->getImporter()->registerService() instead
Set the class mapping of Extractor/Injector classes.
@param array $mapping An associative array with two main keys. The 'injectors' and 'extractors' keys refer to sub-arrays containing respectively classnames of MetadataInjector and MetadataExt... | [
"@deprecated",
"use",
"MetadataService",
"-",
">",
"getImporter",
"()",
"-",
">",
"registerService",
"()",
"instead"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/MetadataRegistry.php#L120-L130 |
oat-sa/extension-tao-itemqti | model/qti/metadata/MetadataRegistry.php | MetadataRegistry.registerMetadataInjector | public function registerMetadataInjector($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->register(MetadataImporter::INJECTOR_KEY, $fqcn);
} | php | public function registerMetadataInjector($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->register(MetadataImporter::INJECTOR_KEY, $fqcn);
} | [
"public",
"function",
"registerMetadataInjector",
"(",
"$",
"fqcn",
")",
"{",
"$",
"this",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"MetadataService",
"::",
"SERVICE_ID",
")",
"->",
"getImporter",
"(",
")",
"->",
"register",
"(",
"MetadataImporte... | @deprecated use MetadataService->getImporter()->register(MetadataImport::INJECTOR_KEY, $fqcn)
Register a MetadataInjector implementation by $fqcn (Fully Qualified Class Name).
@param string $fqcn A Fully Qualified Class Name.
@throws InvalidArgumentException If the given $fqcn does not correspond to an implementation... | [
"@deprecated",
"use",
"MetadataService",
"-",
">",
"getImporter",
"()",
"-",
">",
"register",
"(",
"MetadataImport",
"::",
"INJECTOR_KEY",
"$fqcn",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/MetadataRegistry.php#L141-L147 |
oat-sa/extension-tao-itemqti | model/qti/metadata/MetadataRegistry.php | MetadataRegistry.unregisterMetadataInjector | public function unregisterMetadataInjector($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->unregister(MetadataImporter::INJECTOR_KEY, $fqcn);
} | php | public function unregisterMetadataInjector($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->unregister(MetadataImporter::INJECTOR_KEY, $fqcn);
} | [
"public",
"function",
"unregisterMetadataInjector",
"(",
"$",
"fqcn",
")",
"{",
"$",
"this",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"MetadataService",
"::",
"SERVICE_ID",
")",
"->",
"getImporter",
"(",
")",
"->",
"unregister",
"(",
"MetadataImp... | @deprecated use MetadataService->getImporter()->unregister(MetadataImport::INJECTOR_KEY, $fqcn)
Unregister a MetadataInjector implementation by $fqcn (Fully Qualified Class Name).
@param string $fqcn A Fully Qualified Class Name.
@see oat\taoQtiItem\model\qti\metadata\MetadataInjector The MetadataInjector interface. | [
"@deprecated",
"use",
"MetadataService",
"-",
">",
"getImporter",
"()",
"-",
">",
"unregister",
"(",
"MetadataImport",
"::",
"INJECTOR_KEY",
"$fqcn",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/MetadataRegistry.php#L157-L163 |
oat-sa/extension-tao-itemqti | model/qti/metadata/MetadataRegistry.php | MetadataRegistry.registerMetadataExtractor | public function registerMetadataExtractor($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->register(MetadataImporter::EXTRACTOR_KEY, $fqcn);
} | php | public function registerMetadataExtractor($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->register(MetadataImporter::EXTRACTOR_KEY, $fqcn);
} | [
"public",
"function",
"registerMetadataExtractor",
"(",
"$",
"fqcn",
")",
"{",
"$",
"this",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"MetadataService",
"::",
"SERVICE_ID",
")",
"->",
"getImporter",
"(",
")",
"->",
"register",
"(",
"MetadataImport... | @deprecated use MetadataService->getImporter()->register(MetadataImport::EXTRACTOR_KEY, $fqcn)
Register a MetadataExtractor implementation by $fqcn (Fully Qualified Class Name).
@param string $fqcn A Fully Qualified Class Name.
@throws InvalidArgumentException If the given $fqcn does not correspond to an implementati... | [
"@deprecated",
"use",
"MetadataService",
"-",
">",
"getImporter",
"()",
"-",
">",
"register",
"(",
"MetadataImport",
"::",
"EXTRACTOR_KEY",
"$fqcn",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/MetadataRegistry.php#L174-L180 |
oat-sa/extension-tao-itemqti | model/qti/metadata/MetadataRegistry.php | MetadataRegistry.unregisterMetadataExtractor | public function unregisterMetadataExtractor($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->unregister(MetadataImporter::EXTRACTOR_KEY, $fqcn);
} | php | public function unregisterMetadataExtractor($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->unregister(MetadataImporter::EXTRACTOR_KEY, $fqcn);
} | [
"public",
"function",
"unregisterMetadataExtractor",
"(",
"$",
"fqcn",
")",
"{",
"$",
"this",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"MetadataService",
"::",
"SERVICE_ID",
")",
"->",
"getImporter",
"(",
")",
"->",
"unregister",
"(",
"MetadataIm... | @deprecated use MetadataService->getImporter()->unregister(MetadataImport::EXTRACTOR_KEY, $fqcn)
Unregister a MetadataExtractor implementation by $fqcn (Fully Qualified Class Name).
@param string $fqcn A Fully Qualified Class Name.
@see oat\taoQtiItem\model\qti\metadata\MetadataExtractor The MetadataExtractor interfa... | [
"@deprecated",
"use",
"MetadataService",
"-",
">",
"getImporter",
"()",
"-",
">",
"unregister",
"(",
"MetadataImport",
"::",
"EXTRACTOR_KEY",
"$fqcn",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/MetadataRegistry.php#L190-L196 |
oat-sa/extension-tao-itemqti | model/qti/metadata/MetadataRegistry.php | MetadataRegistry.registerMetadataGuardian | public function registerMetadataGuardian($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->register(MetadataImporter::GUARDIAN_KEY, $fqcn);
} | php | public function registerMetadataGuardian($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->register(MetadataImporter::GUARDIAN_KEY, $fqcn);
} | [
"public",
"function",
"registerMetadataGuardian",
"(",
"$",
"fqcn",
")",
"{",
"$",
"this",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"MetadataService",
"::",
"SERVICE_ID",
")",
"->",
"getImporter",
"(",
")",
"->",
"register",
"(",
"MetadataImporte... | @deprecated use MetadataService->getImporter()->register(MetadataImport::GUARDIAN_KEY, $fqcn)
Register a MetadataGuardian implementation by $fqcn (Fully Qualified Class Name).
@param string $fqcn A Fully Qualified Class Name.
@throws InvalidArgumentException If the given $fqcn does not correspond to an implementation... | [
"@deprecated",
"use",
"MetadataService",
"-",
">",
"getImporter",
"()",
"-",
">",
"register",
"(",
"MetadataImport",
"::",
"GUARDIAN_KEY",
"$fqcn",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/MetadataRegistry.php#L207-L213 |
oat-sa/extension-tao-itemqti | model/qti/metadata/MetadataRegistry.php | MetadataRegistry.unregisterMetadataGuardian | public function unregisterMetadataGuardian($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->unregister(MetadataImporter::GUARDIAN_KEY, $fqcn);
} | php | public function unregisterMetadataGuardian($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->unregister(MetadataImporter::GUARDIAN_KEY, $fqcn);
} | [
"public",
"function",
"unregisterMetadataGuardian",
"(",
"$",
"fqcn",
")",
"{",
"$",
"this",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"MetadataService",
"::",
"SERVICE_ID",
")",
"->",
"getImporter",
"(",
")",
"->",
"unregister",
"(",
"MetadataImp... | @deprecated use MetadataService->getImporter()->unregister(MetadataImport::GUARDIAN_KEY, $fqcn)
Unregister a MetadataGuardian implementation by $fqcn (Fully Qualified Class Name).
@param string $fqcn A Fully Qualified Class Name.
@see oat\taoQtiItem\model\qti\metadata\MetadataGuardian The MetadataGuardian interface. | [
"@deprecated",
"use",
"MetadataService",
"-",
">",
"getImporter",
"()",
"-",
">",
"unregister",
"(",
"MetadataImport",
"::",
"GUARDIAN_KEY",
"$fqcn",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/MetadataRegistry.php#L223-L229 |
oat-sa/extension-tao-itemqti | model/qti/metadata/MetadataRegistry.php | MetadataRegistry.registerMetadataClassLookup | public function registerMetadataClassLookup($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->register(MetadataImporter::CLASS_LOOKUP_KEY, $fqcn);
} | php | public function registerMetadataClassLookup($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->register(MetadataImporter::CLASS_LOOKUP_KEY, $fqcn);
} | [
"public",
"function",
"registerMetadataClassLookup",
"(",
"$",
"fqcn",
")",
"{",
"$",
"this",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"MetadataService",
"::",
"SERVICE_ID",
")",
"->",
"getImporter",
"(",
")",
"->",
"register",
"(",
"MetadataImpo... | @deprecated use MetadataService->getImporter()->register(MetadataImport::CLASS_LOOKUP_KEY, $fqcn)
Register a MetadataClassLookup implementation by $fqcn (Fully Qualified Class Name).
@param string $fqcn A Fully Qualified Class Name.
@throws InvalidArgumentException If the given $fqcn does not correspond to an impleme... | [
"@deprecated",
"use",
"MetadataService",
"-",
">",
"getImporter",
"()",
"-",
">",
"register",
"(",
"MetadataImport",
"::",
"CLASS_LOOKUP_KEY",
"$fqcn",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/MetadataRegistry.php#L240-L246 |
oat-sa/extension-tao-itemqti | model/qti/metadata/MetadataRegistry.php | MetadataRegistry.unregisterMetadataClassLookup | public function unregisterMetadataClassLookup($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->unregister(MetadataImporter::CLASS_LOOKUP_KEY, $fqcn);
} | php | public function unregisterMetadataClassLookup($fqcn)
{
$this->getServiceManager()
->get(MetadataService::SERVICE_ID)
->getImporter()
->unregister(MetadataImporter::CLASS_LOOKUP_KEY, $fqcn);
} | [
"public",
"function",
"unregisterMetadataClassLookup",
"(",
"$",
"fqcn",
")",
"{",
"$",
"this",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"MetadataService",
"::",
"SERVICE_ID",
")",
"->",
"getImporter",
"(",
")",
"->",
"unregister",
"(",
"Metadata... | @deprecated use MetadataService->getImporter()->unregister(MetadataImport::CLASS_LOOKUP_KEY, $fqcn)
Unregister a MetadataClassLookup implementation by $fqcn (Fully Qualified Class Name).
@param string $fqcn A Fully Qualified Class Name.
@see oat\taoQtiItem\model\qti\metadata\MetadataClassLookup The MetadataClassLooku... | [
"@deprecated",
"use",
"MetadataService",
"-",
">",
"getImporter",
"()",
"-",
">",
"unregister",
"(",
"MetadataImport",
"::",
"CLASS_LOOKUP_KEY",
"$fqcn",
")"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/metadata/MetadataRegistry.php#L256-L262 |
oat-sa/extension-tao-itemqti | controller/QtiItemRunner.php | QtiItemRunner.submitResponses | public function submitResponses() {
$success = false;
$itemUri = $this->getItemUri();
if(!empty($itemUri)){
$this->processResponses(new core_kernel_classes_Resource($itemUri));
$success = true;
}else{
throw new common_Exception('missing required ite... | php | public function submitResponses() {
$success = false;
$itemUri = $this->getItemUri();
if(!empty($itemUri)){
$this->processResponses(new core_kernel_classes_Resource($itemUri));
$success = true;
}else{
throw new common_Exception('missing required ite... | [
"public",
"function",
"submitResponses",
"(",
")",
"{",
"$",
"success",
"=",
"false",
";",
"$",
"itemUri",
"=",
"$",
"this",
"->",
"getItemUri",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"itemUri",
")",
")",
"{",
"$",
"this",
"->",
"process... | The main entry poin for respon evaluation
@throws common_Exception | [
"The",
"main",
"entry",
"poin",
"for",
"respon",
"evaluation"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/QtiItemRunner.php#L93-L105 |
oat-sa/extension-tao-itemqti | controller/QtiItemRunner.php | QtiItemRunner.processResponses | protected function processResponses(core_kernel_classes_Resource $item) {
$jsonPayload = taoQtiCommon_helpers_Utils::readJsonPayload();
try {
$qtiXmlFileContent = QtiFile::getQtiFileContent($item);
$qtiXmlDoc = new XmlDocument();
$qtiXmlDoc->loadFromString($qtiXmlFi... | php | protected function processResponses(core_kernel_classes_Resource $item) {
$jsonPayload = taoQtiCommon_helpers_Utils::readJsonPayload();
try {
$qtiXmlFileContent = QtiFile::getQtiFileContent($item);
$qtiXmlDoc = new XmlDocument();
$qtiXmlDoc->loadFromString($qtiXmlFi... | [
"protected",
"function",
"processResponses",
"(",
"core_kernel_classes_Resource",
"$",
"item",
")",
"{",
"$",
"jsonPayload",
"=",
"taoQtiCommon_helpers_Utils",
"::",
"readJsonPayload",
"(",
")",
";",
"try",
"{",
"$",
"qtiXmlFileContent",
"=",
"QtiFile",
"::",
"getQt... | Item's ResponseProcessing.
@throws RuntimeException If an error occurs while processing responses or transmitting results | [
"Item",
"s",
"ResponseProcessing",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/QtiItemRunner.php#L112-L178 |
oat-sa/extension-tao-itemqti | controller/QtiItemRunner.php | QtiItemRunner.transmitResults | protected function transmitResults(core_kernel_classes_Resource $item, AssessmentItemSession $itemSession) {
$resultTransmitter = new taoQtiCommon_helpers_ResultTransmitter(taoResultServer_models_classes_ResultServerStateFull::singleton());
foreach ($itemSession->getKeys() as $identifier) {
... | php | protected function transmitResults(core_kernel_classes_Resource $item, AssessmentItemSession $itemSession) {
$resultTransmitter = new taoQtiCommon_helpers_ResultTransmitter(taoResultServer_models_classes_ResultServerStateFull::singleton());
foreach ($itemSession->getKeys() as $identifier) {
... | [
"protected",
"function",
"transmitResults",
"(",
"core_kernel_classes_Resource",
"$",
"item",
",",
"AssessmentItemSession",
"$",
"itemSession",
")",
"{",
"$",
"resultTransmitter",
"=",
"new",
"taoQtiCommon_helpers_ResultTransmitter",
"(",
"taoResultServer_models_classes_ResultS... | Transmit the variables contained in the AssessmentTestSession $itemSession as
item results to the Result Server.
@param core_kernel_classes_Resource $item The item definition in database.
@param AssessmentItemSession $itemSession The AssessmentItemSession objects from where the results must be extracted.
@throws taoQt... | [
"Transmit",
"the",
"variables",
"contained",
"in",
"the",
"AssessmentTestSession",
"$itemSession",
"as",
"item",
"results",
"to",
"the",
"Result",
"Server",
"."
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/controller/QtiItemRunner.php#L188-L198 |
oat-sa/extension-tao-itemqti | model/qti/response/Custom.php | Custom.getRule | public function getRule(){
$returnValue = (string) '';
foreach($this->responseRules as $responseRule){
$returnValue .= $responseRule->getRule();
}
return (string) $returnValue;
} | php | public function getRule(){
$returnValue = (string) '';
foreach($this->responseRules as $responseRule){
$returnValue .= $responseRule->getRule();
}
return (string) $returnValue;
} | [
"public",
"function",
"getRule",
"(",
")",
"{",
"$",
"returnValue",
"=",
"(",
"string",
")",
"''",
";",
"foreach",
"(",
"$",
"this",
"->",
"responseRules",
"as",
"$",
"responseRule",
")",
"{",
"$",
"returnValue",
".=",
"$",
"responseRule",
"->",
"getRule... | Short description of method getRule
@access public
@author Joel Bout, <joel.bout@tudor.lu>
@return string | [
"Short",
"description",
"of",
"method",
"getRule"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/qti/response/Custom.php#L62-L70 |
oat-sa/extension-tao-itemqti | model/update/ItemUpdateInlineFeedback.php | ItemUpdateInlineFeedback.updateItem | protected function updateItem(\oat\taoQtiItem\model\qti\Item $item, $itemFile)
{
$changed = false;
$responses = $item->getResponses();
foreach ($responses as $response) {
$responseIdentifier = $response->attr('identifier');
$rules = $response->getFeedba... | php | protected function updateItem(\oat\taoQtiItem\model\qti\Item $item, $itemFile)
{
$changed = false;
$responses = $item->getResponses();
foreach ($responses as $response) {
$responseIdentifier = $response->attr('identifier');
$rules = $response->getFeedba... | [
"protected",
"function",
"updateItem",
"(",
"\\",
"oat",
"\\",
"taoQtiItem",
"\\",
"model",
"\\",
"qti",
"\\",
"Item",
"$",
"item",
",",
"$",
"itemFile",
")",
"{",
"$",
"changed",
"=",
"false",
";",
"$",
"responses",
"=",
"$",
"item",
"->",
"getRespons... | Update the item content by wrapping the modalfeedback body into a new wrapper
@param oat\taoQtiItem\modal\Item $item
@param string $itemFile
@return boolean | [
"Update",
"the",
"item",
"content",
"by",
"wrapping",
"the",
"modalfeedback",
"body",
"into",
"a",
"new",
"wrapper"
] | train | https://github.com/oat-sa/extension-tao-itemqti/blob/a55b73c7894523bde169ba520d5001ce7b5bb88c/model/update/ItemUpdateInlineFeedback.php#L38-L72 |
webmozart/glob | src/Iterator/RegexFilterIterator.php | RegexFilterIterator.key | public function key()
{
if (!$this->valid()) {
return null;
}
if ($this->mode & self::KEY_AS_KEY) {
return parent::key();
}
return $this->cursor;
} | php | public function key()
{
if (!$this->valid()) {
return null;
}
if ($this->mode & self::KEY_AS_KEY) {
return parent::key();
}
return $this->cursor;
} | [
"public",
"function",
"key",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"valid",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"mode",
"&",
"self",
"::",
"KEY_AS_KEY",
")",
"{",
"return",
"parent",
"::",
"... | Returns the current position.
@return int The current position. | [
"Returns",
"the",
"current",
"position",
"."
] | train | https://github.com/webmozart/glob/blob/8da14867b709e8776d9f6272faaf844aefc695e3/src/Iterator/RegexFilterIterator.php#L109-L120 |
webmozart/glob | src/Iterator/RegexFilterIterator.php | RegexFilterIterator.accept | public function accept()
{
$path = ($this->mode & self::FILTER_VALUE) ? $this->current() : parent::key();
if (0 !== strpos($path, $this->staticPrefix)) {
return false;
}
$result = (bool) preg_match($this->regExp, $path);
return $result;
} | php | public function accept()
{
$path = ($this->mode & self::FILTER_VALUE) ? $this->current() : parent::key();
if (0 !== strpos($path, $this->staticPrefix)) {
return false;
}
$result = (bool) preg_match($this->regExp, $path);
return $result;
} | [
"public",
"function",
"accept",
"(",
")",
"{",
"$",
"path",
"=",
"(",
"$",
"this",
"->",
"mode",
"&",
"self",
"::",
"FILTER_VALUE",
")",
"?",
"$",
"this",
"->",
"current",
"(",
")",
":",
"parent",
"::",
"key",
"(",
")",
";",
"if",
"(",
"0",
"!=... | Accepts paths matching the glob.
@return bool Whether the path is accepted. | [
"Accepts",
"paths",
"matching",
"the",
"glob",
"."
] | train | https://github.com/webmozart/glob/blob/8da14867b709e8776d9f6272faaf844aefc695e3/src/Iterator/RegexFilterIterator.php#L140-L151 |
webmozart/glob | src/Glob.php | Glob.glob | public static function glob($glob, $flags = 0)
{
$results = iterator_to_array(new GlobIterator($glob, $flags));
sort($results);
return $results;
} | php | public static function glob($glob, $flags = 0)
{
$results = iterator_to_array(new GlobIterator($glob, $flags));
sort($results);
return $results;
} | [
"public",
"static",
"function",
"glob",
"(",
"$",
"glob",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"$",
"results",
"=",
"iterator_to_array",
"(",
"new",
"GlobIterator",
"(",
"$",
"glob",
",",
"$",
"flags",
")",
")",
";",
"sort",
"(",
"$",
"results",
... | Globs the file system paths matching the glob.
The glob may contain the wildcard "*". This wildcard matches any number
of characters, *including* directory separators.
```php
foreach (Glob::glob('/project/**.twig') as $path) {
// do something...
}
```
@param string $glob The canonical glob. The glob should contain ... | [
"Globs",
"the",
"file",
"system",
"paths",
"matching",
"the",
"glob",
"."
] | train | https://github.com/webmozart/glob/blob/8da14867b709e8776d9f6272faaf844aefc695e3/src/Glob.php#L110-L117 |
webmozart/glob | src/Glob.php | Glob.match | public static function match($path, $glob, $flags = 0)
{
if (!self::isDynamic($glob)) {
return $glob === $path;
}
if (0 !== strpos($path, self::getStaticPrefix($glob, $flags))) {
return false;
}
if (!preg_match(self::toRegEx($glob, $flags), $path)) {... | php | public static function match($path, $glob, $flags = 0)
{
if (!self::isDynamic($glob)) {
return $glob === $path;
}
if (0 !== strpos($path, self::getStaticPrefix($glob, $flags))) {
return false;
}
if (!preg_match(self::toRegEx($glob, $flags), $path)) {... | [
"public",
"static",
"function",
"match",
"(",
"$",
"path",
",",
"$",
"glob",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"isDynamic",
"(",
"$",
"glob",
")",
")",
"{",
"return",
"$",
"glob",
"===",
"$",
"path",
";",
"}",... | Matches a path against a glob.
```php
if (Glob::match('/project/views/index.html.twig', '/project/**.twig')) {
// path matches
}
```
@param string $path The path to match.
@param string $glob The canonical glob. The glob should contain forward
slashes as directory separators only. It must not
contain any "." or "..... | [
"Matches",
"a",
"path",
"against",
"a",
"glob",
"."
] | train | https://github.com/webmozart/glob/blob/8da14867b709e8776d9f6272faaf844aefc695e3/src/Glob.php#L139-L154 |
webmozart/glob | src/Glob.php | Glob.filter | public static function filter(array $paths, $glob, $flags = self::FILTER_VALUE)
{
if (($flags & self::FILTER_VALUE) && ($flags & self::FILTER_KEY)) {
throw new InvalidArgumentException('The flags Glob::FILTER_VALUE and Glob::FILTER_KEY cannot be passed at the same time.');
}
if ... | php | public static function filter(array $paths, $glob, $flags = self::FILTER_VALUE)
{
if (($flags & self::FILTER_VALUE) && ($flags & self::FILTER_KEY)) {
throw new InvalidArgumentException('The flags Glob::FILTER_VALUE and Glob::FILTER_KEY cannot be passed at the same time.');
}
if ... | [
"public",
"static",
"function",
"filter",
"(",
"array",
"$",
"paths",
",",
"$",
"glob",
",",
"$",
"flags",
"=",
"self",
"::",
"FILTER_VALUE",
")",
"{",
"if",
"(",
"(",
"$",
"flags",
"&",
"self",
"::",
"FILTER_VALUE",
")",
"&&",
"(",
"$",
"flags",
"... | Filters an array for paths matching a glob.
The filtered array is returned. This array preserves the keys of the
passed array.
```php
$filteredPaths = Glob::filter($paths, '/project/**.twig');
```
@param string[] $paths A list of paths.
@param string $glob The canonical glob. The glob should contain
forward slash... | [
"Filters",
"an",
"array",
"for",
"paths",
"matching",
"a",
"glob",
"."
] | train | https://github.com/webmozart/glob/blob/8da14867b709e8776d9f6272faaf844aefc695e3/src/Glob.php#L178-L220 |
webmozart/glob | src/Glob.php | Glob.getBasePath | public static function getBasePath($glob, $flags = 0)
{
// Search the static prefix for the last "/"
$staticPrefix = self::getStaticPrefix($glob, $flags);
if (false !== ($pos = strrpos($staticPrefix, '/'))) {
// Special case: Return "/" if the only slash is at the beginning
... | php | public static function getBasePath($glob, $flags = 0)
{
// Search the static prefix for the last "/"
$staticPrefix = self::getStaticPrefix($glob, $flags);
if (false !== ($pos = strrpos($staticPrefix, '/'))) {
// Special case: Return "/" if the only slash is at the beginning
... | [
"public",
"static",
"function",
"getBasePath",
"(",
"$",
"glob",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"// Search the static prefix for the last \"/\"",
"$",
"staticPrefix",
"=",
"self",
"::",
"getStaticPrefix",
"(",
"$",
"glob",
",",
"$",
"flags",
")",
";",
... | Returns the base path of a glob.
This method returns the most specific directory that contains all files
matched by the glob. If this directory does not exist on the file system,
it's not necessary to execute the glob algorithm.
More specifically, the "base path" is the longest path trailed by a "/"
on the left of th... | [
"Returns",
"the",
"base",
"path",
"of",
"a",
"glob",
"."
] | train | https://github.com/webmozart/glob/blob/8da14867b709e8776d9f6272faaf844aefc695e3/src/Glob.php#L257-L280 |
webmozart/glob | src/Glob.php | Glob.toRegEx | public static function toRegEx($glob, $flags = 0, $delimiter = '~')
{
if (!Path::isAbsolute($glob) && false === strpos($glob, '://')) {
throw new InvalidArgumentException(sprintf(
'The glob "%s" is not absolute and not a URI.',
$glob
));
}
... | php | public static function toRegEx($glob, $flags = 0, $delimiter = '~')
{
if (!Path::isAbsolute($glob) && false === strpos($glob, '://')) {
throw new InvalidArgumentException(sprintf(
'The glob "%s" is not absolute and not a URI.',
$glob
));
}
... | [
"public",
"static",
"function",
"toRegEx",
"(",
"$",
"glob",
",",
"$",
"flags",
"=",
"0",
",",
"$",
"delimiter",
"=",
"'~'",
")",
"{",
"if",
"(",
"!",
"Path",
"::",
"isAbsolute",
"(",
"$",
"glob",
")",
"&&",
"false",
"===",
"strpos",
"(",
"$",
"g... | Converts a glob to a regular expression.
Use this method if you need to match many paths against a glob:
```php
$staticPrefix = Glob::getStaticPrefix('/project/**.twig');
$regEx = Glob::toRegEx('/project/**.twig');
if (0 !== strpos($path, $staticPrefix)) {
// no match
}
if (!preg_match($regEx, $path)) {
// no match... | [
"Converts",
"a",
"glob",
"to",
"a",
"regular",
"expression",
"."
] | train | https://github.com/webmozart/glob/blob/8da14867b709e8776d9f6272faaf844aefc695e3/src/Glob.php#L314-L441 |
webmozart/glob | src/Glob.php | Glob.getStaticPrefix | public static function getStaticPrefix($glob, $flags = 0)
{
if (!Path::isAbsolute($glob) && false === strpos($glob, '://')) {
throw new InvalidArgumentException(sprintf(
'The glob "%s" is not absolute and not a URI.',
$glob
));
}
$pref... | php | public static function getStaticPrefix($glob, $flags = 0)
{
if (!Path::isAbsolute($glob) && false === strpos($glob, '://')) {
throw new InvalidArgumentException(sprintf(
'The glob "%s" is not absolute and not a URI.',
$glob
));
}
$pref... | [
"public",
"static",
"function",
"getStaticPrefix",
"(",
"$",
"glob",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"Path",
"::",
"isAbsolute",
"(",
"$",
"glob",
")",
"&&",
"false",
"===",
"strpos",
"(",
"$",
"glob",
",",
"'://'",
")",
")",... | Returns the static prefix of a glob.
The "static prefix" is the part of the glob up to the first wildcard "*".
If the glob does not contain wildcards, the full glob is returned.
@param string $glob The canonical glob. The glob should contain forward
slashes as directory separators only. It must not
contain any "." o... | [
"Returns",
"the",
"static",
"prefix",
"of",
"a",
"glob",
"."
] | train | https://github.com/webmozart/glob/blob/8da14867b709e8776d9f6272faaf844aefc695e3/src/Glob.php#L459-L515 |
webmozart/glob | src/Glob.php | Glob.isDynamic | public static function isDynamic($glob)
{
return false !== strpos($glob, '*') || false !== strpos($glob, '{') || false !== strpos($glob, '?') || false !== strpos($glob, '[');
} | php | public static function isDynamic($glob)
{
return false !== strpos($glob, '*') || false !== strpos($glob, '{') || false !== strpos($glob, '?') || false !== strpos($glob, '[');
} | [
"public",
"static",
"function",
"isDynamic",
"(",
"$",
"glob",
")",
"{",
"return",
"false",
"!==",
"strpos",
"(",
"$",
"glob",
",",
"'*'",
")",
"||",
"false",
"!==",
"strpos",
"(",
"$",
"glob",
",",
"'{'",
")",
"||",
"false",
"!==",
"strpos",
"(",
... | Returns whether the glob contains a dynamic part.
The glob contains a dynamic part if it contains an unescaped "*" or
"{" character.
@param string $glob The glob to test.
@return bool Returns `true` if the glob contains a dynamic part and
`false` otherwise. | [
"Returns",
"whether",
"the",
"glob",
"contains",
"a",
"dynamic",
"part",
"."
] | train | https://github.com/webmozart/glob/blob/8da14867b709e8776d9f6272faaf844aefc695e3/src/Glob.php#L528-L531 |
webmozart/glob | src/Iterator/RecursiveDirectoryIterator.php | RecursiveDirectoryIterator.key | public function key()
{
$key = parent::key();
if ($this->normalizeKey) {
$key = str_replace('\\', '/', $key);
}
return $key;
} | php | public function key()
{
$key = parent::key();
if ($this->normalizeKey) {
$key = str_replace('\\', '/', $key);
}
return $key;
} | [
"public",
"function",
"key",
"(",
")",
"{",
"$",
"key",
"=",
"parent",
"::",
"key",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"normalizeKey",
")",
"{",
"$",
"key",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"$",
"key",
")",
";",
"}"... | {@inheritdoc} | [
"{"
] | train | https://github.com/webmozart/glob/blob/8da14867b709e8776d9f6272faaf844aefc695e3/src/Iterator/RecursiveDirectoryIterator.php#L61-L70 |
webmozart/glob | src/Iterator/RecursiveDirectoryIterator.php | RecursiveDirectoryIterator.current | public function current()
{
$current = parent::current();
if ($this->normalizeCurrent) {
$current = str_replace('\\', '/', $current);
}
return $current;
} | php | public function current()
{
$current = parent::current();
if ($this->normalizeCurrent) {
$current = str_replace('\\', '/', $current);
}
return $current;
} | [
"public",
"function",
"current",
"(",
")",
"{",
"$",
"current",
"=",
"parent",
"::",
"current",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"normalizeCurrent",
")",
"{",
"$",
"current",
"=",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"$",
"curre... | {@inheritdoc} | [
"{"
] | train | https://github.com/webmozart/glob/blob/8da14867b709e8776d9f6272faaf844aefc695e3/src/Iterator/RecursiveDirectoryIterator.php#L75-L84 |
sonata-project/SonataClassificationBundle | src/Block/Service/AbstractClassificationBlockService.php | AbstractClassificationBlockService.getFormAdminType | final protected function getFormAdminType(FormMapper $formMapper, AdminInterface $admin, $formField, $field, $fieldOptions = [], $adminOptions = [])
{
$adminOptions = array_merge([
'edit' => 'list',
'translation_domain' => 'SonataClassificationBundle',
], $adminOptions);
... | php | final protected function getFormAdminType(FormMapper $formMapper, AdminInterface $admin, $formField, $field, $fieldOptions = [], $adminOptions = [])
{
$adminOptions = array_merge([
'edit' => 'list',
'translation_domain' => 'SonataClassificationBundle',
], $adminOptions);
... | [
"final",
"protected",
"function",
"getFormAdminType",
"(",
"FormMapper",
"$",
"formMapper",
",",
"AdminInterface",
"$",
"admin",
",",
"$",
"formField",
",",
"$",
"field",
",",
"$",
"fieldOptions",
"=",
"[",
"]",
",",
"$",
"adminOptions",
"=",
"[",
"]",
")"... | @param FormMapper $formMapper
@param AdminInterface $admin
@param string $formField
@param string $field
@param array $fieldOptions
@param array $adminOptions
@return FormBuilder | [
"@param",
"FormMapper",
"$formMapper",
"@param",
"AdminInterface",
"$admin",
"@param",
"string",
"$formField",
"@param",
"string",
"$field",
"@param",
"array",
"$fieldOptions",
"@param",
"array",
"$adminOptions"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Block/Service/AbstractClassificationBlockService.php#L58-L81 |
sonata-project/SonataClassificationBundle | src/Block/Service/AbstractClassificationBlockService.php | AbstractClassificationBlockService.getContextChoices | final protected function getContextChoices()
{
$contextChoices = [];
/* @var ContextInterface $context */
foreach ($this->contextManager->findAll() as $context) {
$contextChoices[$context->getId()] = $context->getName();
}
return $contextChoices;
} | php | final protected function getContextChoices()
{
$contextChoices = [];
/* @var ContextInterface $context */
foreach ($this->contextManager->findAll() as $context) {
$contextChoices[$context->getId()] = $context->getName();
}
return $contextChoices;
} | [
"final",
"protected",
"function",
"getContextChoices",
"(",
")",
"{",
"$",
"contextChoices",
"=",
"[",
"]",
";",
"/* @var ContextInterface $context */",
"foreach",
"(",
"$",
"this",
"->",
"contextManager",
"->",
"findAll",
"(",
")",
"as",
"$",
"context",
")",
... | Returns a context choice array.
@return string[] | [
"Returns",
"a",
"context",
"choice",
"array",
"."
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Block/Service/AbstractClassificationBlockService.php#L88-L97 |
sonata-project/SonataClassificationBundle | src/Admin/TagAdmin.php | TagAdmin.configureFormFields | protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name')
->add('context')
;
if ($this->hasSubject() && $this->getSubject()->getId()) {
$formMapper->add('slug');
}
$formMapper->add('enabled', CheckboxType:... | php | protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('name')
->add('context')
;
if ($this->hasSubject() && $this->getSubject()->getId()) {
$formMapper->add('slug');
}
$formMapper->add('enabled', CheckboxType:... | [
"protected",
"function",
"configureFormFields",
"(",
"FormMapper",
"$",
"formMapper",
")",
"{",
"$",
"formMapper",
"->",
"add",
"(",
"'name'",
")",
"->",
"add",
"(",
"'context'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasSubject",
"(",
")",
"&&",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Admin/TagAdmin.php#L28-L42 |
sonata-project/SonataClassificationBundle | src/Admin/CategoryAdmin.php | CategoryAdmin.getFormBuilder | public function getFormBuilder()
{
// NEXT_MAJOR: set constraints unconditionally
if (isset($this->formOptions['cascade_validation'])) {
unset($this->formOptions['cascade_validation']);
$this->formOptions['constraints'][] = new Valid();
} else {
@trigger_e... | php | public function getFormBuilder()
{
// NEXT_MAJOR: set constraints unconditionally
if (isset($this->formOptions['cascade_validation'])) {
unset($this->formOptions['cascade_validation']);
$this->formOptions['constraints'][] = new Valid();
} else {
@trigger_e... | [
"public",
"function",
"getFormBuilder",
"(",
")",
"{",
"// NEXT_MAJOR: set constraints unconditionally",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"formOptions",
"[",
"'cascade_validation'",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"formOptions",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Admin/CategoryAdmin.php#L48-L63 |
sonata-project/SonataClassificationBundle | src/Admin/CategoryAdmin.php | CategoryAdmin.configureFormFields | protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->with('group_general', ['class' => 'col-md-6'])
->add('name')
->add('description', TextareaType::class, [
'required' => false,
])
;
i... | php | protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->with('group_general', ['class' => 'col-md-6'])
->add('name')
->add('description', TextareaType::class, [
'required' => false,
])
;
i... | [
"protected",
"function",
"configureFormFields",
"(",
"FormMapper",
"$",
"formMapper",
")",
"{",
"$",
"formMapper",
"->",
"with",
"(",
"'group_general'",
",",
"[",
"'class'",
"=>",
"'col-md-6'",
"]",
")",
"->",
"add",
"(",
"'name'",
")",
"->",
"add",
"(",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Admin/CategoryAdmin.php#L68-L120 |
sonata-project/SonataClassificationBundle | src/Block/Service/AbstractCategoriesBlockService.php | AbstractCategoriesBlockService.execute | public function execute(BlockContextInterface $blockContext, Response $response = null)
{
$category = $this->getCategory($blockContext->getSetting('categoryId'), $blockContext->getSetting('category'));
$root = $this->categoryManager->getRootCategory($blockContext->getSetting('context'));
re... | php | public function execute(BlockContextInterface $blockContext, Response $response = null)
{
$category = $this->getCategory($blockContext->getSetting('categoryId'), $blockContext->getSetting('category'));
$root = $this->categoryManager->getRootCategory($blockContext->getSetting('context'));
re... | [
"public",
"function",
"execute",
"(",
"BlockContextInterface",
"$",
"blockContext",
",",
"Response",
"$",
"response",
"=",
"null",
")",
"{",
"$",
"category",
"=",
"$",
"this",
"->",
"getCategory",
"(",
"$",
"blockContext",
"->",
"getSetting",
"(",
"'categoryId... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Block/Service/AbstractCategoriesBlockService.php#L64-L76 |
sonata-project/SonataClassificationBundle | src/Block/Service/AbstractCategoriesBlockService.php | AbstractCategoriesBlockService.load | public function load(BlockInterface $block)
{
if (is_numeric($block->getSetting('categoryId'))) {
$block->setSetting('categoryId', $this->getCategory($block->getSetting('categoryId')));
}
} | php | public function load(BlockInterface $block)
{
if (is_numeric($block->getSetting('categoryId'))) {
$block->setSetting('categoryId', $this->getCategory($block->getSetting('categoryId')));
}
} | [
"public",
"function",
"load",
"(",
"BlockInterface",
"$",
"block",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"block",
"->",
"getSetting",
"(",
"'categoryId'",
")",
")",
")",
"{",
"$",
"block",
"->",
"setSetting",
"(",
"'categoryId'",
",",
"$",
"this",... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Block/Service/AbstractCategoriesBlockService.php#L146-L151 |
sonata-project/SonataClassificationBundle | src/Block/Service/AbstractCategoriesBlockService.php | AbstractCategoriesBlockService.getBlockMetadata | public function getBlockMetadata($code = null)
{
$description = (null !== $code ? $code : $this->getName());
return new Metadata($this->getName(), $description, false, 'SonataClassificationBundle', [
'class' => 'fa fa-folder-open-o',
]);
} | php | public function getBlockMetadata($code = null)
{
$description = (null !== $code ? $code : $this->getName());
return new Metadata($this->getName(), $description, false, 'SonataClassificationBundle', [
'class' => 'fa fa-folder-open-o',
]);
} | [
"public",
"function",
"getBlockMetadata",
"(",
"$",
"code",
"=",
"null",
")",
"{",
"$",
"description",
"=",
"(",
"null",
"!==",
"$",
"code",
"?",
"$",
"code",
":",
"$",
"this",
"->",
"getName",
"(",
")",
")",
";",
"return",
"new",
"Metadata",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Block/Service/AbstractCategoriesBlockService.php#L172-L179 |
sonata-project/SonataClassificationBundle | src/Block/Service/AbstractCategoriesBlockService.php | AbstractCategoriesBlockService.getCategory | final protected function getCategory($id, $default = null)
{
if ($id instanceof CategoryInterface) {
return $id;
}
if (is_numeric($id)) {
return $this->categoryManager->find($id);
}
if ($default instanceof CategoryInterface) {
return $def... | php | final protected function getCategory($id, $default = null)
{
if ($id instanceof CategoryInterface) {
return $id;
}
if (is_numeric($id)) {
return $this->categoryManager->find($id);
}
if ($default instanceof CategoryInterface) {
return $def... | [
"final",
"protected",
"function",
"getCategory",
"(",
"$",
"id",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"id",
"instanceof",
"CategoryInterface",
")",
"{",
"return",
"$",
"id",
";",
"}",
"if",
"(",
"is_numeric",
"(",
"$",
"id",
")... | @param CategoryInterface|int $id
@param mixed $default
@return CategoryInterface | [
"@param",
"CategoryInterface|int",
"$id",
"@param",
"mixed",
"$default"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Block/Service/AbstractCategoriesBlockService.php#L187-L202 |
sonata-project/SonataClassificationBundle | src/Controller/Api/TagController.php | TagController.getTagsAction | public function getTagsAction(ParamFetcherInterface $paramFetcher)
{
$page = $paramFetcher->get('page');
$count = $paramFetcher->get('count');
/** @var PagerInterface $tagsPager */
$tagsPager = $this->tagManager->getPager($this->filterCriteria($paramFetcher), $page, $count);
... | php | public function getTagsAction(ParamFetcherInterface $paramFetcher)
{
$page = $paramFetcher->get('page');
$count = $paramFetcher->get('count');
/** @var PagerInterface $tagsPager */
$tagsPager = $this->tagManager->getPager($this->filterCriteria($paramFetcher), $page, $count);
... | [
"public",
"function",
"getTagsAction",
"(",
"ParamFetcherInterface",
"$",
"paramFetcher",
")",
"{",
"$",
"page",
"=",
"$",
"paramFetcher",
"->",
"get",
"(",
"'page'",
")",
";",
"$",
"count",
"=",
"$",
"paramFetcher",
"->",
"get",
"(",
"'count'",
")",
";",
... | Retrieves the list of tags (paginated) based on criteria.
@ApiDoc(
resource=true,
output={"class"="Sonata\DatagridBundle\Pager\PagerInterface", "groups"={"sonata_api_read"}}
)
@QueryParam(name="page", requirements="\d+", default="1", description="Page for tag list pagination")
@QueryParam(name="count", requirements="... | [
"Retrieves",
"the",
"list",
"of",
"tags",
"(",
"paginated",
")",
"based",
"on",
"criteria",
"."
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Controller/Api/TagController.php#L74-L83 |
sonata-project/SonataClassificationBundle | src/Controller/Api/TagController.php | TagController.deleteTagAction | public function deleteTagAction($id)
{
$tag = $this->getTag($id);
$this->tagManager->delete($tag);
return ['deleted' => true];
} | php | public function deleteTagAction($id)
{
$tag = $this->getTag($id);
$this->tagManager->delete($tag);
return ['deleted' => true];
} | [
"public",
"function",
"deleteTagAction",
"(",
"$",
"id",
")",
"{",
"$",
"tag",
"=",
"$",
"this",
"->",
"getTag",
"(",
"$",
"id",
")",
";",
"$",
"this",
"->",
"tagManager",
"->",
"delete",
"(",
"$",
"tag",
")",
";",
"return",
"[",
"'deleted'",
"=>",... | Deletes a tag.
@ApiDoc(
requirements={
{"name"="id", "dataType"="integer", "requirement"="\d+", "description"="tag identifier"}
},
statusCodes={
200="Returned when tag is successfully deleted",
400="Returned when an error has occurred while tag deletion",
404="Returned when unable to find tag"
}
)
@param int $id A Ta... | [
"Deletes",
"a",
"tag",
"."
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Controller/Api/TagController.php#L182-L189 |
sonata-project/SonataClassificationBundle | src/Controller/Api/TagController.php | TagController.filterCriteria | protected function filterCriteria(ParamFetcherInterface $paramFetcher)
{
$criteria = $paramFetcher->all();
unset($criteria['page'], $criteria['count']);
foreach ($criteria as $key => $value) {
if (null === $value) {
unset($criteria[$key]);
}
... | php | protected function filterCriteria(ParamFetcherInterface $paramFetcher)
{
$criteria = $paramFetcher->all();
unset($criteria['page'], $criteria['count']);
foreach ($criteria as $key => $value) {
if (null === $value) {
unset($criteria[$key]);
}
... | [
"protected",
"function",
"filterCriteria",
"(",
"ParamFetcherInterface",
"$",
"paramFetcher",
")",
"{",
"$",
"criteria",
"=",
"$",
"paramFetcher",
"->",
"all",
"(",
")",
";",
"unset",
"(",
"$",
"criteria",
"[",
"'page'",
"]",
",",
"$",
"criteria",
"[",
"'c... | Filters criteria from $paramFetcher to be compatible with the Pager criteria.
@param ParamFetcherInterface $paramFetcher
@return array The filtered criteria | [
"Filters",
"criteria",
"from",
"$paramFetcher",
"to",
"be",
"compatible",
"with",
"the",
"Pager",
"criteria",
"."
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Controller/Api/TagController.php#L198-L211 |
sonata-project/SonataClassificationBundle | src/Controller/Api/TagController.php | TagController.getTag | protected function getTag($id)
{
$tag = $this->tagManager->find($id);
if (null === $tag) {
throw new NotFoundHttpException(sprintf('Tag (%d) not found', $id));
}
return $tag;
} | php | protected function getTag($id)
{
$tag = $this->tagManager->find($id);
if (null === $tag) {
throw new NotFoundHttpException(sprintf('Tag (%d) not found', $id));
}
return $tag;
} | [
"protected",
"function",
"getTag",
"(",
"$",
"id",
")",
"{",
"$",
"tag",
"=",
"$",
"this",
"->",
"tagManager",
"->",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"null",
"===",
"$",
"tag",
")",
"{",
"throw",
"new",
"NotFoundHttpException",
"(",
"sp... | Retrieves tag with id $id or throws an exception if it doesn't exist.
@param int $id A Tag identifier
@throws NotFoundHttpException
@return TagInterface | [
"Retrieves",
"tag",
"with",
"id",
"$id",
"or",
"throws",
"an",
"exception",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Controller/Api/TagController.php#L222-L231 |
sonata-project/SonataClassificationBundle | src/Controller/Api/TagController.php | TagController.handleWriteTag | protected function handleWriteTag($request, $id = null)
{
$tag = $id ? $this->getTag($id) : null;
$form = $this->formFactory->createNamed(null, 'sonata_classification_api_form_tag', $tag, [
'csrf_protection' => false,
]);
FormHelper::removeFields($request->request->all(... | php | protected function handleWriteTag($request, $id = null)
{
$tag = $id ? $this->getTag($id) : null;
$form = $this->formFactory->createNamed(null, 'sonata_classification_api_form_tag', $tag, [
'csrf_protection' => false,
]);
FormHelper::removeFields($request->request->all(... | [
"protected",
"function",
"handleWriteTag",
"(",
"$",
"request",
",",
"$",
"id",
"=",
"null",
")",
"{",
"$",
"tag",
"=",
"$",
"id",
"?",
"$",
"this",
"->",
"getTag",
"(",
"$",
"id",
")",
":",
"null",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"fo... | Write a tag, this method is used by both POST and PUT action methods.
@param Request $request Symfony request
@param int|null $id A tag identifier
@return FormInterface | [
"Write",
"a",
"tag",
"this",
"method",
"is",
"used",
"by",
"both",
"POST",
"and",
"PUT",
"action",
"methods",
"."
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Controller/Api/TagController.php#L241-L267 |
sonata-project/SonataClassificationBundle | src/Admin/ContextAwareAdmin.php | ContextAwareAdmin.getNewInstance | public function getNewInstance()
{
$instance = parent::getNewInstance();
if ($contextId = $this->getPersistentParameter('context')) {
$context = $this->contextManager->find($contextId);
if (!$context) {
/** @var ContextInterface $context */
$... | php | public function getNewInstance()
{
$instance = parent::getNewInstance();
if ($contextId = $this->getPersistentParameter('context')) {
$context = $this->contextManager->find($contextId);
if (!$context) {
/** @var ContextInterface $context */
$... | [
"public",
"function",
"getNewInstance",
"(",
")",
"{",
"$",
"instance",
"=",
"parent",
"::",
"getNewInstance",
"(",
")",
";",
"if",
"(",
"$",
"contextId",
"=",
"$",
"this",
"->",
"getPersistentParameter",
"(",
"'context'",
")",
")",
"{",
"$",
"context",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Admin/ContextAwareAdmin.php#L44-L65 |
sonata-project/SonataClassificationBundle | src/Admin/ContextAwareAdmin.php | ContextAwareAdmin.getPersistentParameters | public function getPersistentParameters()
{
$parameters = array_merge(
parent::getPersistentParameters(),
[
'context' => '',
'hide_context' => $this->hasRequest() ? (int) $this->getRequest()->get('hide_context', 0) : 0,
]
);
... | php | public function getPersistentParameters()
{
$parameters = array_merge(
parent::getPersistentParameters(),
[
'context' => '',
'hide_context' => $this->hasRequest() ? (int) $this->getRequest()->get('hide_context', 0) : 0,
]
);
... | [
"public",
"function",
"getPersistentParameters",
"(",
")",
"{",
"$",
"parameters",
"=",
"array_merge",
"(",
"parent",
"::",
"getPersistentParameters",
"(",
")",
",",
"[",
"'context'",
"=>",
"''",
",",
"'hide_context'",
"=>",
"$",
"this",
"->",
"hasRequest",
"(... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Admin/ContextAwareAdmin.php#L70-L93 |
sonata-project/SonataClassificationBundle | src/Admin/ContextAwareAdmin.php | ContextAwareAdmin.configureDatagridFilters | protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$options = [];
if (1 === $this->getPersistentParameter('hide_context')) {
$options['disabled'] = true;
}
$datagridMapper
->add('context', null, [], null, $options)
;
} | php | protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$options = [];
if (1 === $this->getPersistentParameter('hide_context')) {
$options['disabled'] = true;
}
$datagridMapper
->add('context', null, [], null, $options)
;
} | [
"protected",
"function",
"configureDatagridFilters",
"(",
"DatagridMapper",
"$",
"datagridMapper",
")",
"{",
"$",
"options",
"=",
"[",
"]",
";",
"if",
"(",
"1",
"===",
"$",
"this",
"->",
"getPersistentParameter",
"(",
"'hide_context'",
")",
")",
"{",
"$",
"o... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Admin/ContextAwareAdmin.php#L98-L109 |
sonata-project/SonataClassificationBundle | src/Controller/Api/CategoryController.php | CategoryController.getCategoriesAction | public function getCategoriesAction(ParamFetcherInterface $paramFetcher)
{
$page = $paramFetcher->get('page');
$count = $paramFetcher->get('count');
/** @var PagerInterface $categoriesPager */
$categoriesPager = $this->categoryManager->getPager($this->filterCriteria($paramFetcher), ... | php | public function getCategoriesAction(ParamFetcherInterface $paramFetcher)
{
$page = $paramFetcher->get('page');
$count = $paramFetcher->get('count');
/** @var PagerInterface $categoriesPager */
$categoriesPager = $this->categoryManager->getPager($this->filterCriteria($paramFetcher), ... | [
"public",
"function",
"getCategoriesAction",
"(",
"ParamFetcherInterface",
"$",
"paramFetcher",
")",
"{",
"$",
"page",
"=",
"$",
"paramFetcher",
"->",
"get",
"(",
"'page'",
")",
";",
"$",
"count",
"=",
"$",
"paramFetcher",
"->",
"get",
"(",
"'count'",
")",
... | Retrieves the list of categories (paginated) based on criteria.
@ApiDoc(
resource=true,
output={"class"="Sonata\DatagridBundle\Pager\PagerInterface", "groups"={"sonata_api_read"}}
)
@QueryParam(name="page", requirements="\d+", default="1", description="Page for category list pagination")
@QueryParam(name="count", req... | [
"Retrieves",
"the",
"list",
"of",
"categories",
"(",
"paginated",
")",
"based",
"on",
"criteria",
"."
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Controller/Api/CategoryController.php#L75-L84 |
sonata-project/SonataClassificationBundle | src/Controller/Api/CategoryController.php | CategoryController.deleteCategoryAction | public function deleteCategoryAction($id)
{
$category = $this->getCategory($id);
$this->categoryManager->delete($category);
return ['deleted' => true];
} | php | public function deleteCategoryAction($id)
{
$category = $this->getCategory($id);
$this->categoryManager->delete($category);
return ['deleted' => true];
} | [
"public",
"function",
"deleteCategoryAction",
"(",
"$",
"id",
")",
"{",
"$",
"category",
"=",
"$",
"this",
"->",
"getCategory",
"(",
"$",
"id",
")",
";",
"$",
"this",
"->",
"categoryManager",
"->",
"delete",
"(",
"$",
"category",
")",
";",
"return",
"[... | Deletes a category.
@ApiDoc(
requirements={
{"name"="id", "dataType"="integer", "requirement"="\d+", "description"="category identifier"}
},
statusCodes={
200="Returned when category is successfully deleted",
400="Returned when an error has occurred while category deletion",
404="Returned when unable to find category"... | [
"Deletes",
"a",
"category",
"."
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Controller/Api/CategoryController.php#L183-L190 |
sonata-project/SonataClassificationBundle | src/Controller/Api/CategoryController.php | CategoryController.getCategory | protected function getCategory($id)
{
$category = $this->categoryManager->find($id);
if (null === $category) {
throw new NotFoundHttpException(sprintf('Category (%d) not found', $id));
}
return $category;
} | php | protected function getCategory($id)
{
$category = $this->categoryManager->find($id);
if (null === $category) {
throw new NotFoundHttpException(sprintf('Category (%d) not found', $id));
}
return $category;
} | [
"protected",
"function",
"getCategory",
"(",
"$",
"id",
")",
"{",
"$",
"category",
"=",
"$",
"this",
"->",
"categoryManager",
"->",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"null",
"===",
"$",
"category",
")",
"{",
"throw",
"new",
"NotFoundHttpExce... | Retrieves category with id $id or throws an exception if it doesn't exist.
@param int $id A Category identifier
@throws NotFoundHttpException
@return CategoryInterface | [
"Retrieves",
"category",
"with",
"id",
"$id",
"or",
"throws",
"an",
"exception",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Controller/Api/CategoryController.php#L223-L232 |
sonata-project/SonataClassificationBundle | src/Controller/Api/CategoryController.php | CategoryController.handleWriteCategory | protected function handleWriteCategory($request, $id = null)
{
$category = $id ? $this->getCategory($id) : null;
$form = $this->formFactory->createNamed(null, 'sonata_classification_api_form_category', $category, [
'csrf_protection' => false,
]);
FormHelper::removeField... | php | protected function handleWriteCategory($request, $id = null)
{
$category = $id ? $this->getCategory($id) : null;
$form = $this->formFactory->createNamed(null, 'sonata_classification_api_form_category', $category, [
'csrf_protection' => false,
]);
FormHelper::removeField... | [
"protected",
"function",
"handleWriteCategory",
"(",
"$",
"request",
",",
"$",
"id",
"=",
"null",
")",
"{",
"$",
"category",
"=",
"$",
"id",
"?",
"$",
"this",
"->",
"getCategory",
"(",
"$",
"id",
")",
":",
"null",
";",
"$",
"form",
"=",
"$",
"this"... | Write a category, this method is used by both POST and PUT action methods.
@param Request $request Symfony request
@param int|null $id A category identifier
@return View|FormInterface | [
"Write",
"a",
"category",
"this",
"method",
"is",
"used",
"by",
"both",
"POST",
"and",
"PUT",
"action",
"methods",
"."
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Controller/Api/CategoryController.php#L242-L268 |
sonata-project/SonataClassificationBundle | src/DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('sonata_classification');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->root('sonata_classification');
} else {
... | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('sonata_classification');
// Keep compatibility with symfony/config < 4.2
if (!method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->root('sonata_classification');
} else {
... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
"'sonata_classification'",
")",
";",
"// Keep compatibility with symfony/config < 4.2",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"treeBuilder",
",",
"'ge... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/DependencyInjection/Configuration.php#L29-L94 |
sonata-project/SonataClassificationBundle | src/Model/Tag.php | Tag.slugify | public static function slugify($text)
{
$text = Slugify::create()->slugify($text);
if (empty($text)) {
return 'n-a';
}
return $text;
} | php | public static function slugify($text)
{
$text = Slugify::create()->slugify($text);
if (empty($text)) {
return 'n-a';
}
return $text;
} | [
"public",
"static",
"function",
"slugify",
"(",
"$",
"text",
")",
"{",
"$",
"text",
"=",
"Slugify",
"::",
"create",
"(",
")",
"->",
"slugify",
"(",
"$",
"text",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"text",
")",
")",
"{",
"return",
"'n-a'",
";"... | source : http://snipplr.com/view/22741/slugify-a-string-in-php/.
@static
@param string $text
@return mixed|string | [
"source",
":",
"http",
":",
"//",
"snipplr",
".",
"com",
"/",
"view",
"/",
"22741",
"/",
"slugify",
"-",
"a",
"-",
"string",
"-",
"in",
"-",
"php",
"/",
"."
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Model/Tag.php#L154-L163 |
sonata-project/SonataClassificationBundle | src/Block/Service/AbstractCollectionsBlockService.php | AbstractCollectionsBlockService.execute | public function execute(BlockContextInterface $blockContext, Response $response = null)
{
$collection = $this->getCollection($blockContext->getSetting('collectionId'), $blockContext->getSetting('collection'));
$collections = $this->contextManager->findBy([
'enabled' => true,
... | php | public function execute(BlockContextInterface $blockContext, Response $response = null)
{
$collection = $this->getCollection($blockContext->getSetting('collectionId'), $blockContext->getSetting('collection'));
$collections = $this->contextManager->findBy([
'enabled' => true,
... | [
"public",
"function",
"execute",
"(",
"BlockContextInterface",
"$",
"blockContext",
",",
"Response",
"$",
"response",
"=",
"null",
")",
"{",
"$",
"collection",
"=",
"$",
"this",
"->",
"getCollection",
"(",
"$",
"blockContext",
"->",
"getSetting",
"(",
"'collec... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Block/Service/AbstractCollectionsBlockService.php#L64-L79 |
sonata-project/SonataClassificationBundle | src/Block/Service/AbstractCollectionsBlockService.php | AbstractCollectionsBlockService.load | public function load(BlockInterface $block)
{
if (is_numeric($block->getSetting('collectionId'))) {
$block->setSetting('collectionId', $this->getCollection($block->getSetting('collectionId')));
}
} | php | public function load(BlockInterface $block)
{
if (is_numeric($block->getSetting('collectionId'))) {
$block->setSetting('collectionId', $this->getCollection($block->getSetting('collectionId')));
}
} | [
"public",
"function",
"load",
"(",
"BlockInterface",
"$",
"block",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"block",
"->",
"getSetting",
"(",
"'collectionId'",
")",
")",
")",
"{",
"$",
"block",
"->",
"setSetting",
"(",
"'collectionId'",
",",
"$",
"th... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Block/Service/AbstractCollectionsBlockService.php#L149-L154 |
sonata-project/SonataClassificationBundle | src/Block/Service/AbstractCollectionsBlockService.php | AbstractCollectionsBlockService.getCollection | final protected function getCollection($id, $default = null)
{
if ($id instanceof CollectionInterface) {
return $id;
}
if (is_numeric($id)) {
return $this->collectionManager->find($id);
}
if ($default instanceof CollectionInterface) {
ret... | php | final protected function getCollection($id, $default = null)
{
if ($id instanceof CollectionInterface) {
return $id;
}
if (is_numeric($id)) {
return $this->collectionManager->find($id);
}
if ($default instanceof CollectionInterface) {
ret... | [
"final",
"protected",
"function",
"getCollection",
"(",
"$",
"id",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"id",
"instanceof",
"CollectionInterface",
")",
"{",
"return",
"$",
"id",
";",
"}",
"if",
"(",
"is_numeric",
"(",
"$",
"id",
... | @param CollectionInterface|int $id
@param mixed $default
@return CollectionInterface|null | [
"@param",
"CollectionInterface|int",
"$id",
"@param",
"mixed",
"$default"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Block/Service/AbstractCollectionsBlockService.php#L190-L205 |
sonata-project/SonataClassificationBundle | src/Form/Type/CategorySelectorType.php | CategorySelectorType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
$that = $this;
if (!interface_exists(ChoiceLoaderInterface::class)) {
$resolver->setDefaults([
'context' => null,
'category' => null,
'choice_list' => static function (Options $... | php | public function configureOptions(OptionsResolver $resolver)
{
$that = $this;
if (!interface_exists(ChoiceLoaderInterface::class)) {
$resolver->setDefaults([
'context' => null,
'category' => null,
'choice_list' => static function (Options $... | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"that",
"=",
"$",
"this",
";",
"if",
"(",
"!",
"interface_exists",
"(",
"ChoiceLoaderInterface",
"::",
"class",
")",
")",
"{",
"$",
"resolver",
"->",
"setDefaul... | NEXT_MAJOR: replace usage of deprecated 'choice_list' option, when bumping requirements to SF 2.7+.
{@inheritdoc} | [
"NEXT_MAJOR",
":",
"replace",
"usage",
"of",
"deprecated",
"choice_list",
"option",
"when",
"bumping",
"requirements",
"to",
"SF",
"2",
".",
"7",
"+",
"."
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Form/Type/CategorySelectorType.php#L63-L85 |
sonata-project/SonataClassificationBundle | src/Form/Type/CategorySelectorType.php | CategorySelectorType.getChoices | public function getChoices(Options $options)
{
if (!$options['category'] instanceof CategoryInterface) {
return [];
}
if (null === $options['context']) {
$categories = $this->manager->getAllRootCategories();
} else {
$categories = $this->manager->... | php | public function getChoices(Options $options)
{
if (!$options['category'] instanceof CategoryInterface) {
return [];
}
if (null === $options['context']) {
$categories = $this->manager->getAllRootCategories();
} else {
$categories = $this->manager->... | [
"public",
"function",
"getChoices",
"(",
"Options",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"$",
"options",
"[",
"'category'",
"]",
"instanceof",
"CategoryInterface",
")",
"{",
"return",
"[",
"]",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"options",
"... | @param Options $options
@return array | [
"@param",
"Options",
"$options"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Form/Type/CategorySelectorType.php#L92-L113 |
sonata-project/SonataClassificationBundle | src/Command/FixContextCommand.php | FixContextCommand.execute | public function execute(InputInterface $input, OutputInterface $output)
{
$contextManager = $this->getContainer()->get('sonata.classification.manager.context');
$tagManager = $this->getContainer()->get('sonata.classification.manager.tag');
$collectionManager = $this->getContainer()->get('son... | php | public function execute(InputInterface $input, OutputInterface $output)
{
$contextManager = $this->getContainer()->get('sonata.classification.manager.context');
$tagManager = $this->getContainer()->get('sonata.classification.manager.tag');
$collectionManager = $this->getContainer()->get('son... | [
"public",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"contextManager",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'sonata.classification.manager.context'",
")",
";",... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Command/FixContextCommand.php#L35-L100 |
sonata-project/SonataClassificationBundle | src/Admin/ContextAdmin.php | ContextAdmin.configureFormFields | protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->ifTrue(!($this->hasSubject() && null !== $this->getSubject()->getId()))
->add('id')
->ifEnd()
->add('name')
->add('enabled', CheckboxType::class, [
'... | php | protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->ifTrue(!($this->hasSubject() && null !== $this->getSubject()->getId()))
->add('id')
->ifEnd()
->add('name')
->add('enabled', CheckboxType::class, [
'... | [
"protected",
"function",
"configureFormFields",
"(",
"FormMapper",
"$",
"formMapper",
")",
"{",
"$",
"formMapper",
"->",
"ifTrue",
"(",
"!",
"(",
"$",
"this",
"->",
"hasSubject",
"(",
")",
"&&",
"null",
"!==",
"$",
"this",
"->",
"getSubject",
"(",
")",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Admin/ContextAdmin.php#L29-L40 |
sonata-project/SonataClassificationBundle | src/Model/Category.php | Category.addChild | public function addChild(CategoryInterface $child, $nested = false)
{
$this->children[] = $child;
if ($this->getContext()) {
$child->setContext($this->getContext());
}
if (!$nested) {
$child->setParent($this, true);
}
} | php | public function addChild(CategoryInterface $child, $nested = false)
{
$this->children[] = $child;
if ($this->getContext()) {
$child->setContext($this->getContext());
}
if (!$nested) {
$child->setParent($this, true);
}
} | [
"public",
"function",
"addChild",
"(",
"CategoryInterface",
"$",
"child",
",",
"$",
"nested",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"children",
"[",
"]",
"=",
"$",
"child",
";",
"if",
"(",
"$",
"this",
"->",
"getContext",
"(",
")",
")",
"{",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/sonata-project/SonataClassificationBundle/blob/f75add739dc0f79e02933fb87aca0ea8355a1a4b/src/Model/Category.php#L228-L239 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.