_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q6300 | DocumentHydrator.processSingleResourceDocument | train | protected function processSingleResourceDocument($source): SingleResourceDocument
{
$resource = $this->hydrateResource($source->data);
$document = new SingleResourceDocument($resource);
$this->hydrateObject($document, $source);
return $document;
} | php | {
"resource": ""
} |
q6301 | DocumentHydrator.processResourceCollectionDocument | train | protected function processResourceCollectionDocument($source): ResourceCollectionDocument
{
$document = new ResourceCollectionDocument();
foreach ($source->data as $resourceSrc)
{
$document->addResource($this->hydrateResource($resourceSrc));
}
$this->hydrateObject($document, $source);
return $document;
} | php | {
"resource": ""
} |
q6302 | Mailer.send | train | public function send($first, $last, $email, $message)
{
$quote = nl2br($message);
$name = $first.' '.$last;
$this->sendMessage($name, $email, $quote);
$this->sendThanks($first, $email, $quote);
} | php | {
"resource": ""
} |
q6303 | HttpClient.streamToDocument | train | protected function streamToDocument(StreamInterface $stream): AbstractDocument
{
$content = $stream->getContents();
$decoded = json_decode($content);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \RuntimeException('Decoding error: "' . json_last_error_msg() . '""');
}
return $this->hydrator->hydrate($decoded);
} | php | {
"resource": ""
} |
q6304 | HttpClient.documentToStream | train | protected function documentToStream(AbstractDocument $document): StreamInterface
{
$encoded = json_encode($document->toArray());
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \RuntimeException('Encoding error: "' . json_last_error_msg() . '""');
}
$stream = fopen('php://memory', 'r+');
fwrite($stream, $encoded);
fseek($stream, 0);
return new Stream($stream);
} | php | {
"resource": ""
} |
q6305 | BaseResource.getId | train | protected function getId($id = null)
{
$id = (empty($id)) ? $this->resourceId : $id;
if (empty($id)) {
throw new \Exception('Invalid id supplied [' . $id . ']. Operation requires valid resource id.');
}
return $id;
} | php | {
"resource": ""
} |
q6306 | BaseResource.request | train | protected function request($verb, $path, $resource = '', array $payload = [])
{
return $this->client->request($verb, $path, $this->resourceType, $resource, $payload, $this->headers);
} | php | {
"resource": ""
} |
q6307 | Template.render | train | public function render()
{
require_once 'functions_include.php';
$block = [];
foreach ($this->blocks as $key => &$subTpl) {
$block[ $key ] = !is_null($subTpl)
? $this->filter('block.' . $key, $subTpl->render())
: '';
}
foreach ($this->vars as $key => $value) {
$$key = $this->filter('var.' . $key, $value);
}
ob_start();
require $this->path . $this->name;
$html = ob_get_clean();
return $this->filter('output', $html);
} | php | {
"resource": ""
} |
q6308 | CustomerRemoveLostUserDataTypo3.migrate | train | public function migrate()
{
$this->msg( 'Remove left over TYPO3 fe_users references', 0, '' );
foreach( $this->sql as $table => $stmt )
{
$this->msg( sprintf( 'Remove unused %1$s records', $table ), 1 );
if( $this->schema->tableExists( 'fe_users' ) && $this->schema->tableExists( $table ) )
{
$this->execute( $stmt );
$this->status( 'done' );
}
else
{
$this->status( 'OK' );
}
}
} | php | {
"resource": ""
} |
q6309 | FormBuilder.group | train | public function group($name, $balise, callable $callback, $attr = null)
{
$form = new FormBuilder([]);
call_user_func_array($callback, [ &$form ]);
$group = $this->merge_attr([ 'balise' => $balise ], $attr);
return $this->input($name, [ 'type' => 'group', 'subform' => $form, 'attr' => $group ]);
} | php | {
"resource": ""
} |
q6310 | FormBuilder.label | train | public function label($name, $label, array $attr = null)
{
return $this->input($name, [ 'type' => 'label', 'label' => $label, 'attr' => $attr ]);
} | php | {
"resource": ""
} |
q6311 | FormBuilder.legend | train | public function legend($name, $legend, array $attr = null)
{
return $this->input($name, [ 'type' => 'legend', 'legend' => $legend, 'attr' => $attr ]);
} | php | {
"resource": ""
} |
q6312 | FormBuilder.textarea | train | public function textarea($name, $id, $content = '', array $attr = null)
{
$basic = $this->merge_attr([ 'id' => $id ], $attr);
return $this->input($name, [ 'id' => $id, 'type' => 'textarea', 'content' => $content,
'attr' => $basic ]);
} | php | {
"resource": ""
} |
q6313 | FormBuilder.inputBasic | train | public function inputBasic($type, $name, $id, array $attr = null)
{
$basic = $this->merge_attr([ 'id' => $id ], $attr);
return $this->input($name, [ 'type' => $type, 'attr' => $basic ]);
} | php | {
"resource": ""
} |
q6314 | FormBuilder.submit | train | public function submit($name, $value, array $attr = null)
{
$basic = $this->merge_attr([ 'value' => $value ], $attr);
return $this->input($name, [ 'type' => 'submit', 'attr' => $basic ]);
} | php | {
"resource": ""
} |
q6315 | FormBuilder.input | train | protected function input($name, array $attr)
{
/**
* Si le for n'est pas précisé dans le label précédent
* il devient automatiquement l'id de la balise courante.
*/
$previous = end($this->form);
if ($previous && $previous[ 'type' ] == 'label' && !isset($previous[ 'attr' ][ 'for' ]) && isset($attr[ 'attr' ][ 'id' ])) {
$this->form[ key($this->form) ][ 'attr' ][ 'for' ] = $attr[ 'attr' ][ 'id' ];
}
$this->form[ $name ] = $attr;
return $this;
} | php | {
"resource": ""
} |
q6316 | FormBuilder.getAttributesCSS | train | protected function getAttributesCSS(array $attr)
{
$output = [];
foreach ($attr as $key => $values) {
if (in_array($key, $this->attributesCss) && $values !== '') {
$output[] = $key . '="' . $values . '"';
}
}
$implode = implode(' ', $output);
return $implode
? " $implode"
: '';
} | php | {
"resource": ""
} |
q6317 | FormBuilder.getAttributesInput | train | protected function getAttributesInput(array $attr)
{
$output = [];
foreach ($attr as $key => $values) {
if (empty($values)) {
continue;
}
if (in_array($key, $this->attributesUnique)) {
$output[] = $key;
} elseif (!in_array($key, $this->attributesCss) && $key !== 'selected') {
$output[] = $key . '="' . $values . '"';
}
}
$implode = implode(' ', $output);
return $implode
? " $implode"
: '';
} | php | {
"resource": ""
} |
q6318 | Size.getSize | train | protected function getSize($value)
{
if (is_numeric($value)) {
/* numeric+0 = int|float */
return $value + 0;
}
if (is_string($value)) {
return strlen($value);
}
if (is_array($value)) {
return count($value);
}
if ($value instanceof UploadedFileInterface) {
if ($value->getError() !== UPLOAD_ERR_OK) {
return 0;
}
return $value->getStream()->getSize();
}
if (is_resource($value)) {
$stats = fstat($value);
return isset($stats[ 'size' ])
? $stats[ 'size' ]
: 0;
}
if (is_object($value) && method_exists($value, '__toString')) {
return strlen((string) $value);
}
throw new \InvalidArgumentException('The between function can not test this type of value.');
} | php | {
"resource": ""
} |
q6319 | ByteFormatter.format | train | public function format($bytes, $precision = null)
{
// Use default precision when not specified.
$precision === null && $precision = $this->getPrecision();
$log = log($bytes, $this->getBase());
$exponent = $this->hasFixedExponent() ? $this->getFixedExponent() : max(0, $log|0);
$value = round(pow($this->getBase(), $log - $exponent), $precision);
$units = $this->getUnitDecorator()->decorate($exponent, $this->getBase(), $value);
return trim(sprintf($this->sprintfFormat, $this->formatValue($value, $precision), $units));
} | php | {
"resource": ""
} |
q6320 | ByteFormatter.formatValue | train | private function formatValue($value, $precision)
{
$formatted = sprintf("%0.${precision}F", $value);
if ($this->hasAutomaticPrecision()) {
// [0 => integer part, 1 => fractional part].
$formattedParts = explode('.', $formatted);
if (isset($formattedParts[1])) {
// Strip trailing 0s in fractional part.
if (!$formattedParts[1] = chop($formattedParts[1], '0')) {
// Remove fractional part.
unset($formattedParts[1]);
}
$formatted = join('.', $formattedParts);
}
}
return $formatted;
} | php | {
"resource": ""
} |
q6321 | RelationshipsContainer.relationshipsToArray | train | protected function relationshipsToArray(): array
{
$relationships = [];
foreach ($this->relationships as $name => $relationship)
{
$relationships[$name] = $relationship->toArray();
}
return $relationships;
} | php | {
"resource": ""
} |
q6322 | SymfonyEventDispatcherDecorator.dispatchOnRequest | train | protected function dispatchOnRequest(RequestInterface $request): RequestInterface
{
$requestEvent = new RequestEvent($request);
$this->dispatcher->dispatch($this->requestEvent, $requestEvent);
return $requestEvent->getRequest();
} | php | {
"resource": ""
} |
q6323 | SymfonyEventDispatcherDecorator.dispatchOnResponse | train | protected function dispatchOnResponse(ResponseInterface $response): ResponseInterface
{
$responseEvent = new ResponseEvent($response);
$this->dispatcher->dispatch($this->responseEvent, $responseEvent);
return $responseEvent->getResponse();
} | php | {
"resource": ""
} |
q6324 | Typo3.saveItem | train | public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
{
self::checkClass( \Aimeos\MShop\Customer\Item\Group\Iface::class, $item );
if( !$item->isModified() ) {
return $item;
}
$context = $this->getContext();
$dbm = $context->getDatabaseManager();
$dbname = $this->getResourceName();
$conn = $dbm->acquire( $dbname );
try
{
$id = $item->getId();
if( $id === null )
{
/** mshop/customer/manager/group/typo3/insert/mysql
* Inserts a new customer group record into the database table
*
* @see mshop/customer/manager/group/typo3/insert/ansi
*/
/** mshop/customer/manager/group/typo3/insert/ansi
* Inserts a new customer group record into the database table
*
* Items with no ID yet (i.e. the ID is NULL) will be created in
* the database and the newly created ID retrieved afterwards
* using the "newid" SQL statement.
*
* The SQL statement must be a string suitable for being used as
* prepared statement. It must include question marks for binding
* the values from the customer group item to the statement before
* they are sent to the database server. The number of question
* marks must be the same as the number of columns listed in the
* INSERT statement. The order of the columns must correspond to
* the order in the saveItems() method, so the correct values are
* bound to the columns.
*
* The SQL statement should conform to the ANSI standard to be
* compatible with most relational database systems. This also
* includes using double quotes for table and column names.
*
* @param string SQL statement for inserting records
* @since 2015.08
* @category Developer
* @see mshop/customer/manager/group/typo3/update/ansi
* @see mshop/customer/manager/group/typo3/newid/ansi
* @see mshop/customer/manager/group/typo3/delete/ansi
* @see mshop/customer/manager/group/typo3/search/ansi
* @see mshop/customer/manager/group/typo3/count/ansi
*/
$path = 'mshop/customer/manager/group/typo3/insert';
}
else
{
/** mshop/customer/manager/group/typo3/update/mysql
* Updates an existing customer group record in the database
*
* @see mshop/customer/manager/group/typo3/update/ansi
*/
/** mshop/customer/manager/group/typo3/update/ansi
* Updates an existing customer group record in the database
*
* Items which already have an ID (i.e. the ID is not NULL) will
* be updated in the database.
*
* The SQL statement must be a string suitable for being used as
* prepared statement. It must include question marks for binding
* the values from the customer group item to the statement before
* they are sent to the database server. The order of the columns
* must correspond to the order in the saveItems() method, so the
* correct values are bound to the columns.
*
* The SQL statement should conform to the ANSI standard to be
* compatible with most relational database systems. This also
* includes using double quotes for table and column names.
*
* @param string SQL statement for updating records
* @since 2015.08
* @category Developer
* @see mshop/customer/manager/group/typo3/insert/ansi
* @see mshop/customer/manager/group/typo3/newid/ansi
* @see mshop/customer/manager/group/typo3/delete/ansi
* @see mshop/customer/manager/group/typo3/search/ansi
* @see mshop/customer/manager/group/typo3/count/ansi
*/
$path = 'mshop/customer/manager/group/typo3/update';
}
$stmt = $this->getCachedStatement( $conn, $path );
$stmt->bind( 1, $this->pid, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
$stmt->bind( 2, $item->getCode() );
$stmt->bind( 3, $item->getLabel() );
$stmt->bind( 4, time(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); // mtime
if( $id !== null ) {
$stmt->bind( 5, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
$item->setId( $id );
} else {
$stmt->bind( 5, time() ); // ctime
}
$stmt->execute()->finish();
if( $id === null && $fetch === true )
{
/** mshop/customer/manager/group/typo3/newid/mysql
* Retrieves the ID generated by the database when inserting a new record
*
* @see mshop/customer/manager/group/typo3/newid/ansi
*/
/** mshop/customer/manager/group/typo3/newid/ansi
* Retrieves the ID generated by the database when inserting a new record
*
* As soon as a new record is inserted into the database table,
* the database server generates a new and unique identifier for
* that record. This ID can be used for retrieving, updating and
* deleting that specific record from the table again.
*
* For MySQL:
* SELECT LAST_INSERT_ID()
* For PostgreSQL:
* SELECT currval('seq_mcus_id')
* For SQL Server:
* SELECT SCOPE_IDENTITY()
* For Oracle:
* SELECT "seq_mcus_id".CURRVAL FROM DUAL
*
* There's no way to retrive the new ID by a SQL statements that
* fits for most database servers as they implement their own
* specific way.
*
* @param string SQL statement for retrieving the last inserted record ID
* @since 2015.08
* @category Developer
* @see mshop/customer/manager/group/typo3/insert/ansi
* @see mshop/customer/manager/group/typo3/update/ansi
* @see mshop/customer/manager/group/typo3/delete/ansi
* @see mshop/customer/manager/group/typo3/search/ansi
* @see mshop/customer/manager/group/typo3/count/ansi
*/
$path = 'mshop/customer/manager/group/typo3/newid';
$item->setId( $this->newId( $conn, $path ) );
}
$dbm->release( $conn, $dbname );
}
catch( \Exception $e )
{
$dbm->release( $conn, $dbname );
throw $e;
}
return $item;
} | php | {
"resource": ""
} |
q6325 | RelationshipProcessor.process | train | public function process(\ReflectionClass $reflection, Definition $definition)
{
foreach ($reflection->getProperties() as $property)
{
$this->processProperty($property, $definition);
}
} | php | {
"resource": ""
} |
q6326 | RelationshipProcessor.handleDataControl | train | protected function handleDataControl(RelationshipAnnotation $annotation, Relationship $relationship)
{
$relationship->setIncludeData($annotation->dataAllowed);
$relationship->setDataLimit($annotation->dataLimit);
} | php | {
"resource": ""
} |
q6327 | RelationshipProcessor.resolveType | train | protected function resolveType(RelationshipAnnotation $annotation): int
{
if ($annotation->type === RelationshipAnnotation::TYPE_ONE) {
return Relationship::TYPE_X_TO_ONE;
}
if ($annotation->type === RelationshipAnnotation::TYPE_MANY) {
return Relationship::TYPE_X_TO_MANY;
}
throw new \LogicException(sprintf('Invalid type of relation "%s" defined.', $annotation->type));
} | php | {
"resource": ""
} |
q6328 | Console.addCommand | train | public function addCommand($callback, $alias = null, $default = false)
{
if ($alias instanceof \Closure && is_string($callback)) {
list($alias, $callback) = array($callback, $alias);
}
if (is_array($callback) && is_string($callback[0])) {
$callback = implode('::', $callback);
}
$name = '';
if (is_string($callback)) {
$name = $callback;
if (is_callable($callback)) {
if (strpos($callback, '::') !== false) {
list($classname, $methodname) = explode('::', $callback);
$name = Utils::dashized($methodname);
} else {
$name = strtolower(trim(str_replace('_', '-', $name), '-'));
}
} else {
if (substr($name, -7) === 'Command') {
$name = substr($name, 0, -7);
}
$name = Utils::dashized(basename(str_replace('\\', '/', $name)));
}
} else if (is_object($callback) && !($callback instanceof Closure)) {
$classname = get_class($callback);
if (!($callback instanceof Command)) {
throw new ConsoleException("'$classname' must inherit from 'ConsoleKit\Command'");
}
if (substr($classname, -7) === 'Command') {
$classname = substr($classname, 0, -7);
}
$name = Utils::dashized(basename(str_replace('\\', '/', $classname)));
} else if (!$alias) {
throw new ConsoleException("Commands using closures must have an alias");
}
$name = $alias ?: $name;
$this->commands[$name] = $callback;
if ($default) {
$this->defaultCommand = $name;
}
return $this;
} | php | {
"resource": ""
} |
q6329 | Console.addCommandsFromDir | train | public function addCommandsFromDir($dir, $namespace = '', $includeFiles = false)
{
foreach (new DirectoryIterator($dir) as $file) {
$filename = $file->getFilename();
if ($file->isDir() || substr($filename, 0, 1) === '.' || strlen($filename) <= 11
|| strtolower(substr($filename, -11)) !== 'command.php') {
continue;
}
if ($includeFiles) {
include $file->getPathname();
}
$className = trim($namespace . '\\' . substr($filename, 0, -4), '\\');
$this->addCommand($className);
}
return $this;
} | php | {
"resource": ""
} |
q6330 | Console.writeln | train | public function writeln($text = '', $pipe = TextWriter::STDOUT)
{
$this->textWriter->writeln($text, $pipe);
return $this;
} | php | {
"resource": ""
} |
q6331 | Console.writeException | train | public function writeException(\Exception $e)
{
if ($this->verboseException) {
$text = sprintf("[%s]\n%s\nIn %s at line %s\n%s",
get_class($e),
$e->getMessage(),
$e->getFile(),
$e->getLine(),
$e->getTraceAsString()
);
} else {
$text = sprintf("\n[%s]\n%s\n", get_class($e), $e->getMessage());
}
$box = new Widgets\Box($this->textWriter, $text, '');
$out = Colors::colorizeLines($box, Colors::WHITE, Colors::RED);
$out = TextFormater::apply($out, array('indent' => 2));
$this->textWriter->writeln($out);
return $this;
} | php | {
"resource": ""
} |
q6332 | Query.validatePaymentTransaction | train | protected function validatePaymentTransaction(PaymentTransaction $paymentTransaction)
{
$this->validateQueryConfig($paymentTransaction);
$errorMessage = '';
$missedFields = array();
$invalidFields = array();
foreach (static::$requestFieldsDefinition as $fieldDescription)
{
list($fieldName, $propertyPath, $isFieldRequired, $validationRule) = $fieldDescription;
$fieldValue = PropertyAccessor::getValue($paymentTransaction, $propertyPath, false);
if (!empty($fieldValue))
{
try
{
Validator::validateByRule($fieldValue, $validationRule);
}
catch (ValidationException $e)
{
$invalidFields[] = "Field '{$fieldName}' from property path '{$propertyPath}', {$e->getMessage()}.";
}
}
elseif ($isFieldRequired)
{
$missedFields[] = "Field '{$fieldName}' from property path '{$propertyPath}' missed or empty.";
}
}
if (!empty($missedFields))
{
$errorMessage .= "Some required fields missed or empty in PaymentTransaction: \n" .
implode("\n", $missedFields) . "\n";
}
if (!empty($invalidFields))
{
$errorMessage .= "Some fields invalid in PaymentTransaction: \n" .
implode("\n", $invalidFields) . "\n";
}
if (!empty($errorMessage))
{
throw new ValidationException($errorMessage);
}
} | php | {
"resource": ""
} |
q6333 | Query.paymentTransactionToRequest | train | protected function paymentTransactionToRequest(PaymentTransaction $paymentTransaction)
{
$requestFields = array();
foreach (static::$requestFieldsDefinition as $fieldDescription)
{
list($fieldName, $propertyPath) = $fieldDescription;
$fieldValue = PropertyAccessor::getValue($paymentTransaction, $propertyPath);
if (!empty($fieldValue))
{
$requestFields[$fieldName] = $fieldValue;
}
}
return new Request($requestFields);
} | php | {
"resource": ""
} |
q6334 | Query.validateResponseOnSuccess | train | protected function validateResponseOnSuccess(PaymentTransaction $paymentTransaction, Response $response)
{
if ($response->getType() !== static::$successResponseType)
{
throw new ValidationException("Response type '{$response->getType()}' does not match " .
"success response type '" . static::$successResponseType . "'");
}
$missedFields = array();
foreach (static::$responseFieldsDefinition as $fieldName)
{
if (empty($response[$fieldName]))
{
$missedFields[] = $fieldName;
}
}
if (!empty($missedFields))
{
throw new ValidationException("Some required fields missed or empty in Response: " .
implode(', ', $missedFields) . ". \n");
}
$this->validateClientId($paymentTransaction, $response);
} | php | {
"resource": ""
} |
q6335 | Query.validateResponseOnError | train | protected function validateResponseOnError(PaymentTransaction $paymentTransaction, Response $response)
{
$allowedTypes = array(static::$successResponseType, 'error', 'validation-error');
if (!in_array($response->getType(), $allowedTypes))
{
throw new ValidationException("Unknown response type '{$response->getType()}'");
}
$this->validateClientId($paymentTransaction, $response);
} | php | {
"resource": ""
} |
q6336 | Query.updatePaymentTransactionOnSuccess | train | protected function updatePaymentTransactionOnSuccess(PaymentTransaction $paymentTransaction, Response $response)
{
$paymentTransaction->setStatus($response->getStatus());
$this->setPaynetId($paymentTransaction, $response);
} | php | {
"resource": ""
} |
q6337 | Query.updatePaymentTransactionOnError | train | protected function updatePaymentTransactionOnError(PaymentTransaction $paymentTransaction, Response $response)
{
if ($response->isDeclined())
{
$paymentTransaction->setStatus($response->getStatus());
}
else
{
$paymentTransaction->setStatus(PaymentTransaction::STATUS_ERROR);
}
$paymentTransaction->addError($response->getError());
$this->setPaynetId($paymentTransaction, $response);
} | php | {
"resource": ""
} |
q6338 | Query.validateQueryDefinition | train | protected function validateQueryDefinition()
{
if (empty(static::$requestFieldsDefinition))
{
throw new RuntimeException('You must configure requestFieldsDefinition property');
}
if (empty(static::$signatureDefinition))
{
throw new RuntimeException('You must configure signatureDefinition property');
}
if (empty(static::$responseFieldsDefinition))
{
throw new RuntimeException('You must configure responseFieldsDefinition property');
}
if (empty(static::$successResponseType))
{
throw new RuntimeException('You must configure allowedResponseTypes property');
}
} | php | {
"resource": ""
} |
q6339 | Query.validateQueryConfig | train | protected function validateQueryConfig(PaymentTransaction $paymentTransaction)
{
$queryConfig = $paymentTransaction->getQueryConfig();
if(strlen($queryConfig->getSigningKey()) === 0)
{
throw new ValidationException("Property 'signingKey' does not defined in PaymentTransaction property 'queryConfig'");
}
if (strlen($queryConfig->getEndPoint()) == 0 && strlen($queryConfig->getEndPointGroup()) === 0)
{
throw new ValidationException(
"Properties 'endPont' and 'endPointGroup' do not defined in " .
"PaymentTransaction property 'queryConfig'. Set one of them."
);
}
if (strlen($queryConfig->getEndPoint()) > 0 && strlen($queryConfig->getEndPointGroup()) > 0)
{
throw new ValidationException(
"Property 'endPont' was set and property 'endPointGroup' was set in " .
"PaymentTransaction property 'queryConfig'. Set only one of them."
);
}
} | php | {
"resource": ""
} |
q6340 | Query.validateClientId | train | protected function validateClientId(PaymentTransaction $paymentTransaction, Response $response)
{
$paymentClientId = $paymentTransaction->getPayment()->getClientId();
$responseClientId = $response->getPaymentClientId();
if ( strlen($responseClientId) > 0
&& $paymentClientId != $responseClientId)
{
throw new ValidationException("Response clientId '{$responseClientId}' does " .
"not match Payment clientId '{$paymentClientId}'");
}
} | php | {
"resource": ""
} |
q6341 | Query.setPaynetId | train | protected function setPaynetId(PaymentTransaction $paymentTransaction, Response $response)
{
$responsePaynetId = $response->getPaymentPaynetId();
if(strlen($responsePaynetId) > 0)
{
$paymentTransaction
->getPayment()
->setPaynetId($responsePaynetId)
;
}
} | php | {
"resource": ""
} |
q6342 | Typo3.encode | train | public function encode( $password, $salt = null )
{
return ( isset( $this->hasher ) ? $this->hasher->getHashedPassword( $password, $salt ) : $password );
} | php | {
"resource": ""
} |
q6343 | Help.fromFQDN | train | public static function fromFQDN($fqdn, $subCommand = null)
{
if (function_exists($fqdn)) {
return self::fromFunction($fqdn);
}
if (class_exists($fqdn) && is_subclass_of($fqdn, 'ConsoleKit\Command')) {
return self::fromCommandClass($fqdn, $subCommand);
}
throw new ConsoleException("'$fqdn' is not a valid ConsoleKit FQDN");
} | php | {
"resource": ""
} |
q6344 | Help.fromCommandClass | train | public static function fromCommandClass($name, $subCommand = null)
{
$prefix = 'execute';
$class = new ReflectionClass($name);
if ($subCommand) {
$method = $prefix . ucfirst(Utils::camelize($subCommand));
if (!$class->hasMethod($method)) {
throw new ConsoleException("Sub command '$subCommand' of '$name' does not exist");
}
return new Help($class->getMethod($method)->getDocComment());
}
$help = new Help($class->getDocComment());
foreach ($class->getMethods() as $method) {
if (strlen($method->getName()) > strlen($prefix) &&
substr($method->getName(), 0, strlen($prefix)) === $prefix) {
$help->subCommands[] = Utils::dashized(substr($method->getName(), strlen($prefix)));
}
}
return $help;
} | php | {
"resource": ""
} |
q6345 | LinksContainer.linksToArray | train | protected function linksToArray(): array
{
$links = [];
foreach ($this->links as $name => $link)
{
if (! $link->hasMetadata()) {
$links[$name] = $link->getReference();
continue;
}
$links[$name] = [
'href' => $link->getReference(),
'meta' => $link->getMetadata()
];
}
return $links;
} | php | {
"resource": ""
} |
q6346 | PaymentTransaction.setProcessorType | train | public function setProcessorType($processorType)
{
if (!in_array($processorType, static::$allowedProcessorTypes))
{
throw new RuntimeException("Unknown transaction processor type given: {$processorType}");
}
if (!empty($this->processorType))
{
throw new RuntimeException('You can set payment transaction processor type only once');
}
$this->processorType = $processorType;
return $this;
} | php | {
"resource": ""
} |
q6347 | PaymentTransaction.setProcessorName | train | public function setProcessorName($processorName)
{
if (!empty($this->processorName))
{
throw new RuntimeException('You can set payment transaction processor name only once');
}
$this->processorName = $processorName;
return $this;
} | php | {
"resource": ""
} |
q6348 | PaymentTransaction.setStatus | train | public function setStatus($status)
{
if (!in_array($status, static::$allowedStatuses))
{
throw new RuntimeException("Unknown transaction status given: {$status}");
}
$this->status = $status;
return $this;
} | php | {
"resource": ""
} |
q6349 | PaymentTransaction.setPayment | train | public function setPayment(Payment $payment)
{
$this->payment = $payment;
if (!$payment->hasPaymentTransaction($this))
{
$payment->addPaymentTransaction($this);
}
return $this;
} | php | {
"resource": ""
} |
q6350 | DoctrineBaseDriver.get | train | public function get($args)
{
$dataItem = $this->create($args);
if ($dataItem->hasId()) {
$dataItem = $this->getById($dataItem->getId());
}
return $dataItem;
} | php | {
"resource": ""
} |
q6351 | DoctrineBaseDriver.fetchList | train | public function fetchList($statement)
{
$result = array();
foreach ($this->getConnection()->fetchAll($statement) as $row) {
$result[] = current($row);
}
return $result;
} | php | {
"resource": ""
} |
q6352 | DoctrineBaseDriver.getPlatformName | train | public function getPlatformName()
{
static $name = null;
if (!$name) {
$name = $this->connection->getDatabasePlatform()->getName();
}
return $name;
} | php | {
"resource": ""
} |
q6353 | DoctrineBaseDriver.prepareResults | train | public function prepareResults(&$rows)
{
foreach ($rows as $key => &$row) {
$row = $this->create($row);
}
return $rows;
} | php | {
"resource": ""
} |
q6354 | DoctrineBaseDriver.getById | train | public function getById($id)
{
$list = $this->getByCriteria($id, $this->getUniqueId());
return reset($list);
} | php | {
"resource": ""
} |
q6355 | DoctrineBaseDriver.getByCriteria | train | public function getByCriteria($criteria, $fieldName)
{
/** @var Statement $statement */
$queryBuilder = $this->getSelectQueryBuilder();
$queryBuilder->where($fieldName . " = :criteria");
$queryBuilder->setParameter('criteria', $criteria);
$statement = $queryBuilder->execute();
$rows = $statement->fetchAll();
$this->prepareResults($rows);
return $rows;
} | php | {
"resource": ""
} |
q6356 | DoctrineBaseDriver.extractTypeValues | train | protected function extractTypeValues(array $data, array $types)
{
$typeValues = array();
foreach ($data as $k => $_) {
$typeValues[] = isset($types[$k])
? $types[$k]
: \PDO::PARAM_STR;
}
return $typeValues;
} | php | {
"resource": ""
} |
q6357 | eWay.setCustomerID | train | public function setCustomerID($id)
{
if(preg_match('/[^A-Za-z0-9]/', $id))
{
throw new ErrorException('Customer ID has invalid characters');
}
elseif(strlen($id) > 8)
{
throw new ErrorException('Customer ID cannot be longer than eight (8) characters');
}
$this->customerID = $id;
return $this;
} | php | {
"resource": ""
} |
q6358 | eWay.setCardHoldersName | train | public function setCardHoldersName($name)
{
if(preg_match('/[^A-Za-z\s\'-\.]/', $name))
{
throw new ErrorException('Card holder name has invalid chracters.');
}
elseif(strlen($name) > 50)
{
throw new ErrorException('Card holder name longer than fifty (50) characters');
}
$this->cardHoldersName = $name;
return $this;
} | php | {
"resource": ""
} |
q6359 | eWay.setCardNumber | train | public function setCardNumber($number)
{
$number = preg_replace('/[^\d]/', '', $number);
if(strlen($number) > 20)
{
throw new ErrorException('Card number longer than twenty (20) digits');
}
$this->cardNumber = $number;
return $this;
} | php | {
"resource": ""
} |
q6360 | Max.sizeMax | train | protected function sizeMax($key, $lengthValue, $max, $not = true)
{
if (($lengthValue > $max) && $not) {
$this->addReturn($key, 'must', [ ':max' => $max ]);
} elseif (!($lengthValue > $max) && !$not) {
$this->addReturn($key, 'not', [ ':max' => $max ]);
}
} | php | {
"resource": ""
} |
q6361 | RepositoryProvider.registerRepository | train | public function registerRepository(string $name, RepositoryInterface $repository)
{
if (isset($this->repositories[$name])) {
throw new \LogicException(sprintf('Links\' Repository "%s" is already registered.', $name));
}
$this->repositories[$name] = $repository;
} | php | {
"resource": ""
} |
q6362 | RepositoryProvider.getRepository | train | public function getRepository(string $name): RepositoryInterface
{
if (isset($this->repositories[$name])) {
return $this->repositories[$name];
}
throw new \LogicException(sprintf('Unknown repository "%s"', $name));
} | php | {
"resource": ""
} |
q6363 | Wrapper.checkMemoryLimit | train | private function checkMemoryLimit()
{
if (function_exists('ini_get')) {
/**
* Note that this calculation is incorrect for memory limits that
* exceed the value range of the underlying platform's native
* integer.
* In practice, we will get away with it, because it doesn't make
* sense to configure PHP's memory limit to half the addressable
* RAM (2 GB on a typical 32-bit system).
*/
$memoryInBytes = function ($value) {
$unit = strtolower(substr($value, -1, 1));
$value = (int) $value;
switch ($unit) {
case 'g':
$value *= 1024 * 1024 * 1024;
break;
case 'm':
$value *= 1024 * 1024;
break;
case 'k':
$value *= 1024;
break;
}
return $value;
};
$memoryLimit = trim(ini_get('memory_limit'));
// Increase memory_limit if it is lower than 512M
if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 512 * 1024 * 1024) {
trigger_error("Configured memory limit ($memoryLimit) is lower " .
"than 512M; composer-wrapper may not work " .
"correctly. Consider increasing PHP's " .
"memory_limit to at least 512M.",
E_USER_NOTICE);
}
}
} | php | {
"resource": ""
} |
q6364 | Wrapper.run | train | public function run($input = '', $output = null)
{
$this->loadComposerPhar(false);
if (!$this->application) {
$this->application = new \Composer\Console\Application();
$this->application->setAutoExit(false);
}
$cli_args = is_string($input) && !empty($input) ?
new \Symfony\Component\Console\Input\StringInput($input) :
null;
$argv0 = $_SERVER['argv'][0];
$this->fixSelfupdate($cli_args);
$exitcode = $this->application->run(
$cli_args,
$output
);
$_SERVER['argv'][0] = $argv0;
return $exitcode;
} | php | {
"resource": ""
} |
q6365 | AttachmentsBehavior.getAttachmentsTags | train | public function getAttachmentsTags($list = true)
{
$tags = $this->config('tags');
if (!$list) {
return $tags;
}
$tagsList = [];
foreach ($tags as $key => $tag) {
$tagsList[$key] = $tag['caption'];
}
return $tagsList;
} | php | {
"resource": ""
} |
q6366 | AttachmentsBehavior.saveTags | train | public function saveTags($attachment, $tags)
{
$newTags = [];
foreach ($tags as $tag) {
if (isset($this->config('tags')[$tag])) {
$newTags[] = $tag;
if ($this->config('tags')[$tag]['exclusive'] === true) {
$this->_clearTag($attachment, $tag);
}
}
}
$this->Attachments->patchEntity($attachment, ['tags' => $newTags]);
return (bool)$this->Attachments->save($attachment);
} | php | {
"resource": ""
} |
q6367 | Checkpoint.month | train | public function month(int $vehicleId, int $year, int $month = 1, ?Query $query = null): Response
{
$this->requiresAccessToken();
return $this->send(
'GET',
"vehicles/{$vehicleId}/checkpoints/{$year}/{$month}",
$this->getApiHeaders(),
$this->buildHttpQuery($query)
);
} | php | {
"resource": ""
} |
q6368 | Summary.yesterday | train | public function yesterday(int $vehicleId): Response
{
$this->requiresAccessToken();
return $this->send(
'GET',
"vehicles/{$vehicleId}/travels/summaries/yesterday",
$this->getApiHeaders()
);
} | php | {
"resource": ""
} |
q6369 | Summary.date | train | public function date(int $vehicleId, int $year, int $month = 1, int $day = 1): Response
{
$this->requiresAccessToken();
return $this->send(
'GET',
"vehicles/{$vehicleId}/travels/summaries/{$year}/{$month}/{$day}",
$this->getApiHeaders()
);
} | php | {
"resource": ""
} |
q6370 | PNotify.registerNotification | train | protected function registerNotification(array $notification)
{
$view = $this->getView();
$options = Json::encode(ArrayHelper::merge($this->getClientOptions(), $notification));
$view->registerJs("new PNotify({$options});");
} | php | {
"resource": ""
} |
q6371 | AttachmentsHelper.addDependencies | train | public function addDependencies()
{
$this->Html->script('/attachments/js/vendor/jquery.ui.widget.js', ['block' => true]);
$this->Html->script('/attachments/js/vendor/jquery.iframe-transport.js', ['block' => true]);
$this->Html->script('/attachments/js/vendor/jquery.fileupload.js', ['block' => true]);
$this->Html->script('/attachments/js/app/lib/AttachmentsWidget.js', ['block' => true]);
$this->Html->css('/attachments/css/attachments.css', ['block' => true]);
} | php | {
"resource": ""
} |
q6372 | AttachmentsHelper.attachmentsArea | train | public function attachmentsArea(EntityInterface $entity, array $options = [])
{
if ($this->config('includeDependencies')) {
$this->addDependencies();
}
$options = Hash::merge([
'label' => false,
'id' => 'fileupload-' . uniqid(),
'formFieldName' => false,
'mode' => 'full',
'style' => '',
'taggable' => false,
'isAjax' => false,
'panelHeading' => __d('attachments', 'attachments'),
'showIconColumn' => true,
'additionalButtons' => null
], $options);
return $this->_View->element('Attachments.attachments_area', compact('options', 'entity'));
} | php | {
"resource": ""
} |
q6373 | AttachmentsHelper.tagsList | train | public function tagsList($attachment)
{
$tagsString = '';
if (empty($attachment->tags)) {
return $tagsString;
}
$Table = TableRegistry::get($attachment->model);
foreach ($attachment->tags as $tag) {
$tagsString .= '<label class="label label-default">' . $Table->getTagCaption($tag) . '</label> ';
}
return $tagsString;
} | php | {
"resource": ""
} |
q6374 | AttachmentsHelper.tagsChooser | train | public function tagsChooser(EntityInterface $entity, $attachment)
{
if (!TableRegistry::exists($entity->source())) {
throw new Cake\Network\Exception\MissingTableException('Could not find Table ' . $entity->source());
}
$Table = TableRegistry::get($entity->source());
return $this->Form->select('tags', $Table->getAttachmentsTags(), [
'type' => 'select',
'class' => 'tag-chooser',
'style' => 'display: block; width: 100%',
'label' => false,
'multiple' => true,
'value' => $attachment->tags
]);
} | php | {
"resource": ""
} |
q6375 | ObjectMapper.toResource | train | public function toResource($object): ResourceObject
{
$context = $this->createContext(get_class($object));
$id = $this->identifierHandler->getIdentifier($object, $context);
$type = $this->resolveType($object, $context);
$resource = new ResourceObject($id, $type);
foreach ($this->handlers as $handler)
{
$handler->toResource($object, $resource, $context);
}
return $resource;
} | php | {
"resource": ""
} |
q6376 | ObjectMapper.toResourceIdentifier | train | public function toResourceIdentifier($object): ResourceIdentifierObject
{
$context = $this->createContext(get_class($object));
$id = $this->identifierHandler->getIdentifier($object, $context);
$type = $this->resolveType($object, $context);
return new ResourceIdentifierObject($id, $type);
} | php | {
"resource": ""
} |
q6377 | ObjectMapper.fromResource | train | public function fromResource($object, ResourceObject $resource)
{
$context = $this->createContext(get_class($object));
$this->identifierHandler->setIdentifier($object, $resource->getId(), $context);
foreach ($this->handlers as $handler)
{
$handler->fromResource($object, $resource, $context);
}
} | php | {
"resource": ""
} |
q6378 | ObjectMapper.resolveType | train | protected function resolveType($object, MappingContext $context): string
{
$definition = $context->getDefinition();
if ($definition->hasType()) {
return $definition->getType();
}
return $this->typeHandler->getType($object, $context);
} | php | {
"resource": ""
} |
q6379 | ObjectMapper.createContext | train | protected function createContext(string $class): MappingContext
{
$definition = $this->definitionProvider->getDefinition($class);
return new MappingContext($this, $definition);
} | php | {
"resource": ""
} |
q6380 | NotIterableAttribute.resolveTypeDescription | train | protected function resolveTypeDescription($value): string
{
$type = gettype($value);
if ($type === 'object') {
return 'an instance of ' . get_class($value);
}
if ($type === 'integer') {
return 'an integer';
}
return 'a ' . $type;
} | php | {
"resource": ""
} |
q6381 | Typo3.setHasherTypo3 | train | public function setHasherTypo3( \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface $object )
{
$this->hasher = $object;
return $this;
} | php | {
"resource": ""
} |
q6382 | Oracle.transformColumnNames | train | public static function transformColumnNames(&$rows)
{
$columnNames = array_keys(current($rows));
foreach ($rows as &$row) {
foreach ($columnNames as $name) {
$row[ strtolower($name) ] = &$row[ $name ];
unset($row[ $name ]);
}
}
} | php | {
"resource": ""
} |
q6383 | UnitsHelperTrait.units | train | public static function units()
{
// Helper Class Exists
if (isset(self::$unitConverter)) {
return self::$unitConverter;
}
// Initialize Class
self::$unitConverter = new UnitConverter();
// Return Helper Class
return self::$unitConverter;
} | php | {
"resource": ""
} |
q6384 | Message.filterProtocolVersion | train | protected function filterProtocolVersion($version)
{
if (!is_string($version) || !in_array($version, $this->protocols)) {
throw new \InvalidArgumentException('The specified protocol is invalid.');
}
return $version;
} | php | {
"resource": ""
} |
q6385 | Request.getAuthorizationHeader | train | public static function getAuthorizationHeader()
{
$headers = null;
if (isset($_SERVER['Authorization'])) {
$headers = trim($_SERVER["Authorization"]);
} else if (isset($_SERVER['HTTP_AUTHORIZATION'])) {
$headers = trim($_SERVER["HTTP_AUTHORIZATION"]);
} elseif (function_exists('apache_request_headers')) {
$requestHeaders = apache_request_headers();
$requestHeaders = array_combine(array_map(
'ucwords',
array_keys($requestHeaders)),
array_values($requestHeaders)
);
if (isset($requestHeaders['Authorization'])) {
$headers = trim($requestHeaders['Authorization']);
}
}
return $headers;
} | php | {
"resource": ""
} |
q6386 | SimpleFieldsTrait.getSimple | train | protected function getSimple($fieldName, $objectName = "object", $default = null)
{
if (isset($this->{$objectName}->{$fieldName})) {
$this->out[$fieldName] = trim($this->{$objectName}->{$fieldName});
} else {
$this->out[$fieldName] = $default;
}
return $this;
} | php | {
"resource": ""
} |
q6387 | SimpleFieldsTrait.getSimpleBool | train | protected function getSimpleBool($fieldName, $objectName = "object", $default = false)
{
if (isset($this->{$objectName}->{$fieldName})) {
$this->out[$fieldName] = (bool) trim($this->{$objectName}->{$fieldName});
} else {
$this->out[$fieldName] = (bool) $default;
}
return $this;
} | php | {
"resource": ""
} |
q6388 | SimpleFieldsTrait.getSimpleDouble | train | protected function getSimpleDouble($fieldName, $objectName = "object", $default = 0)
{
if (isset($this->{$objectName}->{$fieldName})) {
$this->out[$fieldName] = (double) trim($this->{$objectName}->{$fieldName});
} else {
$this->out[$fieldName] = (double) $default;
}
return $this;
} | php | {
"resource": ""
} |
q6389 | SimpleFieldsTrait.getSimpleBit | train | protected function getSimpleBit($fieldName, $position, $objectName = "object", $default = false)
{
if (isset($this->{$objectName}->{$fieldName})) {
$this->out[$fieldName] = (bool) (($this->{$objectName}->{$fieldName} >> $position) & 1);
} else {
$this->out[$fieldName] = (bool) $default;
}
return $this;
} | php | {
"resource": ""
} |
q6390 | SimpleFieldsTrait.setSimpleFloat | train | protected function setSimpleFloat($fieldName, $fieldData, $objectName = "object")
{
//====================================================================//
// Compare Field Data
if (!isset($this->{$objectName}->{$fieldName})
|| (abs($this->{$objectName}->{$fieldName} - $fieldData) > 1E-6)) {
//====================================================================//
// Update Field Data
$this->{$objectName}->{$fieldName} = $fieldData;
$this->needUpdate($objectName);
}
return $this;
} | php | {
"resource": ""
} |
q6391 | SimpleFieldsTrait.setSimpleBit | train | protected function setSimpleBit($fieldName, $position, $fieldData, $objectName = "object")
{
//====================================================================//
// Compare Field Data
if ($this->getSimpleBit($fieldName, $position, $objectName) !== $fieldData) {
//====================================================================//
// Update Field Data
if ($fieldData) {
$this->{$objectName}->{$fieldName} = $this->{$objectName}->{$fieldName} | (1 << $position);
} else {
$this->{$objectName}->{$fieldName} = $this->{$objectName}->{$fieldName} & ~ (1 << $position);
}
$this->needUpdate($objectName);
}
return $this;
} | php | {
"resource": ""
} |
q6392 | Payment.addPaymentTransaction | train | public function addPaymentTransaction(PaymentTransaction $paymentTransaction)
{
if (!$this->hasPaymentTransaction($paymentTransaction))
{
$this->paymentTransactions[] = $paymentTransaction;
}
if ($paymentTransaction->getPayment() !== $this)
{
$paymentTransaction->setPayment($this);
}
return $this;
} | php | {
"resource": ""
} |
q6393 | ImageDimensionsWidth.sizeBetween | train | protected function sizeBetween($lengthValue, $min, $max, $not = true)
{
if (!($lengthValue <= $max && $lengthValue >= $min) && $not) {
$this->addReturn('image_dimensions_width', 'width', [
':min' => $min,
':max' => $max
]);
} elseif ($lengthValue <= $max && $lengthValue >= $min && !$not) {
$this->addReturn('image_dimensions_width', 'not_width', [
':min' => $min,
':max' => $max
]);
}
} | php | {
"resource": ""
} |
q6394 | ImagesHelper.touchRemoteFile | train | public static function touchRemoteFile($imageUrl)
{
// Get cURL resource
$curl = curl_init($imageUrl);
if (!$curl) {
return false;
}
// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $imageUrl,
CURLOPT_USERAGENT => 'Splash cURL Agent'
));
// Send the request & save response to $resp
$resp = curl_exec($curl);
// Close request to clear up some resources
curl_close($curl);
return (false != $resp);
} | php | {
"resource": ""
} |
q6395 | ImagesHelper.getRemoteFileSize | train | private static function getRemoteFileSize($imageUrl)
{
$result = curl_init($imageUrl);
if (!$result) {
return 0;
}
curl_setopt($result, CURLOPT_RETURNTRANSFER, true);
curl_setopt($result, CURLOPT_HEADER, true);
curl_setopt($result, CURLOPT_NOBODY, true);
curl_exec($result);
$imageSize = curl_getinfo($result, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
curl_close($result);
return (int) $imageSize;
} | php | {
"resource": ""
} |
q6396 | SplashCore.configuration | train | public static function configuration()
{
//====================================================================//
// Configuration Array Already Exists
//====================================================================//
if (isset(self::core()->conf)) {
return self::core()->conf;
}
//====================================================================//
// Load Module Core Configuration
//====================================================================//
//====================================================================//
// Initialize Empty Configuration
self::core()->conf = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
$config = &self::core()->conf;
//====================================================================//
// Load Module Core Configuration from Definition File
//====================================================================//
// Translations Parameters
$config->DefaultLanguage = SPLASH_DF_LANG;
//====================================================================//
// WebService Core Parameters
$config->WsMethod = SPLASH_WS_METHOD;
$config->WsTimout = SPLASH_TIMEOUT;
$config->WsCrypt = SPLASH_CRYPT_METHOD;
$config->WsEncode = SPLASH_ENCODE;
$config->WsHost = 'www.splashsync.com/ws/soap';
//====================================================================//
// Activity Logging Parameters
$config->Logging = SPLASH_LOGGING;
$config->TraceIn = SPLASH_TRACE_IN;
$config->TraceOut = SPLASH_TRACE_OUT;
$config->TraceTasks = SPLASH_TRACE_TASKS;
//====================================================================//
// Custom Parameters Configurator
$config->Configurator = JsonConfigurator::class;
//====================================================================//
// Server Requests Configuration
$config->server = array();
//====================================================================//
// Load Module Local Configuration (In Safe Mode)
//====================================================================//
$localConf = self::local()->Parameters();
//====================================================================//
// Validate Local Parameters
if (self::validate()->isValidLocalParameterArray($localConf)) {
//====================================================================//
// Import Local Parameters
foreach ($localConf as $key => $value) {
$config->{$key} = trim($value);
}
}
//====================================================================//
// Load Module Local Custom Configuration (from Configurator)
//====================================================================//
$customConf = self::configurator()->getParameters();
//====================================================================//
// Import Local Parameters
foreach ($customConf as $key => $value) {
$config->{$key} = trim($value);
}
return self::core()->conf;
} | php | {
"resource": ""
} |
q6397 | SplashCore.log | train | public static function log()
{
if (!isset(self::core()->log)) {
//====================================================================//
// Initialize Log & Debug
self::core()->log = new Logger();
//====================================================================//
// Define Standard Messages Prefix if Not Overiden
if (isset(self::configuration()->localname)) {
self::core()->log->setPrefix(self::configuration()->localname);
}
}
return self::core()->log;
} | php | {
"resource": ""
} |
q6398 | SplashCore.com | train | public static function com()
{
if (isset(self::core()->com)) {
return self::core()->com;
}
switch (self::configuration()->WsMethod) {
case 'SOAP':
self::log()->deb('Selected SOAP PHP Protocol for Communication');
self::core()->com = new \Splash\Components\SOAP\SOAPInterface();
break;
case 'NuSOAP':
default:
self::log()->deb('Selected NuSOAP PHP Librarie for Communication');
self::core()->com = new \Splash\Components\NuSOAP\NuSOAPInterface();
break;
}
return self::core()->com;
} | php | {
"resource": ""
} |
q6399 | SplashCore.ws | train | public static function ws()
{
if (!isset(self::core()->soap)) {
//====================================================================//
// WEBSERVICE INITIALISATION
//====================================================================//
// Initialize SOAP WebServices Class
self::core()->soap = new Webservice();
//====================================================================//
// Initialize WebService Configuration Array
self::core()->soap->setup();
//====================================================================//
// Load Translation File
self::translator()->load('ws');
}
return self::core()->soap;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.