_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 83
13k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q253100 | DataItem.getHandlingObject | validation | public static function getHandlingObject($a, $b)
{
$handlingA = $a->handlingComparison;
$handlingB = $b->handlingComparison;
if (!$handlingB) {
return $a;
}
if ($handlingA !== false && $handlingB !== false) {
if ($handlingA > $handlingB) {
return $a;
} else {
return $b;
}
}
return $a;
} | php | {
"resource": ""
} |
q253101 | DataItem.setCompanionObject | validation | public function setCompanionObject($value)
{
if ($this->isForeign) {
return $this->localObject = $value;
} else {
return $this->foreignObject = $value;
}
} | php | {
"resource": ""
} |
q253102 | DataItem.getCompanionId | validation | public function getCompanionId()
{
if ($this->isForeign && isset($this->foreignPrimaryKey)) {
return $this->foreignPrimaryKey;
} elseif (!$this->isForeign && isset($this->localPrimaryKey)) {
return $this->localPrimaryKey;
}
if (isset($this->companionObject)) {
return $this->companionObject->primaryKey;
}
return;
} | php | {
"resource": ""
} |
q253103 | DataItem.setPairedDataItem | validation | public function setPairedDataItem(DataItem $value)
{
$this->_pairedDataItem = $value;
if (!isset($this->_localObject) && isset($value->localObject)) {
$this->localObject = $value->localObject;
}
if (!isset($this->_foreignObject) && isset($value->foreignObject)) {
$this->foreignObject = $value->foreignObject;
}
if ($value->handledDataItem) {
$this->handledDataItem = $value->handledDataItem;
}
} | php | {
"resource": ""
} |
q253104 | DataItem.setHandledDataItem | validation | public function setHandledDataItem($value)
{
if (isset($this->_pairedDataItem)) {
$this->pairedDataItem->handledDataItem = $value;
}
if (!$this->_handledDataItem && $value) {
$this->dataSource->reduceRemaining($this);
}
$this->clean();
return $this->_handledDataItem = $value;
} | php | {
"resource": ""
} |
q253105 | MockStorage.save | validation | public function save(string $sessionIdentifier, string $sessionData): void
{
self::$files[$sessionIdentifier] = [
'data' => $sessionData,
'time' => microtime(true)
];
} | php | {
"resource": ""
} |
q253106 | MockStorage.get | validation | public function get(string $sessionIdentifier): string
{
if (!$this->sessionExists($sessionIdentifier)) {
throw new SessionNotFoundException();
}
return self::$files[$sessionIdentifier]['data'];
} | php | {
"resource": ""
} |
q253107 | MockStorage.lock | validation | public function lock(string $sessionIdentifier): bool
{
if (in_array($sessionIdentifier, self::$lockedIdentifiers)) {
return true;
}
self::$lockedIdentifiers[] = $sessionIdentifier;
return true;
} | php | {
"resource": ""
} |
q253108 | MockStorage.unlock | validation | public function unlock(string $sessionIdentifier): void
{
$index = array_search($sessionIdentifier, self::$lockedIdentifiers);
if ($index !== false) {
unset(self::$lockedIdentifiers[$index]);
}
} | php | {
"resource": ""
} |
q253109 | MockStorage.destroy | validation | public function destroy(string $sessionIdentifier): void
{
if (!isset(self::$files[$sessionIdentifier])) {
throw new SessionNotFoundException();
}
unset(self::$files[$sessionIdentifier]);
} | php | {
"resource": ""
} |
q253110 | MockStorage.clearOld | validation | public function clearOld(int $maxLife): void
{
$limit = microtime(true) - $maxLife / 1000000;
foreach (self::$files as &$file) {
if ($file['time'] <= $limit) {
$file = null;
}
}
self::$files = array_filter(self::$files);
} | php | {
"resource": ""
} |
q253111 | HidePageController.hideAction | validation | public function hideAction(Request $request, Application $app)
{
$options = array(
"request" => $request,
"page_manager" => $app["red_kite_cms.page_manager"],
"username" => $this->fetchUsername($app["security"], $app["red_kite_cms.configuration_handler"]),
);
return parent::hide($options);
} | php | {
"resource": ""
} |
q253112 | CustomFieldText.buildForm | validation | public function buildForm(FormBuilderInterface $builder, CustomField $customField)
{
$options = $customField->getOptions();
$type = ($options[self::MAX_LENGTH] < 256) ? 'text'
: 'textarea';
$attrArray = array();
if(array_key_exists(self::MULTIPLE_CF_INLINE, $options) and
$options[self::MULTIPLE_CF_INLINE]) {
$attrArray['class'] = 'multiple-cf-inline';
}
$builder->add($customField->getSlug(), $type, array(
'label' => $this->translatableStringHelper->localize($customField->getName()),
'required' => false,
'attr' => $attrArray
));
} | php | {
"resource": ""
} |
q253113 | DataKeyAwareTrait._setDataKey | validation | protected function _setDataKey($key)
{
if (!is_null($key) && !is_string($key) && !($key instanceof Stringable)) {
throw $this->_createInvalidArgumentException($this->__('Data key must be a string or stringable'), 0, null, $key);
}
$this->dataKey = $key;
return $this;
} | php | {
"resource": ""
} |
q253114 | AuthorizerAccessToken.getToken | validation | public function getToken($forceRefresh = false)
{
$cached = $this->authorizer->getAccessToken();
if ($forceRefresh || empty($cached)) {
return $this->renewAccessToken();
}
return $cached;
} | php | {
"resource": ""
} |
q253115 | AuthorizerAccessToken.renewAccessToken | validation | protected function renewAccessToken()
{
$token = $this->authorizer->getApi()
->getAuthorizerToken(
$this->authorizer->getAppId(),
$this->authorizer->getRefreshToken()
);
$this->authorizer->setAccessToken($token['authorizer_access_token'], $token['expires_in'] - 1500);
return $token['authorizer_access_token'];
} | php | {
"resource": ""
} |
q253116 | AbstractModule.getModuleDir | validation | final public function getModuleDir()
{
if (! $this->moduleDir) {
$reflection = new ReflectionClass(static::class);
$this->moduleDir = dirname($reflection->getFileName());
}
return $this->moduleDir;
} | php | {
"resource": ""
} |
q253117 | Debug.getDump | validation | public static function getDump($var, $maxSize = null)
{
// Trace
$trace = debug_backtrace();
// Initialise la sortie
$dump = '';
// Header
$dump .= static::getHeader('Dump de variable');
// Contexte
$dump .= '<div class="dump_segment">Contexte</div>';
if (count($trace) > 2) {
$dump .= static::getContext($trace[1], $trace[2]);
} else {
$dump .= static::getContext($trace[1]);
}
// Requête SQL
if (is_object($var) && get_class($var) == 'sylab\common\sgbd\Query') {
$dump .= '<div class="dump_segment">Requête SQL</div>';
$dump .= '<div class="dump_segment_content"><pre>' . $var->getSql() . '</pre></div>';
}
// Exploration
$dump .= '<div class="dump_segment">Exploration de la variable</div>';
$dump .= '<div class="dump_segment_content"><pre>';
if (is_object($var) && get_class($var) == 'sylab\framework\query\Query') {
$dump .= static::getDumpQueryResult($var->getQueryResults());
} elseif (is_object($var) && get_class($var) == 'sylab\framework\query\QueryResult') {
$dump .= static::getDumpQueryResult($var);
} else {
$dump .= static::getDumpContent($var, $maxSize);
}
$dump .= '</pre></div>';
// Footer
$dump .= static::getFooter();
return $dump;
} | php | {
"resource": ""
} |
q253118 | Debug.getDumpQueryResult | validation | public static function getDumpQueryResult($var)
{
$header = true;
$dump = '<table cellpadding=5 cellspacing=0>';
$i = 1;
foreach ($var as $ligne) {
// Affichage du header
if ($header) {
$dump .= '<tr>';
foreach ($ligne as $key => $value) {
if (!is_numeric($key)) {
$dump .= '<th>' . $key . '</th>';
}
}
$dump .= '</tr>';
$header = false;
}
// Affichage des données
$class = '';
if (!($i % 2)) {
$class = 'highlight';
}
$dump .= '<tr class="' . $class . '">';
foreach ($ligne as $key => $value) {
if (!is_numeric($key)) {
if ($value != '') {
$dump .= '<td>' . $value . '</td>';
} else {
$dump .= '<td> </td>';
}
}
}
$dump .= '</tr>';
$i++;
}
$dump .= '</table>';
return $dump;
} | php | {
"resource": ""
} |
q253119 | Debug.getDumpContent | validation | protected static function getDumpContent($var, $maxSize = null)
{
$dump = '<div class="dump_segment_content_main">';
$dump .= '<div class="dump_variable">';
$dump .= sprintf('<ul>%s</ul>', static::dumpElement($var, '', $maxSize));
$dump .= '</div>';
$dump .= '</div>';
return $dump;
} | php | {
"resource": ""
} |
q253120 | Debug.getTrace | validation | public static function getTrace()
{
// Trace
$trace = debug_backtrace();
// Initialise la sortie
$dump = '';
// Header
$dump .= static::getHeader('Trace du contexte');
// Contexte
$dump .= '<div class="dump_segment">Contexte</div>';
$nb = count($trace);
for ($i = 1; $i < $nb; $i++) {
if ($i < $nb - 1) {
$dump .= static::getContext($trace[$i], $trace[$i + 1]);
} else {
$dump .= static::getContext($trace[$i]);
}
}
// Footer
$dump .= static::getFooter();
return $dump;
} | php | {
"resource": ""
} |
q253121 | CliApplication.getRunner | validation | protected function getRunner()
{
if (null === $this->runner) {
$this->runner = new ConsoleApplication($this->name, $this->version, $this->description, $this->alias);
}
return $this->runner;
} | php | {
"resource": ""
} |
q253122 | CliApplication.run | validation | public function run()
{
// Boot the application.
if (false === $this->boot()) {
exit(1);
}
// Let symfony/console do the rest.
$this->runner->run($this->request, $this->response);
return $this;
} | php | {
"resource": ""
} |
q253123 | CustomFieldNumber.prepareFieldOptions | validation | private function prepareFieldOptions(CustomField $customField, $type)
{
$options = $customField->getOptions();
/**
* @var mixed[] the formField options
*/
$fieldOptions = array();
// add required
$fieldOptions['required'] = False;
//add label
$fieldOptions['label'] = $this->translatableStringHelper->localize($customField->getName());
// add constraints if required
if ($options[self::MIN] !== NULL) {
$fieldOptions['constraints'][] = new GreaterThanOrEqual(array('value' => $options[self::MIN]));
}
if ($options[self::MAX] !== NULL) {
$fieldOptions['constraints'][] = new LessThanOrEqual(array('value' => $options[self::MAX]));
}
// add precision to options if required
if ($type === 'number') {
$fieldOptions['scale'] = $options[self::SCALE];
}
if (!empty($options[self::POST_TEXT])) {
$fieldOptions['post_text'] = $options[self::POST_TEXT];
}
return $fieldOptions;
} | php | {
"resource": ""
} |
q253124 | Card.getTicketCacheKey | validation | public function getTicketCacheKey()
{
if (is_null($this->ticketCacheKey)) {
return $this->ticketCachePrefix.$this->getAccessToken()->getAppId();
}
return $this->ticketCacheKey;
} | php | {
"resource": ""
} |
q253125 | Taxonomy.getModuleHandler | validation | public function getModuleHandler()
{
if (is_null($this->_moduleHandler)) {
$stem = $this->field;
if (!isset(self::$_moduleHandlers[$stem])) {
self::$_moduleHandlers[$stem] = [];
}
$n = count(self::$_moduleHandlers[$stem]);
$this->_moduleHandler = $this->field . ':_' . $n;
self::$_moduleHandlers[$stem][] = $this->_moduleHandler;
}
return $this->_moduleHandler;
} | php | {
"resource": ""
} |
q253126 | CommonStructureDefinition.addPlaceholder | validation | public function addPlaceholder($placeholder, $description, $sampleValue, $emptyValue)
{
if (isset($this->placeholders[$placeholder])) {
throw new DefinitionDuplicateException(
sprintf('Field with same placeholder "%s" already exists in structure', $placeholder)
);
}
$this->placeholders[$placeholder] = array(
'placeholder' => $placeholder,
'description' => $description,
'sample' => $sampleValue,
'empty' => $emptyValue,
);
} | php | {
"resource": ""
} |
q253127 | CommonStructureDefinition.addChild | validation | public function addChild($structureName, $prefix = '', $suffix = '')
{
if (isset($this->children[$structureName])) {
throw new DefinitionDuplicateException(
sprintf('Child structure with same name "%s" already exists', $structureName)
);
}
$this->children[$structureName] = array(
'name' => $structureName,
'prefix' => (string)$prefix,
'suffix' => (string)$suffix
);
} | php | {
"resource": ""
} |
q253128 | Familiarity.getUser | validation | public function getUser($owner = true)
{
if ($owner && $this->owner->getBehavior('Ownable') !== null && isset($this->owner->objectOwner)) {
return $this->owner->objectOwner;
} elseif (isset(Yii::$app->user) && isset(Yii::$app->user->identity->primaryKey)) {
return Yii::$app->user->identity;
}
return false;
} | php | {
"resource": ""
} |
q253129 | Familiarity.getFamiliarity | validation | public function getFamiliarity($user = null)
{
if (is_null($user)) {
$user = $this->getUser(false);
}
if (is_object($user)) {
$user = $user->primaryKey;
}
$familarityKey = md5($user);
if (!isset($this->_familiarity[$familarityKey])) {
$this->_familiarity[$familarityKey] = false;
$familiarityClass = Yii::$app->classes['ObjectFamiliarity'];
if (!empty($user)) {
$attributes = [];
$attributes[$this->objectField] = $this->owner->primaryKey;
$attributes[$this->userField] = $user;
$this->_familiarity[$familarityKey] = $familiarityClass::find()->where($attributes)->one();
if (empty($this->_familiarity[$familarityKey])) {
$this->_familiarity[$familarityKey] = new $familiarityClass();
$this->_familiarity[$familarityKey]->attributes = $attributes;
}
}
}
return $this->_familiarity[$familarityKey];
} | php | {
"resource": ""
} |
q253130 | PaginateProviderTrait.paginate | validation | public function paginate()
{
$model = $this->model;
if (property_exists($model, 'order')) {
$paginator = $model::orderBy($model::$order, $model::$sort)->paginate($model::$paginate, $model::$index);
} else {
$paginator = $model::paginate($model::$paginate, $model::$index);
}
if (!$this->isPageInRange($paginator) && !$this->isFirstPage($paginator)) {
throw new NotFoundHttpException();
}
if ($paginator->getTotal()) {
$this->paginateLinks = $paginator->links();
}
return $paginator;
} | php | {
"resource": ""
} |
q253131 | ElementRequireAttributesProviderTrait.addRequiredAttributeToFields | validation | final protected function addRequiredAttributeToFields(array $specifications)
{
/** @var array $data */
foreach ($specifications as $field => $data) {
if (!$this->has($field)) {
continue;
}
$validators = ArrayUtils::get($data, 'validators', []);
$isRequired = (bool) ArrayUtils::get(
$data,
'required',
ArrayUtils::get($validators, NotEmpty::class, ArrayUtils::get($validators, 'NotEmpty'))
);
if ($isRequired) {
$this->get($field)->setAttribute('required', 'required');
}
}
return $this;
} | php | {
"resource": ""
} |
q253132 | CustomFieldController.createCreateForm | validation | private function createCreateForm(CustomField $entity, $type)
{
$form = $this->createForm('custom_field_choice', $entity, array(
'action' => $this->generateUrl('customfield_create',
array('type' => $type)),
'method' => 'POST',
'type' => $type,
'group_widget' => ($entity->getCustomFieldsGroup()) ? 'hidden' :'entity'
));
$form->add('submit', 'submit', array('label' => 'Create'));
return $form;
} | php | {
"resource": ""
} |
q253133 | CustomFieldController.newAction | validation | public function newAction(Request $request)
{
$entity = new CustomField();
//add the custom field group if defined in URL
$cfGroupId = $request->query->get('customFieldsGroup', null);
if ($cfGroupId !== null) {
$cfGroup = $this->getDoctrine()->getManager()
->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
->find($cfGroupId);
if (!$cfGroup) {
throw $this->createNotFoundException('CustomFieldsGroup with id '
. $cfGroupId.' is not found !');
}
$entity->setCustomFieldsGroup($cfGroup);
}
$form = $this->createCreateForm($entity, $request->query->get('type'));
return $this->render('ChillCustomFieldsBundle:CustomField:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
} | php | {
"resource": ""
} |
q253134 | CustomFieldController.createEditForm | validation | private function createEditForm(CustomField $entity, $type)
{
$form = $this->createForm('custom_field_choice', $entity, array(
'action' => $this->generateUrl('customfield_update', array('id' => $entity->getId())),
'method' => 'PUT',
'type' => $type,
'group_widget' => 'hidden'
));
$form->add('submit', 'submit', array('label' => 'Update'));
return $form;
} | php | {
"resource": ""
} |
q253135 | Mcrypt.encrypt | validation | public function encrypt($data)
{
if ($this->iv === null) {
$dataEncrypted = mcrypt_encrypt($this->cipher, $this->key, $data, $this->mode);
} else {
$dataEncrypted = mcrypt_encrypt($this->cipher, $this->key, $data, $this->mode, $this->iv);
}
return bin2hex($dataEncrypted);
} | php | {
"resource": ""
} |
q253136 | Mcrypt.decrypt | validation | public function decrypt($data)
{
if (!is_string($data) || !preg_match('/^[0-9A-Fa-f]*$/', $data)) {
throw new \InvalidArgumentException('blowfishDecryptCBC require hex input', 1502);
}
$data = pack('H*', $data);
if ($this->iv === null) {
$return = mcrypt_decrypt($this->cipher, $this->key, $data, $this->mode);
} else {
$return = mcrypt_decrypt($this->cipher, $this->key, $data, $this->mode, $this->iv);
}
return rtrim($return, "\0");
} | php | {
"resource": ""
} |
q253137 | Mcrypt.generateIV | validation | protected function generateIV()
{
$sizeIV = $this->getSizeIV();
if ($sizeIV === 0) {
return $this;
}
$this->setIV(mcrypt_create_iv($sizeIV, MCRYPT_RAND));
return $this;
} | php | {
"resource": ""
} |
q253138 | DataInterfaceLog.getStatusLog | validation | public function getStatusLog($checkRecent = false)
{
if (!isset($this->_statusLog)) {
$this->_statusLog = Cacher::get([get_called_class(), $this->primaryKey, $this->created]);
if (empty($this->_statusLog)) {
if (is_null($this->message)) {
$this->_statusLog = $this->_startStatus();
} else {
$this->_statusLog = unserialize($this->message);
}
} elseif ($checkRecent) {
$testStatusLog = unserialize($this->message);
if ($testStatusLog && $testStatusLog->lastUpdate > $this->_statusLog->lastUpdate) {
$this->_statusLog = $testStatusLog;
}
}
if (empty($this->_statusLog)) {
$this->_statusLog = new Status();
}
}
$this->_statusLog->log = $this;
return $this->_statusLog;
} | php | {
"resource": ""
} |
q253139 | DataInterfaceLog.getEstimateTimeRemaining | validation | public function getEstimateTimeRemaining()
{
$estimatedDuration = $this->dataInterface->estimateDuration();
if ($estimatedDuration) {
$startedTime = strtotime($this->started);
$estimatedEndTime = $startedTime + $estimatedDuration;
if (time() > $estimatedEndTime) {
return false;
}
return $estimatedEndTime - time();
}
return false;
} | php | {
"resource": ""
} |
q253140 | DataInterfaceLog.getDuration | validation | public function getDuration()
{
$ended = microtime(true);
if ($this->ended) {
$ended = strtotime($this->ended);
}
$started = strtotime($this->started);
return Date::niceDuration($ended-$started);
} | php | {
"resource": ""
} |
q253141 | DataInterfaceLog.getIsMostRecent | validation | public function getIsMostRecent()
{
return !empty($this->dataInterface) && $this->dataInterface->lastDataInterfaceLog && $this->dataInterface->lastDataInterfaceLog->primaryKey === $this->primaryKey;
} | php | {
"resource": ""
} |
q253142 | Url.assembleUrl | validation | private function assembleUrl()
{
$address = '';
if (!empty($this->scheme)) {
$address .= $this->scheme . '://';
}
if (!empty($this->user)) {
$address .= $this->user;
}
if (!empty($this->pass)) {
$address .= ':' . $this->pass . '@';
}
if (!empty($this->host)) {
$address .= $this->host;
}
if (!empty($this->port)) {
$address .= ':' . $this->port;
}
if (!empty($this->path)) {
$address .= $this->path;
}
if (count($this->query) > 0) {
$this->query_string = http_build_query($this->query);
$address .= '?' . $this->query_string;
}
if (!empty($this->fragment)) {
$address .= '#' . $this->fragment;
}
$this->full_address = $address;
} | php | {
"resource": ""
} |
q253143 | FilesystemAssetAdapter.cache | validation | public function cache(ContentfulAsset $asset)
{
if (!isset($asset->file)) {
$this->log('Asset %s has no file.', $asset);
return;
}
foreach ($asset->file as $locale => $file) {
if (!$file) {
// File not published.
$this->log('Asset %s contains unpublished file for %s.', $asset, $locale);
continue;
}
$localFile = $this->getLocalFile($asset, $locale);
if ($localFile->isFile()) {
continue;
}
$this->log(
'Caching "%s" file for asset "%s" as "%s" ...',
$locale,
$asset->getId(),
$localFile->getPathname()
);
$dir = new \SplFileInfo($localFile->getPath());
if (!$dir->isWritable()) {
throw new RuntimeException(
sprintf(
'Target directory "%s" is not writeable!',
$localFile->getPath()
)
);
}
copy(str_replace('//', 'https://', $file['url']), $localFile->getPathname());
$size = filesize($localFile->getPathname());
$this->log(
'%d bytes saved.',
$size
);
}
} | php | {
"resource": ""
} |
q253144 | DeferredAction.getDescriptor | validation | public function getDescriptor()
{
$logModel = $this->getLogModel(true);
if (empty($logModel) || !isset($logModel->dataInterface)) {
return 'Unknown Data Interface';
}
return 'Interface: ' . $logModel->dataInterface->name;
} | php | {
"resource": ""
} |
q253145 | DeferredAction.getLogModel | validation | public function getLogModel($refresh = false)
{
$config = $this->config;
if (isset($config['logModel'])) {
if (!is_object($config['logModel'])) {
if ($refresh) {
return DataInterfaceLog::find()->where(['id' => $config['logModel']])->one();
} else {
return DataInterfaceLog::get($config['logModel']);
}
}
if ($refresh) {
return DataInterfaceLog::find()->where(['id' => $config['logModel']->primaryKey])->one();
}
return $config['logModel'];
}
return;
} | php | {
"resource": ""
} |
q253146 | Base.getType | validation | public function getType()
{
if (is_null($this->_type)) {
$this->_type = FieldTypeDetector::detect($this->modelField);
}
return $this->_type;
} | php | {
"resource": ""
} |
q253147 | NoticeJsonRequestHandler.handle | validation | public function handle(ServerRequestInterface $request): ResponseInterface
{
$msg = "This is the default request handler. This means no middleware produced a response before hitting it.";
$contents = json_encode([
'type' => MiddlewareStackExhaustedException::class,
'message' => $msg,
]);
$response = $this->factory
->createResponse(404)
->withHeader('Content-type', 'application/json');
$response->getBody()->write($contents);
return $response;
} | php | {
"resource": ""
} |
q253148 | BootingAppBuilder.doFullBootBuildIfNecessary | validation | public function doFullBootBuildIfNecessary(AviatorApp $app)
{
// check if the watcher is running
$beaconUpdatedAt = $this->getChangedAt(Aviator::getInstallDir() . '/tmp/watch_beacon');
if ($beaconUpdatedAt > LocalDate::now()->modifyBySeconds(3)->getTimestamp()) {
echo DebugErrorHandler::watcherBeaconInFuture();
die();
}
if (PHP_SAPI !== 'cli' && $beaconUpdatedAt < LocalDate::now()->modifyBySeconds(-3)->getTimestamp()) {
echo DebugErrorHandler::watcherNotRunning();
exit(-1);
}
// when the container does not exist we need a build
$needsBuild = ! class_exists($app->getContainerFqcn());
// when the container is older then the last file update we need a build as well
if (! $needsBuild) {
$reflect = new \ReflectionClass($app->getContainerFqcn());
$containerFile = $reflect->getFileName();
clearstatcache(true, $containerFile);
$fileUpdatedAt = $this->getChangedAt(Aviator::getInstallDir() . '/tmp/file_update_found');
// is the container outdated ?
$needsBuild = filemtime($containerFile) < $fileUpdatedAt;
}
// so do we need a build now ?
if ($needsBuild) {
$this->doFullBootBuild($app);
}
} | php | {
"resource": ""
} |
q253149 | BootingAppBuilder.getChangedAt | validation | private function getChangedAt(string $filename) : float
{
clearstatcache(true, $filename);
return file_exists($filename)
? (float) file_get_contents($filename)
: -1;
} | php | {
"resource": ""
} |
q253150 | OperationDefinition.getRequiredParams | validation | public function getRequiredParams() {
$requiredParams = [];
foreach ($this->parameters as $parameter) {
if ($parameter->getIsOptional() || $parameter->hasDefault()) {
continue;
}
$requiredParams[] = $parameter;
}
return $requiredParams;
} | php | {
"resource": ""
} |
q253151 | OperationDefinition.getDefaultParams | validation | public function getDefaultParams() {
$defaultParams = [];
foreach ($this->parameters as $parameter) {
if ($parameter->hasDefault()) {
if ($parameter->getIsAPIParameter() == false) {
$defaultParams[] = $parameter;
}
}
}
return $defaultParams;
} | php | {
"resource": ""
} |
q253152 | StringHelper.trimStringRight | validation | public static function trimStringRight($str, $remove)
{
if (!is_string($str))
throw new InvalidArgumentException('$str has to be a string');
if (!is_string($remove))
throw new InvalidArgumentException('$remove has to be a string');
$len = strlen($remove);
$offset = strlen($str) - $len;
while(0 < $offset && strpos($str, $remove, $offset) === $offset)
{
$str = substr($str, 0, $offset);
$offset = strlen($str) - $len;
}
return $str;
} | php | {
"resource": ""
} |
q253153 | Notice.setIndustry | validation | public function setIndustry($industryOne, $industryTwo)
{
$params = [
'industry_id1' => $industryOne,
'industry_id2' => $industryTwo,
];
return $this->parseJSON('json', [self::API_SET_INDUSTRY, $params]);
} | php | {
"resource": ""
} |
q253154 | Map.current | validation | public function current()
{
$current = current($this->storage);
if ($this->useMapEntries) {
return new MapEntry($current[0], $current[1]);
}
return $current[1];
} | php | {
"resource": ""
} |
q253155 | Container.addDynamic | validation | public function addDynamic($name, $factory, $createDefault = 0, $forceDefault = false)
{
$control = new RContainer($factory, $createDefault, $forceDefault);
$control->currentGroup = $this->currentGroup;
return $this[$name] = $control;
} | php | {
"resource": ""
} |
q253156 | DiOptionsCollection.from | validation | public static function from(Reader $reader, \Reflector $reflector)
{
if ($reflector instanceof \ReflectionClass) {
return new static(
Psi::it($reader->getClassAnnotations($reflector))->toArray()
);
}
if ($reflector instanceof \ReflectionMethod) {
return new static(
Psi::it($reader->getMethodAnnotations($reflector))->toArray()
);
}
return new static();
} | php | {
"resource": ""
} |
q253157 | ApiResponse.response | validation | public function response(array $data, $http_code)
{
if (config('odin.queryRequest')) {
$data['queries'] = $this->getQueries();
}
return response()->json($data, $http_code);
} | php | {
"resource": ""
} |
q253158 | Repository.newInstanceQuery | validation | public function newInstanceQuery(array $data = [], array $selectable = ['*'])
{
$tm = new TextGenerator();
$r = $this->newInstanceRepository();
$query = $r->newQuery();
if (!empty($this->filter)) {
$filter = new Filter($r->getTableName(), $selectable);
$filter->build($query, $tm->generateAndRender($this->filter, $data));
}
return $query;
} | php | {
"resource": ""
} |
q253159 | Container.register | validation | public function register(callable $inject) : void
{
$reflection = new ReflectionFunction($inject);
$parameters = $reflection->getParameters();
foreach ($parameters as $parameter) {
$key = $parameter->name;
$getter = function ($c) use ($reflection, $parameters, $key) {
if (isset($c->delegate)) {
try {
return $c->delegate->get($key);
} catch (NotFoundExceptionInterface $e) {
// That's fine, we'll try our own container next.
}
}
$args = [];
foreach ($parameters as $param) {
if (!$param->isPassedByReference()) {
$args[] = $c->get($param->name);
} else {
${$param->name} = null;
$args[$param->name] =& ${$param->name};
}
}
$reflection->invokeArgs($args);
foreach ($args as $found => $value) {
if (!is_numeric($found) && $found == $key) {
$c::$map[$found] = $value;
}
}
if (array_key_exists($key, $args)) {
return $args[$key];
}
throw new NotFoundException($key);
};
static::$map[$key] = new ReflectionFunction($getter);
}
} | php | {
"resource": ""
} |
q253160 | AbstractTemplate.attr | validation | public function attr($keys = [])
{
if (!is_array($keys)) {
$keys = [$keys];
}
$out = '';
foreach ($keys as $key) {
$value = $this->getValue($key)->attr();
if (!empty($value)) {
$out .= ' ' . $value;
}
}
return ltrim($out, ' ');
} | php | {
"resource": ""
} |
q253161 | PageRemovedListener.onPageRemoved | validation | public function onPageRemoved(PageCollectionRemovedEvent $event)
{
$pageName = basename($event->getFilePath());
$page = $this->pagesParser
->contributor($event->getUsername())
->parse()
->page($pageName);
if (null === $page) {
return;
}
foreach ($page["seo"] as $seo) {
$permalink = $seo["permalink"];
$this->permalinkManager->remove($permalink);
}
$this->permalinkManager->save();
} | php | {
"resource": ""
} |
q253162 | Utils.arrayRecursiveDiff | validation | public static function arrayRecursiveDiff($aArray1, $aArray2) {
$aReturn = array();
foreach ($aArray1 as $mKey => $mValue) {
if (array_key_exists($mKey, $aArray2)) {
if (is_array($mValue)) {
$aRecursiveDiff = self::arrayRecursiveDiff($mValue, $aArray2[$mKey]);
if (count($aRecursiveDiff)) { $aReturn[$mKey] = $aRecursiveDiff; }
} else {
if ($mValue != $aArray2[$mKey]) {
$aReturn[$mKey] = $mValue;
}
}
} else {
$aReturn[$mKey] = $mValue;
}
}
return $aReturn;
} | php | {
"resource": ""
} |
q253163 | CartItem.getAmount | validation | public function getAmount()
{
$amount = $this->getPerUnitAmount();
$totalAmount = bcmul($amount, $this->getQuantity(), 2);
return floatval($totalAmount);
} | php | {
"resource": ""
} |
q253164 | CartItem.getPerUnitAmount | validation | public function getPerUnitAmount()
{
$amount = $this->getProduct()->getPrice();
foreach ($this->getOptions() as $cartOption) {
$amount = bcadd($amount, $cartOption->getOption()->getPrice(), 2);
}
foreach ($this->getExtras() as $cartExtra) {
$amount = bcadd($amount, $cartExtra->getExtra()->getPrice(), 2);
}
return floatval($amount);
} | php | {
"resource": ""
} |
q253165 | PermalinkChangedListener.onPermalinkChanged | validation | public function onPermalinkChanged(PermalinkChangedEvent $event)
{
$previousPermalink = $event->getOriginalText();
$newPermalink = $event->getChangedText();
$this->updatePermalinkOnBlocks($previousPermalink, $newPermalink);
$this->updateHomepagePermalink($previousPermalink, $newPermalink);
} | php | {
"resource": ""
} |
q253166 | MasterGenerator.generate | validation | public function generate(string $outputDir) : array
{
$generatedFiles = [];
foreach ($this->generators as $generator) {
$this->logger->info('Running generator ' . get_class($generator));
$result = $generator->generate();
foreach ($result->all() as $phpFile) {
$path = str_replace(
['/', "\\"],
DIRECTORY_SEPARATOR,
$outputDir . '/' . $phpFile->getFqcn()->getNamespace()
);
BaseUtil::ensureDirectory($path, 0711);
$filePath = $path . DIRECTORY_SEPARATOR . $phpFile->getFqcn()->getName() . '.php';
$this->logger->info('Writing to file ' . $filePath);
file_put_contents($filePath, $phpFile->getText());
$generatedFiles[] = new GeneratedFile($filePath, $phpFile);
}
}
return $generatedFiles;
} | php | {
"resource": ""
} |
q253167 | ConfigReaderAutoloadListener.setAutoloadDir | validation | public function setAutoloadDir($dir)
{
if (! is_string($dir) || empty($dir)) {
throw new InvalidArgumentException(sprintf(
'Invalid directory for autoload of configuration provided; '
. 'must be a non-empty string, "%s" received.',
is_object($dir) ? get_class($dir) : gettype($dir)
));
}
$dir = Normalizer::path($dir);
if (! file_exists($dir) || ! is_dir($dir)) {
throw new InvalidArgumentException(sprintf(
'The directory "%s", specified for autoload of configurations, '
. 'does not exists.',
$dir
));
}
$this->autoloadDir = $dir;
} | php | {
"resource": ""
} |
q253168 | InterfaceController.actionRunOne | validation | public function actionRunOne()
{
$this->out("Run Interface " . $this->dataInterface->object->name, Console::UNDERLINE, Console::FG_GREEN);
$this->hr();
$this->dataInterface->run(null, new ConsoleAction());
} | php | {
"resource": ""
} |
q253169 | InterfaceController.getDataInterface | validation | public function getDataInterface()
{
if (!$this->started) {
return $this->_interface;
}
if (is_null($this->_interface)) {
$interfaces = ArrayHelper::map(Yii::$app->collectors['dataInterfaces']->getAll(), 'systemId', 'object.name');
$this->dataInterface = $this->select("Choose interface", $interfaces);
}
return $this->_interface;
} | php | {
"resource": ""
} |
q253170 | InterfaceController.setDataInterface | validation | public function setDataInterface($value)
{
if (($interfaceItem = Yii::$app->collectors['dataInterfaces']->getOne($value)) && ($interface = $interfaceItem->object)) {
$this->_interface = $interfaceItem;
} else {
throw new Exception("Invalid interface!");
}
} | php | {
"resource": ""
} |
q253171 | CustomFieldsGroup.getActiveCustomFields | validation | public function getActiveCustomFields()
{
if($this->activeCustomFields === null) {
$this->activeCustomFields = array();
foreach ($this->customFields as $cf) {
if($cf->isActive()) {
array_push($this->activeCustomFields, $cf);
}
}
}
return $this->activeCustomFields;
} | php | {
"resource": ""
} |
q253172 | LoadContentTypeData.generateField | validation | protected function generateField($fieldType, $fieldId, array $labels)
{
$field = new FieldType();
$field->setType($fieldType);
$field->setFieldId($fieldId);
$field->setDefaultValue(null);
$field->setSearchable(true);
$field->setLabels($labels);
return $field;
} | php | {
"resource": ""
} |
q253173 | LoadContentTypeData.generateOption | validation | protected function generateOption($key, $value)
{
$option = new FieldOption();
$option->setKey($key);
$option->setValue($value);
return $option;
} | php | {
"resource": ""
} |
q253174 | AdminController.render | validation | public function render($view, array $parameters = array(), Response $response = null)
{
$parameters['base_template'] = isset($parameters['base_template']) ? $parameters['base_template'] : $this->getBaseTemplate();
$parameters['admin_pool'] = $this->get('sonata.admin.pool');
return parent::render($view, $parameters);
} | php | {
"resource": ""
} |
q253175 | ArrayList.walk | validation | public function walk(Callable $callback)
{
$arrayCopy = $this->getArrayCopy();
$result = array_walk($arrayCopy, $callback);
$this->exchangeArray($arrayCopy);
return $result;
} | php | {
"resource": ""
} |
q253176 | Model.primaryKey | validation | public function primaryKey()
{
$pk = $this->meta->schema->primaryKey;
if (is_array($pk)) {
$ppk = [];
foreach ($pk as $key) {
$ppk[] = $key;
}
return implode('.', $ppk);
}
return $pk;
} | php | {
"resource": ""
} |
q253177 | Model.getPrimaryKey | validation | public function getPrimaryKey()
{
$pk = $this->meta->schema->primaryKey;
if (is_array($pk)) {
$ppk = [];
foreach ($pk as $key) {
if (!isset($this->attributes[$key])) {
$ppk[] = null;
} else {
$ppk[] = $this->attributes[$key];
}
}
return implode('.', $ppk);
}
if (!isset($this->attributes[$pk])) {
return;
}
return $this->attributes[$pk];
} | php | {
"resource": ""
} |
q253178 | Model.find | validation | protected function find($params)
{
$debug = false;
$q = new Query();
$q->select('*');
$q->from($this->_tableName);
foreach ($params as $k => $v) {
if ($k === 'join') {
foreach ($v as $join) {
if (!isset($join['type'])) {
$join['type'] = 'INNER JOIN';
}
if (!isset($join['params'])) {
$join['params'] = [];
}
$q->join($join['type'], $join['table'], $join['on'], $join['params']);
}
$debug = true;
} elseif (in_array($k, ['where'])) {
$q->{$k}($v);
} else {
$q->{$k} = $v;
}
}
if ($debug) {
//var_dump($q->createCommand()->rawSql);exit;
}
return $q;
} | php | {
"resource": ""
} |
q253179 | Model.findAll | validation | public function findAll($params = [])
{
$return = $this->populateRecords($this->find($params)->all($this->interface->db));
return $return;
} | php | {
"resource": ""
} |
q253180 | Model.findOne | validation | public function findOne($params = [])
{
return $this->populateRecord($this->find($params)->one($this->interface->db));
} | php | {
"resource": ""
} |
q253181 | UrlManager.getUrl | validation | public function getUrl(string $sCode, array $aParams = array()) : string
{
if (isset($_SERVER) && isset($_SERVER['HTTP_HOST'])) {
foreach (Config::get('route') as $sHost => $oHost) {
if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST'])
|| (strstr($sHost, '/')
&& strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) {
if (strstr($sHost, '/')
&& strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost)) {
$this->_sBaseUri = preg_replace('#^[^/]+#', '', $sHost);
}
if (isset($oHost->routes)) {
foreach($oHost->routes as $sKey => $oRoute) {
if ($sKey === $sCode) {
$sRoute = $this->_sBaseUri.$oRoute->route;
if (isset($oRoute->constraints)) {
foreach ($oRoute->constraints as $sName => $sType) {
if (!isset($aParams[$sName])) { $aParams[$sName] = ''; }
if (preg_match('#'.$sType.'#', $aParams[$sName])) {
if ($aParams[$sName]) { $sRoute = str_replace('[/:'.$sName.']', '/'.$aParams[$sName], $sRoute); } else { $sRoute = str_replace('[/:'.$sName.']', '', $sRoute); }
$sRoute = str_replace('[:'.$sName.']', $aParams[$sName], $sRoute);
continue;
} else if (isset($oRoute->defaults_constraints)
&& isset($oRoute->defaults_constraints->{$sName})
&& preg_match('#'.$sType.'#', $oRoute->defaults_constraints->{$sName})) {
continue;
}
throw new \Exception('For the route '.$sCode.' the parameter '.$sName.' is not good!');
}
}
return $sRoute;
}
}
}
}
}
}
} | php | {
"resource": ""
} |
q253182 | ArgumentEvent.onExecuteAction | validation | public function onExecuteAction(ExecuteActionEvent $event){
$request=$event->getRequest();
$position=1;
foreach($request->getConfig()->getArray('argument') as $argument){
$this->validateArgument($request,$argument,$position++);
}
} | php | {
"resource": ""
} |
q253183 | ArgumentEvent.validateArgument | validation | private function validateArgument(Request $request , ConfigContainer $config , $position){
$value=null;
switch($config->getValue('storage')){
case 'url':
$value=$this->validateUrl($request , $config , $position);
break;
case 'post':
$value=$this->validateGetPost($request->getData() , $config , $position);
break;
case 'get':
$value=$this->validateGetPost($request->getQuery() , $config , $position);
break;
default:
throw new InvalidConfigValueException('storage',$config->getValue('storage'));
}
$validatorName=$config->getValue('validator');
if($validatorName!==''){
/**
* @var ValidatorAbstract $validatorObject
*/
$validatorObject=new $validatorName();
$error=$validatorObject->validate($value);
if($error){
throw new InvalidArgumentException($position,$config->getValue('name'),$error);
}
}
$mapperName=$config->getValue('mapper');
if($mapperName!==''){
/**
* @var MapperAbstract $mapper
*/
$mapper=new $mapperName($this->container);
$value=$mapper->cast($value);
}
$request->setArgument($config->getValue('name'),$value);
} | php | {
"resource": ""
} |
q253184 | ArgumentEvent.validateUrl | validation | private function validateUrl(Request $request , ConfigContainer $config , $position){
$url=$request->getUrl();
$default=$config->getValue('default');
if(preg_match('/^'.$config->getValue('pattern').'$/',$url,$matches) && isset($matches[1])){
return $matches[1];
}
else if($default!==false){
return $config->getValue('default');
}
else{
throw new RequiredArgumentException($position,$config->getValue('name'));
}
} | php | {
"resource": ""
} |
q253185 | ArgumentEvent.validateGetPost | validation | private function validateGetPost($data , ConfigContainer $config , $position){
$argumentName=$config->getValue('name');
$default=$config->getValue('default');
if(!isset($data[$argumentName])){
if($default!==false){
return $default;
}
else{
throw new RequiredArgumentException($position,$argumentName);
}
}
return $data[$argumentName];
} | php | {
"resource": ""
} |
q253186 | Guard.handleEventMessage | validation | protected function handleEventMessage(array $message)
{
Log::debug('OpenPlatform Event Message detail:', $message);
$message = new Collection($message);
$infoType = $message->get('InfoType');
if ($handler = $this->getHandler($infoType)) {
$handler->handle($message);
} else {
Log::notice("No existing handler for '{$infoType}'.");
}
if ($messageHandler = $this->getMessageHandler()) {
call_user_func_array($messageHandler, [$message]);
}
} | php | {
"resource": ""
} |
q253187 | ApiUser.getCurrentUser | validation | protected function getCurrentUser()
{
try {
return JWTAuth::parseToken()->authenticate();
} catch (\Tymon\JWTAuth\Exceptions\JWTException $ex) {
return null;
}
} | php | {
"resource": ""
} |
q253188 | SectionTrait.getPriority | validation | public function getPriority()
{
if (isset($this->object->singleWidget)) {
if (isset($this->object->singleWidget) && isset($this->object->singleWidget->content->priorityAdjust)) {
//\d($this->object->singleWidget->content->priorityAdjust);exit;
return $this->_priority + $this->object->singleWidget->content->priorityAdjust;
}
}
return $this->_priority;
} | php | {
"resource": ""
} |
q253189 | Oauth1.getSignature | validation | public function getSignature($baseString, array $params) {
// Remove oauth_signature if present
// Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
unset($params['oauth_signature']);
if ($this->signature_method === 'HMAC-SHA1') {
$result = $this->sign_HMAC_SHA1($baseString);
}
else if ($this->signature_method == 'RSA-SHA1') {
$result = $this->sign_RSA_SHA1($baseString);
}
else if ($this->signature_method == 'PLAINTEXT') {
$result = $this->sign_PLAINTEXT($baseString);
}
else {
throw new ArtaxServiceException('Unknown signature method: '
. $this->signature_method);
}
return base64_encode($result);
} | php | {
"resource": ""
} |
q253190 | Oauth1.createBaseString | validation | protected function createBaseString(Request $request, array $params)
{
// Remove query params from URL. Ref: Spec: 9.1.2.
//TODO - remove params properly, not this hack method
$request = clone $request;
// $request->setQueryFields([]);
$uri = $request->getUri();
$queryString = '';
if ($questionMark = strpos($uri, '?')) {
$uri = substr($uri, 0, $questionMark);
$request->setUri($uri);
}
// $url = $request->getUri();
$query = http_build_query($params, '', '&', PHP_QUERY_RFC3986);
return strtoupper($request->getMethod())
. '&' . rawurlencode($uri)
. '&' . rawurlencode($query);
} | php | {
"resource": ""
} |
q253191 | Oauth1.buildAuthorizationHeader | validation | private function buildAuthorizationHeader(array $params)
{
foreach ($params as $key => $value) {
$params[$key] = $key . '="' . rawurlencode($value) . '"';
}
if ($this->realm) {
array_unshift(
$params,
'realm="' . rawurlencode($this->realm) . '"'
);
}
return ['Authorization', 'OAuth ' . implode(', ', $params)];
} | php | {
"resource": ""
} |
q253192 | Oauth1.getOauthParams | validation | private function getOauthParams($nonce)
{
$params = [
'oauth_nonce' => $nonce,
'oauth_timestamp' => time(),
];
if (isset($this->oauth_token)) {
$params['oauth_token'] = $this->oauth_token;
}
$params = $this->oauthConfig->toArray($params);
return $params;
} | php | {
"resource": ""
} |
q253193 | Web2All_Table_SaveObjectTrait.substituteSQLOperationPlaceholders | validation | protected function substituteSQLOperationPlaceholders($sqloperation)
{
$sql_value=$sqloperation->toSQLString();
if (count($sqloperation->getPlaceholderValues())>0) {
// there are placeholders
// replace each questionmark by a placeholder value
$startpos=0;
$sql_value_replaced='';
foreach ($sqloperation->getPlaceholderValues() as $avalue) {
// find the questionmark
$qpos=strpos($sql_value, '?', $startpos);
// copy everything after the last question mark till this questionmark in the new string
$sql_value_replaced.=substr( $sql_value, $startpos, $qpos );
// append the replacement for the questionmark
$sql_value_replaced.=$this->db->Quote($avalue);
// start searching for questionmarks after this questionmark
$startpos=$qpos+1;
}
// and add the rest of the string
$sql_value_replaced.=substr( $sql_value, $startpos );
$sql_value=$sql_value_replaced;
}
return $sql_value;
} | php | {
"resource": ""
} |
q253194 | Web2All_Table_SaveObjectTrait.deleteFromDB | validation | public function deleteFromDB()
{
// first check if keys are available
if (!$this->isValid()) {
return false;
}
if(count($this->key_properties)==0){
// cannot delete without keys
return false;
}
// build where part
$where_part='';
foreach ($this->key_properties as $key) {
if ($where_part) {
$where_part.=' AND ';
}
if ($this->{$key} instanceof Web2All_Table_SQLOperation) {
trigger_error('Web2All_Table_SaveObjectTrait->deleteFromDB(): using Web2All_Table_SQLOperation object for key value '.$key,E_USER_NOTICE);
$where_part.=$this->obj_to_db_trans[$key].'='.$this->{$key}->toSQLString();
}else if ($this->{$key} instanceof Web2All_Table_SQLOperationList) {
throw new Exception("Web2All_Table_SaveObjectTrait: can't delete using a Web2All_Table_SQLOperationList for key value ".$key);
}else{
$where_part.=$this->obj_to_db_trans[$key].'='.$this->db->Quote($this->{$key});
}
}
$this->db->Execute('DELETE FROM '.$this->quote($this->tablename).' WHERE '.$where_part.' ');
return true;
} | php | {
"resource": ""
} |
q253195 | Web2All_Table_SaveObjectTrait.resetAllPropertiesExcept | validation | public function resetAllPropertiesExcept($properties=array())
{
foreach ($this->obj_to_db_trans as $obj_prop => $db_field) {
if( !in_array($obj_prop,$this->key_properties) && !in_array($obj_prop,$properties) ){
$this->{$obj_prop}=null;
}
}
} | php | {
"resource": ""
} |
q253196 | RoutingGenerator.generate | validation | public function generate(RouterInterface $router)
{
$routes = $router->getRouteCollection();
$pagesDir = $this->configurationHandler->pagesDir();
$homepageValues = array(
'_locale' => $this->configurationHandler->language(),
'country' => $this->configurationHandler->country(),
'page' => $this->configurationHandler->homepage(),
);
$homeRouteName = '_home_' . $homepageValues["_locale"] . '_' . $homepageValues["country"] . '_' . $homepageValues["page"];
$this->routes["homepage"] = $homeRouteName;
if ($this->explicitHomepageRoute) {
$values = array_merge($homepageValues, array('_controller' => $this->frontController,));
$routes->add($homeRouteName, new Route($this->pattern, $values));
}
$seoFileName = 'seo.json';
if (null !== $this->contributor) {
$seoFileName = $this->contributor . '.json';
}
$finder = new Finder();
$pages = $finder->directories()->depth(0)->in($pagesDir);
foreach ($pages as $page) {
$this->generateLanguagesRoutes($routes, $page, $seoFileName);
}
} | php | {
"resource": ""
} |
q253197 | AggregateQueue.addQueue | validation | function addQueue($channel, $queue, $weight = 1)
{
$orig = $channel;
$channel = $this->_normalizeQueueName($channel);
if (! $queue instanceof iQueueDriver)
throw new \Exception(sprintf(
'Queue must be instance of iQueueDriver; given: (%s).'
, \Poirot\Std\flatten($queue)
));
if ( isset($this->channels_queue[$channel]) )
throw new \RuntimeException(sprintf(
'Channel (%s) is currently filled with (%s) and is not empty.'
, $orig , get_class( $this->channels_queue[$channel] )
));
$this->channels_queue[$channel] = $queue;
$this->channels_weight[$channel] = $weight;
return $this;
} | php | {
"resource": ""
} |
q253198 | FuelProvider.add | validation | public function add($renderer, $name = null)
{
if (is_null($name))
{
$name = $renderer;
}
$this->renderers[$name] = $renderer;
} | php | {
"resource": ""
} |
q253199 | Collection.remove | validation | public function remove($element)
{
if (!$this->contains($element)) {
return false;
}
$this->offsetUnset($this->indexOf($element));
return true;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.