_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q240500 | Gdn_Session.End | train | public function End($Authenticator = NULL) {
if ($Authenticator == NULL)
$Authenticator = Gdn::Authenticator();
$Authenticator->AuthenticateWith()->DeAuthenticate();
$this->SetCookie('-Vv', NULL, -3600);
$this->UserID = 0;
$this->User = FALSE;
$this->_Attributes = ar... | php | {
"resource": ""
} |
q240501 | Gdn_Session.HourOffset | train | public function HourOffset() {
static $GuestHourOffset;
if ($this->UserID > 0) {
return $this->User->HourOffset;
} else {
if (!isset($GuestHourOffset)) {
$GuestTimeZone = C('Garden.GuestTimeZone');
if ($GuestTimeZone) {
try {
... | php | {
"resource": ""
} |
q240502 | Gdn_Session.Start | train | public function Start($UserID = FALSE, $SetIdentity = TRUE, $Persist = FALSE) {
if (!C('Garden.Installed', FALSE)) return;
// Retrieve the authenticated UserID from the Authenticator module.
$UserModel = Gdn::Authenticator()->GetUserModel();
$this->UserID = $UserID !== FALSE ? $UserID : Gdn::Aut... | php | {
"resource": ""
} |
q240503 | Gdn_Session.TransientKey | train | public function TransientKey($NewKey = NULL) {
if (!is_null($NewKey)) {
$this->_TransientKey = Gdn::Authenticator()->GetUserModel()->SetTransientKey($this->UserID, $NewKey);
}
// if ($this->_TransientKey)
return $this->_TransientKey;
// else
// return RandomString(12); /... | php | {
"resource": ""
} |
q240504 | IntrospectedWorkflow.guessIsIntrospectedStateRootOrLeaf | train | private function guessIsIntrospectedStateRootOrLeaf()
{
foreach ($this->introspectedStates as $introspectedState) {
$this->guessIsIntrospectedStateRoot($introspectedState);
$this->guessIsIntrospectedStateLeaf($introspectedState);
}
} | php | {
"resource": ""
} |
q240505 | OptionPolicy.update | train | public function update(User $user, $option, $categoryKey)
{
if (!empty($option)) {
return $user->hasPermission('options-update-' . $categoryKey);
}
return false;
} | php | {
"resource": ""
} |
q240506 | Middleman.executePipeline | train | public function executePipeline($pipeline, Request $request, Response $response = null)
{
$middleman = new \mindplay\middleman\Dispatcher($pipeline, $this->resolver);
return $middleman->dispatch($request);
} | php | {
"resource": ""
} |
q240507 | endpoint_form.automatic_form | train | public function automatic_form(){
@header('text/html; charset=UTF-8');
$rtn = '';
if( !strlen($this->options['table']) ){
// --------------------
// 対象のテーブルが選択されていない
echo $this->page_table_list();
return null;
}
$table_definition = $this->get_current_table_definition();
// var_dump($table_def... | php | {
"resource": ""
} |
q240508 | endpoint_form.automatic_signup_form | train | public function automatic_signup_form($table_name, $init_cols, $options = array()){
@header('text/html; charset=UTF-8');
$param_options = $this->get_options();
$data = $param_options['post_params'];
$this->table_definition = $this->exdb->get_table_definition($table_name);
$is_login = $this->exdb->user()->i... | php | {
"resource": ""
} |
q240509 | endpoint_form.auth | train | public function auth($table_name, $inquiries){
$options = $this->get_options();
$data = $options['post_params'];
if(@$this->query_options['action'] == 'login'){
// ログインを試みる
$result = $this->exdb->user()->login( $table_name, $inquiries, $data );
}
$is_login = $this->exdb->user()->is_login($table_name)... | php | {
"resource": ""
} |
q240510 | ProcessRunner.run | train | public function run($commandline, callable $callback = null, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
{
$process = new Process(
$commandline,
$cwd,
$env,
$input,
$timeout
);
$helper = new DebugFor... | php | {
"resource": ""
} |
q240511 | Translation.translate | train | public function translate($string, Array $vars = array())
{
// Use custom translator
if ($this->translator) {
return $this->translator($this->getString($string), $vars);
}
return $this->compileString($this->getString($string), $vars);
} | php | {
"resource": ""
} |
q240512 | Translation.getString | train | public function getString($string)
{
// Exact match?
if (isset($this->strings[$string])) {
return $this->strings[$string];
} else {
return $string;
}
} | php | {
"resource": ""
} |
q240513 | Translation.calculateNumeral | train | public function calculateNumeral($numeral)
{
// Use custom enumerator
if ($this->enumerator) {
return $this->enumerator($numeral);
}
return ($numeral > 1 or $numeral < -1 or $numeral == 0) ? 1 : 0;
} | php | {
"resource": ""
} |
q240514 | Translation.compileString | train | protected function compileString($string, $vars)
{
$translation = $string;
// Loop through and replace the placeholders
// with the values from the $vars array.
$count = 0;
foreach ($vars as $key => $val) {
$count++;
// If array key is an integer,
... | php | {
"resource": ""
} |
q240515 | Sport.initObjects | train | public function initObjects($overrideExisting = true)
{
if (null !== $this->collObjects && !$overrideExisting) {
return;
}
$this->collObjects = new ObjectCollection();
$this->collObjects->setModel('\gossi\trixionary\model\Object');
} | php | {
"resource": ""
} |
q240516 | Sport.getObjects | train | public function getObjects(Criteria $criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collObjectsPartial && !$this->isNew();
if (null === $this->collObjects || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collObjects) {
// ... | php | {
"resource": ""
} |
q240517 | Sport.countObjects | train | public function countObjects(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collObjectsPartial && !$this->isNew();
if (null === $this->collObjects || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collObjects) {... | php | {
"resource": ""
} |
q240518 | Sport.addObject | train | public function addObject(ChildObject $l)
{
if ($this->collObjects === null) {
$this->initObjects();
$this->collObjectsPartial = true;
}
if (!$this->collObjects->contains($l)) {
$this->doAddObject($l);
}
return $this;
} | php | {
"resource": ""
} |
q240519 | Sport.initPositions | train | public function initPositions($overrideExisting = true)
{
if (null !== $this->collPositions && !$overrideExisting) {
return;
}
$this->collPositions = new ObjectCollection();
$this->collPositions->setModel('\gossi\trixionary\model\Position');
} | php | {
"resource": ""
} |
q240520 | Sport.getPositions | train | public function getPositions(Criteria $criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collPositionsPartial && !$this->isNew();
if (null === $this->collPositions || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collPositions) {
... | php | {
"resource": ""
} |
q240521 | Sport.countPositions | train | public function countPositions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
{
$partial = $this->collPositionsPartial && !$this->isNew();
if (null === $this->collPositions || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collPosi... | php | {
"resource": ""
} |
q240522 | Sport.addPosition | train | public function addPosition(ChildPosition $l)
{
if ($this->collPositions === null) {
$this->initPositions();
$this->collPositionsPartial = true;
}
if (!$this->collPositions->contains($l)) {
$this->doAddPosition($l);
}
return $this;
} | php | {
"resource": ""
} |
q240523 | Sport.getSkillsJoinObject | train | public function getSkillsJoinObject(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
{
$query = ChildSkillQuery::create(null, $criteria);
$query->joinWith('Object', $joinBehavior);
return $this->getSkills($query, $con);
} | php | {
"resource": ""
} |
q240524 | Sport.initGroups | train | public function initGroups($overrideExisting = true)
{
if (null !== $this->collGroups && !$overrideExisting) {
return;
}
$this->collGroups = new ObjectCollection();
$this->collGroups->setModel('\gossi\trixionary\model\Group');
} | php | {
"resource": ""
} |
q240525 | Sport.getGroups | train | public function getGroups(Criteria $criteria = null, ConnectionInterface $con = null)
{
$partial = $this->collGroupsPartial && !$this->isNew();
if (null === $this->collGroups || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collGroups) {
// retu... | php | {
"resource": ""
} |
q240526 | Sport.addGroup | train | public function addGroup(ChildGroup $l)
{
if ($this->collGroups === null) {
$this->initGroups();
$this->collGroupsPartial = true;
}
if (!$this->collGroups->contains($l)) {
$this->doAddGroup($l);
}
return $this;
} | php | {
"resource": ""
} |
q240527 | PagesController.getAll | train | public function getAll(Request $request)
{
// Get the views' directory
$viewsPath = base_path() . '/resources/views/';
if (!is_dir($viewsPath)) {
error_log("The directory /resources/views/ doesn't exists.");
throw new PathNotFoundException();
}
// Get the lang' directory
$langPath... | php | {
"resource": ""
} |
q240528 | PagesController.getLastMod | train | private function getLastMod($dirPath)
{
$dirInfo = new \SplFileInfo($dirPath);
$lastMod = $dirInfo->getMTime();
// Check files and subdirectories
$iter = new \FilesystemIterator($dirPath);
foreach ($iter as $fileInfo) {
if ($fileInfo->isDir()) {
$mtime = self::getLastMod($fileInfo-... | php | {
"resource": ""
} |
q240529 | PagesController.getViewsList | train | private function getViewsList($dirPath, $checkSubDir = true)
{
$viewsList = [];
$iter = new \FilesystemIterator($dirPath);
foreach ($iter as $fileInfo) {
$filename = $fileInfo->getFilename();
if ($filename[0] === '_') {
continue;
}
// Directories
if ($fileInfo->isDi... | php | {
"resource": ""
} |
q240530 | Engine.loadLanguages | train | private function loadLanguages()
{
$app = $this->app;
$engine = $this;
$languages = $app['config.app.languages'];
$app['multi_languages'] = count($languages) > 1;
$app->register(new LocaleServiceProvider());
$app->register(new TranslationServiceProvider(), [
... | php | {
"resource": ""
} |
q240531 | Engine.loadRouting | train | private function loadRouting()
{
$app = $this->app;
$maps = [];
$routing_file_path = $this->getAppPath('config').DIRECTORY_SEPARATOR.'routing.php';
if (is_readable($routing_file_path)) {
$maps = require $routing_file_path;
}
if ($maps) {
$pre... | php | {
"resource": ""
} |
q240532 | Factory.setLoader | train | public function setLoader(Loader $loader)
{
$this->loader = $loader;
$this->loader->setNamespace($this->getNamespace());
} | php | {
"resource": ""
} |
q240533 | HaringoBuilderImpl.getSerializerValSourceExtBasedOn | train | private function getSerializerValSourceExtBasedOn(ValueSourceExtension $ext)
{
return new SerializerValueSourceExtensionImpl(
$ext->getMapper(),
$ext->getSupportedValueSourceClass(),
$ext->getUniqueExtensionId()
);
} | php | {
"resource": ""
} |
q240534 | MediaType.getTitle | train | public function getTitle($code)
{
if (!isset($this->titles[$code])) {
$code = key($this->getTitles());
}
return $this->titles[$code];
} | php | {
"resource": ""
} |
q240535 | RequestSigner.getSignatureContent | train | public function getSignatureContent(\TYPO3\Flow\Http\Request $httpRequest) {
$date = $httpRequest->getHeader('Date');
$dateValue = $date instanceof \DateTime ? $date->format(DATE_RFC2822) : '';
$signData = $httpRequest->getMethod() . chr(10)
. sha1($httpRequest->getContent()) . chr(10)
. $httpRequest->getHe... | php | {
"resource": ""
} |
q240536 | Model.assignAttribute | train | public function assignAttribute($name, $value)
{
$table = static::table();
if (!is_object($value)) {
if (array_key_exists($name, $table->columns)) {
$value = $table->columns[$name]->cast($value, static::connection());
} else {
$col = $table->getColumnByInflectedName($name);
if (!is_null($col)){
... | php | {
"resource": ""
} |
q240537 | Model.& | train | public function &readAttribute($name)
{
// check for aliased attribute
if (array_key_exists($name, static::$aliasAttribute))
$name = static::$aliasAttribute[$name];
// check for attribute
if (array_key_exists($name,$this->_attributes))
return $this->_attributes[$name];
// check relationships if no at... | php | {
"resource": ""
} |
q240538 | Model.hasAttribute | train | public function hasAttribute($attrName)
{
// In default attributes
if (array_key_exists($attrName, $this->_attributes)) return true;
// A getter available?
if (method_exists($this, "__get_$attrName")) return true;
return false;
} | php | {
"resource": ""
} |
q240539 | Model.flagDirty | train | public function flagDirty($name, $dirty = true)
{
if (!$this->_dirty) $this->_dirty = array();
if ($dirty) {
$this->_dirty[$name] = true;
} else {
if (array_key_exists($name, $this->_dirty)) {
unset($this->_dirty[$name]);
}
}
} | php | {
"resource": ""
} |
q240540 | Model.dirtyAttributes | train | public function dirtyAttributes()
{
if (!$this->_dirty)
return null;
$dirty = array_intersect_key($this->_attributes, $this->_dirty);
return !empty($dirty) ? $dirty : null;
} | php | {
"resource": ""
} |
q240541 | Model.attributeIsDirty | train | public function attributeIsDirty($attribute)
{
return $this->_dirty && isset($this->_dirty[$attribute]) && array_key_exists($attribute, $this->_attributes);
} | php | {
"resource": ""
} |
q240542 | Model.create | train | public static function create($attributes, $validate = true, $guardAttributes=true)
{
// Get class and instantiate it
$className = get_called_class();
$model = new $className($attributes, $guardAttributes);
$model->save($validate);
return $model;
} | php | {
"resource": ""
} |
q240543 | Model.insert | train | private function insert($validate = true)
{
$this->verifyNotReadonly('insert');
// Check if validation or beforeCreate returns false.
if (($validate && !$this->_validate() || !$this->invokeCallback('beforeCreate',false))) {
return false;
}
$table = static::table();
// Get dirty attributes, or when no... | php | {
"resource": ""
} |
q240544 | Model.update | train | private function update($validate = true)
{
$this->verifyNotReadonly('update');
// Valid record?
if ($validate && !$this->_validate()) {
return false;
}
// Anything to update?
if ($this->isDirty()) {
// Check my primary key
$pk = $this->valuesForPk();
if (empty($pk)) {
throw new ActiveRe... | php | {
"resource": ""
} |
q240545 | Model.delete | train | public function delete()
{
$this->verifyNotReadonly('delete');
$pk = $this->valuesForPk();
if (empty($pk))
throw new ActiveRecordException("Cannot delete, no primary key defined for: " . get_called_class());
if (!$this->invokeCallback('beforeDestroy',false))
return false;
static::table()->delete($p... | php | {
"resource": ""
} |
q240546 | Model.valuesFor | train | public function valuesFor($attributeNames)
{
$filter = array();
foreach ($attributeNames as $name)
$filter[$name] = $this->$name;
return $filter;
} | php | {
"resource": ""
} |
q240547 | Model._validate | train | protected function _validate()
{
// Check if validation is necessary and parsed
if (static::$validates === false) return true;
if (is_null(static::$_validation)) {
require_once("Validation/Validation.php");
static::$_validation = Validation\Validation::onModel(get_called_class());
}
// Go validate... | php | {
"resource": ""
} |
q240548 | Model.setTimestamps | train | public function setTimestamps()
{
$now = date('Y-m-d H:i:s');
if (isset($this->updated_at))
$this->updated_at = $now;
if (isset($this->created_at) && $this->isNewRecord())
$this->created_at = $now;
} | php | {
"resource": ""
} |
q240549 | Model.updateAttribute | train | public function updateAttribute($name, $value)
{
$this->__set($name, $value);
return $this->update(false);
} | php | {
"resource": ""
} |
q240550 | Model.reload | train | public function reload()
{
$this->_relationships = array();
$pk = array_values($this->getValuesFor($this->getPrimaryKey()));
$this->setAttributesViaMassAssignment($this->find($pk)->attributes, false);
$this->resetDirty();
return $this;
} | php | {
"resource": ""
} |
q240551 | Model.count | train | public static function count(/* ... */)
{
$args = func_get_args();
$options = static::extractAndValidateOptions($args);
$options['select'] = 'COUNT(*)';
if (!empty($args) && !is_null($args[0]) && !empty($args[0]))
{
if (is_hash($args[0]))
$options['conditions'] = $args[0];
else
$options['condi... | php | {
"resource": ""
} |
q240552 | Model.find | train | public static function find(/* $type, $options */)
{
$class = get_called_class();
if (func_num_args() <= 0)
throw new RecordNotFound("Couldn't find $class without an ID");
$args = func_get_args();
$options = static::extractAndValidateOptions($args);
$num_args = count($args);
$single = true;
if ($nu... | php | {
"resource": ""
} |
q240553 | Model.findByPk | train | public static function findByPk($values, $options)
{
$options['conditions'] = static::pkConditions($values);
$list = static::table()->find($options);
$results = count($list);
if ($results != ($expected = count($values)))
{
$class = get_called_class();
if ($expected == 1)
{
if (!is_array($value... | php | {
"resource": ""
} |
q240554 | Model.isOptionsHash | train | public static function isOptionsHash($array, $throw = true)
{
if (Arry::isHash($array))
{
$keys = array_keys($array);
$diff = array_diff($keys,self::$validOptions);
if (!empty($diff) && $throw) {
throw new ActiveRecordException("Unknown key(s): " . join(', ',$diff));
}
$intersect = array_inter... | php | {
"resource": ""
} |
q240555 | Model.invokeCallback | train | private function invokeCallback($method_name, $must_exist=true)
{
return static::table()->callback->invoke($this,$method_name,$must_exist);
} | php | {
"resource": ""
} |
q240556 | Model.transaction | train | public static function transaction($closure)
{
$connection = static::connection();
try
{
$connection->transaction();
if ($closure() === false)
{
$connection->rollback();
return false;
}
else
$connection->commit();
}
catch (\Exception $e)
{
$connection->rollback();
throw $... | php | {
"resource": ""
} |
q240557 | FlashData.isFromRoute | train | public function isFromRoute($routeName)
{
$session = $this->getSession();
/** @noinspection PhpUndefinedFieldInspection */
if ($session->data === null || !is_array($session->source)) {
return null;
}
/** @noinspection PhpUndefinedFieldInspection */
retur... | php | {
"resource": ""
} |
q240558 | FlashData.removeData | train | public function removeData()
{
$session = $this->getSession();
/** @noinspection PhpUndefinedFieldInspection */
if ($session->data !== null) {
unset($session->data);
return true;
}
return false;
} | php | {
"resource": ""
} |
q240559 | DBALGenerator.generate | train | public function generate(Module $module, $modelName, array $arrayValues)
{
$modelClass = $module->getNamespace() . '\\Model\\' . $modelName;
$modelPath = $module->getPath() . '/Model/' . str_replace('\\', '/', $modelName) . '.php';
$modelCode = $this->generateCode($module, $modelN... | php | {
"resource": ""
} |
q240560 | DBALGenerator.generateCode | train | protected function generateCode(Module $module, $modelName, $arrayValues)
{
$replaces = array(
'<namespace>' => 'namespace ' . $module->getNamespace() . '\\Model;',
'<modelAnnotation>' => $this->generateDocBlock($modelName),
'<modelClassName>' => $modelName,
... | php | {
"resource": ""
} |
q240561 | Helper.fileNameStrategy | train | public function fileNameStrategy($database, $name)
{
$name = join('_', array_map('lcfirst', preg_split('/(?=[A-Z])/', $name)));
return $database . DS . $this->generateVersion() . $name . '.php';
} | php | {
"resource": ""
} |
q240562 | Token.style | train | public function style(): Style
{
$type = StyleType::get($this->style);
return StyleFactory::factory($type)
->lineWidth($this->lineWidth);
} | php | {
"resource": ""
} |
q240563 | Token.value | train | public function value(): ?string
{
if (is_empty($this->key)) {
return $this->original;
}
$value = $this->replacements->get($this->key, null);
return $this->convertToString($value);
} | php | {
"resource": ""
} |
q240564 | Token.width | train | public function width(): int
{
$lines = explode("\n", $this->value());
$width = [];
foreach ($lines as $line) {
$raw = strip_tags($line);
$width[] = strlen(trim($raw));
}
return max($width);
} | php | {
"resource": ""
} |
q240565 | Content.setUserId | train | public function setUserId( $userId )
{
$this->_user = null;
$this->userId = ( (int) $userId ) ?: null;
return $this;
} | php | {
"resource": ""
} |
q240566 | Content.getUserMapper | train | protected function getUserMapper()
{
if ( null === $this->_userMapper )
{
$mapper = $this->getMapper();
$this->_userMapper = $this->getServiceLocator()
->get( 'Di' )
->get( 'Grid\User\Model\User\Mapp... | php | {
"resource": ""
} |
q240567 | Content.setPublishedFrom | train | public function setPublishedFrom( $date, $format = null )
{
$this->publishedFrom = empty( $date ) ? null : $this->inputDate( $date, $format );
return $this;
} | php | {
"resource": ""
} |
q240568 | Content.setPublishedTo | train | public function setPublishedTo( $date, $format = null )
{
$this->publishedTo = empty( $date ) ? null : $this->inputDate( $date, $format );
return $this;
} | php | {
"resource": ""
} |
q240569 | Content.isPublished | train | public function isPublished( $now = null )
{
if ( ! $this->published )
{
return false;
}
if ( empty( $now ) )
{
$now = new DateTime();
}
else
{
$now = $this->inputDate( $now );
}
if ( ! empty( $this... | php | {
"resource": ""
} |
q240570 | Content.setAccessUsers | train | public function setAccessUsers( $users )
{
$this->accessUsers = array_unique(
is_array( $users ) ? $users : preg_split( '/[,\s]+/', $users )
);
return $this;
} | php | {
"resource": ""
} |
q240571 | Content.setAccessGroups | train | public function setAccessGroups( $groups )
{
$this->accessGroups = array_unique(
is_array( $groups ) ? $groups : preg_split( '/[,\s]+/', $groups )
);
return $this;
} | php | {
"resource": ""
} |
q240572 | Content.setEditUsers | train | public function setEditUsers( $users )
{
$this->editUsers = array_unique(
is_array( $users ) ? $users : preg_split( '/[,\s]+/', $users )
);
return $this;
} | php | {
"resource": ""
} |
q240573 | Content.setEditGroups | train | public function setEditGroups( $groups )
{
$this->editGroups = array_unique(
is_array( $groups ) ? $groups : preg_split( '/[,\s]+/', $groups )
);
return $this;
} | php | {
"resource": ""
} |
q240574 | Content.getSeoUri | train | public function getSeoUri()
{
if ( ! empty( $this->_seoUri ) )
{
return $this->_seoUri;
}
if ( empty( $this->id ) )
{
return '';
}
if ( empty( $this->_seoUri ) )
{
$this->_seoUriStructure = $this->getUriStructure( ... | php | {
"resource": ""
} |
q240575 | Container.getUri | train | public function getUri()
{
if ( $this->hasChildren() )
{
foreach( $this->getChildren() as $child )
{
$uri = $child->getUri();
if ( '#' != $uri[0] )
{
return $uri;
}
}
}
... | php | {
"resource": ""
} |
q240576 | OperationState.execute | train | public function execute()
{
$returnValues = array();
while ($execute = array_shift($this->executeParameters)) {
$returnValues[] = $this->run($execute);
}
return $returnValues;
} | php | {
"resource": ""
} |
q240577 | OperationState.undo | train | public function undo()
{
$returnValues = array();
while ($undo = array_shift($this->undoParameters)) {
$returnValues[] = $this->run($undo);
}
return $returnValues;
} | php | {
"resource": ""
} |
q240578 | OperationState.run | train | protected function run($call)
{
if (!isset($call['callable'])) {
throw new OperationStateException("\$call['callable'] was not set");
}
if (!isset($call['arguments'])) {
try {
is_null($call['arguments']);
} catch (\Excepti... | php | {
"resource": ""
} |
q240579 | OperationState.getKey | train | public function getKey()
{
if (!isset($this->key)) {
$this->key = md5(microtime().rand());
}
return $this->key;
} | php | {
"resource": ""
} |
q240580 | ComposerLoader.getFile | train | public function getFile(Repo $repo)
{
$file = tempnam(sys_get_temp_dir(), 'composer');
$content = file_get_contents($this->helper->getRawFileUrl($repo->getSlug(), 'master', 'composer.json'));
file_put_contents($file, $content);
return $file;
} | php | {
"resource": ""
} |
q240581 | CheckoutManager.calculateTotalAmountForDeliveryExpenses | train | private function calculateTotalAmountForDeliveryExpenses(Transaction $transaction)
{
$total = 0;
foreach ($transaction->getItems() as $productPurchase) {
if($productPurchase->getProduct() instanceof Product){
if(!$productPurchase->getProduct()->isFreeTransport()){
... | php | {
"resource": ""
} |
q240582 | CheckoutManager.getCurrentTransaction | train | public function getCurrentTransaction()
{
if (false === $this->session->has('transaction-id')) {
throw new AccessDeniedHttpException();
}
return $this->manager->getRepository('EcommerceBundle:Transaction')->find($this->session->get('transaction-id'));
} | php | {
"resource": ""
} |
q240583 | CheckoutManager.updateTransaction | train | public function updateTransaction()
{
$cart = $this->cartProvider->getCart();
if (0 === $cart->countItems() || $this->isTransactionUpdated($cart)) {
return;
}
/** @var TransactionRepository $transactionRepository */
$transactionRepository = $this->manage... | php | {
"resource": ""
} |
q240584 | CheckoutManager.isTransactionUpdated | train | private function isTransactionUpdated(Cart $cart)
{
if (false === $this->session->has('transaction-id')) {
return false;
}
/** @var TransactionRepository $transactionRepository */
$transactionRepository = $this->manager->getRepository('EcommerceBundle:Transaction');
... | php | {
"resource": ""
} |
q240585 | CheckoutManager.getDelivery | train | public function getDelivery(Transaction $transaction = null)
{
if ($this->session->has('delivery-id')) {
$delivery = $this->manager->getRepository('EcommerceBundle:Delivery')->find($this->session->get('delivery-id'));
return $delivery;
}
$delivery = new Delivery();
... | php | {
"resource": ""
} |
q240586 | CheckoutManager.saveDelivery | train | public function saveDelivery(Delivery $delivery, array $params, $cart)
{
/** @var Carrier $carrier */
// $carrier = $this->manager->getRepository('ModelBundle:Carrier')->find($delivery->getCarrier());
if ('same' === $params['selectDelivery']) {
$delivery->setDeliveryContactPerson... | php | {
"resource": ""
} |
q240587 | CheckoutManager.saveUserBillingAddress | train | private function saveUserBillingAddress($delivery)
{
// get billing address
/** @var Address $billingAddress */
$billingAddress = $this->manager->getRepository('EcommerceBundle:Address')->findOneBy(array(
'actor' => $this->securityContext->getToken()... | php | {
"resource": ""
} |
q240588 | CheckoutManager.cleanSession | train | public function cleanSession()
{
// remove checkout session parameters
$this->session->remove('select-delivery');
$this->session->remove('delivery-id');
$this->session->remove('existing-delivery-address');
$this->session->remove('transaction-id');
// abandon cart
... | php | {
"resource": ""
} |
q240589 | CheckoutManager.getBillingAddress | train | public function getBillingAddress($actor=null)
{
if(is_null($actor)){
$actor = $this->securityContext->getToken()->getUser();
if (!$actor || !is_object($actor)) {
throw new \LogicException(
'The getBillingAddress cannot be used without an authentic... | php | {
"resource": ""
} |
q240590 | CheckoutManager.isCurrentUserOwner | train | public function isCurrentUserOwner(Transaction $transaction)
{
if($this->securityContext->getToken()->getUser()->isGranted('ROLE_ADMIN')){
return true;
}
$currentUserId = $this->securityContext->getToken()->getUser()->getId();
//actor owner
if($transactio... | php | {
"resource": ""
} |
q240591 | CheckoutManager.processBankTransfer | train | public function processBankTransfer(Transaction $transaction)
{
$transaction->setStatus(Transaction::STATUS_PENDING_TRANSFER);
$pm = $this->manager->getRepository('EcommerceBundle:PaymentMethod')->findOneBySlug('bank-transfer-test');
$transaction->setPaymentMethod($pm);
$this->manag... | php | {
"resource": ""
} |
q240592 | CheckoutManager.processRedsysTransaction | train | public function processRedsysTransaction($ds_response, Transaction $transaction)
{
if ($ds_response > 99) {
return false;
}
$transaction->setStatus(Transaction::STATUS_PAID);
$pm = $this->manager->getRepository('EcommerceBundle:PaymentMethod')->findOneBySlug('redsys');
... | php | {
"resource": ""
} |
q240593 | ResponseCookieCollection.get | train | public function get(string $name): ?ResponseCookieInterface
{
if (!isset($this->responseCookies[$name])) {
return null;
}
return $this->responseCookies[$name];
} | php | {
"resource": ""
} |
q240594 | ResponseCookieCollection.set | train | public function set(string $name, ResponseCookieInterface $responseCookie): void
{
$this->responseCookies[$name] = $responseCookie;
} | php | {
"resource": ""
} |
q240595 | LocalAccess.isLocalIp | train | private function isLocalIp ()
{
$ip = $this->serverData["REMOTE_ADDR"];
if (!is_string($ip))
{
return false;
}
if (in_array($ip, ['127.0.0.1', 'fe80::1', '::1'], true))
{
return true;
}
// allowed (= local) IPs include
... | php | {
"resource": ""
} |
q240596 | SerpPageSerializer.serialize | train | public function serialize($serializablePage, $format)
{
// check if supported serialization format
if (!SerpPageSerializerHelper::validFormat($format, self::$supportedFormatSerialization))
throw new \Franzip\SerpPageSerializer\Exceptions\UnsupportedSerializationFormatException('Invalid S... | php | {
"resource": ""
} |
q240597 | SerpPageSerializer.deserialize | train | public function deserialize($serializedPage, $format)
{
// check if supported deserialization format
if (!SerpPageSerializerHelper::validFormat($format, self::$supportedFormatDeserialization))
throw new \Franzip\SerpPageSerializer\Exceptions\UnsupportedDeserializationFormatException('Inv... | php | {
"resource": ""
} |
q240598 | SerpPageSerializer.prepareForSerialization | train | private function prepareForSerialization($serializablePage, $format, $entries)
{
$engine = $serializablePage->getEngine();
$keyword = $serializablePage->getKeyword();
$pageUrl = $serializablePage->getPageUrl();
$pageNumber = $serializablePage->getPageNumber();
$age ... | php | {
"resource": ""
} |
q240599 | SerpPageSerializer.createEntries | train | private function createEntries($serializablePage, $format)
{
$result = array();
$entries = $serializablePage->getEntries();
for ($i = 0; $i < count($entries); $i++) {
$args = array(($i + 1), $entries[$i]['url'], $entries[$i]['title'], $entries[$i]['snippet']);
array_p... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.