_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 83
13k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q2500
|
Reporter.on
|
train
|
public function on() : self
{
$this->handler->setErrorHandler();
$this->handler->setExceptionHandler();
$this->handler->setFatalHandler();
return $this;
}
|
php
|
{
"resource": ""
}
|
q2501
|
Driver.start
|
train
|
public function start($type = '*firefox', $startUrl = 'http://localhost')
{
if (null !== $this->sessionId) {
throw new Exception("Session already started");
}
$response = $this->doExecute('getNewBrowserSession', $type, $startUrl);
if (preg_match('/^OK,(.*)$/', $response, $vars)) {
$this->sessionId = $vars[1];
} else {
throw new Exception("Invalid response from server : $response");
}
}
|
php
|
{
"resource": ""
}
|
q2502
|
Driver.getString
|
train
|
public function getString($command, $target = null, $value = null)
{
$result = $this->doExecute($command, $target, $value);
if (!preg_match('/^OK,/', $result)) {
throw new Exception("Unexpected response from Selenium server : ".$result);
}
return strlen($result) > 3 ? substr($result, 3) : '';
}
|
php
|
{
"resource": ""
}
|
q2503
|
Driver.getStringArray
|
train
|
public function getStringArray($command, $target = null, $value = null)
{
$string = $this->getString($command, $target, $value);
$results = preg_split('/(?<!\\\),/', $string);
foreach ($results as &$result) {
$result = str_replace('\,', ',', $result);
}
return $results;
}
|
php
|
{
"resource": ""
}
|
q2504
|
Driver.getNumber
|
train
|
public function getNumber($command, $target = null, $value = null)
{
$string = $this->getString($command, $target, $value);
return (int) $string;
}
|
php
|
{
"resource": ""
}
|
q2505
|
Driver.getBoolean
|
train
|
public function getBoolean($command, $target = null, $value = null)
{
$string = $this->getString($command, $target, $value);
return $string == 'true';
}
|
php
|
{
"resource": ""
}
|
q2506
|
Driver.stop
|
train
|
public function stop()
{
if (null === $this->sessionId) {
throw new Exception("Session not started");
}
$this->doExecute('testComplete');
$this->sessionId = null;
}
|
php
|
{
"resource": ""
}
|
q2507
|
Driver.doExecute
|
train
|
protected function doExecute($command, $target = null, $value = null)
{
$postFields = array();
$query = array('cmd' => $command);
if ($target !== null) {
$postFields[1] = $target;
}
if ($value !== null) {
$postFields[2] = $value;
}
if (null !== $this->sessionId) {
$query['sessionId'] = $this->sessionId;
}
$query = http_build_query($query);
$url = $this->url.'?'.$query;
//open connection
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, count($postFields));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postFields));
curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
$curlErrno = curl_errno($ch);
curl_close($ch);
if ($curlErrno > 0) {
throw new Exception("Unable to connect ! ");
}
if (false === $result) {
throw new Exception("Connection refused");
}
return $result;
}
|
php
|
{
"resource": ""
}
|
q2508
|
StacktraceFormatterTrait.unpackThrowables
|
train
|
private function unpackThrowables($throwable)
{
if (!$throwable instanceof Throwable) {
return [];
}
$throwables = [$throwable];
while ($throwable = $throwable->getPrevious()) {
$throwables[] = $throwable;
}
return $throwables;
}
|
php
|
{
"resource": ""
}
|
q2509
|
RenderViewHelper.renderStatic
|
train
|
public static function renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
/** @var FieldViewHelperService $fieldService */
$fieldService = Core::instantiate(FieldViewHelperService::class);
if (false === $fieldService->fieldContextExists()) {
throw ContextNotFoundException::slotRenderViewHelperFieldContextNotFound();
}
/** @var SlotViewHelperService $slotService */
$slotService = Core::instantiate(SlotViewHelperService::class);
$slotName = $arguments['slot'];
$result = '';
if ($slotService->hasSlot($slotName)) {
$currentVariables = version_compare(VersionNumberUtility::getCurrentTypo3Version(), '8.0.0', '<')
? $renderingContext->getTemplateVariableContainer()->getAll()
: $renderingContext->getVariableProvider()->getAll();
ArrayUtility::mergeRecursiveWithOverrule($currentVariables, $arguments['arguments']);
$slotService->addTemplateVariables($slotName, $currentVariables);
$slotClosure = $slotService->getSlotClosure($slotName);
$result = $slotClosure();
$slotService->restoreTemplateVariables($slotName);
}
return $result;
}
|
php
|
{
"resource": ""
}
|
q2510
|
ExceptionHandler.handle
|
train
|
public function handle($throwable)
{
if ($throwable instanceof Exception) {
$response = $this->handler->handleException($this->defaultRequest, $this->defaultResponse, $throwable);
} elseif ($throwable instanceof Throwable) {
$response = $this->handler->handleThrowable($this->defaultRequest, $this->defaultResponse, $throwable);
} else {
return false;
}
if ($response instanceof ResponseInterface) {
$this->renderResponse($response);
return true;
} else {
return false;
}
}
|
php
|
{
"resource": ""
}
|
q2511
|
FieldViewHelper.storeViewDataLegacy
|
train
|
protected function storeViewDataLegacy()
{
$originalArguments = [];
$variableProvider = $this->getVariableProvider();
foreach (self::$reservedVariablesNames as $key) {
if ($variableProvider->exists($key)) {
$originalArguments[$key] = $variableProvider->get($key);
}
}
$viewHelperVariableContainer = $this->renderingContext->getViewHelperVariableContainer();
$currentView = $viewHelperVariableContainer->getView();
return function (array $templateArguments) use ($originalArguments, $variableProvider, $viewHelperVariableContainer, $currentView) {
$viewHelperVariableContainer->setView($currentView);
/*
* Cleaning up the variables in the provider: the original
* values are restored to make the provider like it was before
* the field rendering started.
*/
foreach ($variableProvider->getAllIdentifiers() as $identifier) {
if (array_key_exists($identifier, $templateArguments)) {
$variableProvider->remove($identifier);
}
}
foreach ($originalArguments as $key => $value) {
if ($variableProvider->exists($key)) {
$variableProvider->remove($key);
}
$variableProvider->add($key, $value);
}
};
}
|
php
|
{
"resource": ""
}
|
q2512
|
FieldViewHelper.injectFieldInService
|
train
|
protected function injectFieldInService($fieldName)
{
$formObject = $this->formService->getFormObject();
$formConfiguration = $formObject->getConfiguration();
if (false === is_string($fieldName)) {
throw InvalidArgumentTypeException::fieldViewHelperInvalidTypeNameArgument();
} elseif (false === $formConfiguration->hasField($fieldName)) {
throw PropertyNotAccessibleException::fieldViewHelperFieldNotAccessibleInForm($formObject, $fieldName);
}
$this->fieldService->setCurrentField($formConfiguration->getField($fieldName));
}
|
php
|
{
"resource": ""
}
|
q2513
|
FieldViewHelper.getLayout
|
train
|
protected function getLayout(View $viewConfiguration)
{
$layout = $this->arguments['layout'];
if (false === is_string($layout)) {
throw InvalidArgumentTypeException::invalidTypeNameArgumentFieldViewHelper($layout);
}
list($layoutName, $templateName) = GeneralUtility::trimExplode('.', $layout);
if (empty($templateName)) {
$templateName = 'default';
}
if (empty($layoutName)) {
throw InvalidArgumentValueException::fieldViewHelperEmptyLayout();
}
if (false === $viewConfiguration->hasLayout($layoutName)) {
throw EntryNotFoundException::fieldViewHelperLayoutNotFound($layout);
}
if (false === $viewConfiguration->getLayout($layoutName)->hasItem($templateName)) {
throw EntryNotFoundException::fieldViewHelperLayoutItemNotFound($layout, $templateName);
}
return $viewConfiguration->getLayout($layoutName)->getItem($templateName);
}
|
php
|
{
"resource": ""
}
|
q2514
|
FieldViewHelper.getTemplateArguments
|
train
|
protected function getTemplateArguments()
{
$templateArguments = $this->arguments['arguments'] ?: [];
ArrayUtility::mergeRecursiveWithOverrule($templateArguments, $this->fieldService->getFieldOptions());
return $templateArguments;
}
|
php
|
{
"resource": ""
}
|
q2515
|
Convert.valueToBytes
|
train
|
public static function valueToBytes($value): int
{
if (is_int($value)) {
return $value;
}
$value = trim($value);
// Native PHP check for digits in string
if (ctype_digit(ltrim($value, '-'))) {
return (int)$value;
}
$signed = (substr($value, 0, 1) === '-') ? -1 : 1;
// Kilobytes
if (preg_match('/(\d+)K$/i', $value, $matches)) {
return (int)($matches[1] * $signed * 1024);
}
// Megabytes
if (preg_match('/(\d+)M$/i', $value, $matches)) {
return (int)($matches[1] * $signed * 1024 * 1024);
}
// Gigabytes
if (preg_match('/(\d+)G$/i', $value, $matches)) {
return (int)($matches[1] * $signed * 1024 * 1024 * 1024);
}
throw new InvalidArgumentException("Failed to find K, M, or G in a non-integer value [$value]");
}
|
php
|
{
"resource": ""
}
|
q2516
|
Convert.objectToArray
|
train
|
public static function objectToArray($source): array
{
$result = [];
if (is_array($source)) {
return $source;
}
if (!is_object($source)) {
return $result;
}
$json = json_encode($source);
if ($json === false) {
return $result;
}
$array = json_decode($json, true);
if ($array === null) {
return $result;
}
$result = $array;
return $result;
}
|
php
|
{
"resource": ""
}
|
q2517
|
Convert.dataToJson
|
train
|
public static function dataToJson(string $data, bool $lint = false): stdClass
{
if ($lint) {
$linter = new JsonParser();
$linter->parse($data);
}
$data = json_decode($data);
if ($data === null) {
throw new InvalidArgumentException("Failed to decode json");
}
return (object)$data;
}
|
php
|
{
"resource": ""
}
|
q2518
|
URI.getQueryParam
|
train
|
public function getQueryParam(UriInterface $uri, $param)
{
if (!$query = $uri->getQuery()) {
return null;
}
parse_str($query, $params);
if (!array_key_exists($param, $params)) {
return null;
}
return $params[$param];
}
|
php
|
{
"resource": ""
}
|
q2519
|
URI.uriFor
|
train
|
public function uriFor($route, array $params = [], array $query = [])
{
if (!$route) {
return '';
}
return $this->router->relativePathFor($route, $params, $query);
}
|
php
|
{
"resource": ""
}
|
q2520
|
URI.absoluteURIFor
|
train
|
public function absoluteURIFor(UriInterface $uri, $route, array $params = [], array $query = [])
{
$path = $this->uriFor($route, $params);
return (string) $uri
->withUserInfo('')
->withPath($path)
->withQuery(http_build_query($query))
->withFragment('');
}
|
php
|
{
"resource": ""
}
|
q2521
|
FormBuilder.getTypeObject
|
train
|
private function getTypeObject($type, $args)
{
/* @var AbstractType $object */
if ($type instanceof AbstractType) {
$object = $type;
} else {
$class = $this->getTypeClass($type);
if (!\class_exists($class)) {
$class = TextType::class;
}
$object = new $class($args, $this);
}
return $object;
}
|
php
|
{
"resource": ""
}
|
q2522
|
BehavioursManager.applyBehaviourOnFormInstance
|
train
|
public function applyBehaviourOnFormInstance(FormObject $formObject)
{
if ($formObject->hasForm()) {
$formInstance = $formObject->getForm();
foreach ($formObject->getConfiguration()->getFields() as $fieldName => $field) {
if (ObjectAccess::isPropertyGettable($formInstance, $fieldName)
&& ObjectAccess::isPropertySettable($formInstance, $fieldName)
) {
$propertyValue = ObjectAccess::getProperty($formInstance, $fieldName);
foreach ($field->getBehaviours() as $behaviour) {
/** @var AbstractBehaviour $behaviourInstance */
$behaviourInstance = GeneralUtility::makeInstance($behaviour->getClassName());
// Applying the behaviour on the field's value.
$propertyValue = $behaviourInstance->applyBehaviour($propertyValue);
}
ObjectAccess::setProperty($formInstance, $fieldName, $propertyValue);
}
}
}
}
|
php
|
{
"resource": ""
}
|
q2523
|
ConditionFactory.registerCondition
|
train
|
public function registerCondition($name, $className)
{
if (false === is_string($name)) {
throw InvalidArgumentTypeException::conditionNameNotString($name);
}
if (false === class_exists($className)) {
throw ClassNotFoundException::conditionClassNameNotFound($name, $className);
}
if (false === in_array(ConditionItemInterface::class, class_implements($className))) {
throw InvalidArgumentTypeException::conditionClassNameNotValid($className);
}
$this->conditions[$name] = $className;
return $this;
}
|
php
|
{
"resource": ""
}
|
q2524
|
ConditionFactory.registerDefaultConditions
|
train
|
public function registerDefaultConditions()
{
if (false === $this->defaultConditionsWereRegistered) {
$this->defaultConditionsWereRegistered = true;
$this->registerCondition(
FieldHasValueCondition::CONDITION_NAME,
FieldHasValueCondition::class
)->registerCondition(
FieldHasErrorCondition::CONDITION_NAME,
FieldHasErrorCondition::class
)->registerCondition(
FieldIsValidCondition::CONDITION_NAME,
FieldIsValidCondition::class
)->registerCondition(
FieldIsEmptyCondition::CONDITION_NAME,
FieldIsEmptyCondition::class
)->registerCondition(
FieldIsFilledCondition::CONDITION_IDENTIFIER,
FieldIsFilledCondition::class
)->registerCondition(
FieldCountValuesCondition::CONDITION_IDENTIFIER,
FieldCountValuesCondition::class
);
}
}
|
php
|
{
"resource": ""
}
|
q2525
|
TypoScriptService.getFormConfiguration
|
train
|
public function getFormConfiguration($formClassName)
{
$formzConfiguration = $this->getExtensionConfiguration();
return (isset($formzConfiguration['forms'][$formClassName]))
? $formzConfiguration['forms'][$formClassName]
: [];
}
|
php
|
{
"resource": ""
}
|
q2526
|
TypoScriptService.getExtensionConfiguration
|
train
|
protected function getExtensionConfiguration()
{
$cacheInstance = CacheService::get()->getCacheInstance();
$hash = $this->getContextHash();
if ($cacheInstance->has($hash)) {
$result = $cacheInstance->get($hash);
} else {
$result = $this->getFullConfiguration();
$result = (ArrayUtility::isValidPath($result, self::EXTENSION_CONFIGURATION_PATH, '.'))
? ArrayUtility::getValueByPath($result, self::EXTENSION_CONFIGURATION_PATH, '.')
: [];
if (ArrayUtility::isValidPath($result, 'settings.typoScriptIncluded', '.')) {
$cacheInstance->set($hash, $result);
}
}
return $result;
}
|
php
|
{
"resource": ""
}
|
q2527
|
TypoScriptService.getFullConfiguration
|
train
|
protected function getFullConfiguration()
{
$contextHash = $this->getContextHash();
if (false === array_key_exists($contextHash, $this->configuration)) {
$typoScriptArray = ($this->environmentService->isEnvironmentInFrontendMode())
? $this->getFrontendTypoScriptConfiguration()
: $this->getBackendTypoScriptConfiguration();
$this->configuration[$contextHash] = $this->typoScriptService->convertTypoScriptArrayToPlainArray($typoScriptArray);
}
return $this->configuration[$contextHash];
}
|
php
|
{
"resource": ""
}
|
q2528
|
Generator.generate
|
train
|
public function generate(
ContainerConfiguration $config,
ConfigCache $dump
): ContainerInterface {
$this->compiler->compile($config, $dump, $this);
return $this->loadContainer($config, $dump);
}
|
php
|
{
"resource": ""
}
|
q2529
|
HtmlToJson.toJson
|
train
|
public function toJson($html)
{
// Strip white space between tags to prevent creation of empty #text nodes
$html = preg_replace('~>\s+<~', '><', $html);
$document = new \DOMDocument();
// Load UTF-8 HTML hack (from http://bit.ly/pVDyCt)
$document->loadHTML('<?xml encoding="UTF-8">' . $html);
$document->encoding = 'UTF-8';
// fetch the body of the document. All html is stored in there
$body = $document->getElementsByTagName("body")->item(0);
$data = array();
// loop trough the child nodes and convert them
if ($body) {
foreach ($body->childNodes as $node) {
$data[] = $this->convert($node);
}
}
return json_encode(array('data' => $data));
}
|
php
|
{
"resource": ""
}
|
q2530
|
HtmlToJson.convert
|
train
|
private function convert(\DOMElement $node)
{
foreach ($this->converters as $converter) {
if ($converter->matches($node)) {
return $converter->toJson($node);
}
}
}
|
php
|
{
"resource": ""
}
|
q2531
|
AbstractActivation.getConditions
|
train
|
public function getConditions()
{
$conditionList = $this->withFirstParent(
Form::class,
function (Form $formConfiguration) {
return $formConfiguration->getConditionList();
}
);
$conditionList = ($conditionList) ?: [];
ArrayUtility::mergeRecursiveWithOverrule($conditionList, $this->conditions);
return $conditionList;
}
|
php
|
{
"resource": ""
}
|
q2532
|
AbstractActivation.getCondition
|
train
|
public function getCondition($name)
{
if (false === $this->hasCondition($name)) {
throw EntryNotFoundException::activationConditionNotFound($name);
}
$items = $this->getConditions();
return $items[$name];
}
|
php
|
{
"resource": ""
}
|
q2533
|
FormService.getFormWithErrors
|
train
|
public static function getFormWithErrors($formClassName)
{
GeneralUtility::logDeprecatedFunction();
return (isset(self::$formWithErrors[$formClassName]))
? self::$formWithErrors[$formClassName]
: null;
}
|
php
|
{
"resource": ""
}
|
q2534
|
ConditionParser.getNodeRecursive
|
train
|
protected function getNodeRecursive()
{
while (false === empty($this->scope->getExpression())) {
$currentExpression = $this->scope->getExpression();
$this->processToken($currentExpression[0]);
$this->processLogicalAndNode();
}
$this->processLastLogicalOperatorNode();
$node = $this->scope->getNode();
unset($this->scope);
return $node;
}
|
php
|
{
"resource": ""
}
|
q2535
|
ConditionParser.processToken
|
train
|
protected function processToken($token)
{
switch ($token) {
case ')':
$this->processTokenClosingParenthesis();
break;
case '(':
$this->processTokenOpeningParenthesis();
break;
case self::LOGICAL_OR:
case self::LOGICAL_AND:
$this->processTokenLogicalOperator($token);
break;
default:
$this->processTokenCondition($token);
break;
}
return $this;
}
|
php
|
{
"resource": ""
}
|
q2536
|
ConditionParser.processTokenOpeningParenthesis
|
train
|
protected function processTokenOpeningParenthesis()
{
$groupNode = $this->getGroupNode($this->scope->getExpression());
$scopeSave = $this->scope;
$expression = array_slice($scopeSave->getExpression(), count($groupNode) + 2);
$scopeSave->setExpression($expression);
$this->scope = $this->getNewScope();
$this->scope->setExpression($groupNode);
$node = $this->getNodeRecursive();
$this->scope = $scopeSave;
$this->scope->setNode($node);
}
|
php
|
{
"resource": ""
}
|
q2537
|
ConditionParser.processTokenLogicalOperator
|
train
|
protected function processTokenLogicalOperator($operator)
{
if (null === $this->scope->getNode()) {
$this->addError('Logical operator must be preceded by a valid operation.', self::ERROR_CODE_LOGICAL_OPERATOR_PRECEDED);
} else {
if (self::LOGICAL_OR === $operator) {
if (null !== $this->scope->getLastOrNode()) {
/*
* If a `or` node was already registered, we create a new
* boolean node to join the two nodes.
*/
$node = new BooleanNode($this->scope->getLastOrNode(), $this->scope->getNode(), $operator);
$this->scope->setNode($node);
}
$this->scope->setLastOrNode($this->scope->getNode());
} else {
$this->scope
->setCurrentLeftNode($this->scope->getNode())
->deleteNode();
}
$this->scope
->setCurrentOperator($operator)
->shiftExpression();
}
}
|
php
|
{
"resource": ""
}
|
q2538
|
ConditionParser.processTokenCondition
|
train
|
protected function processTokenCondition($condition)
{
if (false === $this->condition->hasCondition($condition)) {
$this->addError('The condition "' . $condition . '" does not exist.', self::ERROR_CODE_CONDITION_NOT_FOUND);
} else {
$node = new ConditionNode($condition, $this->condition->getCondition($condition));
$this->scope
->setNode($node)
->shiftExpression();
}
}
|
php
|
{
"resource": ""
}
|
q2539
|
ConditionParser.processLogicalAndNode
|
train
|
protected function processLogicalAndNode()
{
if (null !== $this->scope->getCurrentLeftNode()
&& null !== $this->scope->getNode()
&& null !== $this->scope->getCurrentOperator()
) {
$node = new BooleanNode($this->scope->getCurrentLeftNode(), $this->scope->getNode(), $this->scope->getCurrentOperator());
$this->scope
->setNode($node)
->deleteCurrentLeftNode()
->deleteCurrentOperator();
}
return $this;
}
|
php
|
{
"resource": ""
}
|
q2540
|
ConditionParser.processLastLogicalOperatorNode
|
train
|
protected function processLastLogicalOperatorNode()
{
if (null !== $this->scope->getCurrentLeftNode()) {
$this->addError('Logical operator must be followed by a valid operation.', self::ERROR_CODE_LOGICAL_OPERATOR_FOLLOWED);
} elseif (null !== $this->scope->getLastOrNode()) {
$node = new BooleanNode($this->scope->getLastOrNode(), $this->scope->getNode(), self::LOGICAL_OR);
$this->scope->setNode($node);
}
return $this;
}
|
php
|
{
"resource": ""
}
|
q2541
|
ConditionParser.getGroupNodeClosingIndex
|
train
|
protected function getGroupNodeClosingIndex(array $expression)
{
$parenthesis = 1;
$index = 0;
while ($parenthesis > 0) {
$index++;
if ($index > count($expression)) {
$this->addError('Parenthesis not correctly closed.', self::ERROR_CODE_CLOSING_PARENTHESIS_NOT_FOUND);
}
if ('(' === $expression[$index]) {
$parenthesis++;
} elseif (')' === $expression[$index]) {
$parenthesis--;
}
}
return $index;
}
|
php
|
{
"resource": ""
}
|
q2542
|
Salt.getSalt
|
train
|
public static function getSalt(): string
{
$result = '';
try {
$result = static::readSaltFromFile();
} catch (InvalidArgumentException $e) {
Log::warning("Failed to read salt from file");
}
if ($result) {
return $result;
}
try {
$salt = static::generateSalt();
static::writeSaltToFile($salt);
$result = static::readSaltFromFile();
} catch (InvalidArgumentException $e) {
throw new InvalidArgumentException("Failed to regenerate and save new salt: " . $e->getMessage(), 0, $e);
}
Log::warning("New salt is generated and stored. Users might need to logout and clean their cookies.");
return $result;
}
|
php
|
{
"resource": ""
}
|
q2543
|
Salt.readSaltFromFile
|
train
|
protected static function readSaltFromFile(): string
{
Utility::validatePath(static::$saltFile);
$result = file_get_contents(static::$saltFile);
$result = $result ?: '';
static::validateSalt($result);
return $result;
}
|
php
|
{
"resource": ""
}
|
q2544
|
Salt.writeSaltToFile
|
train
|
protected static function writeSaltToFile(string $salt): void
{
static::validateSalt($salt);
$result = @file_put_contents(static::$saltFile, $salt);
if (($result === false) || ($result <> strlen($salt))) {
throw new InvalidArgumentException("Failed to write salt to file [" . static::$saltFile . "]");
}
}
|
php
|
{
"resource": ""
}
|
q2545
|
Salt.validateSalt
|
train
|
protected static function validateSalt(string $salt): void
{
if (!ctype_print($salt)) {
throw new InvalidArgumentException("Salt is not a printable string");
}
static::validateSaltMinLength();
$saltLength = strlen($salt);
if ($saltLength < static::$saltMinLength) {
throw new InvalidArgumentException("Salt length of $saltLength characters is less than expected " . static::$saltMinLength);
}
}
|
php
|
{
"resource": ""
}
|
q2546
|
Salt.generateSalt
|
train
|
protected static function generateSalt(): string
{
$result = '';
static::validateSaltMinLength();
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$poolSize = strlen($pool);
for ($i = 0; $i < static::$saltMinLength; $i++) {
$result .= $pool[rand(0, $poolSize - 1)];
}
return $result;
}
|
php
|
{
"resource": ""
}
|
q2547
|
Client.getBrowser
|
train
|
public function getBrowser($startPage, $type = '*firefox')
{
$url = 'http://'.$this->host.':'.$this->port.'/selenium-server/driver/';
$driver = new Driver($url, $this->timeout);
$class = $this->browserClass;
return new $class($driver, $startPage, $type);
}
|
php
|
{
"resource": ""
}
|
q2548
|
MySQL.describeTable
|
train
|
public function describeTable($table)
{
if (!$this->connection->expr('show tables like []', [$table])->get()) {
return []; // no such table
}
$result = [];
foreach ($this->connection->expr('describe {}', [$table]) as $row) {
$row2 = [];
$row2['name'] = $row['Field'];
$row2['pk'] = $row['Key'] == 'PRI';
$row2['type'] = preg_replace('/\(.*/', '', $row['Type']);
$result[] = $row2;
}
return $result;
}
|
php
|
{
"resource": ""
}
|
q2549
|
FormObjectHash.getHash
|
train
|
public function getHash()
{
if (null === $this->hash) {
$this->hash = $this->calculateHash();
}
return $this->hash;
}
|
php
|
{
"resource": ""
}
|
q2550
|
ErrorHandler.register
|
train
|
public function register($handledErrors = E_ALL)
{
$errHandler = [$this, 'handleError'];
$exHandler = [$this, 'handleException'];
$handledErrors = is_int($handledErrors) ? $handledErrors : E_ALL;
set_error_handler($errHandler, $handledErrors);
set_exception_handler($exHandler);
return $this;
}
|
php
|
{
"resource": ""
}
|
q2551
|
ErrorHandler.registerShutdown
|
train
|
public function registerShutdown()
{
if (self::$reservedMemory === null) {
self::$reservedMemory = str_repeat('x', 10240);
register_shutdown_function(__CLASS__ . '::handleFatalError');
}
self::$exceptionHandler = [$this, 'handleException'];
return $this;
}
|
php
|
{
"resource": ""
}
|
q2552
|
ConditionProcessorFactory.fetchProcessorInstanceFromCache
|
train
|
protected function fetchProcessorInstanceFromCache($cacheIdentifier, FormObject $formObject)
{
$cacheInstance = CacheService::get()->getCacheInstance();
/** @var ConditionProcessor $instance */
if ($cacheInstance->has($cacheIdentifier)) {
$instance = $cacheInstance->get($cacheIdentifier);
$instance->attachFormObject($formObject);
} else {
$instance = $this->getNewProcessorInstance($formObject);
$instance->calculateAllTrees();
$cacheInstance->set($cacheIdentifier, $instance);
}
return $instance;
}
|
php
|
{
"resource": ""
}
|
q2553
|
GoogleRecaptcha.verify
|
train
|
public function verify($response)
{
$result = $this->getVerificationResult($response);
if ($result['success']) {
return true;
}
if (!empty($result['error-codes'])) {
$this->errors = $result['error-codes'];
}
return false;
}
|
php
|
{
"resource": ""
}
|
q2554
|
GoogleRecaptcha.getScriptSrc
|
train
|
protected function getScriptSrc($onloadCallbackName)
{
$url = static::SCRIPT_URL;
$queryArgs = [];
\parse_str(\parse_url($url, PHP_URL_QUERY), $queryArgs);
$queryArgs['onload'] = $onloadCallbackName;
$queryArgs['render'] = 'explicit';
$url = \sprintf('%s?%s', \strtok($url, '?'), \http_build_query($queryArgs));
return $url;
}
|
php
|
{
"resource": ""
}
|
q2555
|
NegotiatingContentHandler.getContentTypeHandler
|
train
|
private function getContentTypeHandler(ServerRequestInterface $request)
{
$acceptHeader = $request->getHeaderLine('Accept');
$acceptedTypes = explode(',', $acceptHeader);
foreach ($this->handlers as $contentType => $handler) {
if ($this->doesTypeMatch($acceptedTypes, $contentType)) {
return $handler;
}
}
return reset($this->handlers);
}
|
php
|
{
"resource": ""
}
|
q2556
|
FootprintBehavior.beforeSave
|
train
|
public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options): void
{
if (! is_callable($this->getConfig('callback'))) {
return;
}
$user = call_user_func($this->getConfig('callback'));
if (empty($user['id'])) {
return;
}
// Set created_by only if that field is not set during entity creation
if ($entity->isNew() && empty($entity->get($this->getConfig('created_by')))) {
$entity->set($this->getConfig('created_by'), $user['id']);
}
// Set modified_by if that field is not set during update
$userId = $entity->isDirty($this->getConfig('modified_by')) && !empty($this->getConfig('modified_by')) ? $entity->get($this->getConfig('modified_by')) : $user['id'];
$entity->set($this->getConfig('modified_by'), $userId);
}
|
php
|
{
"resource": ""
}
|
q2557
|
BuilderAbstract.build
|
train
|
public function build(InputSettings $settings)
{
$this->settings = $settings;
$this->setElement();
$this->setValidator();
$this->setLabel();
$this->setDefault();
$this->setAttributes();
$this->setData();
$this->setAdditionalOptions();
return $this->getElement();
}
|
php
|
{
"resource": ""
}
|
q2558
|
BuilderAbstract.initElement
|
train
|
public function initElement()
{
if(is_null($this->settings)) {
$this->settings = new InputSettings();
}
return $this->build($this->settings);
}
|
php
|
{
"resource": ""
}
|
q2559
|
BuilderAbstract.setLabel
|
train
|
public function setLabel()
{
if($this->settings->getValue(InputSettings::LABEL_PARAM)) {
$this->element->setLabel($this->settings->getValue(InputSettings::LABEL_PARAM));
} else {
$this->element->setLabel(preg_replace('/.*\\\/', '', get_class($this)));
}
}
|
php
|
{
"resource": ""
}
|
q2560
|
BuilderAbstract.setDefault
|
train
|
public function setDefault()
{
if($this->settings->getValue(InputSettings::DEFAULTS_PARAM)) {
$this->element->setDefault($this->settings->getValue(InputSettings::DEFAULTS_PARAM));
}
}
|
php
|
{
"resource": ""
}
|
q2561
|
BuilderAbstract.setAttributes
|
train
|
public function setAttributes()
{
if($this->settings->getValue(InputSettings::PLACEHOLDER_PARAM)) {
$this->element->setAttribute('placeholder', $this->settings->getValue(InputSettings::PLACEHOLDER_PARAM));
}
}
|
php
|
{
"resource": ""
}
|
q2562
|
DoctrineWriter.getNewInstance
|
train
|
protected function getNewInstance()
{
$className = $this->objectMetadata->getName();
if (class_exists($className) === false) {
throw new \RuntimeException('Unable to create new instance of ' . $className);
}
return new $className;
}
|
php
|
{
"resource": ""
}
|
q2563
|
DoctrineWriter.setValue
|
train
|
protected function setValue($object, $value, $setter)
{
if (method_exists($object, $setter)) {
$object->$setter($value);
}
}
|
php
|
{
"resource": ""
}
|
q2564
|
AssetHandlerFactory.getAssetHandler
|
train
|
public function getAssetHandler($className)
{
if (false === array_key_exists($className, $this->instances)) {
if (false === class_exists($className)) {
throw ClassNotFoundException::wrongAssetHandlerClassName($className);
}
$instance = GeneralUtility::makeInstance($className, $this);
if (false === $instance instanceof AbstractAssetHandler) {
throw InvalidArgumentTypeException::wrongAssetHandlerType(get_class($instance));
}
$this->instances[$className] = $instance;
}
return $this->instances[$className];
}
|
php
|
{
"resource": ""
}
|
q2565
|
FormInitializationJavaScriptAssetHandler.getFormInitializationJavaScriptCode
|
train
|
public function getFormInitializationJavaScriptCode()
{
$formName = GeneralUtility::quoteJSvalue($this->getFormObject()->getName());
$formConfigurationJson = $this->handleFormConfiguration($this->getFormConfiguration());
$javaScriptCode = <<<JS
(function() {
Fz.Form.register($formName, $formConfigurationJson);
})();
JS;
return $javaScriptCode;
}
|
php
|
{
"resource": ""
}
|
q2566
|
FormInitializationJavaScriptAssetHandler.getFormConfiguration
|
train
|
protected function getFormConfiguration()
{
$formConfigurationArray = $this->getFormObject()->getConfiguration()->toArray();
$this->removeFieldsValidationConfiguration($formConfigurationArray)
->addClassNameProperty($formConfigurationArray);
return ArrayService::get()->arrayToJavaScriptJson($formConfigurationArray);
}
|
php
|
{
"resource": ""
}
|
q2567
|
FormInitializationJavaScriptAssetHandler.removeFieldsValidationConfiguration
|
train
|
protected function removeFieldsValidationConfiguration(array &$formConfiguration)
{
foreach ($formConfiguration['fields'] as $fieldName => $fieldConfiguration) {
if (true === isset($fieldConfiguration['validation'])) {
unset($fieldConfiguration['validation']);
unset($fieldConfiguration['activation']);
$formConfiguration['fields'][$fieldName] = $fieldConfiguration;
}
}
return $this;
}
|
php
|
{
"resource": ""
}
|
q2568
|
FormzLocalizationJavaScriptAssetHandler.getJavaScriptCode
|
train
|
public function getJavaScriptCode()
{
$realTranslations = [];
$translationsBinding = [];
foreach ($this->translations as $key => $value) {
$hash = HashService::get()->getHash($value);
$realTranslations[$hash] = $value;
$translationsBinding[$key] = $hash;
}
$jsonRealTranslations = $this->handleRealTranslations(ArrayService::get()->arrayToJavaScriptJson($realTranslations));
$jsonTranslationsBinding = $this->handleTranslationsBinding(ArrayService::get()->arrayToJavaScriptJson($translationsBinding));
return <<<JS
Fz.Localization.addLocalization($jsonRealTranslations, $jsonTranslationsBinding);
JS;
}
|
php
|
{
"resource": ""
}
|
q2569
|
FormzLocalizationJavaScriptAssetHandler.getTranslationKeysForFieldValidation
|
train
|
public function getTranslationKeysForFieldValidation(Field $field, $validationName)
{
$result = [];
if (true === $field->hasValidation($validationName)) {
$key = $field->getName() . '-' . $validationName;
$this->storeTranslationsForFieldValidation($field);
$result = $this->translationKeysForFieldValidation[$key];
}
return $result;
}
|
php
|
{
"resource": ""
}
|
q2570
|
FormzLocalizationJavaScriptAssetHandler.injectTranslationsForFormFieldsValidation
|
train
|
public function injectTranslationsForFormFieldsValidation()
{
$formConfiguration = $this->getFormObject()->getConfiguration();
foreach ($formConfiguration->getFields() as $field) {
$this->storeTranslationsForFieldValidation($field);
}
return $this;
}
|
php
|
{
"resource": ""
}
|
q2571
|
FormzLocalizationJavaScriptAssetHandler.storeTranslationsForFieldValidation
|
train
|
protected function storeTranslationsForFieldValidation(Field $field)
{
if (false === $this->translationsForFieldValidationWereInjected($field)) {
$fieldName = $field->getName();
foreach ($field->getValidation() as $validationName => $validation) {
$messages = ValidatorService::get()->getValidatorMessages($validation->getClassName(), $validation->getMessages());
foreach ($messages as $key => $message) {
$message = MessageService::get()->parseMessageArray($message, ['{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}']);
$localizationKey = $this->getIdentifierForFieldValidationName($field, $validationName, $key);
$this->addTranslation($localizationKey, $message);
$messages[$key] = $localizationKey;
}
$this->translationKeysForFieldValidation[$fieldName . '-' . $validationName] = $messages;
$key = $this->getFormObject()->getClassName() . '-' . $field->getName();
$this->injectedTranslationKeysForFieldValidation[$key] = true;
}
}
return $this;
}
|
php
|
{
"resource": ""
}
|
q2572
|
FormzLocalizationJavaScriptAssetHandler.translationsForFieldValidationWereInjected
|
train
|
protected function translationsForFieldValidationWereInjected(Field $field)
{
$key = $this->getFormObject()->getClassName() . '-' . $field->getName();
return true === isset($this->injectedTranslationKeysForFieldValidation[$key]);
}
|
php
|
{
"resource": ""
}
|
q2573
|
Configuration.getConfigurationObjectServices
|
train
|
public static function getConfigurationObjectServices()
{
return ServiceFactory::getInstance()
->attach(ServiceInterface::SERVICE_CACHE)
->with(ServiceInterface::SERVICE_CACHE)
->setOption(CacheService::OPTION_CACHE_NAME, InternalCacheService::CONFIGURATION_OBJECT_CACHE_IDENTIFIER)
->setOption(CacheService::OPTION_CACHE_BACKEND, InternalCacheService::get()->getBackendCache())
->attach(ServiceInterface::SERVICE_PARENTS)
->attach(ServiceInterface::SERVICE_DATA_PRE_PROCESSOR)
->attach(ServiceInterface::SERVICE_MIXED_TYPES);
}
|
php
|
{
"resource": ""
}
|
q2574
|
Configuration.addForm
|
train
|
public function addForm(FormObject $form)
{
if (true === $this->hasForm($form->getClassName(), $form->getName())) {
throw DuplicateEntryException::formWasAlreadyRegistered($form);
}
$form->getConfiguration()->setParents([$this]);
$this->forms[$form->getClassName()][$form->getName()] = $form;
}
|
php
|
{
"resource": ""
}
|
q2575
|
Configuration.calculateHash
|
train
|
public function calculateHash()
{
$fullArray = $this->toArray();
$configurationArray = [
'view' => $fullArray['view'],
'settings' => $fullArray['settings']
];
$this->hash = HashService::get()->getHash(serialize($configurationArray));
}
|
php
|
{
"resource": ""
}
|
q2576
|
MethodBuilder.buildCode
|
train
|
public function buildCode()
{
$code = '';
if ($this->documentation) {
$code .= ' /**'."\n";
$code .= ' * '.str_replace("\n", "\n * ", wordwrap($this->documentation, 73))."\n";
$code .= ' */'."\n";
}
$code .= ' public function '.$this->name.'('.implode(', ', $this->parameters).')'."\n";
$code .= ' {'."\n";
$code .= ' '.str_replace("\n", "\n ", $this->body)."\n";
$code .= ' }';
// Trim trailing whitespaces
$code = preg_replace('/[ ]+$/m', '', $code);
return $code;
}
|
php
|
{
"resource": ""
}
|
q2577
|
Taxonomy.createVocabulary
|
train
|
public function createVocabulary($name) {
if ($this->vocabulary->where('name', $name)->count()) {
throw new Exceptions\VocabularyExistsException();
}
return $this->vocabulary->create(['name' => $name]);
}
|
php
|
{
"resource": ""
}
|
q2578
|
Taxonomy.getVocabularyByNameAsArray
|
train
|
public function getVocabularyByNameAsArray($name) {
$vocabulary = $this->vocabulary->where('name', $name)->first();
if (!is_null($vocabulary)) {
return $vocabulary->terms->pluck('name', 'id')->toArray();
}
return [];
}
|
php
|
{
"resource": ""
}
|
q2579
|
Taxonomy.getVocabularyByNameOptionsArray
|
train
|
public function getVocabularyByNameOptionsArray($name) {
$vocabulary = $this->vocabulary->where('name', $name)->first();
if (is_null($vocabulary)) {
return [];
}
$parents = $this->term->whereParent(0)
->whereVocabularyId($vocabulary->id)
->orderBy('weight', 'ASC')
->get();
$options = [];
foreach ($parents as $parent) {
$options[$parent->id] = $parent->name;
$this->recurse_children($parent, $options);
}
return $options;
}
|
php
|
{
"resource": ""
}
|
q2580
|
Taxonomy.recurse_children
|
train
|
private function recurse_children($parent, &$options, $depth = 1) {
$parent->childrens->map(function($child) use (&$options, $depth) {
$options[$child->id] = str_repeat('-', $depth) .' '. $child->name;
if ($child->childrens) {
$this->recurse_children($child, $options, $depth+1);
}
});
}
|
php
|
{
"resource": ""
}
|
q2581
|
Taxonomy.deleteVocabularyByName
|
train
|
public function deleteVocabularyByName($name) {
$vocabulary = $this->vocabulary->where('name', $name)->first();
if (!is_null($vocabulary)) {
return $vocabulary->delete();
}
return FALSE;
}
|
php
|
{
"resource": ""
}
|
q2582
|
Taxonomy.createTerm
|
train
|
public function createTerm($vid, $name, $parent = 0, $weight = 0) {
$vocabulary = $this->vocabulary->findOrFail($vid);
$term = [
'name' => $name,
'vocabulary_id' => $vid,
'parent' => $parent,
'weight' => $weight,
];
return $this->term->create($term);
}
|
php
|
{
"resource": ""
}
|
q2583
|
ConditionIsValidValidator.isValid
|
train
|
public function isValid($condition)
{
$conditionTree = ConditionParser::get()
->parse($condition);
if (true === $conditionTree->getValidationResult()->hasErrors()) {
$errorMessage = $this->translateErrorMessage(
'validator.form.condition_is_valid.error',
'formz',
[
$condition->getExpression(),
$conditionTree->getValidationResult()->getFirstError()->getMessage()
]
);
$this->addError($errorMessage, self::ERROR_CODE);
}
}
|
php
|
{
"resource": ""
}
|
q2584
|
InjectorServiceProvider.alias
|
train
|
protected function alias($aliasKey, $serviceKey)
{
// Bound as a factory to ALWAYS pass through to underlying definition.
$this->bindFactory(
$aliasKey,
function (Container $app) use ($serviceKey) {
return $app[$serviceKey];
}
);
}
|
php
|
{
"resource": ""
}
|
q2585
|
InjectorServiceProvider.autoBind
|
train
|
protected function autoBind($className, callable $parameterFactory = null)
{
$this->bind(
$className,
$this->closureFactory->createAutoWireClosure($className, $parameterFactory)
);
}
|
php
|
{
"resource": ""
}
|
q2586
|
InjectorServiceProvider.autoBindFactory
|
train
|
protected function autoBindFactory($className, callable $parameterFactory = null)
{
$this->bindFactory(
$className,
$this->closureFactory->createAutoWireClosure($className, $parameterFactory)
);
}
|
php
|
{
"resource": ""
}
|
q2587
|
Injector.create
|
train
|
public function create($className, $parameters = [])
{
$reflectionClass = new \ReflectionClass($className);
if (!$reflectionClass->hasMethod("__construct")) {
//This class doesn't have a constructor
return $reflectionClass->newInstanceWithoutConstructor();
}
if (!$reflectionClass->getMethod('__construct')->isPublic()) {
throw new InjectorInvocationException(
"Injector failed to create $className - constructor isn't public." .
" Do you need to use a static factory method instead?"
);
}
try {
$parameters = $this->buildParameterArray(
$this->inspector->getSignatureByReflectionClass($reflectionClass, "__construct"),
$parameters
);
return $reflectionClass->newInstanceArgs($parameters);
} catch (MissingRequiredParameterException $e) {
throw new InjectorInvocationException(
"Can't create $className " .
" - __construct() missing parameter '" . $e->getParameterString() . "'" .
" could not be found. Either register it as a service or pass it to create via parameters."
);
} catch (InjectorInvocationException $e) {
//Wrap the exception stack for recursive calls to aid debugging
throw new InjectorInvocationException(
$e->getMessage() .
PHP_EOL . " => (Called when creating $className)"
);
}
}
|
php
|
{
"resource": ""
}
|
q2588
|
Injector.canAutoCreate
|
train
|
public function canAutoCreate($className)
{
foreach ($this->autoCreateWhiteList as $regex) {
if (preg_match($regex, $className)) {
return true;
}
}
return false;
}
|
php
|
{
"resource": ""
}
|
q2589
|
Injector.buildParameterArray
|
train
|
private function buildParameterArray($methodSignature, $providedParameters)
{
$parameters = [];
foreach ($methodSignature as $position => $parameterData) {
if (!isset($parameterData['variadic'])) {
$parameters[$position] = $this->resolveParameter($position, $parameterData, $providedParameters);
} else {
// variadic parameter must be the last one, so
// the rest of the provided paramters should be piped
// into it to mimic native php behaviour
foreach ($providedParameters as $variadicParameter) {
$parameters[] = $variadicParameter;
}
}
}
return $parameters;
}
|
php
|
{
"resource": ""
}
|
q2590
|
ParameterInspector.getSignatureByReflectionClass
|
train
|
public function getSignatureByReflectionClass(\ReflectionClass $reflectionClass, $methodName)
{
$className = $reflectionClass->getName();
return $this->getMethodSignature($className, $methodName, $reflectionClass);
}
|
php
|
{
"resource": ""
}
|
q2591
|
BindingClosureFactory.createAutoWireClosure
|
train
|
public function createAutoWireClosure($className, callable $parameterFactory = null)
{
return function (Container $app) use ($className, $parameterFactory) {
$parameters = $parameterFactory ? $parameterFactory($app) : [];
return $this->injector->create($className, $parameters);
};
}
|
php
|
{
"resource": ""
}
|
q2592
|
BindingClosureFactory.createProxy
|
train
|
private function createProxy($className, callable $serviceFactory, Container $app)
{
return $this->proxyFactory->createProxy(
$className,
function (&$wrappedObject, $proxy, $method, $parameters, &$initializer) use (
$className,
$serviceFactory,
$app
) {
$wrappedObject = $serviceFactory($app);
$initializer = null;
return true;
}
);
}
|
php
|
{
"resource": ""
}
|
q2593
|
Packages.classmap
|
train
|
public function classmap()
{
$path = $this->composerPath . $this->classmapName;
$i = 0;
if (is_file($path)) {
$data = include $path;
foreach ($data as $key => $value) {
if (false === empty($value)) {
$this->libs[addcslashes($key, '\\')] = $value;
$i++;
}
}
$this->log[] = 'Imported ' . $i . ' classes from classmap';
return $i;
}
$this->log[] = 'Warn: classmap not found';
return false;
}
|
php
|
{
"resource": ""
}
|
q2594
|
Packages.psr0
|
train
|
public function psr0()
{
$i = $this->load($this->composerPath . $this->psrZeroName);
if ($i !== false) {
$this->log[] = 'Imported ' . $i . ' classes from psr0';
return $i;
}
$this->log[] = 'Warn: psr0 not found';
return false;
}
|
php
|
{
"resource": ""
}
|
q2595
|
Packages.psr4
|
train
|
public function psr4()
{
$i = $this->load($this->composerPath . $this->psrFourName);
if ($i !== false) {
$this->log[] = 'Imported ' . $i . ' classes from psr4';
return $i;
}
$this->log[] = 'Warn: psr4 not found';
return false;
}
|
php
|
{
"resource": ""
}
|
q2596
|
Packages.save
|
train
|
public function save($path)
{
if (count($this->libs) === 0) {
return false;
}
$handle = fopen($path, 'w');
if ($handle === false) {
throw new \InvalidArgumentException('This path is not writabled: ' . $path);
}
$first = true;
$eol = chr(10);
fwrite($handle, '<?php' . $eol . 'return array(');
foreach ($this->libs as $key => $value) {
$value = self::relativePath($value);
fwrite($handle, ($first ? '' : ',') . $eol . " '" . $key . "' => '" . $value . "'");
$first = false;
}
fwrite($handle, $eol . ');' . $eol);
fclose($handle);
return true;
}
|
php
|
{
"resource": ""
}
|
q2597
|
Packages.version
|
train
|
public static function version($name)
{
$file = INPHINIT_ROOT . 'composer.lock';
$data = is_file($file) ? json_decode(file_get_contents($file)) : false;
if (empty($data->packages)) {
return false;
}
$version = false;
foreach ($data->packages as $package) {
if ($package->name === $name) {
$version = $package->version;
break;
}
}
$data = null;
return $version;
}
|
php
|
{
"resource": ""
}
|
q2598
|
ObjectArrayStorage.get
|
train
|
public function get($object) : array
{
$values = $this->storage->get($object);
return ($values === null) ? [] : $values;
}
|
php
|
{
"resource": ""
}
|
q2599
|
ObjectArrayStorage.add
|
train
|
public function add($object, $value) : void
{
$values = $this->get($object);
$values[] = $value;
$this->storage->set($object, $values);
}
|
php
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.