_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q253400
Module.getTitle
validation
public function getTitle() { if (!is_object($this->_title)) { $this->_title = new Noun($this->_title); } return $this->_title; }
php
{ "resource": "" }
q253401
Module.getDetailsWidget
validation
public function getDetailsWidget($objectModel = null) { if (is_null($objectModel) && isset(Yii::$app->request->object)) { $objectModel = Yii::$app->request->object; } elseif (is_null($objectModel)) { $objectModel = $this->dummyModel; } $detailsSection = $this...
php
{ "resource": "" }
q253402
Module.getIsChildless
validation
public function getIsChildless() { if (empty($this->collectorItem) || empty($this->collectorItem->children)) { return true; } return false; }
php
{ "resource": "" }
q253403
Module.getForm
validation
public function getForm($primaryModel = false, $settings = []) { if (!$primaryModel) { return false; } $formSegments = [$this->getFormSegment($primaryModel, $settings)]; $config = ['class' => $this->formGeneratorClass, 'models' => $primaryModel->collectModels(), 'items' =...
php
{ "resource": "" }
q253404
Module.getFormSegment
validation
public function getFormSegment($primaryModel = null, $settings = []) { if (empty($primaryModel)) { return false; } return $primaryModel->form($settings); }
php
{ "resource": "" }
q253405
Schema.createAuthorityTable
validation
private function createAuthorityTable() { //Drop the authority table if exists, create if doesn't $this->database->query("DROP TABLE IF EXISTS `?authority`;"); $this->database->query( "CREATE TABLE IF NOT EXISTS `?authority` ( `authority_id` bigint(20) NOT NULL AUTO_...
php
{ "resource": "" }
q253406
Schema.createAuthorityPermissionsTable
validation
private function createAuthorityPermissionsTable() { //Drop the authority table if exists, create if doesn't $this->database->query("DROP TABLE IF EXISTS `?authority_permissions`;"); $this->database->query( "CREATE TABLE IF NOT EXISTS `?authority_permissions` ( `auth...
php
{ "resource": "" }
q253407
Schema.createMenutable
validation
private function createMenutable() { //Drop the menu table if it already exists; $this->database->query("DROP TABLE IF EXISTS `?menu`;"); $this->database->query( "CREATE TABLE IF NOT EXISTS `?menu` ( `menu_id` int(11) NOT NULL AUTO_INCREMENT, `menu_pa...
php
{ "resource": "" }
q253408
Schema.createMenuGroupTable
validation
private function createMenuGroupTable() { $this->database->query("DROP TABLE IF EXISTS `?menu_group`;"); $this->database->query( "CREATE TABLE IF NOT EXISTS `?menu_group` ( `menu_group_id` int(11) NOT NULL AUTO_INCREMENT, `menu_group_title` varchar(45) NOT NU...
php
{ "resource": "" }
q253409
Schema.createPropertyValuesProxyTable
validation
public function createPropertyValuesProxyTable($group, $dropExisting = true) { $group = strtolower($group); if (!empty($group)) : $this->database->query("DROP TABLE IF EXISTS `?{$group}_property_values`;"); $this->database->query( "CREATE TABLE IF NOT EXISTS `?{$...
php
{ "resource": "" }
q253410
Schema.createPropertyValuesTable
validation
private function createPropertyValuesTable() { $this->database->query("DROP TABLE IF EXISTS `?property_values`;"); $this->database->query( "CREATE TABLE IF NOT EXISTS `?property_values` ( `value_id` mediumint(11) NOT NULL AUTO_INCREMENT, `value_data` t...
php
{ "resource": "" }
q253411
Schema.createTables
validation
public function createTables(Database $database) { $this->database = $database; $this->database->startTransaction(); $this->createAuthorityTable(); $this->createAuthorityPermissionsTable(); $this->createMenutable(); $this->createMenuGroupTable(); $this->creat...
php
{ "resource": "" }
q253412
Definition.getDefaultForClass
validation
public static function getDefaultForClass($class, array $params = array()) { $reflectionClass = new ReflectionClass($class); if (!$reflectionClass->isInstantiable()) { throw new NotInstantiableException("Class $class is not instantiable"); } $factory = new static([$reflectionClass, 'newInstance'], "$class...
php
{ "resource": "" }
q253413
Definition.getDefaultForCallable
validation
public static function getDefaultForCallable($callable, array $params = array()) { if ($callable instanceof Closure) { $factory = new static($callable, 'closure'); $factory->addOptionalClassArgument('$container', 'Autarky\Container\ContainerInterface'); return $factory->getFactory($params); } return st...
php
{ "resource": "" }
q253414
Definition.addReflectionArguments
validation
protected static function addReflectionArguments(Definition $factory, ReflectionFunctionAbstract $reflectionFunction = null) { if (!$reflectionFunction) { $callable = $factory->getCallable(); if (is_array($callable)) { $reflectionFunction = new ReflectionMethod($callable[0], $callable[1]); } else { ...
php
{ "resource": "" }
q253415
Definition.addScalarArgument
validation
public function addScalarArgument($name, $type, $required = true, $default = null) { return $this->addArgument(new ScalarArgument($this->argumentPosition++, $name, $type, $required, $default)); }
php
{ "resource": "" }
q253416
Definition.addOptionalScalarArgument
validation
public function addOptionalScalarArgument($name, $type, $default) { return $this->addArgument(new ScalarArgument($this->argumentPosition++, $name, $type, false, $default)); }
php
{ "resource": "" }
q253417
Definition.addClassArgument
validation
public function addClassArgument($name, $class, $required = true) { return $this->addArgument(new ClassArgument($this->argumentPosition++, $name, $class, $required)); }
php
{ "resource": "" }
q253418
Definition.addArgument
validation
public function addArgument(ArgumentInterface $argument) { $this->argumentPositions[$argument->getPosition()] = $argument; $this->argumentNames[$argument->getName()] = $argument; if ($argument->isClass()) { $this->argumentClasses[$argument->getClass()] = $argument; } return $argument; }
php
{ "resource": "" }
q253419
User.getIndividual
validation
public function getIndividual() { if (!isset($this->_individual) && !empty($this->object_individual_id)) { $this->_individual = false; $individualType = Yii::$app->collectors['types']->getOne('Individual'); if (!empty($individualType->object)) { $individua...
php
{ "resource": "" }
q253420
User.getPhotoEmail
validation
public function getPhotoEmail() { if (!empty($this->email) && substr($this->email, -6) !== ".local") { return $this->email; } return false; }
php
{ "resource": "" }
q253421
Relationship.getTaxonomyPackage
validation
public function getTaxonomyPackage() { if (empty($this->taxonomy)) { return false; } $taxonomySettings = $this->taxonomy; if (!is_array($taxonomySettings)) { $taxonomySettings = ['id' => $taxonomySettings]; } $taxonomy = Yii::$app->collectors['...
php
{ "resource": "" }
q253422
Relationship.getPrimaryObject
validation
public function getPrimaryObject($primaryObject, $relatedObject, $role) { if (!$this->handlePrimary) { return false; } if ($role === 'child') { $primaryField = 'primary_child'; if (!$relatedObject->objectType->getPrimaryAsChild($this->parent)) { ...
php
{ "resource": "" }
q253423
Relationship.getPrimaryChild
validation
public function getPrimaryChild($parentObject) { if (!$this->handlePrimary) { return false; } if (!$this->child->getPrimaryAsChild($this->parent)) { return false; } $key = json_encode([__FUNCTION__, $this->systemId, $parentObject->primaryKey]); ...
php
{ "resource": "" }
q253424
Relationship.getOne
validation
public static function getOne(Item $parent, Item $child, $options = []) { $key = md5($parent->systemId . "." . $child->systemId); if (isset(self::$_relationships[$key])) { self::$_relationships[$key]->mergeOptions($options); } else { self::$_relationships[$key] = new ...
php
{ "resource": "" }
q253425
Relationship.getById
validation
public static function getById($relationshipId) { $key = md5($relationshipId); if (isset(self::$_relationships[$key])) { return self::$_relationships[$key]; } return false; }
php
{ "resource": "" }
q253426
Relationship.getNiceId
validation
public function getNiceId($queryRole) { $roleType = $this->roleType($queryRole); if (empty($roleType)) { return false; } return implode(':', [$this->role($queryRole), $roleType->systemId]); }
php
{ "resource": "" }
q253427
Relationship.getCompanionNiceId
validation
public function getCompanionNiceId($queryRole) { $companionRoleType = $this->companionRoleType($queryRole); if (empty($companionRoleType)) { return false; } return implode(':', [$this->companionRole($queryRole), $companionRoleType->systemId]); }
php
{ "resource": "" }
q253428
Relationship.setDefaultOptions
validation
public function setDefaultOptions() { foreach ($this->_defaultOptions as $k => $v) { if (!array_key_exists($k, $this->_options)) { $this->_options[$k] = $v; } } return true; }
php
{ "resource": "" }
q253429
Relationship.getRelatedObject
validation
public function getRelatedObject($baseObject, $baseRole, $primaryRelation = null) { $companionRole = $this->companionRole($baseRole); $companionType = $this->companionRoleType($baseRole); $companionModel = $companionType->primaryModel; if (!isset($primaryRelation) || is_array($primar...
php
{ "resource": "" }
q253430
Relationship.getPrimaryRelation
validation
public function getPrimaryRelation($baseObject, $baseRole, $relationOptions = []) { $companionRole = $this->companionRole($baseRole); $companionType = $this->companionRoleType($baseRole); $companionModel = $companionType->primaryModel; if (!isset($relationOptions['order'])) { ...
php
{ "resource": "" }
q253431
Relationship.getActive
validation
public function getActive() { return (isset($this->_child) and $this->_child->active) and (isset($this->_parent) and $this->_parent->active); }
php
{ "resource": "" }
q253432
UnresolveableArgumentException.buildMessage
validation
protected function buildMessage() { $className = $this->getClassName(); $methodName = $this->getMethodName(); $functionName = $this->getFunctionName(); if ($className !== null && $methodName !== null) { $callable = $className . '::' . $methodName;; } else { ...
php
{ "resource": "" }
q253433
ProfilingCacheDecorator.doSave
validation
protected function doSave($id, $data, $lifeTime = 0) { return $this->delegate->doSave($id, $data, $lifeTime); }
php
{ "resource": "" }
q253434
ExceptionListener.onKernelException
validation
public function onKernelException(GetResponseForExceptionEvent $event) { $exception = $event->getException(); if ($exception instanceof AuthenticationCredentialsNotFoundException) { return new RedirectResponse("/login"); } $message = $exception->getMessage(); if ...
php
{ "resource": "" }
q253435
Instantiator.instantiate
validation
public function instantiate($className, array $data = []) { $refl = new \ReflectionClass($className); $instanceArgs = []; if ($data) { $instanceArgs = $this->extractArguments($refl->getConstructor()->getParameters(), $data); } return $refl->newInstanceArgs($ins...
php
{ "resource": "" }
q253436
Instantiator.extractArguments
validation
protected function extractArguments(array $arguments, array $data) { $instanceArgs = []; foreach ($arguments as $arg) { if (array_key_exists($arg->getName(), $data)) { $instanceArgs[] = $data[$arg->getName()]; } else { $instanceArgs[] = null; ...
php
{ "resource": "" }
q253437
Url.current
validation
public static function current() { if (defined('PHPUNIT_RUNNING')) { return 'http://localhost'; } $protocol = 'http://'; if (!empty($_SERVER['HTTPS']) || (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')) { ...
php
{ "resource": "" }
q253438
JsonTools.toBlock
validation
public static function toBlock(Serializer $serializer, $json) { if (empty($json)) { return null; } $contentArray = json_decode($json, true); if (!array_key_exists("type", $contentArray)) { return null; } $className = BlockFactory::getBlockCla...
php
{ "resource": "" }
q253439
JsonTools.toJson
validation
public static function toJson(Serializer $serializer, \RedKiteCms\Content\Block\BaseBlock $block) { return $serializer->serialize($block, 'json'); }
php
{ "resource": "" }
q253440
JsonTools.join
validation
public static function join($json1, $json2) { return array_merge(self::jsonDecode($json1), self::jsonDecode($json2)); }
php
{ "resource": "" }
q253441
Map.getData
validation
public function getData($object) { if (!$this->validateObject($object)) { throw new InvalidArgumentException( "Given object isn't instance of {$this->localName}" ); } $reflection = new ReflectionObject($object); $data = []; foreac...
php
{ "resource": "" }
q253442
ElFinderMediaController.mediaAction
validation
public function mediaAction(Request $request, Application $app) { $options = array( "connector" => $app["red_kite_cms.elfinder_media_connector"], ); return parent::show($options); }
php
{ "resource": "" }
q253443
GuzzleResponseFactory.create
validation
public function create(int $status = 200, array $headers = [], $body = null) : ResponseInterface { return new Response($status, $headers, $body); }
php
{ "resource": "" }
q253444
RoleEventHandler.subscribe
validation
public function subscribe($events) { $events->listen('Neonbug\\Common\\Events\\AdminAddEditPrepareField', function($event) { if ($event->field['type'] != 'user_admin::add_fields.role') return; $roles = \Neonbug\Common\Models\Role::all(); $roles_by_key = []; foreach ($roles as $role) { ...
php
{ "resource": "" }
q253445
EmojiModifier.makeEmojiAccessible
validation
public function makeEmojiAccessible($text) { return preg_replace_callback( $this->search, function ($matches) { $desc = $this->emoji[$this->utf8ToUnicode($matches[0])]; return sprintf($this->output, $desc, $matches[0]); }, $text...
php
{ "resource": "" }
q253446
HTTPCachedResponseFactory.generate
validation
public function generate($date='global', Response $response=null) { if (!$response) $response = new Response; if ($this->maxAge) $response->setMaxAge ($this->maxAge); if ($this->sharedMaxAge) $response->setSharedMaxAge ($this->sharedMaxAge); if ($date instanceof \DateTime) { ...
php
{ "resource": "" }
q253447
PaginationFactoryTrait.createPagination
validation
public function createPagination($currentPage, $total, $perPage = null, $baseUrl = null, $neighbours = null) { if (isset($this->container) && $this->container instanceof \League\Container\ContainerInterface) { return $this->getContainer()->get('Laasti\Pagination\Pagination', [$currentPage, $tota...
php
{ "resource": "" }
q253448
Slot.refresh
validation
public function refresh() { if (null === $this->options || null === $this->sourceDir) { return; } $this->render($this->sourceDir, $this->options, $this->username); }
php
{ "resource": "" }
q253449
SingleSection.getSingleWidget
validation
public function getSingleWidget() { if (is_null($this->_singleWidget)) { $this->_singleWidget = false; $widgets = $this->collectorItem->getAll(); if (!empty($widgets)) { $widget = array_shift($widgets); $this->_singleWidget = Yii::$app->col...
php
{ "resource": "" }
q253450
ProcessOrders.getAccSys
validation
private function getAccSys($assetTypeCode) { $req = new \Praxigento\Accounting\Api\Service\Account\Get\Request(); $req->setIsSystem(TRUE); $req->setAssetTypeCode($assetTypeCode); $resp = $this->servAccount->exec($req); $result = $resp->getId(); return $result; }
php
{ "resource": "" }
q253451
ProcessOrders.saveTransLogs
validation
private function saveTransLogs($orders, $transIds) { /* re-map orders from with saleId key */ $bySaleId = []; foreach ($orders as $custId => $order) { $saleId = $order[QGetOrders::A_SALE_ID]; $bySaleId[$saleId] = $order; } foreach ($transIds as $tranId...
php
{ "resource": "" }
q253452
AbstractCompositeView.addSnippet
validation
public function addSnippet(string $snptName): void { $this->snippets[$snptName] = ViewFactory::createSnippet($snptName); }
php
{ "resource": "" }
q253453
AbstractCompositeView.getSnippet
validation
public function getSnippet(string $snptName = '') { if (empty($snptName)) { return $this->snippets; } else { return isset($this->snippets[$snptName]) ? $this->snippets[$snptName] : null; } }
php
{ "resource": "" }
q253454
App.getMiddleware
validation
public function getMiddleware($name, $arguments = null) { if ($this->existsMiddleware($name)) { return $this->middlewares[$name](); } return false; }
php
{ "resource": "" }
q253455
App.run
validation
public function run($route) { if (!is_array($route)) { $this->makeResponse($route); } // Se separa la vista por ".", si es que la vista esta en subcarpetas // NOTA: En ForeverPHP los niveles de directorios se separan por "." $viewSegments = explode('.', $route['view'...
php
{ "resource": "" }
q253456
ConfigurationCompiler.compileConfiguration
validation
protected function compileConfiguration(Traversable $source, string $target, CompilerContext $context) { $compiler = new StandardCompiler(); $compiler->setSource($source); $compiler->setTarget($target); $compiler->compile(); }
php
{ "resource": "" }
q253457
ConfigurationCompiler.yieldConfigurationFiles
validation
protected function yieldConfigurationFiles(CompilerContext $context): Generator{ $configDirs = []; foreach($context->getProjectSearchPaths(SearchPathAttribute::SEARCH_PATH_USER_CONFIG) as $configDir) { $configDirs[] = (string)$configDir; } $pattern = $this->info[ static::INF...
php
{ "resource": "" }
q253458
Mistake.register
validation
private function register() { // Don't display any errors since we want this error handler to handle all // errors. Error messages sent to the client will be serialized. ini_set('display_errors', false); // In development however it is beneficiary to display errors. if ($thi...
php
{ "resource": "" }
q253459
Mistake.shutdownHandler
validation
public function shutdownHandler() { $error = error_get_last(); if ($error && $error['type'] & $this->fatalErrors) { $this->errorHandler( $error['type'], $error['message'], $error['file'], $error['line'] ); ...
php
{ "resource": "" }
q253460
Mistake.errorHandler
validation
public function errorHandler($errno, $errstr, $errfile, $errline, array $errcontext = []) { $codes = array( 256 => 'E_USER_ERROR', 512 => 'E_USER_WARNING', 1024 => 'E_USER_NOTICE', 2048 => 'E_STRICT', 4096 => 'E_RECOVERABLE_ERROR', ...
php
{ "resource": "" }
q253461
Mistake.exceptionHandler
validation
public function exceptionHandler($exception) { // Try and get the latest request, or a new request $request = (isset($this->container['latestRequest']) ? $this->container['latestRequest'] : $this->container['request']); // Try and get the latest response, or a ne...
php
{ "resource": "" }
q253462
Mistake.logException
validation
private function logException(Exception $exception) { // Check if the error message should be logged or not if (in_array($exception->getStatusCode(), $this->doNotLog)) { return; } // Prepare log message $message = sprintf( 'Uncaught exception of type ...
php
{ "resource": "" }
q253463
Mistake.prepareErrorBody
validation
private function prepareErrorBody(Exception $exception) { // Prepare body $body = [ 'errors' => [] ]; // Set HTTP status code if (!empty($statusCode = $exception->getStatusCode())) { $body['errors']['statusCode'] = $statusCode; } // Check if a descriptio...
php
{ "resource": "" }
q253464
BuilderSearch.get
validation
public function get($keys=[]) { $this->buildIfNotBuilded(); $keys = $keys == [] ? $this->keys() : $keys; if (!$keys) { return $this->builder->get(); } return $this->builder->withColumns($keys)->get($keys); }
php
{ "resource": "" }
q253465
BuilderSearch.paginate
validation
public function paginate($keys=[], $perPage = null) { $this->buildIfNotBuilded(); $keys = $keys == [] ? $this->keys() : $keys; if (!$keys) { return $this->builder->paginate($perPage); } return $this->builder->withColumns($keys)->paginate($perPage); }
php
{ "resource": "" }
q253466
AbstractAPI.retryMiddleware
validation
protected function retryMiddleware() { return Middleware::retry(function ( $retries, RequestInterface $request, ResponseInterface $response = null ...
php
{ "resource": "" }
q253467
SimpleDOM.insertBeforeSelf
validation
public function insertBeforeSelf(SimpleXMLElement $new) { $tmp = dom_import_simplexml($this); $node = $tmp->ownerDocument->importNode(dom_import_simplexml($new), true); return simplexml_import_dom($this->insertNode($tmp, $node, 'before'), get_class($this)); }
php
{ "resource": "" }
q253468
SimpleDOM.deleteSelf
validation
public function deleteSelf() { $tmp = dom_import_simplexml($this); if ($tmp->isSameNode($tmp->ownerDocument->documentElement)) { throw new BadMethodCallException('deleteSelf() cannot be used to delete the root node'); } $tmp->parentNode->removeChild($tmp); }
php
{ "resource": "" }
q253469
SimpleDOM.removeSelf
validation
public function removeSelf() { $tmp = dom_import_simplexml($this); if ($tmp->isSameNode($tmp->ownerDocument->documentElement)) { throw new BadMethodCallException('removeSelf() cannot be used to remove the root node'); } $node = $tmp->parentNode->removeChild($tmp); ...
php
{ "resource": "" }
q253470
SimpleDOM.replaceSelf
validation
public function replaceSelf(SimpleXMLElement $new) { $old = dom_import_simplexml($this); $new = $old->ownerDocument->importNode(dom_import_simplexml($new), true); $node = $old->parentNode->replaceChild($new, $old); return simplexml_import_dom($node, get_class($this)); }
php
{ "resource": "" }
q253471
SimpleDOM.deleteNodes
validation
public function deleteNodes($xpath) { if (!is_string($xpath)) { throw new InvalidArgumentException( 'Argument 1 passed to deleteNodes() must be a string, ' . gettype($xpath) . ' given' ); } $nodes = $this->_xpath($xpath); if (isset($nodes[0])...
php
{ "resource": "" }
q253472
SimpleDOM.copyAttributesFrom
validation
public function copyAttributesFrom(SimpleXMLElement $src, $overwrite = true) { $dom = dom_import_simplexml($this); foreach (dom_import_simplexml($src)->attributes as $attr) { if ($overwrite || !$dom->hasAttributeNS($attr->namespaceURI, $attr->nodeName) ) { ...
php
{ "resource": "" }
q253473
SimpleDOM.cloneChildrenFrom
validation
public function cloneChildrenFrom(SimpleXMLElement $src, $deep = true) { $src = dom_import_simplexml($src); $dst = dom_import_simplexml($this); $doc = $dst->ownerDocument; $fragment = $doc->createDocumentFragment(); foreach ($src->childNodes as $child) { $fragmen...
php
{ "resource": "" }
q253474
SimpleDOM.moveTo
validation
public function moveTo(SimpleXMLElement $dst) { return simplexml_import_dom(dom_import_simplexml($dst), get_class($this))->appendChild($this->removeSelf()); }
php
{ "resource": "" }
q253475
SimpleDOM.firstOf
validation
public function firstOf($xpath) { $nodes = $this->xpath($xpath); return (isset($nodes[0])) ? $nodes[0] : null; }
php
{ "resource": "" }
q253476
SimpleDOM.insertXML
validation
public function insertXML($xml, $mode = 'append') { $tmp = dom_import_simplexml($this); $fragment = $tmp->ownerDocument->createDocumentFragment(); /** * Disable error reporting */ $use_errors = libxml_use_internal_errors(true); if (!$fragment->appendXML($x...
php
{ "resource": "" }
q253477
SimpleDOM.insertPI
validation
public function insertPI($target, $data = null, $mode = 'before') { $tmp = dom_import_simplexml($this); $doc = $tmp->ownerDocument; if (isset($data)) { if (is_array($data)) { $str = ''; foreach ($data as $k => $v) { $str .= $k ...
php
{ "resource": "" }
q253478
SimpleDOM.setAttributes
validation
public function setAttributes(array $attr, $ns = null) { $dom = dom_import_simplexml($this); foreach ($attr as $k => $v) { $dom->setAttributeNS($ns, $k, $v); } return $this; }
php
{ "resource": "" }
q253479
SimpleDOM.innerHTML
validation
public function innerHTML() { $dom = dom_import_simplexml($this); $doc = $dom->ownerDocument; $html = ''; foreach ($dom->childNodes as $child) { $html .= ($child instanceof DOMText) ? $child->textContent : $doc->saveXML($child); } return $html; }
php
{ "resource": "" }
q253480
SimpleDOM.innerXML
validation
public function innerXML() { $xml = $this->outerXML(); $pos = 1 + strpos($xml, '>'); $len = strrpos($xml, '<') - $pos; return substr($xml, $pos, $len); }
php
{ "resource": "" }
q253481
SimpleDOM.getElementsByClassName
validation
public function getElementsByClassName($class) { if (strpos($class, '"') !== false || strpos($class, "'") !== false ) { return array(); } $xpath = './/*[contains(concat(" ", @class, " "), " ' . htmlspecialchars($class) . ' ")]'; return $this->xpath($x...
php
{ "resource": "" }
q253482
SimpleDOM.addClass
validation
public function addClass($class) { if (!$this->hasClass($class)) { $current = (string)$this['class']; if ($current !== '' && substr($current, -1) !== ' ' ) { $this['class'] .= ' '; } $this['class'] .= $class; ...
php
{ "resource": "" }
q253483
SimpleDOM.asPrettyXML
validation
public function asPrettyXML($filepath = null) { /** * Dump and reload this node's XML with LIBXML_NOBLANKS. * * Also import it as a DOMDocument because some older of XSLTProcessor rejected * SimpleXMLElement as a source. */ $xml = dom_import_simplexml( ...
php
{ "resource": "" }
q253484
SimpleDOM.XSLT
validation
public function XSLT($filepath, $use_xslcache = true) { if ($use_xslcache && extension_loaded('xslcache')) { $xslt = new XSLTCache; $xslt->importStylesheet($filepath); } else { $xsl = new DOMDocument; $xsl->load($filepath); $xslt = new XSL...
php
{ "resource": "" }
q253485
SimpleDOM.sortedXPath
validation
public function sortedXPath($xpath) { $nodes = $this->xpath($xpath); $args = func_get_args(); $args[0] =& $nodes; call_user_func_array(array(get_class($this), 'sort'), $args); return $nodes; }
php
{ "resource": "" }
q253486
SimpleDOM.sortChildren
validation
public function sortChildren() { $nodes = $this->removeNodes('*'); $args = func_get_args(); array_unshift($args, null); $args[0] =& $nodes; call_user_func_array(array(get_class($this), 'sort'), $args); foreach ($nodes as $node) { $this->appendChild($nod...
php
{ "resource": "" }
q253487
SimpleDOM.sort
validation
static public function sort(array &$nodes) { $args = func_get_args(); unset($args[0]); $sort = array(); $tmp = array(); foreach ($args as $k => $arg) { if (is_string($arg)) { $tmp[$k] = array(); if (preg_match('#^@?[a-z_0-9]+$#Di...
php
{ "resource": "" }
q253488
SimpleDOM.getNodeByName
validation
public function getNodeByName($strXpath, $strName) { $varResult = $this->xpath($strXpath . "[@name='" . $strName . "']"); if ($varResult !== false) { // Get first element return reset($varResult); } else { return false; } }
php
{ "resource": "" }
q253489
SimpleDOM.xpathSingle
validation
public function xpathSingle($strXpathQuery) { $arrResults = $this->xpath($strXpathQuery); if ($arrResults === false) { //throw new Exception('xpathElement returned an unspecified error on '.$strXpathQuery); return null; } if (is_array($arrResults) && count($...
php
{ "resource": "" }
q253490
SimpleDOM.xpathByAttribute
validation
public function xpathByAttribute($strXpathQuery, $strIndexAttribute = 'name') { $arrOut = array(); $objResult = $this->xpath($strXpathQuery); foreach ($objResult as $intIndex => $objNode) { $strIndex = (string)$objNode->attributes()->$strIndexAttribute; $arrOut[$str...
php
{ "resource": "" }
q253491
SimpleDOM.getAttribute
validation
public function getAttribute($strName, $varDefault = false) { if (isset($this->attributes()->$strName) && (((string)$this->attributes()->$strName) !== '')) { return (string)$this->attributes()->$strName; } else { return $varDefault; } }
php
{ "resource": "" }
q253492
SimpleDOM.getNode
validation
public function getNode($strName, $varDefault = false) { $varResult = $this->$strName; if (($varResult !== false) && ((string)$varResult !== '')) { // Get first element return (string)$varResult; } else { return $varDefault; } }
php
{ "resource": "" }
q253493
SimpleDOM.addMissing
validation
public function addMissing($objStructure, &$objElement) { // Set missing attributes foreach ($objStructure->attributes() as $strName => $objAttribute) { if (!isset($objElement->attributes()->$strName)) { $objElement->addAttribute($strName, (string)$objAttribute); ...
php
{ "resource": "" }
q253494
SimpleDOM.dump
validation
public function dump() { $dom = new DOMDocument('1.0'); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $dom->loadXML($this->asXML()); return $dom->saveXML(); }
php
{ "resource": "" }
q253495
CompilerContext.addCompiler
validation
public function addCompiler($compiler) { if($compiler instanceof CompilerFactoryInterface || $compiler instanceof CompilerInterface) { $this->compilers[] = $compiler; $this->orderedCompilers = NULL; } else throw new CompilerException("Can only add objects that impleme...
php
{ "resource": "" }
q253496
CompilerContext.removeCompiler
validation
public function removeCompiler($compiler) { if(($idx = array_search($compiler, $this->compilers)) !== false) { unset($this->compilers[$idx]); $this->orderedCompilers = NULL; } }
php
{ "resource": "" }
q253497
CompilerContext.getSkylineAppDirectory
validation
public function getSkylineAppDirectory(string $dirName) { $name = CC::get([], $dirName); if($name) { return $this->getSkylineAppDataDirectory() . "/$name"; } return NULL; }
php
{ "resource": "" }
q253498
CompilerContext.getProjectSearchPaths
validation
public function getProjectSearchPaths(string $name): array { $srcPaths = $this->getProject()->getAttribute(AttributeInterface::SEARCH_PATHS_ATTR_NAME); if($srcPaths instanceof SearchPathCollection) { return $srcPaths->getSearchPaths($name) ?? []; } return []; }
php
{ "resource": "" }
q253499
CompilerContext.getOrganizedCompilers
validation
public function getOrganizedCompilers() { if(NULL === $this->orderedCompilers) { $depCollection = new DependencyCollection(false); $depCollection->setAcceptsDuplicates(false); foreach($this->compilers as $compiler) { if($compiler instanceof CompilerInterface)...
php
{ "resource": "" }