_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q28800 | EntityRelation.getTargetDefinition | train | public function getTargetDefinition() {
if($this->targetDefinition)
return $this->targetDefinition;
if(isset($this->params['entities']))
$entityClass = $this->params['entities'][0];
else
$entityClass = $this->params['entity'];
return $this->definition->getEntityManager()->get($entityClass);
... | php | {
"resource": ""
} |
q28801 | EntityRelation.type | train | public function type() {
if($this->get('relation_type'))
return $this->get('relation_type');
elseif($this->get('poymorphic'))
throw new \Exception('Parameter relation_type must be provided for polymorphic relations.');
$rev = $this->reverse();
if($this->get('many')) {
if($rev->get('many'))
... | php | {
"resource": ""
} |
q28802 | EntityRelation.reverse | train | public function reverse() {
if($this->reverseRelation !== null)
return $this->reverseRelation;
$origEntityName = $this->entityClass;
$entityName = preg_replace('/^\\\/', '', $origEntityName);
$relationDefinition = $this->getTargetDefinition();
$name = $this->name;
$rev_relations = [];
for... | php | {
"resource": ""
} |
q28803 | EntityRelation.prepareValidator | train | public function prepareValidator(\Asgard\Validation\ValidatorInterface $validator) {
if(isset($this->params['validation'])) {
$validation = $this->params['validation'];
foreach($validation as $name=>$params) {
if(is_integer($name)) {
$name = $params;
$params = [];
}
if($name === 'r... | php | {
"resource": ""
} |
q28804 | If_.evaluate | train | protected function evaluate ()
{
$prop = $this->props;
$np = Parser::NAMELESS_PROP;
$v = isset ($prop->$np) ? $prop->$np : $prop->get ('value');
$not = $prop->not;
if (exists ($prop->matches))
return (bool)preg_match ("%$prop->matches%", $v) xor $not;
if ($prop->case) {
for... | php | {
"resource": ""
} |
q28805 | ValidationError.getValidationErrorsByName | train | public function getValidationErrorsByName($name)
{
$errors = [];
if ($this->name == $name) {
$errors[] = $this;
}
$errors = array_merge($errors, $this->getValidationErrorsByNameRecursive($name, $this->subErrors));
return $errors;
} | php | {
"resource": ""
} |
q28806 | TimetableRepository.hasAmqpTasksRunning | train | public function hasAmqpTasksRunning($timetableId, $taskTypeId = AmqpTask::AREA_PDF_GENERATION_TYPE)
{
$result = $this->getEntityManager()->getRepository('CanalTPMttBundle:AmqpTask')->findBy(
array(
'objectId' => $timetableId,
'status' => AmqpTask::LAUNCHED_STATUS,... | php | {
"resource": ""
} |
q28807 | AbstractSmartyPlugin.explode | train | protected function explode($commaSeparatedValues)
{
if (null === $commaSeparatedValues) {
return array();
}
$array = explode(',', $commaSeparatedValues);
if (array_walk(
$array,
function (&$item) {
$item = strtoupper(trim($item));
... | php | {
"resource": ""
} |
q28808 | AbstractSmartyPlugin.getNormalizedParam | train | public function getNormalizedParam($params, $name, $default = null)
{
$value = $this->getParam($params, $name, $default);
if (is_string($value)) {
$value = strtolower(trim($value));
}
return $value;
} | php | {
"resource": ""
} |
q28809 | AbstractSmartyPlugin.getParam | train | public function getParam($params, $name, $default = null)
{
if (is_array($name)) {
foreach ($name as $test) {
if (isset($params[$test])) {
return $params[$test];
}
}
} elseif (isset($params[$name])) {
return $par... | php | {
"resource": ""
} |
q28810 | StdConnection.start | train | public static function start(array $database = [], bool $new_instance = false)
{
if (!self::$instance instanceof self or $new_instance) {
self::$instance = new self($database);
}
return self::$instance;
} | php | {
"resource": ""
} |
q28811 | StdConnection.create | train | public static function create($database = [])
{
try {
$driver = isset($database['driver']) ? ucwords($database['driver']) : "";
$className = __NAMESPACE__ . "\\Engines\\" . $driver;
if (class_exists($className)) {
return new $className($database);
... | php | {
"resource": ""
} |
q28812 | StdConnection.escape | train | public function escape($e)
{
if (!isset($e)) {
return '';
}
if (is_numeric($e) and PHP_INT_MIN <= $e and $e <= PHP_INT_MAX) {
if (explode('.', $e)[0] != $e) {
return (float) $e;
}
return (int) $e;
}
return (str... | php | {
"resource": ""
} |
q28813 | StdConnection.query | train | public function query(string $q): \PDOStatement
{
try {
$_SESSION['___QUERY_DEBUG___'][] = (string) $q;
return parent::query($q);
} catch (\Exception $e) {
$message = 'Error in query: <b>' . $q . '<b/><br /><br />' . $e->getMessage();
}
} | php | {
"resource": ""
} |
q28814 | StdConnection.delete | train | public function delete(string $table, string $where, string $limit = 'LIMIT 1'): \PDOStatement
{
return $this->query("DELETE FROM $table WHERE $where $limit;");
} | php | {
"resource": ""
} |
q28815 | StdConnection.insert | train | public function insert(string $table, array $e): \PDOStatement
{
if (sizeof($e) == 0) {
trigger_error('array passed in Connection::insert(...) is empty.', E_ERROR);
}
$query = "INSERT INTO $table (";
$values = '';
foreach ($e as $campo => $v) {
$query... | php | {
"resource": ""
} |
q28816 | DecimalFormatter.getFormatter | train | public function getFormatter(Column $column)
{
$decimalDigits = $column->getDecimalDigits();
return function (Model $model, $value) use ($decimalDigits) {
return number_format($value, $decimalDigits);
};
} | php | {
"resource": ""
} |
q28817 | OpauthMemberLoginFormExtension.forgotPassword | train | public function forgotPassword($member) {
if(Config::inst()->get('OpauthMemberLoginFormExtension', 'allow_password_reset')) {
return null;
}
$identity = OpauthIdentity::get()->find('MemberID', $member->ID);
if(!$member->Password && $identity) {
$this->owner->sessionMessage(
_t(
'OpauthMemberLogi... | php | {
"resource": ""
} |
q28818 | InputBag.attribute | train | public function attribute($attribute) {
if(!is_array($attribute))
$attribute = explode('.', $attribute);
$next = array_shift($attribute);
if(count($attribute) === 0) {
if(!isset($this->attributes[$next]))
return (new static(null))->setParent($this);
else
return $this->attributes[$next];
}
i... | php | {
"resource": ""
} |
q28819 | InputBag.input | train | public function input($attribute=null) {
if($attribute)
return $this->attribute($attribute)->input();
return $this->input;
} | php | {
"resource": ""
} |
q28820 | File.getMimeType | train | public function getMimeType()
{
if (function_exists('finfo_open')) {
$finfo = finfo_open(FILEINFO_MIME);
if (!$finfo) {
throw new \RuntimeException('Failed to open finfo');
}
$actualInfo = @finfo_file($finfo, $this->getPathname());
... | php | {
"resource": ""
} |
q28821 | File.fread | train | public function fread()
{
try {
$file = $this->openFile('r');
} catch (\Exception $exc) {
throw new \RuntimeException('Unable to open file', 0, $exc);
}
$result = '';
foreach ($file as $line) {
$result .= $line;
}
return $... | php | {
"resource": ""
} |
q28822 | File.getFilenameRelativeToRoot | train | protected function getFilenameRelativeToRoot($root_path)
{
// strip path from filename
$result = ltrim(
substr($this->getPathname(), strlen($root_path)),
DIRECTORY_SEPARATOR
);
if ($result === '') {
throw new \InvalidArgumentException(
... | php | {
"resource": ""
} |
q28823 | EditableHtmlFilter.filter | train | public function filter($content, array $options = array())
{
$wrap = '<div id="content_%s_%s" class="su-content-inline su-input-html-inline-content">%s</div>';
return sprintf(
$wrap,
$this->blockProperty->getBlock()->getId(),
str_replace('.', '_', $this->blockProperty->getHierarchicalName()),
... | php | {
"resource": ""
} |
q28824 | InlineTagRendererUtils.renderBody | train | public static function renderBody(array $callable, array $context, array $blocks, $lineno = -1, $name = null)
{
if (2 !== \count($callable) || !$callable[0] instanceof Template || !\is_string($callable[1])) {
throw new BodyTagRendererException('The callable argument must be an array with Twig_Te... | php | {
"resource": ""
} |
q28825 | CalendarRepository.findCalendarByExternalCoverageIdAndApplication | train | public function findCalendarByExternalCoverageIdAndApplication($externalCoverageId, $applicationCanonicalName)
{
$qb = $this->createQueryBuilder('cal');
$qb
->addSelect('cus')
->addSelect('ne')
->addSelect('per')
->leftJoin('cal.customer', 'cus')
... | php | {
"resource": ""
} |
q28826 | Email.getPart | train | public function getPart(string $contentType)
{
if (! isset($this->parts[$contentType])) {
return null;
}
return $this->parts[$contentType];
} | php | {
"resource": ""
} |
q28827 | Email.setHtml | train | public function setHtml(string $html): self
{
return $this->addPart(Part::create($html, 'text/html'), true);
} | php | {
"resource": ""
} |
q28828 | Email.setText | train | public function setText(string $text): self
{
return $this->addPart(Part::create($text, 'text/plain'), true);
} | php | {
"resource": ""
} |
q28829 | Email.addVariableForRecipient | train | public function addVariableForRecipient(string $recipient, string $name, string $value): self
{
$this->recipientVariables[$recipient][$name] = $value;
return $this;
} | php | {
"resource": ""
} |
q28830 | Email.addVariablesForRecipient | train | public function addVariablesForRecipient(string $recipient, array $variables): self
{
$this->recipientVariables[$recipient] = $variables;
return $this;
} | php | {
"resource": ""
} |
q28831 | Email.removeVariableForRecipient | train | public function removeVariableForRecipient(string $recipient, string $name): self
{
unset($this->recipientVariables[$recipient][$name]);
return $this;
} | php | {
"resource": ""
} |
q28832 | Driver.performTokenInitialization | train | private function performTokenInitialization()
{
if (!empty($_COOKIE[$this->sessionCookieName])) {
$this->sessionToken = $_COOKIE[$this->sessionCookieName];
if (preg_match('#[a-f0-9]{40}#', $this->sessionToken)) {
return;
}
}
$this->sessio... | php | {
"resource": ""
} |
q28833 | Driver.set | train | public function set($variable, $value = null)
{
if (is_array($variable)) {
$this->userData = array_merge($this->userData, $variable);
} else if (is_object($variable)) {
$this->userData = array_merge($this->userData, (array)$variable);
} else {
if ($value =... | php | {
"resource": ""
} |
q28834 | Driver.markFlashDataForDeletion | train | private function markFlashDataForDeletion()
{
foreach ($this->userData as $variable => $value) {
if ($variable[0] == '@') {
$this->killList[] = $variable;
}
}
} | php | {
"resource": ""
} |
q28835 | Driver.killMarkedFlashData | train | private function killMarkedFlashData()
{
foreach ($this->killList as $killVariable) {
if (isset($this->userData[$killVariable])) {
unset($this->userData[$killVariable]);
}
}
} | php | {
"resource": ""
} |
q28836 | Driver.commit | train | public function commit()
{
if (empty($this->sessionToken)) return;
$this->handler->write($this->sessionToken, $this->encode($this->userData));
} | php | {
"resource": ""
} |
q28837 | PageLayout.before | train | public function before(\Asgard\Http\Controller $controller, \Asgard\Http\Request $request) {
if(!$controller->has('layout'))
$controller->set('layout', null);
if(!$controller->has('htmlLayout'))
$controller->set('htmlLayout', null);
} | php | {
"resource": ""
} |
q28838 | PageLayout.after | train | public function after(\Asgard\Http\Controller $controller, \Asgard\Http\Request $request, &$result) {
if(!is_string($result) || $controller->request->header['x-requested-with'] == 'XMLHttpRequest')
return;
if($controller->response->getHeader('Content-Type') && $controller->response->getHeader('Content-Type') != ... | php | {
"resource": ""
} |
q28839 | Response.cacheUntil | train | public function cacheUntil($expires)
{
if (!is_int($expires)) {
$expires = strtotime($expires);
}
return $this
->withHeader('Pragma', 'public')
->withHeader('Cache-Control', 'maxage='.($expires - time()))
->withHeader('Expires', gmdate('D, d M ... | php | {
"resource": ""
} |
q28840 | Response.expireCookie | train | public function expireCookie($name, $extra = '')
{
$extra = implode('; ', array_filter([ $extra, 'Expires=' . date('r', 0) ]));
return $this->withCookie($name, 'deleted', $extra);
} | php | {
"resource": ""
} |
q28841 | SitemapController.getCacheDir | train | protected function getCacheDir()
{
$cacheDir = $this->container->getParameter("kernel.cache_dir");
$cacheDir = rtrim($cacheDir, '/');
$cacheDir .= '/' . self::SITEMAP_CACHE_DIR . '/';
return $cacheDir;
} | php | {
"resource": ""
} |
q28842 | Expression.translateSimpleExpSegs | train | static function translateSimpleExpSegs (array $segments)
{
if (count ($segments) == 1) {
$seg = $segments[0];
if ($seg[0] == '#')
return sprintf ('%s->renderBlock("%s")', self::BINDER_PARAM, substr ($seg, 1));
PhpCode::evalConstant ($seg, $ok);
if ($ok) return $seg;
if (is_... | php | {
"resource": ""
} |
q28843 | Expression.translate | train | static private function translate ($expression)
{
list ($main, $op) = self::translateSimpleExpression ($expression);
$exp = $main;
if ($op == '|') {
$filters = preg_split (self::PARSE_FILTER, $expression);
if ($filters)
foreach ($filters as $filter)
$exp = self::translateFil... | php | {
"resource": ""
} |
q28844 | Expression.translateFilter | train | static private function translateFilter ($filter, $input)
{
// Filter expressions syntax: filter arg1,...argN
if (preg_match ('/^\S+\s*?\(/', $filter))
self::filterSyntaxError ($filter, "Filter arguments must not be enclosed in <kbd>()</kbd>");
list ($name, $argsStr) = str_extractSegment ($filter, ... | php | {
"resource": ""
} |
q28845 | ListCommand.guessServiceClass | train | protected function guessServiceClass($name) {
try {
$obj = $this->getContainer()->get($name);
return gettype($obj)=='object' ? get_class($obj):gettype($obj);
}
catch(\Exception $e) {} #defined = ??? / class = ???
catch(\Throwable $e) {} #defined = ??? / class = ???
} | php | {
"resource": ""
} |
q28846 | AbstractType.appendWrapper | train | protected function appendWrapper(\DOMElement $element, \DOMDocument $dom)
{
$wrapper = $dom->createElement('div');
$wrapper->setAttribute('class', 'cms-slide-wrapper');
$element->appendChild($wrapper);
return $wrapper;
} | php | {
"resource": ""
} |
q28847 | StopPointManager.initStopPoint | train | private function initStopPoint($externalCoverageId)
{
$navitiaStopPoint = $this->navitia->getStopPoint(
$externalCoverageId,
$this->stopPoint->getExternalId(),
array('depth' => 1, 'show_codes' => 'true')
);
$this->stopPoint->setTitle($navitiaStopPoint->st... | php | {
"resource": ""
} |
q28848 | StopPointManager.getStopPoint | train | public function getStopPoint($externalStopPointId, $timetable, $externalCoverageId)
{
$this->stopPoint = $this->repository->findOneBy(array(
'externalId' => $externalStopPointId,
'timetable' => $timetable->getId()
));
$this->timetable = $timetable;
if (!empty(... | php | {
"resource": ""
} |
q28849 | StopPointManager.enhanceStopPoints | train | public function enhanceStopPoints($stopPoints, $timetable)
{
$externalStopPointIds = array();
$stopPointsIndexed = array();
// extract externalStopPointIds to prepare SQL WHERE IN
foreach ($stopPoints as $stopPoint_data) {
$externalStopPointIds[] = $stopPoint_data->stop_p... | php | {
"resource": ""
} |
q28850 | MenuGenerator.generateMenus | train | public function generateMenus()
{
foreach ($this->config['roots'] as $name => $config) {
$this->output->write(sprintf(
'- <comment>%s</comment> %s ',
$name,
str_pad('.', 44 - mb_strlen($name), '.', STR_PAD_LEFT)
));
if (nul... | php | {
"resource": ""
} |
q28851 | Repository.transformDataFromRepository | train | public function transformDataFromRepository($modelData)
{
foreach ($this->columnTransforms as $columnName => $transforms) {
if ($transforms[0] !== null) {
$closure = $transforms[0];
$modelData[$columnName] = $closure($modelData);
}
}
... | php | {
"resource": ""
} |
q28852 | Repository.transformDataForRepository | train | protected function transformDataForRepository($modelData)
{
foreach ($this->columnTransforms as $columnName => $transforms) {
if ($transforms[1] !== null) {
$closure = $transforms[1];
$transformedData = $closure($modelData);
if (is_array($transfo... | php | {
"resource": ""
} |
q28853 | Repository.batchCommitUpdatesFromCollection | train | public function batchCommitUpdatesFromCollection(RepositoryCollection $collection, $propertyPairs)
{
foreach ($collection as $item) {
$item->mergeRawData($propertyPairs);
$item->save();
}
} | php | {
"resource": ""
} |
q28854 | Repository.cacheObjectData | train | final protected function cacheObjectData(Model $object)
{
$uniqueIdentifier = $object->UniqueIdentifier;
if ($uniqueIdentifier === null) {
return;
}
if (!isset($this->cachedObjectData[$uniqueIdentifier])) {
$this->cachedObjectData[$uniqueIdentifier] = $objec... | php | {
"resource": ""
} |
q28855 | Repository.deleteObjectFromCache | train | final protected function deleteObjectFromCache(Model $object)
{
$uniqueIdentifier = $object->UniqueIdentifier;
if ($uniqueIdentifier === null) {
return;
}
if (isset($this->cachedObjectData[$uniqueIdentifier])) {
unset($this->cachedObjectData[$uniqueIdentifie... | php | {
"resource": ""
} |
q28856 | Repository.fetchObjectData | train | final protected function fetchObjectData(Model $object, $uniqueIdentifier, $relationshipsToAutoHydrate = [])
{
if (!isset($this->cachedObjectData[$uniqueIdentifier])) {
$this->cachedObjectData[$uniqueIdentifier] = $this->fetchMissingObjectData(
$object,
$uniqueIde... | php | {
"resource": ""
} |
q28857 | Repository.hydrateObject | train | final public function hydrateObject(Model $object, $uniqueIdentifier, $relationshipsToAutoHydrate = [])
{
$objectData = $this->fetchObjectData($object, $uniqueIdentifier, $relationshipsToAutoHydrate);
$object->importRawData($objectData);
} | php | {
"resource": ""
} |
q28858 | Repository.saveObject | train | final public function saveObject(Model $object)
{
$this->onObjectSaved($object);
if ($object->getUniqueIdentifier() === null) {
throw new ModelException("The object could not be saved as it has no unique identifier.", $object);
}
$this->cacheObjectData($object);
} | php | {
"resource": ""
} |
q28859 | Repository.deleteObject | train | final public function deleteObject(Model $object)
{
if ($object->isNewRecord()) {
return;
}
$this->onObjectDeleted($object);
$this->deleteObjectFromCache($object);
} | php | {
"resource": ""
} |
q28860 | Style.render | train | protected function render ()
{
$prop = $this->props;
if (exists ($prop->src))
$this->context->getAssetsService ()->addStylesheet ($prop->src, $this->props->prepend);
else if ($this->hasChildren ())
$this->context->getAssetsService ()->addInlineCss (self::getRenderingOfSet ($this->getChildren (... | php | {
"resource": ""
} |
q28861 | AbstractProperties.apply | train | function apply (array $props)
{
$this->beingAssigned = $props;
foreach ($props as $k => $v)
$this->set ($k, $v);
} | php | {
"resource": ""
} |
q28862 | AbstractProperties.applyDefaults | train | function applyDefaults (array $props)
{
$this->beingAssigned = $props;
foreach ($props as $k => $v)
if (!$this->isModified ($k))
$this->set ($k, $v);
} | php | {
"resource": ""
} |
q28863 | AbstractProperties.canBeSubtag | train | function canBeSubtag ($propName)
{
if ($this->defines ($propName)) {
$type = $this->getTypeOf ($propName);
switch ($type) {
case type::content:
case type::collection:
case type::metadata:
case type::string:
case type::number:
return true;
}
}... | php | {
"resource": ""
} |
q28864 | AbstractProperties.ensurePropertyExists | train | function ensurePropertyExists ($propName)
{
if (!$this->defines ($propName)) {
throw new ComponentException(
$this->component,
sprintf ("Invalid property <kbd>%s</kbd> specified for a %s instance.", $propName, Debug::typeInfoOf ($this))
);
}
} | php | {
"resource": ""
} |
q28865 | AbstractProperties.getComputed | train | function getComputed ($propName, $default = null)
{
$v = $this->component->getComputedPropValue ($propName);
return exists ($v) ? $v : $default;
} | php | {
"resource": ""
} |
q28866 | AbstractProperties.getPropertiesOf | train | function getPropertiesOf (...$types)
{
$result = [];
$names = $this->getPropertyNames ();
if (isset($names))
foreach ($names as $name)
if (in_array ($this->getTypeOf ($name), $types))
$result[$name] = $this->get ($name);
return $result;
} | php | {
"resource": ""
} |
q28867 | AbstractProperties.isScalar | train | function isScalar ($propName)
{
$type = $this->getTypeOf ($propName);
return $type == type::bool || $type == type::id || $type == type::number ||
$type == type::string;
} | php | {
"resource": ""
} |
q28868 | AbstractProperties.set | train | function set ($propName, $value)
{
$this->ensurePropertyExists ($propName);
$this->$propName = $this->typecastPropertyValue ($propName, $value);
if ($this->isModified ($propName))
$this->onPropertyChange ($propName);
} | php | {
"resource": ""
} |
q28869 | AbstractProperties.setComponent | train | function setComponent (Component $owner)
{
$this->component = $owner;
$props = $this->getPropertiesOf (type::content);
foreach ($props as $name => $value)
if (!is_null ($value)) {
/** @var Component $c */
$c = clone $value;
$c->attachTo ($owner);
$this->$nam... | php | {
"resource": ""
} |
q28870 | AbstractProperties.typecastPropertyValue | train | function typecastPropertyValue ($name, $v)
{
if ($this->isScalar ($name) && $this->isEnum ($name))
$this->validateEnum ($name, $v);
$type = $this->getTypeOf ($name);
if ($type && !type::validate ($type, $v))
throw new ComponentException ($this->component,
sprintf (
"%s is no... | php | {
"resource": ""
} |
q28871 | AbstractProperties.validateEnum | train | protected function validateEnum ($name, $v)
{
$enum = $this->getEnumOf ($name);
if (is_null ($v) && !$this->isRequired($name))
return;
if (array_search ($v, $enum) === false) {
$list = implode ('</b>, <b>', $enum);
throw new ComponentException ($this->component,
"Invalid value fo... | php | {
"resource": ""
} |
q28872 | CViewContainer.getTemplateFile | train | public function getTemplateFile($template)
{
$paths = $this->config["path"];
$suffix = $this->config["suffix"];
foreach ($paths as $path) {
$file = $path . "/" . $template . $suffix;
if (is_file($file)) {
return $file;
}
}
... | php | {
"resource": ""
} |
q28873 | CViewContainer.addCallback | train | public function addCallback($callback, $data = [], $region = "main", $sort = 0)
{
$view = $this->di->get("view");
$view->set(["callback" => $callback], $data, $sort, "callback");
$view->setDI($this->di);
$this->views[$region][] = $view;
return $this;
} | php | {
"resource": ""
} |
q28874 | MySql.fetchMissingObjectData | train | protected function fetchMissingObjectData(Model $object, $uniqueIdentifier, $relationshipsToAutoHydrate = [])
{
$schema = $this->getRepositorySchema();
$table = $schema->schemaName;
$data = self::returnFirstRow(
"SELECT * FROM `" . $table . "` WHERE `{$schema->uniqueIdentifierCo... | php | {
"resource": ""
} |
q28875 | MySql.updateObject | train | private function updateObject(Model $object)
{
$schema = $this->reposSchema;
$changes = $object->getModelChanges();
$schemaColumns = $schema->getColumns();
$params = [];
$columns = [];
$sql = "UPDATE `{$schema->schemaName}`";
foreach ($changes as $columnNam... | php | {
"resource": ""
} |
q28876 | MySql.insertObject | train | private function insertObject(Model $object)
{
$schema = $this->reposSchema;
$changes = $object->takeChangeSnapshot();
$params = [];
$columns = [];
$sql = "INSERT INTO `{$schema->schemaName}`";
$schemaColumns = $schema->getColumns();
foreach ($changes as $... | php | {
"resource": ""
} |
q28877 | MySql.getConnection | train | public static function getConnection(StemSettings $settings)
{
$connectionHash = $settings->host . $settings->port . $settings->username . $settings->database;
if (!isset(PdoRepository::$connections[$connectionHash])) {
try {
$pdo = new \PDO(
"mysql:h... | php | {
"resource": ""
} |
q28878 | CmsController.footerAction | train | public function footerAction($locale)
{
$this->get('request_stack')->getCurrentRequest()->setLocale($locale);
return $this
->render('@EkynaCms/Cms/Fragment/footer.html.twig')
->setSharedMaxAge(3600);
} | php | {
"resource": ""
} |
q28879 | Config.setAccessToken | train | public function setAccessToken($accessToken, $accessTokenLimit = null)
{
$this->setAuthConfig('access_token', $accessToken);
if ($accessTokenLimit) {
$this->setAuthConfig('access_token_limit', $accessTokenLimit);
}
} | php | {
"resource": ""
} |
q28880 | RepositoryCollection.canBeFilteredByRepository | train | public function canBeFilteredByRepository()
{
// If the collection can't be filtered entirely by the repos, OR any of the aggregates
// can't be calculated by the repos, we can't perform the intersection (as the intersection itself
// depends critically on the rows selected).
$filte... | php | {
"resource": ""
} |
q28881 | DummyTheme.setDummyReplacements | train | private function setDummyReplacements()
{
$this->dummyReplacements = [
'DefaultTitle' => $this->getAttribute('title'),
'DefaultTheme' => $this->getAttribute('namespace'),
'DefaultOrganisation' => $this->getAttribute('organisation'),
'DefaultAuthor' => $this->getAttrib... | php | {
"resource": ""
} |
q28882 | DummyTheme.authFunctionality | train | private function authFunctionality()
{
if($this->getAttribute('activate')) {
File::deleteDirectory($this->destinationDir.'/controllers/Auth');
File::deleteDirectory($this->destinationDir.'/views/auth');
}
return $this;
} | php | {
"resource": ""
} |
q28883 | DummyTheme.moveTheme | train | public function moveTheme()
{
$this->destinationDir = base_path('themes') . '/' . $this->getAttribute('namespace');
// remove hidden directories
File::deleteDirectory($this->tmpDirectory.'/.git');
File::deleteDirectory($this->tmpDirectory.'/.idea');
$success = File::copyDir... | php | {
"resource": ""
} |
q28884 | DummyTheme.replaceDummyContent | train | private function replaceDummyContent()
{
// Replace DummyTheme string in Controllers
$this->replaceDummy($this->destinationDir . '/controllers');
// Replace DummyTheme string in views
$this->replaceDummy($this->destinationDir . '/views');
// Replace DummyTheme string in con... | php | {
"resource": ""
} |
q28885 | DummyTheme.replaceDummy | train | private function replaceDummy($directory)
{
$files = File::allFiles($directory);
foreach ($files as $file) {
$this->replaceDummyInFile($file->getPathName());
}
return $this;
} | php | {
"resource": ""
} |
q28886 | DummyTheme.replaceDummyInFile | train | private function replaceDummyInFile($filePath)
{
$fileSource = File::get($filePath);
$fileContent = str_replace(array_keys($this->dummyReplacements), array_values($this->dummyReplacements), $fileSource);
$writeFile = File::put($filePath, $fileContent);
if ($writeFile === false) {
... | php | {
"resource": ""
} |
q28887 | Obj.getConstants | train | public static function getConstants($objectOrClass): array
{
try {
$reflectionClass = self::getReflectionClass($objectOrClass);
return $reflectionClass->getConstants();
} catch (\Exception $e) {
return [];
}
} | php | {
"resource": ""
} |
q28888 | Obj.getProperties | train | public static function getProperties(
?object $object,
?string $classOverride = null,
?int $propertyType = null
): array {
$reflectionClass = self::getReflectionClass($object, $classOverride);
$properties = [];
$reflectionProperties = $reflectionClass->getProperties($... | php | {
"resource": ""
} |
q28889 | Obj.callMethod | train | public static function callMethod(
string $name,
?object $object,
array $arguments = [],
?string $classOverride = null
) {
$method = self::getReflectionMethod($name, $object, $classOverride);
$method->setAccessible(true);
if (count($arguments) > 0) {
... | php | {
"resource": ""
} |
q28890 | Obj.hasInterface | train | public static function hasInterface($objectOrClass, string $interfaceClassName): bool
{
return in_array($interfaceClassName, self::getInterfaces($objectOrClass));
} | php | {
"resource": ""
} |
q28891 | Obj.getExtends | train | public static function getExtends($objectOrClass): array
{
if (is_object($objectOrClass)) {
$objectOrClass = get_class($objectOrClass);
}
return array_values(class_parents($objectOrClass));
} | php | {
"resource": ""
} |
q28892 | Obj.hasMethod | train | public static function hasMethod(string $method, $objectOrClass): bool
{
try {
$reflectionClass = self::getReflectionClass($objectOrClass);
return $reflectionClass->hasMethod($method);
} catch (Exception $e) {
return false;
}
} | php | {
"resource": ""
} |
q28893 | Obj.getReflectionClass | train | private static function getReflectionClass($objectOrClass, $classOverride = null): ReflectionClass
{
$class = $classOverride;
if ($class === null) {
if (is_object($objectOrClass)) {
$class = get_class($objectOrClass);
} else {
$class = $objectO... | php | {
"resource": ""
} |
q28894 | Obj.getReflectionMethod | train | private static function getReflectionMethod(string $method, $objectOrClass, $classOverride = null): ReflectionMethod
{
$class = $classOverride;
if ($class === null) {
if (is_object($objectOrClass)) {
$class = get_class($objectOrClass);
} else {
... | php | {
"resource": ""
} |
q28895 | ImageRotator.setRotationCount | train | public function setRotationCount($count)
{
$count = intval($count);
if ($count != 0) {
$count = $count % 4;
$this->rotationCount = $count;
}
return $this;
} | php | {
"resource": ""
} |
q28896 | BasePostController.getAllPosts | train | public function getAllPosts($lang, $postType)
{
// check if user has permissions to access this link
if(!User::hasAccess($postType, 'read')) {
return $this->noPermission();
}
$defaultOrderBy = 'postID';
$orderBy = (Input::get('order') ) ? Input::get('order') : $d... | php | {
"resource": ""
} |
q28897 | BasePostController.getDataForCreate | train | public function getDataForCreate($lang, $postTypeSlug)
{
// Custom field groups
$customFieldsGroups = CustomFieldGroup::findGroups('post-type', 'create', 0, $postTypeSlug);
// post type
$postType = PostType::where('slug', $postTypeSlug)->first();
// Categories (options to s... | php | {
"resource": ""
} |
q28898 | BasePostController.getInTableColumns | train | public function getInTableColumns($postType)
{
$inTableColumnsSlugs = [];
$fields = PostType::getFields($postType);
// default columns
foreach(Post::$defaultListColumns as $key => $label){
if(substr($label, 0, 2) == '__') {
$label = __(substr($label, 2));... | php | {
"resource": ""
} |
q28899 | BasePostController.selectByCategory | train | private function selectByCategory($queryObject, $categoryID, $postTypeSlug)
{
$categoryRelationTable = categoriesRelationTable($postTypeSlug);
return $queryObject->join($categoryRelationTable, $categoryRelationTable.'.postID', $postTypeSlug.'.postID')
->where($categoryRelationTable.'.cat... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.