_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q253600 | Api.decodeHashId | validation | public static function decodeHashId($idHashed)
{
if (! config('odin.hashid.active')) {
return $idHashed;
}
$hashids = App::make('Hashids');
$hashId = $hashids->decode($idHashed);
return (count($hashId) > 0) ? $hashId[0] : '';
} | php | {
"resource": ""
} |
q253601 | Api.encodeHashId | validation | public static function encodeHashId($id)
{
if (! config('odin.hashid.active')) {
return $id;
}
$hashids = App::make('Hashids');
return $hashids->encode($id, date('d'));
} | php | {
"resource": ""
} |
q253602 | HeaderPublisherLocator.getPublisherForMessage | validation | public function getPublisherForMessage(Message $message)
{
$attributes = $message->getAttributes();
if (!isset($attributes['headers']) || !isset($attributes['headers'][$this->headerName])) {
throw MissingPublisherException::noHeaderInMessage($message, $this->headerName);
}
... | php | {
"resource": ""
} |
q253603 | Client.database | validation | public function database($db)
{
$connection = $this->connection;
$connection->db = $db;
$this->constructConnections = $connection;
$connection = class_exists("Clusterpoint\Connection") ? new Connection($this->constructConnections) : new StandartConnection($this->constructConnections... | php | {
"resource": ""
} |
q253604 | SqliteDialect.initialize | validation | public function initialize() {
parent::initialize();
$this->addClauses([
self::DEFERRABLE => 'DEFERRABLE %s',
self::EITHER => 'OR %s',
self::MATCH => 'MATCH %s',
self::NOT_DEFERRABLE => 'NOT DEFERRABLE %s',
sel... | php | {
"resource": ""
} |
q253605 | ExtendableBlock.updateSource | validation | public function updateSource()
{
$source = array(
"value" => $this->value,
"tags" => $this->tags,
"type" => $this->type,
);
$this->source = Yaml::dump($source, 100, 2);
} | php | {
"resource": ""
} |
q253606 | SDIS62_Controller_Action_OauthConsumer.init | validation | public function init()
{
// Récupération du fichier de config
$config = new Zend_Config_Ini(
$this->config_path == null ? APPLICATION_PATH . DS . "configs" . DS . "secret.ini" : $config_path,
APPLICATION_ENV
);
// Initialisation du consumer
$this->setConsum... | php | {
"resource": ""
} |
q253607 | VideoRepository.getNextVideoToConvert | validation | public function getNextVideoToConvert()
{
$query = $this->createQueryBuilder('v');
$this->onlyUploaded($query);
return $query->getQuery()->getOneOrNullResult();
} | php | {
"resource": ""
} |
q253608 | ValidatorAbstract.getOption | validation | protected function getOption($name){
if(!isset($this->options[$name])){
throw new ValueNotFoundException($name);
}
return $this->options[$name];
} | php | {
"resource": ""
} |
q253609 | Headers.set | validation | public function set(string $name, string $value = null) : Headers
{
if ($value !== null) {
header($name . ': ' . $value);
} else {
header($name);
}
return $this;
} | php | {
"resource": ""
} |
q253610 | Client.authenticate | validation | public function authenticate($accountKey, $uniqueUserId, $authMethod = null)
{
if (null === $authMethod) {
$authMethod = self::AUTH_HTTP_TOKEN;
}
$this->getHttpClient()->authenticate($accountKey, $uniqueUserId, $authMethod);
} | php | {
"resource": ""
} |
q253611 | Validator.getArrayItemByPointSeparatedKey | validation | public static function getArrayItemByPointSeparatedKey(array& $data, string $key)
{
if (strpos($key, '.') !== false) {
preg_match('/([a-zA-Z0-9_\-]+)\.([a-zA-Z0-9_\-\.]+)/', $key, $keys);
if (!isset($data[$keys[1]])) {
throw new Exception('Undefined index: '.$keys[1])... | php | {
"resource": ""
} |
q253612 | Validator.addItem | validation | public function addItem(array $item): self
{
if (count($item) < 2) {
throw new Exception('Invalid count of item elements.');
}
$this->items[] = $item;
return $this;
} | php | {
"resource": ""
} |
q253613 | Validator.addRule | validation | public function addRule(string $name, callable $func, $errorMsg = null): self
{
$this->rules[$name] = array($func, $errorMsg);
return $this;
} | php | {
"resource": ""
} |
q253614 | Validator.applyRuleToField | validation | private function applyRuleToField(
string $fieldName,
string $ruleName,
array $options = []
): void {
if (!isset($this->rules[$ruleName])) {
throw new Exception('Undefined rule name.');
}
$func = $this->rules[$ruleName][0];
if (!$func($fieldName, $... | php | {
"resource": ""
} |
q253615 | Validator.run | validation | public function run(): void
{
if (!$this->isRan) {
$this->isRan = true;
foreach ($this->items as $item) {
$options = $item[2] ?? [];
$ruleName = $item[1];
foreach (is_array($item[0]) ? $item[0] : [$item[0]] as $fieldName) {
... | php | {
"resource": ""
} |
q253616 | EqualsBuilder.append | validation | public function append($a, $b = true, $comparatorCallback = null)
{
$this->comparisonList[] = array($a, $b, $comparatorCallback);
return $this;
} | php | {
"resource": ""
} |
q253617 | EqualsBuilder.equals | validation | public function equals()
{
foreach ($this->comparisonList as $valuePair) {
$a = $valuePair[0];
$b = $valuePair[1];
$callback = $valuePair[2];
if (! is_null($callback)) {
if (! is_callable($callback)) {
throw new \InvalidAr... | php | {
"resource": ""
} |
q253618 | Install.superadmin | validation | public function superadmin(User $account, Container $application, Database $database){
//@TODO create master user account
//1. Load the model
$config = $this->config;
//$database = \Library\Database::getInstance();
//2. Prevalidate passwords and other stuff;
$use... | php | {
"resource": ""
} |
q253619 | Install.database | validation | public function database(Container $application){
$config = $this->config;
//Stores all user information in the database;
$dbName = $application->input->getString("dbname", "", "post");
$dbPass = $application->input->getString("dbpassword", "", "post");
$dbHost... | php | {
"resource": ""
} |
q253620 | Help.handle | validation | public function handle(): void
{
/* Help Guide Header */
$help = " -----------------------------------------------------------------\n";
$help .= " | Command Line Interface\n";
$help .= " | See more in https://github.com/senhungwong/command-line-interface\n";
$help .= " -----... | php | {
"resource": ""
} |
q253621 | UnresolvableArgumentException.fromReflectionParam | validation | public static function fromReflectionParam(
ReflectionParameter $param,
ReflectionFunctionAbstract $func = null,
Exception $previous = null,
$afterMessage = null
) {
$message = static::makeMessage($param, $func);
if ($previous) {
$message .= ' - '.$previous->getMessage();
}
if ($afterMessage) {
... | php | {
"resource": ""
} |
q253622 | Logger.interval | validation | public static function interval($startDate, $endDate){
$hits = DB::table('views')->select('id', 'ip', 'created_at')->whereBetween('created_at', [$startDate, $endDate])->groupBy('ip')->get();
return count($hits);
} | php | {
"resource": ""
} |
q253623 | Logger.lastMonth | validation | public static function lastMonth() {
$hits_count = self::interval(Carbon::now()->subMonth()->firstOfMonth(), Carbon::now()->subMonth()->lastOfMonth());
return $hits_count;
} | php | {
"resource": ""
} |
q253624 | Logger.perMonth | validation | public static function perMonth($months = 1, $date_format = "Y-m")
{
$hits_per_month = [];
for ($i = 1; $i <= $months; $i++) {
$hits_count = self::interval(Carbon::now()->subMonths($i)->firstOfMonth(), Carbon::now()->subMonths($i)->lastOfMonth());
$hits_per_month[C... | php | {
"resource": ""
} |
q253625 | Logger.perDay | validation | public static function perDay($days = 1, $date_format = "m-d")
{
$hits_per_day = [];
for ($i = 1; $i <= $days; $i++) {
$hits_count = self::interval(Carbon::now()->subDays($i), Carbon::now()->subDays($i - 1));
$hits_per_day[Carbon::now()->subDays($i)->format($date_format)] =... | php | {
"resource": ""
} |
q253626 | PagesCollectionParser.permalinksByLanguage | validation | public function permalinksByLanguage($language = null)
{
$result = array();
if (null === $language) {
$language = $this->currentLanguage;
}
foreach ($this->pages as $page) {
foreach ($page["seo"] as $pageAttribute) {
if ($pageAttribute["langu... | php | {
"resource": ""
} |
q253627 | PagesCollectionParser.parse | validation | public function parse()
{
$finder = new Finder();
$pages = $finder->directories()->depth(0)->sortByName()->in($this->pagesDir);
$languages = $this->configurationHandler->languages();
$homepage = $this->configurationHandler->homepage();
foreach ($pages as $page) {
... | php | {
"resource": ""
} |
q253628 | ExceptionManager.showErrors | validation | private static function showErrors() {
if (count(static::$errors) > 0) {
$errorsList = '';
foreach (static::$errors as $error) {
$errorsList .= 'Tipo: ' . $error['type'] . '<br>';
$errorsList .= 'Mensaje: ' . $error['message'] . '<br>';
$e... | php | {
"resource": ""
} |
q253629 | DefaultAdapter.logout | validation | public function logout(AdapterChainEvent $e)
{
$session = new Container($this->getStorage()->getNameSpace());
$session->getManager()->forgetMe();
$session->getManager()->destroy();
} | php | {
"resource": ""
} |
q253630 | DefaultAdapter.updateCredentialHash | validation | protected function updateCredentialHash(PasswordableInterface $identityObject, $password)
{
$cryptoService = $this->getMapper()->getPasswordService();
if (!$cryptoService instanceof Bcrypt) {
return $this;
}
$hash = explode('$', $identityObject->getPassword());
i... | php | {
"resource": ""
} |
q253631 | NamespaceOptions.setEntityPrototype | validation | public function setEntityPrototype($entityPrototype)
{
if (!is_object($entityPrototype)) {
throw new Exception\InvalidArgumentException(
sprintf(
'%s expects parameter 1 to be an object, %s provided instead',
__METHOD__,
... | php | {
"resource": ""
} |
q253632 | NamespaceOptions.setHydrator | validation | public function setHydrator($hydrator)
{
if (!is_string($hydrator) && !$hydrator instanceof HydratorInterface) {
throw new Exception\InvalidArgumentException(
sprintf(
'%s expects parameter 1 to be an object of instance Zend\Stdlib\Hydrator\HydratorInterface o... | php | {
"resource": ""
} |
q253633 | GithubPaginator.getPages | validation | public function getPages($startPage, $endPage, $urlStub) {
$pages = [];
//TODO yield this array - after upgrading to php 5.5
for($x=$startPage ; $x<=$endPage ; $x++) {
$pages[] = $urlStub.$x;
}
return $pages;
} | php | {
"resource": ""
} |
q253634 | SiteSavedListener.onSiteSaved | validation | public function onSiteSaved(SiteSavedEvent $event)
{
$fs = new Filesystem();
$fs->mirror(
$this->configurationHandler->uploadAssetsDir(),
$this->configurationHandler->uploadAssetsDirProduction()
);
} | php | {
"resource": ""
} |
q253635 | Job.fill | validation | protected function fill(array $data)
{
$this->uuid = $data["uuid"] ?: "";
$this->status = $data["status"] ?: "";
$this->code = $data["code"] ?: "";
$this->modules = $data["modules"] ?: [];
$this->vars = $data["vars"] ?: [];
$this->error = $data["error"] ?: "";
... | php | {
"resource": ""
} |
q253636 | Builder.listWords | validation | abstract public function __construct(ConnectionInterface $connection);
public function listWords($word, $field = null)
{
$this->where('word','==',$word);
if (!is_null($field)){
$this->scope->listWordsField = $field;
}
else {
$this->scope->listWordsField = '';
}
return $this;
} | php | {
"resource": ""
} |
q253637 | Builder.where | validation | public function where($field, $operator = null, $value = null, $logical = '&&')
{
if ($field instanceof Closure) {
$this->scope->where .= $this->scope->where=='' ? ' (' : $logical.' (';
call_user_func($field, $this);
$this->scope->where .= ') ';
} else {
... | php | {
"resource": ""
} |
q253638 | Builder.orWhere | validation | public function orWhere($field, $operator = null, $value = null)
{
return $this->where($field, $operator, $value, '||');
} | php | {
"resource": ""
} |
q253639 | Builder.select | validation | public function select($select = null)
{
$this->scope->select = Parser::select($select);
return $this;
} | php | {
"resource": ""
} |
q253640 | Builder.orderBy | validation | public function orderBy($field, $order = null)
{
$this->scope->orderBy[] = Parser::orderBy($field, $order);
return $this;
} | php | {
"resource": ""
} |
q253641 | Builder.first | validation | public function first()
{
$this->scope->limit = 1;
$this->scope->offset = 0;
return $this->get(null);
} | php | {
"resource": ""
} |
q253642 | Builder.get | validation | public function get($multiple = true)
{
$scope = $this->scope;
return Parser::get($scope, $this->connection, $multiple);
} | php | {
"resource": ""
} |
q253643 | Builder.update | validation | public function update($id, $document = null)
{
return Parser::update($id, $document, $this->connection);
} | php | {
"resource": ""
} |
q253644 | Builder.replace | validation | public function replace($id, $document = null)
{
return Parser::replace($id, $document, $this->connection);
} | php | {
"resource": ""
} |
q253645 | Builder.transaction | validation | public function transaction()
{
$transaction_id = Parser::beginTransaction($this->connection);
$connection = clone $this->connection;
$connection->transactionId = $transaction_id;
return new Service($connection);
} | php | {
"resource": ""
} |
q253646 | ApprovePageController.approveAction | validation | public function approveAction(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"]),
);
... | php | {
"resource": ""
} |
q253647 | FileCache.exists | validation | public function exists($key) {
$filenameCache = $this->location . DS . $key;
if (file_exists($filenameCache)) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q253648 | FileCache.set | validation | public function set($key, $value) {
try {
$filenameCache = $this->location . DS . $key;
// Escribe el archivo en cache
file_put_contents($filenameCache, $value);
} catch (\Exception $e) {
return false;
}
return true;
} | php | {
"resource": ""
} |
q253649 | YamlConfigurationProvider.load | validation | protected function load()
{
$this->config = array();
if (file_exists($this->filePath)) {
$this->config = Yaml::parse($this->filePath);
}
} | php | {
"resource": ""
} |
q253650 | YamlConfigurationProvider.save | validation | protected function save()
{
$yaml = Yaml::dump($this->config, 2);
file_put_contents($this->filePath, $yaml);
} | php | {
"resource": ""
} |
q253651 | Group.delete | validation | public function delete($groupId)
{
$params = [
'group_id' => intval($groupId),
];
return $this->parseJSON('json', [self::API_DELETE, $params]);
} | php | {
"resource": ""
} |
q253652 | Group.lists | validation | public function lists($begin, $count)
{
$params = [
'begin' => intval($begin),
'count' => intval($count),
];
return $this->parseJSON('json', [self::API_GET_LIST, $params]);
} | php | {
"resource": ""
} |
q253653 | Group.getDetails | validation | public function getDetails($groupId, $begin, $count)
{
$params = [
'group_id' => intval($groupId),
'begin' => intval($begin),
'count' => intval($count),
];
return $this->parseJSON('json', [self::API_GET_DETAIL, $params]);
} | php | {
"resource": ""
} |
q253654 | Group.addDevice | validation | public function addDevice($groupId, array $deviceIdentifiers)
{
$params = [
'group_id' => intval($groupId),
'device_identifiers' => $deviceIdentifiers,
];
return $this->parseJSON('json', [self::API_ADD_DEVICE, $params]);
} | php | {
"resource": ""
} |
q253655 | Group.removeDevice | validation | public function removeDevice($groupId, array $deviceIdentifiers)
{
$params = [
'group_id' => intval($groupId),
'device_identifiers' => $deviceIdentifiers,
];
return $this->parseJSON('json', [self::API_DELETE_DEVICE, $params]);
} | php | {
"resource": ""
} |
q253656 | WingCommander.init | validation | public static function init ($options = array())
{
Flight::map("render", function($template, $data, $toVar = false){
Flight::view()->render($template, $data, $toVar);
});
Flight::register('view', get_called_class(), $options);
} | php | {
"resource": ""
} |
q253657 | ReportTasks.run_coding_style_report | validation | static function run_coding_style_report( $task=null, $args=array(), $cliopts=array() )
{
$opts = self::getOpts( @$args[0], @$args[1], $cliopts );
if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_SH, $opts ) )
throw new PakeException( "Source code locked by another process"... | php | {
"resource": ""
} |
q253658 | ReportTasks.run_copy_paste_report | validation | static function run_copy_paste_report( $task=null, $args=array(), $cliopts=array() )
{
$opts = self::getOpts( @$args[0], @$args[1], $cliopts );
if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_SH, $opts ) )
throw new PakeException( "Source code locked by another process" )... | php | {
"resource": ""
} |
q253659 | ReportTasks.run_php_loc_report | validation | static function run_php_loc_report( $task=null, $args=array(), $cliopts=array() )
{
$opts = self::getOpts( @$args[0], @$args[1], $cliopts );
if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_SH, $opts ) )
throw new PakeException( "Source code locked by another process" );
... | php | {
"resource": ""
} |
q253660 | ReportTasks.run_php_pdepend_report | validation | static function run_php_pdepend_report( $task=null, $args=array(), $cliopts=array() )
{
$opts = self::getOpts( @$args[0], @$args[1], $cliopts );
if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_SH, $opts ) )
throw new PakeException( "Source code locked by another process" ... | php | {
"resource": ""
} |
q253661 | Zend2.dt | validation | public function dt( $domain, $singular )
{
$singular = (string) $singular;
try
{
$locale = $this->getLocale();
foreach( $this->getTranslations( $domain ) as $object )
{
if( ( $string = $object->translate( $singular, $domain, $locale ) ) != $singular ) {
return $string;
}
}
}
catch(... | php | {
"resource": ""
} |
q253662 | Zend2.dn | validation | public function dn( $domain, $singular, $plural, $number )
{
$singular = (string) $singular;
$plural = (string) $plural;
$number = (int) $number;
try
{
$locale = $this->getLocale();
foreach( $this->getTranslations( $domain ) as $object )
{
if( ( $string = $object->translatePlural( $singular, $... | php | {
"resource": ""
} |
q253663 | Zend2.getAll | validation | public function getAll( $domain )
{
$messages = [];
$locale = $this->getLocale();
foreach( $this->getTranslations( $domain ) as $object ) {
$messages = $messages + (array) $object->getMessages( $domain, $locale );
}
return $messages;
} | php | {
"resource": ""
} |
q253664 | Zend2.getTranslations | validation | protected function getTranslations( $domain )
{
if( !isset( $this->translations[$domain] ) )
{
if ( !isset( $this->translationSources[$domain] ) )
{
$msg = sprintf( 'No translation directory for domain "%1$s" available', $domain );
throw new \Aimeos\MW\Translation\Exception( $msg );
}
$locale ... | php | {
"resource": ""
} |
q253665 | BaseApi.getAuthorizationInfo | validation | public function getAuthorizationInfo($authCode = null)
{
$params = [
'component_appid' => $this->getAppId(),
'authorization_code' => $authCode ?: $this->request->get('auth_code'),
];
return $this->parseJSON('json', [self::GET_AUTH_INFO, $params]);
} | php | {
"resource": ""
} |
q253666 | BaseApi.getAuthorizerToken | validation | public function getAuthorizerToken($appId, $refreshToken)
{
$params = [
'component_appid' => $this->getAppId(),
'authorizer_appid' => $appId,
'authorizer_refresh_token' => $refreshToken,
];
return $this->parseJSON('json', [self::GET_AUTHORIZER_TOKEN, $par... | php | {
"resource": ""
} |
q253667 | BaseApi.getAuthorizerInfo | validation | public function getAuthorizerInfo($authorizerAppId)
{
$params = [
'component_appid' => $this->getAppId(),
'authorizer_appid' => $authorizerAppId,
];
return $this->parseJSON('json', [self::GET_AUTHORIZER_INFO, $params]);
} | php | {
"resource": ""
} |
q253668 | BaseApi.getAuthorizerOption | validation | public function getAuthorizerOption($authorizerAppId, $optionName)
{
$params = [
'component_appid' => $this->getAppId(),
'authorizer_appid' => $authorizerAppId,
'option_name' => $optionName,
];
return $this->parseJSON('json', [self::GET_AUTHORIZER_OPTION,... | php | {
"resource": ""
} |
q253669 | BaseApi.setAuthorizerOption | validation | public function setAuthorizerOption($authorizerAppId, $optionName, $optionValue)
{
$params = [
'component_appid' => $this->getAppId(),
'authorizer_appid' => $authorizerAppId,
'option_name' => $optionName,
'option_value' => $optionValue,
];
ret... | php | {
"resource": ""
} |
q253670 | BaseApi.getAuthorizerList | validation | public function getAuthorizerList($offset = 0, $count = 500)
{
$params = [
'component_appid' => $this->getAppId(),
'offset' => $offset,
'count' => $count,
];
return $this->parseJSON('json', [self::GET_AUTHORIZER_LIST, $params]);
} | php | {
"resource": ""
} |
q253671 | ForwardsToCriteria.sort | validation | public function sort($key, $order=Sortable::ASC)
{
$this->criteria->sort($key, $order);
return $this;
} | php | {
"resource": ""
} |
q253672 | ContentRepository.generateContentTypeFilter | validation | protected function generateContentTypeFilter($contentType)
{
$filter = null;
if (!is_null($contentType) && '' != $contentType) {
$filter = array('contentType' => $contentType);
}
return $filter;
} | php | {
"resource": ""
} |
q253673 | PermalinksController.listPermalinksAction | validation | public function listPermalinksAction(Request $request, Application $app)
{
$options = array(
"request" => $request,
"pages_collection_parser" => $app["red_kite_cms.pages_collection_parser"],
"username" => $this->fetchUsername($app["security"], $app["red_kite_cms.configura... | php | {
"resource": ""
} |
q253674 | Calc.getMaxPercentForInfinityBonus | validation | private function getMaxPercentForInfinityBonus($cfgParams, $scheme)
{
$result = 0;
$params = $cfgParams[$scheme];
/** @var ECfgParam $item */
foreach ($params as $item) {
$percent = $item->getInfinity();
if ($percent > $result) {
$result = $per... | php | {
"resource": ""
} |
q253675 | Calc.shouldInterruptInfinityBonus | validation | private function shouldInterruptInfinityBonus($percent, $percentParent)
{
$result = false;
if (
($percentParent > 0) &&
($percentParent <= $percent)
) {
$result = true;
}
return $result;
} | php | {
"resource": ""
} |
q253676 | Form.add | validation | public function add($id, IFormField $field)
{
$field->setId($id);
return $this->addFormField($field);
} | php | {
"resource": ""
} |
q253677 | Form.addExtra | validation | public function addExtra($id, IFormField $formField)
{
$formField->setId($id);
return $this->addFormField($formField, true);
} | php | {
"resource": ""
} |
q253678 | Form.addFormField | validation | public function addFormField(IFormField $field, $isExtra = false)
{
$fieldId = $field->getId();
if (empty($fieldId)) {
throw new \LogicException('The access path of a form field must not be empty');
}
// setup the field and remember it
$field->setParent($this);
... | php | {
"resource": ""
} |
q253679 | Form.get | validation | public function get($id)
{
if (isset($this->children[$id])) {
return $this->children[$id];
}
throw new FormalException(
"Unknown form field '$id' on form '" . get_called_class() . "'. Available fields are: " . implode(', ', array_keys($this->children))
);
... | php | {
"resource": ""
} |
q253680 | Chameleon.render | validation | public function render($template, $data) {
$tplReady = '';
$this->template = $template;
$this->data = $data;
if ($this->loadTemplate()) {
$tplReady = $this->dataRender;
}
// Se verifica si hay que minificar el resultado
if (Settings::getInstance()->g... | php | {
"resource": ""
} |
q253681 | Container.get | validation | public function get($key)
{
if (!isset($this->instances[$key])) {
throw new \LogicException('No instance for given key! (key: ' . $key . ')');
}
return $this->instances[$key];
} | php | {
"resource": ""
} |
q253682 | Container.attach | validation | public function attach($key, $instance, $type = self::OBJECT)
{
switch ($type) {
case self::OBJECT:
case self::CACHE:
if (!is_object($instance)) {
throw new \LogicException('Instance is not an object!');
}
break;
... | php | {
"resource": ""
} |
q253683 | Container.detach | validation | public function detach($key)
{
if (isset($this->instances[$key])) {
unset($this->instances[$key]);
}
return $this;
} | php | {
"resource": ""
} |
q253684 | TaskQueue.add | validation | public function add(InvokerInterface $invoker, $taskArgs = [])
{
$taskArgs = (is_array($taskArgs) ? $taskArgs : array_slice(func_get_args(), 1));
array_unshift($this->tasks, compact('invoker', 'taskArgs'));
return $this;
} | php | {
"resource": ""
} |
q253685 | GD_Resize.run | validation | public static function run($source, $destination, $width, $height = "")
{
// Get the image's MIME
$mime = exif_imagetype($source);
// Check if the MIME is supported
switch ($mime) {
case IMAGETYPE_JPEG :
$source = imagecreatefromjpeg($source);
... | php | {
"resource": ""
} |
q253686 | GetPlainData.getPlainCalcId | validation | private function getPlainCalcId($period)
{
if ($period) {
$dsMax = $this->hlpPeriod->getPeriodLastDate($period);
} else {
$dsMax = Cfg::DEF_MAX_DATESTAMP;
}
/* prepare query */
$query = $this->qbCalcGetLast->build();
$bind = [
QBCal... | php | {
"resource": ""
} |
q253687 | ContainerAwareTrait._setContainer | validation | protected function _setContainer($container)
{
if (!is_null($container) && !($container instanceof BaseContainerInterface)) {
throw $this->_createInvalidArgumentException($this->__('Not a valid container'), 0, null, $container);
}
$this->container = $container;
return $... | php | {
"resource": ""
} |
q253688 | BuildTasks.run_build_dependencies | validation | static function run_build_dependencies( $task=null, $args=array(), $cliopts=array() )
{
$opts = self::getOpts( @$args[0], @$args[1], $cliopts );
$current = $opts['extension']['name'];
foreach( $opts['dependencies']['extensions'] as $ext => $source )
{
// avoid loops... | php | {
"resource": ""
} |
q253689 | BuildTasks.run_update_ezinfo | validation | static function run_update_ezinfo( $task=null, $args=array(), $cliopts=array() )
{
$opts = self::getOpts( @$args[0], @$args[1], $cliopts );
if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_EX, $opts ) )
throw new PakeException( "Source code locked by another process" );
... | php | {
"resource": ""
} |
q253690 | BuildTasks.run_check_gnu_files | validation | static function run_check_gnu_files( $task=null, $args=array(), $cliopts=array() )
{
$opts = self::getOpts( @$args[0], @$args[1], $cliopts );
if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_SH, $opts ) )
throw new PakeException( "Source code locked by another process" );
... | php | {
"resource": ""
} |
q253691 | BuildTasks.run_check_templates | validation | static function run_check_templates( $task=null, $args=array(), $cliopts=array() )
{
$opts = self::getOpts( @$args[0], @$args[1], $cliopts );
if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_SH, $opts ) )
throw new PakeException( "Source code locked by another process" );
... | php | {
"resource": ""
} |
q253692 | BuildTasks.run_check_php_files | validation | static function run_check_php_files( $task=null, $args=array(), $cliopts=array() )
{
$opts = self::getOpts( @$args[0], @$args[1], $cliopts );
if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_SH, $opts ) )
throw new PakeException( "Source code locked by another process" );
... | php | {
"resource": ""
} |
q253693 | BuildTasks.run_update_package_xml | validation | static function run_update_package_xml( $task=null, $args=array(), $cliopts=array() )
{
/// @todo replace hostname, build time
$opts = self::getOpts( @$args[0], @$args[1], $cliopts );
if ( !SharedLock::acquire( $opts['extension']['name'], LOCK_EX, $opts ) )
throw new PakeE... | php | {
"resource": ""
} |
q253694 | BuildTasks.run_generate_sample_package_xml | validation | static function run_generate_sample_package_xml( $task=null, $args=array(), $cliopts=array() )
{
pake_copy( self::getResourceDir() . '/package_master.xml', 'package.xml' );
// tokens not replaced here are replaced at build time
// tokens in square brackets are supposed to be edited by th... | php | {
"resource": ""
} |
q253695 | FactoryAction.create | validation | public function create($entity, $action)
{
$type = ucfirst($entity);
$actionName = ucfirst($action);
$class = sprintf('RedKiteCms\Action\%s\%s%sAction', $type, $actionName, $type);
if (!class_exists($class)) {
return null;
}
$reflectionClass = new \Refle... | php | {
"resource": ""
} |
q253696 | Plugin.hasToolbar | validation | public function hasToolbar()
{
$fileSkeleton = '/Resources/views/Editor/Toolbar/_toolbar_%s_buttons.html.twig';
return file_exists($this->pluginDir . sprintf($fileSkeleton, 'left')) || file_exists($this->pluginDir . sprintf($fileSkeleton, 'right'));
} | php | {
"resource": ""
} |
q253697 | Plugin.installAssets | validation | public function installAssets($targetFolder = "web", $force = false)
{
$sourceDir = $this->pluginDir . '/Resources/public';
$targetDir = $this->rootDir . '/' . $targetFolder . '/plugins/' . strtolower($this->name);
if (is_dir($targetDir) && !$force) {
return;
}
$... | php | {
"resource": ""
} |
q253698 | Web2All_Table_Object.onSuccessLoad | validation | protected function onSuccessLoad()
{
if ($this->Web2All->DebugLevel>Web2All_Manager_Main::DEBUGLEVEL_MEDIUM) {
$this->Web2All->debugLog('Web2All_Table_Object::loadFromTable(): loaded: '.$this->asDebugString());
}
} | php | {
"resource": ""
} |
q253699 | BlogController.createCommentForm | validation | private function createCommentForm(CommentFront $model, $entity)
{
$form = $this->createForm('BlogBundle\Form\CommentFrontType', $model, array(
'action' => $this->generateUrl('blog_blog_comment', array('post' => $entity->getId())),
'method' => 'POST',
'attr' => array('id'... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.