_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q30900 | User.generatePasswordResetHash | train | public function generatePasswordResetHash()
{
$hashProvider = HashProvider::getProvider();
$hash = sha1($hashProvider->createHash($this->UserID . uniqid(), uniqid("salt")));
$this->PasswordResetHash = $hash;
$this->PasswordResetDate = "now";
$this->save();
return $h... | php | {
"resource": ""
} |
q30901 | User.getSavedPasswordTokenData | train | private function getSavedPasswordTokenData()
{
if ($this->isNewRecord()) {
// We can't fulfil the request as we have no UserID which is required for the StringColumn.
throw new TokenException("The user has not been saved");
}
return sha1($this->Username . $this->Pass... | php | {
"resource": ""
} |
q30902 | User.createToken | train | public function createToken()
{
$hashProvider = HashProvider::getProvider();
$token = $hashProvider->createHash($this->getSavedPasswordTokenData(), sha1($this->Password));
$this->Token = $token;
$this->TokenExpiry = date("Y-m-d H:i:s", strtotime("+2 weeks"));
$this->save();
... | php | {
"resource": ""
} |
q30903 | User.validateToken | train | public function validateToken($token)
{
// The token must match of course.
if ($this->Token != $token) {
return false;
}
// Has the token expired?
if (strtotime($this->TokenExpiry) < time()) {
return false;
}
$hashProvider = HashProvi... | php | {
"resource": ""
} |
q30904 | Checkout.postage | train | public function postage()
{
// If no estimate found, generate error
if (!$this->hasEstimate()) {
return $this->redirect($this->Link("noestimate"));
}
$config = SiteConfig::current_site_config();
$member = Security::getCurrentUser();
$estimate = $t... | php | {
"resource": ""
} |
q30905 | Checkout.complete | train | public function complete()
{
$session = $this
->getRequest()
->getSession();
$site = SiteConfig::current_site_config();
$id = $this->request->param('ID');
$error = ($id == "error") ? true : false;
if ($error) {
$return = [
... | php | {
"resource": ""
} |
q30906 | Checkout.noestimate | train | public function noestimate()
{
// If the shoppingcart module is installed we should
// redirect to it when estimate is lost.
if (class_exists(ShoppingCartFactory::class)) {
$shopping_cart = ShoppingCartFactory::create()->getCurrent();
return $this->redirect($shopping_... | php | {
"resource": ""
} |
q30907 | Checkout.CustomerForm | train | public function CustomerForm()
{
// If no estimate found, generate error
if (!$this->hasEstimate()) {
return $this->redirect($this->Link("noestimate"));
}
$session = $this
->getRequest()
->getSession();
$member = Security::getCurrentUser(... | php | {
"resource": ""
} |
q30908 | Checkout.PostageForm | train | public function PostageForm()
{
// If no estimate found, generate error
if (!$this->hasEstimate()) {
return $this->redirect($this->Link("noestimate"));
}
$estimate = $this->getEstimate();
$form = PostageForm::create(
$this,
"PostageForm",... | php | {
"resource": ""
} |
q30909 | Checkout.GatewayForm | train | public function GatewayForm()
{
// If no estimate found, generate error
if (!$this->hasEstimate()) {
return $this->redirect($this->Link("noestimate"));
}
$actions = FieldList::create();
try {
// Get available payment methods and setup payment
... | php | {
"resource": ""
} |
q30910 | Checkout.PaymentForm | train | public function PaymentForm()
{
// If no estimate found, generate error
if (!$this->hasEstimate()) {
return $this->redirect($this->Link("noestimate"));
}
$factory = new GatewayFieldsFactory($this->getPaymentMethod());
$form = Form::create(
$t... | php | {
"resource": ""
} |
q30911 | Checkout.doUpdatePayment | train | public function doUpdatePayment($data, $form)
{
$session = $this
->getRequest()
->getSession();
$session->set(
"Checkout.PaymentMethodID",
$data["PaymentMethodID"]
);
return $this->redirectBack();
} | php | {
"resource": ""
} |
q30912 | EventsHandler.fetchEvent | train | protected function fetchEvent($eventName)
{
return (array_key_exists($eventName, $this->events)) ? $this->events[$eventName] : null;
} | php | {
"resource": ""
} |
q30913 | ContainerFactory.build | train | public function build(array $config)
{
$container = new Container();
foreach ((array) $config as $name => $component) {
if (!is_array($component) || !array_key_exists('component', $component)) {
$container->register($name, $component);
continue;
... | php | {
"resource": ""
} |
q30914 | ContainerFactory.applyDefaults | train | public function applyDefaults($definition)
{
if (!is_array($definition) || !isset($definition['component'])) {
return $definition;
}
if (is_callable($definition['component'])) {
return array_merge($this->callableDefaults, $definition);
}
if (!isset($... | php | {
"resource": ""
} |
q30915 | ContainerFactory.buildDefinition | train | public function buildDefinition($definition)
{
if (is_callable($definition)) {
return $definition;
}
if (array_key_exists('class', $definition)) {
return new Component(
$definition['class'],
$definition['arguments'] ?: [],
... | php | {
"resource": ""
} |
q30916 | Factory.registerDecorator | train | public function registerDecorator($configKey, $className)
{
if (isset($this->decorators[$configKey])) {
throw new \RuntimeException('Decorator key already in use: ' . $configKey);
}
if (in_array($className, $this->decorators)) {
throw new \RuntimeException('Decorator ... | php | {
"resource": ""
} |
q30917 | Factory.unregisterDecorator | train | public function unregisterDecorator($configKey)
{
if (!isset($this->decorators[$configKey])) {
throw new \RuntimeException('Decorator key not registered: ' . $configKey);
}
unset($this->decorators[$configKey]);
} | php | {
"resource": ""
} |
q30918 | Factory.applyDecorators | train | private function applyDecorators(LoggerInterface $logger, array $config)
{
foreach ($this->decorators as $configKey => $decoratorClassName) {
if (!isset($config[$configKey])) {
continue;
}
if (!class_exists($decoratorClassName)) {
throw new... | php | {
"resource": ""
} |
q30919 | UUID.toString | train | public function toString(bool $compact = false): string
{
if ($compact) {
return \bin2hex($this->value);
}
return \vsprintf('%s%s-%s-%s-%s-%s%s%s', \str_split(\bin2hex($this->value), 4));
} | php | {
"resource": ""
} |
q30920 | EmailServices.sendEmail | train | public static function sendEmail($data)
{
$data = self::setTemplate($data);
if(isset($data['html']) && isset($data['text']))
{
Mail::send(['pulsar::common.views.html_display', 'pulsar::common.views.text_display'], $data, function ($message) use ($data) {
$message... | php | {
"resource": ""
} |
q30921 | Game.previousStep | train | public function previousStep($step = null)
{
$steps = $this->getStepsArray();
$key = array_search($step, $steps);
if (is_int($key) && $key > 0) {
return $steps[$key-1];
}
return false;
} | php | {
"resource": ""
} |
q30922 | Game.nextStep | train | public function nextStep($step = null)
{
$steps = $this->getStepsArray();
$key = array_search($step, $steps);
if (is_int($key) && $key < count($steps)-1) {
return $steps[$key+1];
}
return false;
} | php | {
"resource": ""
} |
q30923 | Request.getRouteURL | train | public function getRouteURL()
{
if (empty($this->routeUrl)) {
$param = trim(Server::get('REQUEST_URI'), '/');
// strip base directory from request url
$base_dir = $this->getBaseDir();
$param = substr($param, strlen($base_dir));
// Strip query str... | php | {
"resource": ""
} |
q30924 | Request.getBaseDir | train | public function getBaseDir()
{
if (empty($this->baseDir)) {
$this->baseDir = trim(str_replace('index.php', '', Server::get('SCRIPT_NAME')), '/');
}
return $this->baseDir;
} | php | {
"resource": ""
} |
q30925 | Request.getAppURL | train | public function getAppURL()
{
if (empty($this->appURL)) {
$hostname = $this->getHostname();
if (empty($hostname)) {
$this->appURL = config('app.url');
} else {
$protocol = $this->getProtocol();
$this->appURL = ($protocol ?: ... | php | {
"resource": ""
} |
q30926 | Request.input | train | public function input($key = null, $default = null)
{
if ($key) {
return $this->get($key, $default);
} else {
return $this->all();
}
} | php | {
"resource": ""
} |
q30927 | Request.hasFile | train | public function hasFile($name)
{
//See if it makes sense to use dot notation
if (isset($_FILES[$name])) {
$file = $_FILES[$name];
return isset($file['tmp_name']) && file_exists($file['tmp_name']) && is_uploaded_file($file['tmp_name']);
}
return false;
// ... | php | {
"resource": ""
} |
q30928 | MigrationHelper.createForeignKeyName | train | public static function createForeignKeyName($table, $columns, $refTable)
{
$column = is_array($columns) ? implode('_', $columns) . '_' : '';
return preg_replace('/[^\w_-]/', '', "FK_{$table}_{$column}{$refTable}");
} | php | {
"resource": ""
} |
q30929 | MigrationHelper.createIndex | train | public static function createIndex($table, $columns, $unique = false)
{
return Yii::$app->db->createCommand()
->createIndex($table .'_'.implode('-', (array) $columns) . '_idx', $table, $columns, $unique)
->execute();
} | php | {
"resource": ""
} |
q30930 | MigrationHelper.addPrimaryKey | train | public static function addPrimaryKey($table, $columns)
{
return Yii::$app->db->createCommand()
->addPrimaryKey($table .'_pk', $table, $columns)
->execute();
} | php | {
"resource": ""
} |
q30931 | MigrationHelper.toBatchData | train | public static function toBatchData($data, $adds = [])
{
foreach ($data as $k => $v) {
$data[$k] = array_merge([$v], $adds);
}
return $data;
} | php | {
"resource": ""
} |
q30932 | MigrationHelper.insertUpdate | train | public static function insertUpdate($tableName, $columns, $data, $db = 'db')
{
if (!$data) {
return false;
}
foreach ($data as $key => $row) {
$data[$key] = array_values($row);
}
$sql = \Yii::$app->$db->createCommand()->batchInsert($tableName, $columns... | php | {
"resource": ""
} |
q30933 | MigrationHelper.tableForeignKeys | train | public static function tableForeignKeys($tableName)
{
$result = ['inner' => [], 'outer' => []];
foreach (Yii::$app->db->schema->tableSchemas as $table) {
$foreignKeys = static::findConstraints($table);
/** @var TableSchema $table */
if ($table->name == $tableName)... | php | {
"resource": ""
} |
q30934 | MigrationHelper.getCreateTableSql | train | protected static function getCreateTableSql($table)
{
$db = Yii::$app->db;
$row = $db->createCommand('SHOW CREATE TABLE ' . $db->schema->quoteTableName($table->fullName))->queryOne();
if (isset($row['Create Table'])) {
$sql = $row['Create Table'];
} else {
$ro... | php | {
"resource": ""
} |
q30935 | SimpleEventBus.receiveEvent | train | public function receiveEvent(Event $event): void
{
$event->freeze();
$schema = $event::schema();
$curie = $schema->getCurie();
$vendor = $curie->getVendor();
$package = $curie->getPackage();
$category = $curie->getCategory();
foreach ($schema->getMixinIds() ... | php | {
"resource": ""
} |
q30936 | Client.escape | train | public function escape($string)
{
if(!$this->isConnected())
{
$this->connect();
if(!$this->isConnected()) return false;
}
return $this->_escape($string);
} | php | {
"resource": ""
} |
q30937 | DataManager.fromRequest | train | public function fromRequest(Request $request)
{
$pageName = $request->get('page');
$language = $request->get('_locale');
$permalink = $request->get('permalink');
$options = array(
"pageName" => $pageName,
"languageName" => $language,
"permalink" =>... | php | {
"resource": ""
} |
q30938 | DataManager.fromEntities | train | public function fromEntities(Language $language = null, Page $page = null)
{
$this->language = $language;
$this->page = $page;
if (null !== $this->language && null !== $this->page) {
$options = array(
"languageId" => $this->language->getId(),
"page... | php | {
"resource": ""
} |
q30939 | DataManager.fromOptions | train | public function fromOptions(array $options)
{
$this->seo = $this->setupSeo($options);
if (null !== $this->seo) {
$this->language = $this->seo->getLanguage();
$this->page = $this->seo->getPage();
}
} | php | {
"resource": ""
} |
q30940 | Facade.render | train | public function render($sViewName, array $aViewData = array())
{
// Get the store
$store = $this->store();
// Get the default view namespace
$sNamespace = $this->sNamespace;
// Get the namespace from the view name
$iSeparatorPosition = strrpos($sViewName, '::');
... | php | {
"resource": ""
} |
q30941 | TemplateManager.getSlotManager | train | public function getSlotManager($slotName)
{
if ( ! is_string($slotName)) {
return null;
}
return (array_key_exists($slotName, $this->slotManagers)) ? $this->slotManagers[$slotName] : null;
} | php | {
"resource": ""
} |
q30942 | TemplateManager.slotToArray | train | public function slotToArray($slotName)
{
if (!is_string($slotName)) {
throw new InvalidArgumentTypeException('exception_slotToArray_accepts_only_strings');
}
if (!array_key_exists($slotName, $this->slotManagers)) {
return array();
}
$slotManager = $t... | php | {
"resource": ""
} |
q30943 | TemplateManager.slotsToArray | train | public function slotsToArray()
{
$slotContents = array();
foreach ($this->slotManagers as $slotName => $slot) {
$slotContents[$slotName] = $slot->getBlockManagersCollection()->toArray();
}
return $slotContents;
} | php | {
"resource": ""
} |
q30944 | TemplateManager.refresh | train | public function refresh(ThemeSlotsInterface $themeSlots, Template $template = null, PageBlocksInterface $pageBlocks = null)
{
$this->themeSlots = $themeSlots;
$this->template = $template;
$this->pageBlocks = $pageBlocks;
$this->setUpSlotManagers();
return $this;
} | php | {
"resource": ""
} |
q30945 | TemplateManager.populate | train | public function populate($idLanguage, $idPage, $skipRepeated = false)
{
try {
$this->dispatcher->dispatch(Content\TemplateManagerEvents::BEFORE_POPULATE, new Content\TemplateManager\BeforePopulateEvent($this));
$result = false;
$this->blockRepository->startTransaction();... | php | {
"resource": ""
} |
q30946 | TemplateManager.clearBlocks | train | public function clearBlocks($skipRepeated = true)
{
try {
$result = null;
$this->dispatcher->dispatch(Content\TemplateManagerEvents::BEFORE_CLEAR_BLOCKS, new Content\TemplateManager\BeforeClearBlocksEvent($this));
$this->blockRepository->startTransaction();
f... | php | {
"resource": ""
} |
q30947 | TemplateManager.clearPageBlocks | train | public function clearPageBlocks($languageId, $pageId, $skipRepeated = true)
{
try {
$this->blockRepository->startTransaction();
$pageBlocks = clone($this->pageBlocks);
$this->pageBlocks->refresh($languageId, $pageId);
$result = $this->clearBlocks($skipRepeat... | php | {
"resource": ""
} |
q30948 | TemplateManager.setUpSlotManagers | train | protected function setUpSlotManagers()
{
if (null === $this->themeSlots || null === $this->template) {
return;
}
$this->slotManagers = array();
$templateSlots = $this->template->getSlots();
$themeSlots = $this->themeSlots->getSlots();
foreach ($themeSlots... | php | {
"resource": ""
} |
q30949 | TemplateManager.createSlotManager | train | protected function createSlotManager(Slot $slot)
{
$slotName = $slot->getSlotName();
$blocks = array();
if (null !== $this->pageBlocks) {
$blocks = $this->pageBlocks->getSlotBlocks($slotName);
}
$slotManager = new SlotManager($slot, $this->blockRepository, $this->... | php | {
"resource": ""
} |
q30950 | TemplateManager.isIncluded | train | private function isIncluded($slotName)
{
if ( ! preg_match('/^([0-9]+)\-/', $slotName, $matches)) {
return false;
}
// @codeCoverageIgnoreStart
$blockId = $matches[1];
$slotBlocks = $this->pageBlocks->getBlocks();
foreach ($slotBlocks as $blocks) {
... | php | {
"resource": ""
} |
q30951 | MessageBroker.publish | train | public function publish($payload, $routingKey = null, $deliveryMode = 1)
{
if (empty($payload)) {
throw new Exception('publish: payload not set.');
}
$channel = $this->connection->channel();
// Exchange setup
$this->setupExchange($this->exchangeOptions['name'],... | php | {
"resource": ""
} |
q30952 | MessageBroker.consume | train | public function consume($callback, $consumeAmount = null)
{
$channel = $this->connection->channel();
// Exchange setup
$this->setupExchange($this->exchangeOptions['name'], $this->exchangeOptions['type'], $channel);
foreach ($this->queueOptions as $queueOption) {
// Que... | php | {
"resource": ""
} |
q30953 | MessageBroker.getAllMessages | train | public function getAllMessages($callback)
{
$channel = $this->connection->channel();
// Exchange setup
$this->setupExchange($this->exchangeOptions['name'], $this->exchangeOptions['type'], $channel);
foreach ($this->queueOptions as $queueOption) {
// Queue setup
... | php | {
"resource": ""
} |
q30954 | MessageBroker.sendAck | train | public function sendAck($payload)
{
if (empty($payload->delivery_info['delivery_tag'])) {
throw new Exception('sendAck: delivery_tag not set.');
}
$payload->delivery_info['channel']->basic_ack($payload->delivery_info['delivery_tag']);
} | php | {
"resource": ""
} |
q30955 | MessageBroker.sendNack | train | public function sendNack($payload, $purge = false, $requeue = true)
{
if (empty($payload->delivery_info['delivery_tag'])) {
throw new Exception('sendNack: delivery_tag not set.');
}
$payload->delivery_info['channel']->basic_nack($payload->delivery_info['delivery_tag'], $purge, ... | php | {
"resource": ""
} |
q30956 | MessageBroker.setupExchange | train | public function setupExchange($exchangeName, $exchangeType, $channel)
{
$channel->exchange_declare(
$exchangeName,
$exchangeType,
$this->exchangeOptions['passive'],
$this->exchangeOptions['durable'],
$this->exchangeOptions['auto_delete']
)... | php | {
"resource": ""
} |
q30957 | MessageBroker.setupQueue | train | public function setupQueue($queueName, $channel)
{
foreach ($this->queueOptions as $queue => $queueOption) {
if ($queueOption['name'] == $queueName) {
$status = $channel->queue_declare(
$queueName,
$queueOption['passive'],
... | php | {
"resource": ""
} |
q30958 | MessageBroker.stop | train | public function stop()
{
if (!empty($this->channel)) {
echo 'Stopping consumer by removing callbacks.' . PHP_EOL;
$this->channel->callbacks = null;
return true;
} else {
return false;
}
} | php | {
"resource": ""
} |
q30959 | eZFlowServerCallFunctions.onlineUsers | train | public static function onlineUsers( $args )
{
$result = array();
$result['logged_in_count'] = eZFunctionHandler::execute( 'user', 'logged_in_count', array() );
$result['anonymous_count'] = eZFunctionHandler::execute( 'user', 'anonymous_count', array() );
return $result;
} | php | {
"resource": ""
} |
q30960 | eZFlowServerCallFunctions.getValidItems | train | public static function getValidItems( $args )
{
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
$result = array();
$blockID = $http->postVariable('block_id');
$offset = $http->postVariable('offset');
$limit = $http->postVariable('limit');
$val... | php | {
"resource": ""
} |
q30961 | eZFlowServerCallFunctions.updateblockorder | train | public static function updateblockorder( $args )
{
$http = eZHTTPTool::instance();
$contentObjectAttributeID = (int)$http->postVariable( 'contentobject_attribute_id', 0 );
$version =(int)$http->postVariable( 'version', 0 );
$zoneID = $http->postVariable( 'zone', '' );
$block... | php | {
"resource": ""
} |
q30962 | Consumer.getAuthorization | train | public function getAuthorization($signature, $string = true)
{
//argument test
Argument::i()
//Argument 1 must be a string
->test(1, 'string')
//Argument 2 must be a boolean
->test(2, 'bool');
//this is all possible configurations
... | php | {
"resource": ""
} |
q30963 | Consumer.getDomDocumentResponse | train | public function getDomDocumentResponse(array $query = array())
{
$xml = new DOMDocument();
$xml->loadXML($this->getResponse($query));
return $xml;
} | php | {
"resource": ""
} |
q30964 | Consumer.getHmacSha1Signature | train | public function getHmacSha1Signature(array $query = array())
{
//this is like the authorization params minus the realm and signature
$params = array(
'oauth_consumer_key' => $this->consumerKey,
'oauth_token' => $this->requestToken,
'oauth_signature_method' => self... | php | {
"resource": ""
} |
q30965 | Consumer.getJsonResponse | train | public function getJsonResponse(array $query = array(), $assoc = true)
{
//argument 2 must be bool
Argument::i()->test(2, 'bool');
return json_decode($this->getResponse($query), $assoc);
} | php | {
"resource": ""
} |
q30966 | Consumer.getResponse | train | public function getResponse(array $query = array())
{
$headers = $this->headers;
$json = null;
if ($this->json) {
$json = json_encode($query);
$query = array();
}
//get the authorization parameters as an array
$signature = ... | php | {
"resource": ""
} |
q30967 | Consumer.getSignature | train | public function getSignature(array $query = array())
{
switch ($this->signature) {
case self::HMAC_SHA1:
return $this->getHmacSha1Signature($query);
case self::RSA_SHA1:
case self::PLAIN_TEXT:
default:
return $this->getHmacPlain... | php | {
"resource": ""
} |
q30968 | Consumer.setToken | train | public function setToken($token, $secret)
{
Argument::i()
//argument 1 must be a string
->test(1, 'string')
//argument 2 must be a string
->test(2, 'string');
$this->requestToken = $token;
$this->requestSecret = $secret;
... | php | {
"resource": ""
} |
q30969 | CustomerObserver.initializeCustomer | train | protected function initializeCustomer(array $attr)
{
// load the customer with the passed SKU and merge it with the attributes
if ($entity = $this->loadCustomerByEmailAndWebsiteId($attr[MemberNames::EMAIL], $attr[MemberNames::WEBSITE_ID])) {
return $this->mergeEntity($entity, $attr);
... | php | {
"resource": ""
} |
q30970 | CustomerObserver.getGenderByValue | train | public function getGenderByValue($value)
{
// query whether or not, the requested gender ID is available
if (isset($this->availableGenders[$value])) {
return (integer) $this->availableGenders[$value];
}
// throw an exception, if not
throw new \Exception(
... | php | {
"resource": ""
} |
q30971 | NamespaceContext.compile | train | public function compile(): string
{
$code = 'new \\' . \get_class($this) . '(';
$code .= \var_export($this->namespace, true) . ', [';
$index = 0;
foreach ($this->imports as $k => $v) {
if ($index++ != 0) {
$code .= ', ';
}
... | php | {
"resource": ""
} |
q30972 | NamespaceContext.hasImport | train | public function hasImport(string $importName): bool
{
return \array_key_exists(\strtolower(\trim($importName, '\\')), $this->imports);
} | php | {
"resource": ""
} |
q30973 | NamespaceContext.addImport | train | public function addImport(string $importName): NamespaceContext
{
$importName = \trim($importName, '\\');
if (false !== ($offset = \strrpos($importName, '\\'))) {
$this->imports[\strtolower(\substr($importName, $offset + 1))] = $importName;
} else {
$this->im... | php | {
"resource": ""
} |
q30974 | NamespaceContext.addAliasedImport | train | public function addAliasedImport(string $aliasName, string $importName): NamespaceContext
{
$this->imports[\strtolower(\trim($aliasName))] = \trim($importName, '\\');
return $this;
} | php | {
"resource": ""
} |
q30975 | NamespaceContext.lookup | train | public function lookup(string $localType): string
{
$localType = \trim($localType);
if ($localType === '') {
return $this->namespace;
}
if ($localType[0] === '\\') {
return \trim($localType, '\\');
}
$type = \strtolow... | php | {
"resource": ""
} |
q30976 | eZSquidCacheManager.isEnabled | train | public static function isEnabled()
{
$ini = eZINI::instance( 'squid.ini' );
if ( $ini->hasSection( 'Squid' )
&& $ini->hasVariable( 'Squid', 'PurgeCacheOnPublish' )
&& $ini->variable( 'Squid', 'PurgeCacheOnPublish' ) == 'enabled' )
{
... | php | {
"resource": ""
} |
q30977 | ParametersValidatorLanguageManager.languageExists | train | public function languageExists($laguageName)
{
$language = $this->languageRepository->fromLanguageName($laguageName);
return (null !== $language && count($language) > 0) ? true : false;
} | php | {
"resource": ""
} |
q30978 | Table.addField | train | public function addField(Field $field, Key $key = null)
{
if (null !== $key) {
$field->setKey($key);
}
$this->fields[$field->getName()] = $field;
return $this;
} | php | {
"resource": ""
} |
q30979 | Formatter.asInteger | train | public function asInteger($value, $options = [], $textOptions = [])
{
if ($value === null) {
return $this->nullDisplay;
}
$value = $this->normalizeNumericValue($value);
if ($this->_intlLoaded) {
$f = $this->createNumberFormatter(NumberFormatter::DECIMAL, null,... | php | {
"resource": ""
} |
q30980 | Formatter.normalizeNumericValue | train | protected function normalizeNumericValue($value)
{
if (empty($value)) {
return 0;
}
if (is_string($value) && is_numeric($value)) {
$value = (float) $value;
}
if (!is_numeric($value)) {
throw new InvalidParamException("'$value' is not a nume... | php | {
"resource": ""
} |
q30981 | Eden_Array_Index.copy | train | public function copy($source, $destination)
{
Eden_Array_Argument::i()
//argument 1 must be a string
->test(1, 'string')
//argument 2 must be a string
->test(2, 'string');
$this->data[$destination] = $this->data[$source];
return $this;
... | php | {
"resource": ""
} |
q30982 | Eden_Array_Index.cut | train | public function cut($key)
{
//argument 1 must be scalar
Eden_Array_Argument::i()->test(1, 'scalar');
//if nothing to cut
if (!isset($this->data[$key])) {
//do nothing
return $this;
}
//unset the value
unset($this->data[$key]);
... | php | {
"resource": ""
} |
q30983 | Eden_Array_Index.get | train | public function get($modified = true)
{
//argument 1 must be a bool
Eden_Array_Argument::i()->test(1, 'bool');
return $modified ? $this->data : $this->original;
} | php | {
"resource": ""
} |
q30984 | Eden_Array_Index.paste | train | public function paste($after, $value, $key = null)
{
//Argument test
Eden_Array_Argument::i()
//Argument 1 must be a scalar
->test(1, 'scalar')
//Argument 3 must be a scalar or null
->test(3, 'scalar', 'null');
$list = arr... | php | {
"resource": ""
} |
q30985 | ReflectionFactory.create | train | public static function create($function) : \ReflectionFunctionAbstract
{
if (\is_string($function)) {
return \strpos($function, '::') ? new \ReflectionMethod($function) : new \ReflectionFunction($function);
}
if (\is_array($function)) {
return (new \ReflectionClass(\... | php | {
"resource": ""
} |
q30986 | EmailVerification.sendNotification | train | public function sendNotification($user)
{
$token = Hash::random(35);
VerifiedUser::create([
'email' => $user->email,
'token' => $token
]);
return $this->sendVerifyEmailNotification($user, $token);
} | php | {
"resource": ""
} |
q30987 | Ivona.getUserAgent | train | public function getUserAgent()
{
if (empty($this->userAgent)) {
$this->userAgent = self::DEFAULT_USERAGENT;
}
return $this->userAgent;
} | php | {
"resource": ""
} |
q30988 | Ivona.getAuthenticate | train | public function getAuthenticate()
{
if ($this->authenticate === null) {
$this->authenticate = new Authenticate($this->getSecretKey(), $this->getAccessKey());
}
return $this->authenticate;
} | php | {
"resource": ""
} |
q30989 | QuerySelect.innerJoin | train | public function innerJoin($table, $where, $using = true)
{
return $this->join('INNER', $table, $where, $using);
} | php | {
"resource": ""
} |
q30990 | QuerySelect.leftJoin | train | public function leftJoin($table, $where, $using = true)
{
return $this->join('LEFT', $table, $where, $using);
} | php | {
"resource": ""
} |
q30991 | QuerySelect.rightJoin | train | public function rightJoin($table, $where, $using = true)
{
return $this->join('RIGHT', $table, $where, $using);
} | php | {
"resource": ""
} |
q30992 | Base.generateLoginUrl | train | protected function generateLoginUrl($query)
{
//if there is a scope
if (!is_null($this->scope)) {
//if scope is in array
if (is_array($this->scope)) {
$this->scope = implode(' ', $this->scope);
}
//add scope to the query
$qu... | php | {
"resource": ""
} |
q30993 | Base.generateAccess | train | protected function generateAccess($query, $code = null, $refreshToken = false)
{
//if there is a code
if (!is_null($code)) {
//if you only want to refresh a token
if ($refreshToken) {
//put code in the query
$query['refresh_token'] = $code;
... | php | {
"resource": ""
} |
q30994 | ConsoleIO.askConfirmation | train | public function askConfirmation($question, $default = true)
{
/** @var QuestionHelper $helper */
$helper = $this->_helperSet->get('question');
$confirmation_question = new ConfirmationQuestion(
'<question>' . $question . ' [' . ($default ? 'y' : 'n') . ']?</question> ',
$default
);
return $helper->ask... | php | {
"resource": ""
} |
q30995 | ConsoleIO.choose | train | public function choose($question, array $options, $default, $error_message)
{
/** @var QuestionHelper $helper */
$helper = $this->_helperSet->get('question');
$choice_question = new ChoiceQuestion('<question>' . $question . '</question> ', $options, $default);
$choice_question->setErrorMessage($error_message);... | php | {
"resource": ""
} |
q30996 | AccessDeniedListener.onKernelException | train | public function onKernelException(GetResponseForExceptionEvent $event)
{
$request = $event->getRequest();
$exception = $event->getException();
if ($request->isXmlHttpRequest()) {
if ($exception instanceof AccessDeniedException) {
$token = $this->context->getToken... | php | {
"resource": ""
} |
q30997 | GendoriaCommandQueueExtension.load | train | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration($this->getAlias());
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
... | php | {
"resource": ""
} |
q30998 | GendoriaCommandQueueExtension.disableDoctrineListener | train | private function disableDoctrineListener(ContainerBuilder $container)
{
if (!$container->hasParameter('kernel.bundles')) {
return;
}
$bundles = $container->getParameter('kernel.bundles');
if (!isset($bundles['DoctrineBundle'])) {
$container->prependExtensionCo... | php | {
"resource": ""
} |
q30999 | CssParserCombinatorGeneral.filter | train | public function filter($node, $tagname)
{
$ret = array();
while ($node = Dom::getNextSiblingElement($node)) {
array_push($ret, $node);
}
return $ret;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.