_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q260100 | IPhoneImageDocument.getLongitude | test | public function getLongitude()
{
if (isset($this->exif)) {
return (float)$this->getGps($this->exif['GPSLongitude'], $this->exif['GPSLongitudeRef']);
} else {
return null;
}
} | php | {
"resource": ""
} |
q260101 | RESTResponse.getBodyType | test | public function getBodyType()
{
$result = '';
if (json_decode($this->body)) {
$result = 'json';
} else if (substr(trim($this->body), 0, 1) === '<') {
$result = 'xml';
} else {
$result = 'other';
}
return $result;
} | php | {
"resource": ""
} |
q260102 | RESTResponse.getErrorMessage | test | public function getErrorMessage()
{
$result = '';
switch ($this->getBodyType())
{
case 'json':
$obj = json_decode($this->body);
$statusCode = $obj->errorResponse->statusCode;
$status = $obj->errorResponse->status;
$m... | php | {
"resource": ""
} |
q260103 | RESTRequest.getUrlStr | test | public function getUrlStr()
{
$str = (!empty($this->resource)) ? $this->resource : '';
/* x-www-form-encoded posts encodes query params in the body */
if (!$this->isWWWFormURLEncodedPost()) {
$str .= (!empty($this->params)) ? ('?' . $this->buildQuery()) : '';
}
r... | php | {
"resource": ""
} |
q260104 | RESTAPI.create | test | public function create($client = null)
{
if ($this->exists()) {
$this->logger->debug(
'A REST API named "' . $this->name . '" already exists'
);
return $this;
}
$this->client = $client ?: $this->client;
$params = array();
$h... | php | {
"resource": ""
} |
q260105 | RESTAPI.delete | test | public function delete($client = null)
{
$this->client = $client ?: $this->client;
// Delete content and modules as well
$params = array('include' => array('content', 'modules'));
$body = null;
$headers = array();
$request = new RESTRequest(
'DELETE', 'res... | php | {
"resource": ""
} |
q260106 | RESTAPI.waitUntilSuccess | test | protected function waitUntilSuccess($request, $secs, $limit)
{
sleep($secs);
$limit--;
try {
$response = $this->client->send($request);
} catch(\Exception $e) {
if ($limit > 0) {
$this->waitUntilSuccess($request, $secs, $limit);
} e... | php | {
"resource": ""
} |
q260107 | RESTAPI.exists | test | public function exists()
{
try {
$params = array();
$body = null;
$headers = array();
$request = new RESTRequest(
'GET', 'rest-apis/' . $this->name, $params, $body, $headers
);
$response = $this->client->send($request);
... | php | {
"resource": ""
} |
q260108 | Term.getAsElem | test | public function getAsElem($dom)
{
$termElem = $dom->createElement('term');
$emptyElem = $dom->createElement('empty');
$emptyElem->setAttribute('apply', $this->empty);
$termElem->appendChild($emptyElem);
if (!empty($this->termOptions)) {
foreach($this->termOptions ... | php | {
"resource": ""
} |
q260109 | AbstractConstraint.addTermOptions | test | protected function addTermOptions($dom, $elem)
{
if (!empty($this->termOptions)) {
foreach ($this->termOptions as $opt) {
$termElem = $dom->createElement('term-option');
$termElem->nodeValue = $opt;
$elem->appendChild($termElem);
}
... | php | {
"resource": ""
} |
q260110 | AbstractConstraint.addFacetOptions | test | protected function addFacetOptions($dom, $elem)
{
if (!empty($this->facetOptions)) {
foreach ($this->facetOptions as $opt) {
$facetElem = $dom->createElement('facet-option');
$facetElem->nodeValue = $opt;
$elem->appendChild($facetElem);
... | php | {
"resource": ""
} |
q260111 | AbstractConstraint.addFragmentScope | test | protected function addFragmentScope($dom, $elem)
{
if (!empty($this->fragmentScope)) {
$fragScopeElem = $dom->createElement('fragment-scope');
$fragScopeElem->nodeValue = $this->fragmentScope;
$elem->appendChild($fragScopeElem);
}
return $elem;
} | php | {
"resource": ""
} |
q260112 | ImageDocument.setContentFile | test | public function setContentFile($file)
{
$type = $this->getFileMimeType($file);
// Check for $type === '' to address MIME check not working on XAMPP Windows
if ($type === 'image/jpeg' || $type === 'image/tiff' || $type === '') {
if (function_exists('exif_read_data')) {
... | php | {
"resource": ""
} |
q260113 | SearchResults.getResultByURI | test | public function getResultByURI($uri)
{
$res = null;
foreach ($this->results as $result) {
if ($result->getURI() === $uri) {
$res = $result;
}
}
return $res;
} | php | {
"resource": ""
} |
q260114 | SearchResults.getResultByIndex | test | public function getResultByIndex($index)
{
$res = null;
foreach ($this->results as $result) {
if ($result->getIndex() == $index) {
$res = $result;
}
}
return $res;
} | php | {
"resource": ""
} |
q260115 | SearchResults.getFacet | test | public function getFacet($name)
{
$result = null;
foreach ($this->facets as $facet) {
if ($facet->getName() === $name) {
$result = $facet;
}
}
return $result;
} | php | {
"resource": ""
} |
q260116 | Extracts.addConstraints | test | public function addConstraints($constraints) {
if (is_array($constraints)) {
$this->constraints = array_merge($this->constraints, $constraints);
} else {
$this->constraints[] = (string)$constraints;
}
} | php | {
"resource": ""
} |
q260117 | Extracts.getExtractsAsElem | test | public function getExtractsAsElem($dom) {
$extractsElem = $dom->createElement('extract-metadata');
// constraints
foreach ($this->constraints as $constraint) {
$constraintValElem = $dom->createElement('constraint-value');
$constraintValElem->setAttribute('ref', $constrain... | php | {
"resource": ""
} |
q260118 | TransformResults.addPreferredElements | test | public function addPreferredElements($elements)
{
if (is_array($elements)) {
$this->preferredElements = array_merge($this->preferredElements, $elements);
} else {
$this->preferredElements[] = $elements;
}
} | php | {
"resource": ""
} |
q260119 | TransformResults.getTransformResultsAsElem | test | public function getTransformResultsAsElem($dom)
{
$transElem = $dom->createElement('transform-results');
$transElem->setAttribute('apply', $this->apply);
$prefElem = $dom->createElement('preferred-elements');
// preferred elements
foreach ($this->preferredElements as $elem) {... | php | {
"resource": ""
} |
q260120 | Metadata.addCollections | test | public function addCollections($collections)
{
if (is_array($collections)) {
$this->collections = array_merge($this->collections, $collections);
} else {
$this->collections[] = (string)$collections;
}
return $this;
} | php | {
"resource": ""
} |
q260121 | Metadata.deleteCollections | test | public function deleteCollections($collections)
{
if (is_array($collections)) {
foreach($collections as $coll) {
$pos = array_search($coll, $this->collections);
if($pos !== FALSE) {
array_splice($this->collections, $pos, 1);
}
... | php | {
"resource": ""
} |
q260122 | Metadata.addPermissions | test | public function addPermissions($permissions)
{
if (is_array($permissions)) {
foreach($permissions as $perm) {
$this->permissions[$perm->getRoleName()] = $perm;
}
} else {
$this->permissions[$permissions->getRoleName()] = $permissions;
}
... | php | {
"resource": ""
} |
q260123 | Metadata.deletePermissions | test | public function deletePermissions($roleNames)
{
if (is_array($roleNames)) {
foreach($roleNames as $name) {
unset($this->permissions[$name]);
}
} else {
unset($this->permissions[$roleNames]);
}
return $this;
} | php | {
"resource": ""
} |
q260124 | Metadata.deleteProperties | test | public function deleteProperties($properties)
{
if (is_array($properties)) {
foreach($properties as $prop) {
unset($this->properties[$prop]);
}
} else {
unset($this->properties[$properties]);
}
return $this;
} | php | {
"resource": ""
} |
q260125 | Metadata.getAsXML | test | public function getAsXML()
{
// root
$dom = new \DOMDocument();
$root = $dom->createElement('metadata');
$root->setAttribute('xmlns', 'http://marklogic.com/rest-api');
$dom->appendChild($root);
// collections
$collElem = $dom->createElement('collections');
... | php | {
"resource": ""
} |
q260126 | Metadata.loadFromXML | test | public function loadFromXML($xml)
{
// root
$dom = new \DOMDocument();
$dom->loadXML($xml);
// collections
$collElems = $dom->getElementsByTagName('collections')->item(0)->getElementsByTagName('collection');
foreach ($collElems as $elem) {
if($elem->node... | php | {
"resource": ""
} |
q260127 | ProxyManager.enable | test | public function enable($rootNamespace = self::ROOT_NAMESPACE_GLOBAL)
{
// If XStatic is already enabled, this is a no-op
if ($this->aliasLoader->isRegistered()) {
return true;
}
// Register the loader to handle aliases and link the proxies to the container
if ($t... | php | {
"resource": ""
} |
q260128 | ProxyManager.setContainer | test | public function setContainer(ContainerInterface $container)
{
$this->container = $container;
StaticProxy::setContainer($this->container);
return $this;
} | php | {
"resource": ""
} |
q260129 | FixtureCheckShell._compareConstraints | test | protected function _compareConstraints(array $fixtureConstraints, array $liveConstraints, $fixtureTable) {
if (!$fixtureConstraints && !$liveConstraints) {
return;
}
$fixtureConstraints = $this->normalizeConstraints($fixtureConstraints);
$liveConstraints = $this->normalizeConstraints($liveConstraints);
i... | php | {
"resource": ""
} |
q260130 | FixtureCheckShell._compareIndexes | test | protected function _compareIndexes(array $fixtureIndexes, array $liveIndexes, $fixtureTable) {
if (!$fixtureIndexes && !$liveIndexes) {
return;
}
if ($fixtureIndexes === $liveIndexes) {
return;
}
$errors = [];
foreach ($liveIndexes as $key => $liveIndex) {
if (!isset($fixtureIndexes[$key])) {
... | php | {
"resource": ""
} |
q260131 | FixtureCheckShell._doCompareFieldPresence | test | protected function _doCompareFieldPresence($one, $two, $fixtureClass, $message, $fixtureTable) {
$diff = array_diff_key($one, $two);
if (!empty($diff)) {
$this->warn(sprintf($message, $fixtureClass));
foreach ($diff as $missingField => $type) {
$this->out(' * ' . $missingField);
}
$this->out($this->... | php | {
"resource": ""
} |
q260132 | FixtureCheckShell._getFixtureFiles | test | protected function _getFixtureFiles() {
$fixtureFolder = TESTS . 'Fixture' . DS;
$plugin = $this->param('plugin');
if ($plugin) {
$fixtureFolder = Plugin::path($plugin) . 'tests' . DS . 'Fixture' . DS;
}
$folder = new Folder($fixtureFolder);
$content = $folder->read();
$fixtures = [];
foreach ($con... | php | {
"resource": ""
} |
q260133 | FixtureCheckShell._compareFieldPresence | test | protected function _compareFieldPresence($fixtureFields, $liveFields, $fixtureClass, $fixtureTable) {
$message = '%s has fields that are not in the live DB:';
$this->_doCompareFieldPresence($fixtureFields, $liveFields, $fixtureClass, $message, $fixtureTable);
$message = 'Live DB has fields that are not in %s';
... | php | {
"resource": ""
} |
q260134 | BootstrapBase.form | test | protected function form($type = self::FORM_VERTICAL, $inputClass = '', $labelClass = '') {
$this->formType = $type;
$this->inputClass = $inputClass;
$this->labelClass = $labelClass;
} | php | {
"resource": ""
} |
q260135 | BootstrapBase.horizontal | test | public function horizontal($inputClass = '', $labelClass = '') {
$this->form(self::FORM_HORIZONTAL, $inputClass, $labelClass);
return $this;
} | php | {
"resource": ""
} |
q260136 | BootstrapBase.label | test | protected function label($name, $label = null, array $options = array(), $content = null) {
$return = '';
$options = array_merge(array('class' => 'control-label ' . $this->labelClass, 'for' => (!$content ? $name : null)), $options);
if ($label !== null) {
$return .= '<label' . $this->html->attributes($options... | php | {
"resource": ""
} |
q260137 | BootstrapBase.errors | test | protected function errors($name, $errors = null, $wrap = '<span class="help-block">:message</span>') {
$return = '';
if ($errors && $errors->has($name)) {
$return .= $errors->first($name, $wrap) . "\n";
}
return $return;
} | php | {
"resource": ""
} |
q260138 | BootstrapBase.group | test | protected function group($name, $errors = null, $class = 'form-group', array $options = array())
{
$options = array_merge(array('class' => $class), $options);
$options['class'] .= ($errors && $errors->has($name) ? ' has-error' : '');
$return = '<div' . $this->html->attributes($options) . '>' . "\n";
return $r... | php | {
"resource": ""
} |
q260139 | BootstrapBase.action | test | protected function action($type, $value, array $attributes = array())
{
$return = '';
$containerAttributes = $this->getContainerAttributes($attributes);
switch ($type) {
case 'submit':
$attributes = array_merge(array('class' => 'btn btn-primary pull-right'), $attributes);
break;
case 'button':
... | php | {
"resource": ""
} |
q260140 | BootstrapBase.hyperlink | test | protected function hyperlink($type, $location, $title = null, array $parameters = array(), array $attributes = array(), $secure = null)
{
$attributes = array_merge(array('class' => 'btn btn-default'), $attributes);
switch ($type) {
case 'linkRoute':
case 'linkAction':
$return = $this->html->$type($locat... | php | {
"resource": ""
} |
q260141 | BootstrapBase.alert | test | protected function alert($type = 'message', $content = null, $emphasis = null, $dismissible = false, array $attributes = array())
{
$attributes = array_merge(array('class' => 'alert' . ($dismissible ? ' alert-dismissable' : '') . ' alert-' . ($type != 'message' ? $type : 'default')), $attributes);
$return = '<div ... | php | {
"resource": ""
} |
q260142 | Bootstrap.password | test | public function password($name, $label = null, $errors = null, array $options = array())
{
return $this->input('password', $name, $label, null, $errors, $options);
} | php | {
"resource": ""
} |
q260143 | Bootstrap.file | test | public function file($name, $label = null, $errors = null, array $options = array())
{
return $this->input('file', $name, $label, null, $errors, $options);
} | php | {
"resource": ""
} |
q260144 | Bootstrap.link | test | public function link($url, $title = null, array $attributes = array(), $secure = null)
{
return $this->hyperlink('link', $url, $title, $parameters = array(), $attributes, $secure);
} | php | {
"resource": ""
} |
q260145 | Bootstrap.secureLink | test | public function secureLink($url, $title = null, array $attributes = array(), $secure = null)
{
return $this->hyperlink('secureLink', $url, $title, array(), $attributes, $secure);
} | php | {
"resource": ""
} |
q260146 | Bootstrap.linkRoute | test | public function linkRoute($name, $title = null, array $parameters = array(), array $attributes = array())
{
return $this->hyperlink('linkRoute', $name, $title, $parameters, $attributes, null);
} | php | {
"resource": ""
} |
q260147 | Bootstrap.linkAction | test | public function linkAction($action, $title = null, array $parameters = array(), array $attributes = array())
{
return $this->hyperlink('linkAction', $action, $title, $parameters, $attributes, null);
} | php | {
"resource": ""
} |
q260148 | Bootstrap.mailto | test | public function mailto($email, $title = null, array $attributes = array())
{
return $this->hyperlink('mailto', $email, $title, array(), $attributes, null);
} | php | {
"resource": ""
} |
q260149 | Bootstrap.none | test | public function none($content = null, $emphasis = null, $dismissible = false, array $attributes = array())
{
return $this->alert('message', $content, $emphasis, $dismissible, $attributes);
} | php | {
"resource": ""
} |
q260150 | MbRegex.execReplace | test | private static function execReplace($pattern, $replacement, $subject, $option)
{
return (\is_object($replacement) || \is_array($replacement)) && \is_callable($replacement)
? \mb_ereg_replace_callback($pattern, $replacement, $subject, $option)
: \mb_ereg_replace($pattern, $replacement... | php | {
"resource": ""
} |
q260151 | RegexException.getShortMessage | test | public function getShortMessage()
{
$msg = $this->getMessage();
if (\strpos($msg, '(): ') !== false) {
list(, $msg) = \explode('(): ', $msg);
}
return $msg;
} | php | {
"resource": ""
} |
q260152 | sspmod_redis_Store_Redis.get | test | public function get($type, $key)
{
$redisKey = "{$this->prefix}.$type.$key";
$value = $this->redis->get($redisKey);
if (is_null($value)) {
return null;
}
return unserialize($value);
} | php | {
"resource": ""
} |
q260153 | sspmod_redis_Store_Redis.set | test | public function set($type, $key, $value, $expire = null)
{
$redisKey = "{$this->prefix}.$type.$key";
$this->redis->set($redisKey, serialize($value));
if (is_null($expire)) {
$expire = time() + $this->lifeTime;
}
$this->redis->expireat($redisKey, $expire);
} | php | {
"resource": ""
} |
q260154 | CartController.actionRemoveBasket | test | public function actionRemoveBasket()
{
$rr = new RequestResponse();
if ($rr->isRequestAjaxPost()) {
$basket_id = \Yii::$app->request->post('basket_id');
$shopBasket = ShopOrderItem::find()->where(['id' => $basket_id])->one();
if ($shopBasket) {
i... | php | {
"resource": ""
} |
q260155 | CartController.actionClear | test | public function actionClear()
{
$rr = new RequestResponse();
if ($rr->isRequestAjaxPost()) {
foreach (\Yii::$app->shop->cart->shopOrder->shopOrderItems as $basket) {
$basket->delete();
}
\Yii::$app->shop->cart->shopOrder->link('cmsSite', \Yii::$a... | php | {
"resource": ""
} |
q260156 | CartController.actionUpdateBasket | test | public function actionUpdateBasket()
{
$rr = new RequestResponse();
if ($rr->isRequestAjaxPost()) {
$basket_id = (int)\Yii::$app->request->post('basket_id');
$quantity = (float)\Yii::$app->request->post('quantity');
/**
* @var $shopBasket ShopBasket... | php | {
"resource": ""
} |
q260157 | Util.getLiteralValue | test | public static function getLiteralValue ($literal)
{
preg_match("/^\"(.*)\"/", $literal, $match); //TODO: somehow the copied regex did not work. To be checked. Contained [^]
if (empty($match)) {
throw new \Exception($literal . ' is not a literal');
}
return $match[1];
... | php | {
"resource": ""
} |
q260158 | Util.getLiteralType | test | public static function getLiteralType ($literal)
{
preg_match('/^".*"(?:\^\^([^"]+)|(@)[^@"]+)?$/s',$literal,$match);//TODO: somehow the copied regex did not work. To be checked. Contained [^] instead of the .
if (empty($match))
throw new \Exception($literal . ' is not a literal');
... | php | {
"resource": ""
} |
q260159 | Util.getLiteralLanguage | test | public static function getLiteralLanguage ($literal)
{
preg_match('/^".*"(?:@([^@"]+)|\^\^[^"]+)?$/s', $literal, $match);
if (empty($match))
throw new \Exception($literal . ' is not a literal');
return isset($match[1]) ? strtolower($match[1]) : '';
} | php | {
"resource": ""
} |
q260160 | Util.createIRI | test | public static function createIRI ($iri)
{
return !empty($iri) && substr($iri,0,1) === '"' ? self::getLiteralValue($iri) : $iri;
} | php | {
"resource": ""
} |
q260161 | Util.createLiteral | test | public static function createLiteral ($value, $modifier = null)
{
if (!$modifier) {
switch (gettype($value)) {
case 'boolean':
$value = $value ? "true":"false";
$modifier = self::XSDBOOLEAN;
break;
... | php | {
"resource": ""
} |
q260162 | YandexKassaPaySystem.checkRequestMD5 | test | public function checkRequestMD5($request)
{
//return true;
$str = $request['action'].";".
$request['orderSumAmount'].";".$request['orderSumCurrencyPaycash'].";".
$request['orderSumBankPaycash'].";".$request['shopId'].";".
$request['invoiceId'].";".$request['cust... | php | {
"resource": ""
} |
q260163 | YandexKassaPaySystem.buildResponse | test | public function buildResponse($functionName, $invoiceId, $result_code, $message = null)
{
try {
$performedDatetime = self::formatDate(new \DateTime());
$response = '<?xml version="1.0" encoding="UTF-8"?><'.$functionName.'Response performedDatetime="'.$performedDatetime.
... | php | {
"resource": ""
} |
q260164 | N3Lexer.initTokenize | test | private function initTokenize()
{
$this->_tokenize = function ($input, $finalize) {
// If the input is a string, continuously emit tokens through the callback until the end
if (!isset($this->input))
$this->input = "";
$this->input .= $input;
$... | php | {
"resource": ""
} |
q260165 | N3Lexer.tokenize | test | public function tokenize($input, $finalize = true) {
try {
return call_user_func($this->_tokenize, $input, $finalize);
} catch (\Exception $e) {
throw $e;
}
} | php | {
"resource": ""
} |
q260166 | Abc.deObfuscate | test | public static function deObfuscate(?string $code, string $alias): ?int
{
return self::$obfuscatorFactory->decode($code, $alias);
} | php | {
"resource": ""
} |
q260167 | Abc.obfuscate | test | public static function obfuscate(?int $id, string $alias): ?string
{
return self::$obfuscatorFactory->encode($id, $alias);
} | php | {
"resource": ""
} |
q260168 | ServerRequestFactory.default | test | public static function default(): self
{
return new self(
new Factory\Header\HeadersFactory(
Factories::default()
),
new Factory\Environment\EnvironmentFactory,
new Factory\Cookies\CookiesFactory,
new Factory\Query\QueryFactory,
... | php | {
"resource": ""
} |
q260169 | StatementFixtures.getStatementWithGroupActor | test | public static function getStatementWithGroupActor($id = self::DEFAULT_STATEMENT_ID)
{
if (null === $id) {
$id = UuidFixtures::getUniqueUuid();
}
$group = ActorFixtures::getTypicalGroup();
$verb = VerbFixtures::getTypicalVerb();
$activity = ActivityFixtures::getTy... | php | {
"resource": ""
} |
q260170 | StatementFixtures.getStatementWithStatementRef | test | public static function getStatementWithStatementRef($id = self::DEFAULT_STATEMENT_ID)
{
$minimalStatement = static::getMinimalStatement($id);
return new Statement(
$minimalStatement->getId(),
$minimalStatement->getActor(),
$minimalStatement->getVerb(),
... | php | {
"resource": ""
} |
q260171 | StatementFixtures.getStatementWithResult | test | public static function getStatementWithResult($id = self::DEFAULT_STATEMENT_ID)
{
if (null === $id) {
$id = UuidFixtures::getUniqueUuid();
}
return new Statement(StatementId::fromString($id), ActorFixtures::getTypicalAgent(), VerbFixtures::getTypicalVerb(), ActivityFixtures::get... | php | {
"resource": ""
} |
q260172 | StatementFixtures.getStatementWithSubStatement | test | public static function getStatementWithSubStatement($id = self::DEFAULT_STATEMENT_ID)
{
if (null === $id) {
$id = UuidFixtures::getUniqueUuid();
}
$actor = new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:test@example.com')));
$verb = new Verb(IRI:... | php | {
"resource": ""
} |
q260173 | OptionFactory.create | test | public function create($option, $type = OptionInterface::TYPE_GET)
{
if (!isset($this->mapping[$option])) {
throw new \InvalidArgumentException(sprintf('The option "%s" does not exist.', $option));
}
return new $this->mapping[$option]($type);
} | php | {
"resource": ""
} |
q260174 | StatementResultFixtures.getStatementResult | test | public static function getStatementResult(IRL $urlPath = null)
{
$statement1 = StatementFixtures::getMinimalStatement();
$verb = new Verb(IRI::fromString('http://adlnet.gov/expapi/verbs/deleted'), LanguageMap::create(array('en-US' => 'deleted')));
$statement2 = new Statement(
St... | php | {
"resource": ""
} |
q260175 | Module.attach | test | public function attach(EventManagerInterface $events)
{
$events->attach(ViewEvent::EVENT_RENDERER_POST, array($this, 'cleanLayout'), 1);
$events->attach(ViewEvent::EVENT_RESPONSE, array($this, 'attachPDFtransformer'), 10);
} | php | {
"resource": ""
} |
q260176 | Module.initializeViewHelper | test | public function initializeViewHelper(MvcEvent $e)
{
$viewhelperManager = $this->serviceManager->get('ViewHelperManager');
if ($viewhelperManager->has('InsertFile')) {
$insertFile = $viewhelperManager->get('InsertFile');
$insertFile->attach(FileEvent::GETFILE, array($this, 'ge... | php | {
"resource": ""
} |
q260177 | Module.getFile | test | public function getFile(FileEvent $e)
{
$lastFileName = $e->getLastFileName();
if (is_string($lastFileName)) {
$repository = $this->serviceManager->get('repositories')->get('Applications/Attachment');
$file = $repository->find($lastFileName);
if (isset($file... | php | {
"resource": ""
} |
q260178 | Module.collectFiles | test | public function collectFiles(FileEvent $e)
{
$this->appendPDF = array();
$files = $e->getAllFiles();
foreach ($files as $name => $file) {
if (!empty($file) && $file instanceof FileEntity) {
if (0 === strpos($file->getType(), 'image')) {
$this->... | php | {
"resource": ""
} |
q260179 | Module.cleanLayout | test | public function cleanLayout(ViewEvent $e)
{
$result = $e->getResult();
$response = $e->getResponse();
$model = $e->getModel();
if ($model->hasChildren()) {
$children = $model->getChildren();
$content = null;
foreach ($children as $child) {
... | php | {
"resource": ""
} |
q260180 | Module.attachViewResolver | test | public function attachViewResolver()
{
if (!$this->viewResolverAttached) {
$this->viewResolverAttached = true;
$resolver = $this->serviceManager->get('ViewResolver');
$resolver->attach($this, 100);
}
} | php | {
"resource": ""
} |
q260181 | Module.attachPDFtransformer | test | public function attachPDFtransformer(ViewEvent $e)
{
//$renderer = $e->getRenderer();
$result = $e->getResult();
$response = $e->getResponse();
// the handles are for temporary files
error_reporting(0);
foreach (array(self::RENDER_FULL, self::RENDE... | php | {
"resource": ""
} |
q260182 | Module.resolve | test | public function resolve($name, Renderer $renderer = null)
{
if ($this->serviceManager->has('ViewTemplatePathStack')) {
// get all the Pases made up for the zend-provided resolver
// we won't get any closer to ALL than that
$viewTemplatePathStack = $this->serviceManager->g... | php | {
"resource": ""
} |
q260183 | OptionBag.register | test | public function register($option, $type = OptionInterface::TYPE_GET)
{
if (is_string($option)) {
$option = $this->factory->create($option, $type);
}
if (!$option instanceof OptionInterface) {
throw new \InvalidArgumentException(
'The option should be ... | php | {
"resource": ""
} |
q260184 | OptionBag.getOption | test | private function getOption($name)
{
if (!isset($this->options[$name])) {
throw new \InvalidArgumentException(sprintf('The option "%s" does not exist.', $name));
}
return $this->options[$name];
} | php | {
"resource": ""
} |
q260185 | DocumentFixtures.getActivityProfileDocument | test | public static function getActivityProfileDocument(DocumentData $documentData = null)
{
if (null === $documentData) {
$documentData = static::getDocumentData();
}
$activityProfile = new ActivityProfile('profile-id', new Activity(IRI::fromString('activity-id')));
return n... | php | {
"resource": ""
} |
q260186 | DocumentFixtures.getAgentProfileDocument | test | public static function getAgentProfileDocument(DocumentData $documentData = null)
{
if (null === $documentData) {
$documentData = static::getDocumentData();
}
return new AgentProfileDocument(new AgentProfile('profile-id', new Agent(InverseFunctionalIdentifier::withMbox(IRI::from... | php | {
"resource": ""
} |
q260187 | DocumentFixtures.getStateDocument | test | public static function getStateDocument(DocumentData $documentData = null)
{
if (null === $documentData) {
$documentData = static::getDocumentData();
}
$agent = new Agent(InverseFunctionalIdentifier::withMbox(IRI::fromString('mailto:alice@example.com')));
$activity = new... | php | {
"resource": ""
} |
q260188 | Builder.addBehavior | test | public function addBehavior($slug, $strategy, array $args = [])
{
$behavior = $this->getBehavior($slug, $strategy);
if ($this->bucket->enabled($behavior)) {
$this->setBehavior($behavior, $args);
}
return $this;
} | php | {
"resource": ""
} |
q260189 | Builder.addValue | test | public function addValue($slug, $value)
{
$behavior = $this->getBehavior($slug, function () use ($value) {
return $value;
});
if ($this->bucket->enabled($behavior)) {
$this->setBehavior($behavior);
}
return $this;
} | php | {
"resource": ""
} |
q260190 | Builder.defaultBehavior | test | public function defaultBehavior($strategy, array $args = [])
{
if ($this->defaultWaived) {
$exception = new \LogicException('Defined a default behavior after `noDefault` was called.');
$this->logger->critical('Swivel', compact('exception'));
throw $exception;
}
... | php | {
"resource": ""
} |
q260191 | Builder.defaultValue | test | public function defaultValue($value)
{
if ($this->defaultWaived) {
$exception = new \LogicException('Defined a default value after `noDefault` was called.');
$this->logger->critical('Swivel', compact('exception'));
throw $exception;
}
if (!$this->behavior)... | php | {
"resource": ""
} |
q260192 | Builder.execute | test | public function execute()
{
$behavior = $this->behavior ?: $this->getBehavior(function () {
return;
});
$behaviorSlug = $behavior->getSlug();
$this->metrics && $this->startMetrics($behaviorSlug);
$result = $behavior->execute($this->args ?: []);
$this->met... | php | {
"resource": ""
} |
q260193 | Builder.getBehavior | test | public function getBehavior($slug, $strategy = self::DEFAULT_STRATEGY)
{
$this->logger->debug('Swivel - Creating new behavior.', compact('slug'));
if ($strategy === static::DEFAULT_STRATEGY) {
$strategy = $slug;
$slug = static::DEFAULT_SLUG;
}
if (!is_callabl... | php | {
"resource": ""
} |
q260194 | Builder.noDefault | test | public function noDefault()
{
if ($this->behavior && $this->behavior->getSlug() === static::DEFAULT_SLUG) {
$exception = new \LogicException('Called `noDefault` after a default behavior was defined.');
$this->logger->critical('Swivel', compact('exception'));
throw $except... | php | {
"resource": ""
} |
q260195 | Builder.setBehavior | test | protected function setBehavior(Behavior $behavior, array $args = [])
{
$slug = $behavior->getSlug();
$this->logger->debug('Swivel - Setting behavior.', compact('slug', 'args'));
$this->behavior = $behavior;
$this->args = $args;
} | php | {
"resource": ""
} |
q260196 | Builder.startMetrics | test | protected function startMetrics($behaviorSlug)
{
$metrics = $this->metrics;
$bucketIndex = $this->bucket->getIndex();
// Increment counters
$metrics->increment('Features', $behaviorSlug);
$metrics->increment('Buckets', $this->keys[$bucketIndex - 1], $behaviorSlug);
... | php | {
"resource": ""
} |
q260197 | Builder.stopMetrics | test | protected function stopMetrics($behaviorSlug)
{
$metrics = $this->metrics;
$metrics->endMemoryProfile('Features', $behaviorSlug);
$metrics->endTiming('Features', $behaviorSlug);
} | php | {
"resource": ""
} |
q260198 | Behavior.execute | test | public function execute(array $args = [])
{
$slug = $this->slug;
if ($this->logger) {
$this->logger->debug('Swivel - Executing behavior.', compact('slug', 'args'));
}
return call_user_func_array($this->strategy, $args);
} | php | {
"resource": ""
} |
q260199 | Collection.every | test | public function every($step, $offset = 0)
{
$new = [];
$position = 0;
foreach ($this->items as $key => $item) {
if ($position % $step === $offset) {
$new[] = $item;
}
$position++;
}
return new static($new);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.