_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q262200 | FormattedResponder.formatter | test | protected function formatter(ServerRequestInterface $request)
{
$accept = $request->getHeaderLine('Accept');
$priorities = $this->priorities();
if (!empty($accept)) {
$preferred = $this->negotiator->getBest($accept, array_keys($priorities));
}
if (!empty($prefer... | php | {
"resource": ""
} |
q262201 | FormattedResponder.format | test | protected function format(
ServerRequestInterface $request,
ResponseInterface $response,
PayloadInterface $payload
) {
$formatter = $this->formatter($request);
$response = $response->withHeader('Content-Type', $formatter->type());
// Overwrite the body instead of mak... | php | {
"resource": ""
} |
q262202 | EnvConfiguration.detectEnvFile | test | private function detectEnvFile()
{
$env = DIRECTORY_SEPARATOR . '.env';
$dir = dirname(dirname(__DIR__));
do {
if (is_file($dir . $env)) {
return $dir . $env;
}
$dir = dirname($dir);
} while (is_readable($dir) && dirname($dir) !== ... | php | {
"resource": ""
} |
q262203 | ExceptionHandler.type | test | private function type(ServerRequestInterface $request)
{
$accept = $request->getHeaderLine('Accept');
$priorities = $this->preferences->toArray();
if (!empty($accept)) {
$preferred = $this->negotiator->getBest($accept, array_keys($priorities));
}
if (!empty($pre... | php | {
"resource": ""
} |
q262204 | Application.build | test | public static function build(
Injector $injector = null,
ConfigurationSet $configuration = null,
MiddlewareSet $middleware = null
) {
return new static($injector, $configuration, $middleware);
} | php | {
"resource": ""
} |
q262205 | Application.run | test | public function run($runner = Relay::class)
{
$this->configuration->apply($this->injector);
return $this->injector
->share($this->middleware)
->prepare(Directory::class, $this->routing)
->execute($runner);
} | php | {
"resource": ""
} |
q262206 | ActionHandler.handle | test | private function handle(
Action $action,
ServerRequestInterface $request,
ResponseInterface $response
) {
$domain = $this->resolve($action->getDomain());
$input = $this->resolve($action->getInput());
$responder = $this->resolve($action->getResponder());
$payl... | php | {
"resource": ""
} |
q262207 | ActionHandler.payload | test | private function payload(
DomainInterface $domain,
InputInterface $input,
ServerRequestInterface $request
) {
return $domain($input($request));
} | php | {
"resource": ""
} |
q262208 | ActionHandler.response | test | private function response(
ResponderInterface $responder,
ServerRequestInterface $request,
ResponseInterface $response,
PayloadInterface $payload
) {
return $responder($request, $response, $payload);
} | php | {
"resource": ""
} |
q262209 | StatusResponder.status | test | private function status(
ResponseInterface $response,
PayloadInterface $payload
) {
$status = $payload->getStatus();
$code = $this->http_status->getStatusCode($status);
return $response->withStatus($code);
} | php | {
"resource": ""
} |
q262210 | TranslatorService.getCommandFromResource | test | public function getCommandFromResource($resource, $action, $relation = null)
{
$namespace = Config::get('api.app_namespace');
$mapping = Config::get('api.mapping');
// If the mapping does not exist, we consider this as a 404 error
if (!isset($mapping[$resource])) {
throw... | php | {
"resource": ""
} |
q262211 | Controller.runBeforeCommands | test | protected function runBeforeCommands($command)
{
$beforeCommands = $command::beforeCommands();
if (!is_array($beforeCommands) && strlen(trim($beforeCommands)) > 0) {
$beforeCommands = [$beforeCommands];
}
$this->dispatcher->pipeThrough($beforeCommands);
} | php | {
"resource": ""
} |
q262212 | Command.getPerPageFromModelClass | test | protected function getPerPageFromModelClass($modelClass) {
// We need this empty model to grab perPage and perPageMax parameters
$model = new $modelClass;
// If Model::$perPage equals 0, then pagination is disabled
if ($model->getPerPage() == 0) {
return $modelClass::all();
... | php | {
"resource": ""
} |
q262213 | Command.addWhereStatements | test | protected function addWhereStatements($query, $class)
{
$params = Request::all();
foreach ($params as $key => $value) {
if (!in_array($key, $this->keywordParams) && !in_array($key, $class::$filterable)) {
throw new InvalidFilterException;
}
if (!... | php | {
"resource": ""
} |
q262214 | LaravelRestServiceProvider.boot | test | public function boot()
{
$this->publishes([
implode(DIRECTORY_SEPARATOR, [__DIR__, 'config', 'api.php']) => config_path('api.php')
]);
$this->setupRoutes($this->app->router);
} | php | {
"resource": ""
} |
q262215 | Route.allow | test | public function allow($methods = [])
{
$methods = $methods ? (array) $methods : [];
$methods = array_map('strtoupper', $methods);
$this->_methods = array_fill_keys($methods, true) + $this->_methods;
return $this;
} | php | {
"resource": ""
} |
q262216 | Route.pattern | test | public function pattern($pattern = null)
{
if (!func_num_args()) {
return $this->_pattern;
}
$this->_token = null;
$this->_regex = null;
$this->_variables = null;
if (!$pattern || $pattern[0] !== '[') {
$pattern = '/' . trim($pattern, '/');
... | php | {
"resource": ""
} |
q262217 | Route.token | test | public function token()
{
if ($this->_token === null) {
$parser = $this->_classes['parser'];
$this->_token = [];
$this->_regex = null;
$this->_variables = null;
$this->_token = $parser::tokenize($this->_pattern, '/');
}
return $this... | php | {
"resource": ""
} |
q262218 | Route.regex | test | public function regex()
{
if ($this->_regex !== null) {
return $this->_regex;
}
$this->_compile();
return $this->_regex;
} | php | {
"resource": ""
} |
q262219 | Route.variables | test | public function variables()
{
if ($this->_variables !== null) {
return $this->_variables;
}
$this->_compile();
return $this->_variables;
} | php | {
"resource": ""
} |
q262220 | Route.match | test | public function match($request, &$variables = null, &$hostVariables = null)
{
$hostVariables = [];
if (($host = $this->host()) && !$host->match($request, $hostVariables)) {
return false;
}
$path = isset($request['path']) ? $request['path'] : '';
$method = isset(... | php | {
"resource": ""
} |
q262221 | Route._buildVariables | test | protected function _buildVariables($values)
{
$variables = [];
$parser = $this->_classes['parser'];
$i = 1;
foreach ($this->variables() as $name => $pattern) {
if (!isset($values[$i])) {
$variables[$name] = !$pattern ? null : [];
continue;... | php | {
"resource": ""
} |
q262222 | Route.dispatch | test | public function dispatch($response = null)
{
if ($error = $this->error()) {
throw new RouterException($this->message(), $error);
}
$this->response = $response;
$request = $this->request;
$generator = $this->middleware();
$next = function() use ($request,... | php | {
"resource": ""
} |
q262223 | Route.link | test | public function link($params = [], $options = [])
{
$defaults = [
'absolute' => false,
'basePath' => '',
'query' => '',
'fragment' => ''
];
$options = array_filter($options, function($value) { return $value !== '*'; });
$options += ... | php | {
"resource": ""
} |
q262224 | Host._compile | test | protected function _compile()
{
if ($this->pattern() === '*') {
return;
}
$parser = $this->_classes['parser'];
$rule = $parser::compile($this->token());
$this->_regex = $rule[0];
$this->_variables = $rule[1];
} | php | {
"resource": ""
} |
q262225 | Host.match | test | public function match($request, &$hostVariables = null)
{
$defaults = [
'host' => '*',
'scheme' => '*'
];
$request += $defaults;
$scheme = $request['scheme'];
$host = $request['host'];
$hostVariables = [];
$anyHost = $this->pattern(... | php | {
"resource": ""
} |
q262226 | Host.link | test | public function link($params = [], $options = [])
{
$defaults = [
'scheme' => $this->scheme()
];
$options += $defaults;
if (!isset($options['host'])) {
$options['host'] = $this->_link($this->token(), $params);
}
$scheme = $options['scheme']... | php | {
"resource": ""
} |
q262227 | Parser.tokenize | test | public static function tokenize($pattern, $delimiter = '/')
{
// Checks if the pattern has some optional segments.
if (count(preg_split('~' . static::PLACEHOLDER_REGEX . '(*SKIP)(*F)|\[~x', $pattern)) > 1) {
$tokens = static::_tokenizePattern($pattern, $delimiter);
} else {
... | php | {
"resource": ""
} |
q262228 | Parser._tokenizePattern | test | protected static function _tokenizePattern($pattern, $delimiter, &$variable = null)
{
$tokens = [];
$index = 0;
$path = '';
$parts = static::split($pattern);
foreach ($parts as $part) {
if (is_string($part)) {
$tokens = array_merge($tokens, static... | php | {
"resource": ""
} |
q262229 | Parser._tokenizeSegment | test | protected static function _tokenizeSegment($pattern, $delimiter, &$variable = null)
{
$tokens = [];
$index = 0;
$path = '';
if (preg_match_all('~' . static::PLACEHOLDER_REGEX . '()~x', $pattern, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
foreach ($matches as $mat... | php | {
"resource": ""
} |
q262230 | Parser.split | test | public static function split($pattern)
{
$segments = [];
$len = strlen($pattern);
$buffer = '';
$opened = 0;
for ($i = 0; $i < $len; $i++) {
if ($pattern[$i] === '{') {
do {
$buffer .= $pattern[$i++];
if ($pa... | php | {
"resource": ""
} |
q262231 | Parser.compile | test | public static function compile($token)
{
$variables = [];
$regex = '';
foreach ($token['tokens'] as $child) {
if (is_string($child)) {
$regex .= preg_quote($child, '~');
} elseif (isset($child['tokens'])) {
$rule = static::compile($chil... | php | {
"resource": ""
} |
q262232 | Scope.scopify | test | public function scopify($options)
{
$scope = $this->_scope;
if (!empty($options['name'])) {
$options['name'] = $scope['name'] ? $scope['name'] . '.' . $options['name'] : $options['name'];
}
if (!empty($options['prefix'])) {
$options['prefix'] = $scope['prefi... | php | {
"resource": ""
} |
q262233 | Router.bind | test | public function bind($pattern, $options = [], $handler = null)
{
if (!is_array($options)) {
$handler = $options;
$options = [];
}
if (!$handler instanceof Closure && !method_exists($handler, '__invoke')) {
throw new RouterException("The handler needs to be... | php | {
"resource": ""
} |
q262234 | Router.group | test | public function group($prefix, $options, $handler = null)
{
if (!is_array($options)) {
$handler = $options;
if (is_string($prefix)) {
$options = [];
} else {
$options = $prefix;
$prefix = '';
}
}
... | php | {
"resource": ""
} |
q262235 | Router.route | test | public function route($request)
{
$defaults = [
'path' => '',
'method' => 'GET',
'host' => '*',
'scheme' => '*'
];
$this->_defaults = [];
if ($request instanceof RequestInterface) {
$uri = $request->getUri();
... | php | {
"resource": ""
} |
q262236 | Router._normalizeRequest | test | protected function _normalizeRequest($request)
{
if (preg_match('~^(?:[a-z]+:)?//~i', $request['path'])) {
$parsed = array_intersect_key(parse_url($request['path']), $request);
$request = $parsed + $request;
}
$request['path'] = (ltrim(strtok($request['path'], '?'), '... | php | {
"resource": ""
} |
q262237 | Router._route | test | protected function _route($request)
{
$path = $request['path'];
$httpMethod = $request['method'];
$host = $request['host'];
$scheme = $request['scheme'];
$allowedSchemes = array_unique([$scheme => $scheme, '*' => '*']);
$allowedMethods = array_unique([$httpMethod => ... | php | {
"resource": ""
} |
q262238 | Router.link | test | public function link($name, $params = [], $options = [])
{
$defaults = [
'basePath' => $this->basePath()
];
$options += $defaults;
$params += $this->_defaults;
if (!isset($this[$name])) {
throw new RouterException("No binded route defined for `'{$nam... | php | {
"resource": ""
} |
q262239 | Router.clear | test | public function clear()
{
$this->_basePath = '';
$this->_strategies = [];
$this->_defaults = [];
$this->_routes = [];
$scope = $this->_classes['scope'];
$this->_scopes = [new $scope(['router' => $this])];
} | php | {
"resource": ""
} |
q262240 | WorkflowViewWidget.createJs | test | private function createJs()
{
$nodes = $this->_workflow->getAllStatuses();
$trList = [];
$nodeList = [];
foreach($nodes as $node) {
$n = new \stdClass();
$n->id = $node->getId();
$n->label = $node->getLabel();
if( $node->getMetadata('color') ){
if( $node->getWorkfl... | php | {
"resource": ""
} |
q262241 | FileTokenStorage.get | test | public function get()
{
if (!$this->empty())
{
return $this->file->disk()->get(
$this->hashName
);
}
return null;
} | php | {
"resource": ""
} |
q262242 | SendpulseApi.getToken | test | private function getToken() {
$data = array(
'grant_type' => 'client_credentials',
'client_id' => $this->userId,
'client_secret' => $this->secret,
);
$requestResult = $this->sendRequest( 'oauth/access_token', 'POST', $data, false );
if( $reque... | php | {
"resource": ""
} |
q262243 | SendpulseApi.listAddressBooks | test | public function listAddressBooks( $limit = NULL, $offset = NULL ) {
$data = array();
if( !is_null( $limit ) ) {
$data['limit'] = $limit;
}
if( !is_null( $offset ) ) {
$data['offset'] = $offset;
}
$requestResult = $this->sendRequest( 'addressbooks'... | php | {
"resource": ""
} |
q262244 | SendpulseApi.getEmailsFromBook | test | public function getEmailsFromBook( $id ) {
if( empty( $id ) ) {
return $this->handleError( 'Empty book id' );
}
$requestResult = $this->sendRequest( 'addressbooks/' . $id . '/emails' );
return $this->handleResult( $requestResult );
} | php | {
"resource": ""
} |
q262245 | SendpulseApi.addEmails | test | public function addEmails( $bookId, $emails ) {
if( empty( $bookId ) || empty( $emails ) ) {
return $this->handleError( 'Empty book id or emails' );
}
$data = array(
'emails' => serialize( $emails )
);
$requestResult = $this->sendRequest( 'addressbooks/'... | php | {
"resource": ""
} |
q262246 | SendpulseApi.campaignCost | test | public function campaignCost( $bookId ) {
if( empty( $bookId ) ) {
return $this->handleError( 'Empty book id' );
}
$requestResult = $this->sendRequest( 'addressbooks/' . $bookId . '/cost' );
return $this->handleResult( $requestResult );
} | php | {
"resource": ""
} |
q262247 | SendpulseApi.createCampaign | test | public function createCampaign( $senderName, $senderEmail, $subject, $body, $bookId, $name = '', $attachments = '' ) {
if( empty( $senderName ) || empty( $senderEmail ) || empty( $subject ) || empty( $body ) || empty( $bookId ) ) {
return $this->handleError( 'Not all data.' );
}
if(... | php | {
"resource": ""
} |
q262248 | SendpulseApi.addSender | test | public function addSender( $senderName, $senderEmail ) {
if( empty( $senderName ) || empty( $senderEmail ) ) {
return $this->handleError( 'Empty sender name or email' );
}
$data = array(
'email' => $senderEmail,
'name' => $senderName
);
$req... | php | {
"resource": ""
} |
q262249 | SendpulseApi.activateSender | test | public function activateSender( $email, $code ) {
if( empty( $email ) || empty( $code ) ) {
return $this->handleError( 'Empty email or activation code' );
}
$data = array(
'code' => $code
);
$requestResult = $this->sendRequest( 'senders/' . $email . '/co... | php | {
"resource": ""
} |
q262250 | SendpulseApi.pushListWebsiteSubscriptions | test | public function pushListWebsiteSubscriptions( $websiteId, $limit = NULL, $offset = NULL ) {
$data = array();
if( !is_null( $limit ) ) {
$data['limit'] = $limit;
}
if( !is_null( $offset ) ) {
$data['offset'] = $offset;
}
$requestResult = $this->sen... | php | {
"resource": ""
} |
q262251 | SendpulseApi.pushSetSubscriptionState | test | public function pushSetSubscriptionState( $subscriptionId, $stateValue ) {
$data = array(
'id' => $subscriptionId,
'state' => $stateValue
);
$requestResult = $this->sendRequest( 'push/subscriptions/state', 'POST', $data );
return $this->handleResult( $requestRes... | php | {
"resource": ""
} |
q262252 | SendpulseApi.createPushTask | test | public function createPushTask( $taskInfo, $additionalParams = array() ) {
$data = $taskInfo;
if (!isset($data['ttl'])) {
$data['ttl'] = 0;
}
if( empty($data['title']) || empty($data['website_id']) || empty($data['body']) ) {
return $this->handleError( 'Not all da... | php | {
"resource": ""
} |
q262253 | TokenStorageManager.hashName | test | protected function hashName()
{
$userId = $this->app['config']->get('sendpulse.api_user_id');
$secret = $this->app['config']->get('sendpulse.api_secret');
return md5($userId . '::' . $secret);
} | php | {
"resource": ""
} |
q262254 | CommunicationAdapter.sendToWebsite | test | public function sendToWebsite($url, array $params)
{
// Sending request
$client = $this->getClient();
$response = $client->request('POST', $url, [
'query' => http_build_query($params, '', '&')
]);
// Getting response body
$responseString = $response->get... | php | {
"resource": ""
} |
q262255 | CommunicationAdapter.sendToApi | test | public function sendToApi($url, array $params, $responseType = self::RESPONSE_NEW_LINE, array $notDecode = null, $forceArray = array())
{
$this->preSendToApiCheck();
// Merging post-data
$fields = array();
$fields['loginName'] = $this->getAccount()->getLoginName... | php | {
"resource": ""
} |
q262256 | CommunicationAdapter.preSendToApiCheck | test | protected function preSendToApiCheck()
{
if ($this->getAccount() === null) {
throw new \Exception('Please provided an account');
}
if (!$this->getAccount()->isValid()) {
throw new \Exception('Please provided valid account');
}
return true;
} | php | {
"resource": ""
} |
q262257 | CommunicationAdapter.decodeNewLineEncodedResponse | test | protected function decodeNewLineEncodedResponse($responseString, $requestQuery, array $forceArray = array())
{
// Splitting response body
$parts = explode(chr(10), $responseString);
// Getting the status
$status = trim($parts[0]);
$responseArray = [];
// Valid answ... | php | {
"resource": ""
} |
q262258 | CommunicationAdapter.decodeUrlEncodedResponse | test | protected function decodeUrlEncodedResponse(
$responseString,
$requestQuery,
array $notDecode = null,
$forceArray = array()
)
{
if (empty($notDecode)) {
$responseString = urldecode($responseString);
}
if (!empty($forceArray)) {
for... | php | {
"resource": ""
} |
q262259 | ImapHelper.fetchMails | test | public function fetchMails(ImapAdapter $imap, $search, $markProcessed = true, $assume = false, \Closure $callbackFunction = null)
{
$folder = 'INBOX';
$imap->selectFolder($folder);
$result = $imap->search(array($search));
$messages = [];
foreach ($result as $id) {
... | php | {
"resource": ""
} |
q262260 | ImapHelper.markProcessed | test | protected function markProcessed(ImapAdapter $imap, $id, Message $message = null)
{
$flags = $message ? $message->getFlags() : [];
$flags[] = self::PROCESSED_FLAG;
try {
$imap->setFlags($id, $flags);
} catch (ExceptionInterface $e) {
// Nothing to do
... | php | {
"resource": ""
} |
q262261 | ImapHelper.getTypeOfMail | test | protected function getTypeOfMail(array $mail)
{
foreach (self::$subjects as $key => $subject) {
if (stristr($mail['subject'], $subject) !== false) {
return $key;
}
}
foreach (self::$bodies as $key => $body) {
if (preg_match($body, $mail['p... | php | {
"resource": ""
} |
q262262 | Util.autoRefund | test | public function autoRefund(array $params)
{
if (false === isset($params['refundReasonCode'])) {
$params['refundReasonCode'] = self::AUTO_REFUND_REASON_OTHER;
}
$response = $this
->communicationAdapter
->sendToApi(
self::COMODO_AUTO_REFUND_... | php | {
"resource": ""
} |
q262263 | Util.autoApplySSL | test | public function autoApplySSL(array $params)
{
// Two choices, we want url-encoded
$params['responseFormat'] = CommunicationAdapter::RESPONSE_URL_ENCODED;
$params['showCertificateID'] = 'Y';
// Send request
$arr = $this
->communicationAdapter
->send... | php | {
"resource": ""
} |
q262264 | Util.autoReplaceSSL | test | public function autoReplaceSSL(array $params)
{
// Two choices, we want url-encoded
$params['responseFormat'] = CommunicationAdapter::RESPONSE_URL_ENCODED;
// Send request
$arr = $this
->communicationAdapter
->sendToApi(
self::COMODO_AUTO_REPL... | php | {
"resource": ""
} |
q262265 | Util.autoRevokeSSL | test | public function autoRevokeSSL(array $params)
{
// Two choices, we want url-encoded
$params['responseFormat'] = CommunicationAdapter::RESPONSE_URL_ENCODED;
return $this->sendBooleanRequest(
self::COMODO_AUTO_REVOKE_URL,
$params,
CommunicationAdapter::RESPO... | php | {
"resource": ""
} |
q262266 | Util.collectSsl | test | public function collectSsl(array $params)
{
// Not decode the following indexes
$notDecode = array('caCertificate', 'certificate', 'netscapeCertificateSequence', 'zipFile');
// Force threating as array
$forceArray = array('caCertificate');
// Two choices, we want url-encode... | php | {
"resource": ""
} |
q262267 | Util.getDCVEMailAddressList | test | public function getDCVEMailAddressList(array $params)
{
// Force threating as array
$forceArray = array('whois_email', 'level2_email', 'level3_email');
// Response is always new line encoded
$responseArray = $this
->communicationAdapter
->sendToApi(
... | php | {
"resource": ""
} |
q262268 | Util.sslChecker | test | public function sslChecker(array $params)
{
// Response is always new line encoded
$responseArray = $this
->communicationAdapter
->sendToApi(
self::COMODO_SSLCHECKER,
$params,
CommunicationAdapter::RESPONSE_URL_ENCODED
... | php | {
"resource": ""
} |
q262269 | Util.webHostReport | test | public function webHostReport(array $params) {
if (empty($params['lastResultNo'])) {
$params['lastResultNo'] = 10;
}
// Response is always new line encoded
$responseArray = $this
->communicationAdapter
->sendToApi(
self::COMODO_WEB_HO... | php | {
"resource": ""
} |
q262270 | Util.enterDCVCode | test | public function enterDCVCode(array $params)
{
// Check parameters
if (!isset($params['dcvCode'])) {
throw new ArgumentException(-3, 'Please provide an order-number', 'dcvCode', '');
}
if (!isset($params['orderNumber'])) {
throw new ArgumentException(-3, 'Plea... | php | {
"resource": ""
} |
q262271 | Util.createException | test | protected function createException($responseArray)
{
if (is_array($responseArray) === false) {
return new UnknownException(
0,
'Internal error',
$responseArray['responseString']
);
}
switch ($responseArray['errorCode'])... | php | {
"resource": ""
} |
q262272 | MetaGenerator.generate | test | public function generate()
{
$title = $this->getTitle();
$description = $this->getDescription();
$keywords = $this->getKeywords();
$canonical = $this->getCanonical();
$html[] = "<title>$title</title>";
if (! empty($description)) {
$html[] = "<meta name='... | php | {
"resource": ""
} |
q262273 | MetaGenerator.setDescription | test | public function setDescription($description)
{
$description = strip_tags($description);
if (strlen($description) > $this->max_description_length) {
$description = substr($description, 0, $this->max_description_length);
}
$this->description = $description;
} | php | {
"resource": ""
} |
q262274 | MetaGenerator.reset | test | public function reset()
{
$this->title = null;
$this->description = null;
$this->keywords = null;
$this->canonical = null;
} | php | {
"resource": ""
} |
q262275 | SEOServiceProvider.registerBindings | test | public function registerBindings()
{
// Register the sitemap.xml generator
$this->app->singleton('calotype.seo.generators.sitemap', function ($app) {
return new SitemapGenerator();
});
// Register the meta tags generator
$this->app->singleton('calotype.seo.genera... | php | {
"resource": ""
} |
q262276 | OpenGraphGenerator.generate | test | public function generate()
{
$html = array();
foreach ($this->properties as $property => $value) {
$html[] = strtr(static::OPENGRAPH_TAG, array(
'[property]' => static::OPENGRAPH_PREFIX . $property,
'[value]' => $value
));
}
r... | php | {
"resource": ""
} |
q262277 | SitemapGenerator.addRaw | test | public function addRaw(array $data)
{
$this->validateData($data);
$data = $this->prepareData($data);
$this->entries[] = $data;
} | php | {
"resource": ""
} |
q262278 | SitemapGenerator.prepareData | test | public function prepareData(array $data)
{
$data = $this->replaceAttributes($data);
// Remove trailing slashes from the location
if (array_key_exists('loc', $data)) {
$data['loc'] = trim($data['loc'], '/');
}
return $data;
} | php | {
"resource": ""
} |
q262279 | SitemapGenerator.contains | test | public function contains($url)
{
$url = trim($url, '/');
foreach ($this->entries as $entry) {
if ($entry['loc'] == $url) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q262280 | SitemapGenerator.validateData | test | protected function validateData($data)
{
$data = $this->replaceAttributes($data);
foreach ($this->required as $required) {
if (! array_key_exists($required, $data)) {
$replacement = array_search($required, $this->replacements);
if ($replacement !== false... | php | {
"resource": ""
} |
q262281 | BatchCommand.fillIndex | test | public function fillIndex($index)
{
/** @param Command $value */
$map = function ($value) use ($index) {
if ($value->getIndex() === null) {
$value->index($index);
}
};
array_map($map, $this->commands);
return $this;
} | php | {
"resource": ""
} |
q262282 | BatchCommand.fillType | test | public function fillType($type)
{
/** @param Command $value */
$map = function ($value) use ($type) {
if ($value->getType() === null) {
$value->type($type);
}
};
array_map($map, $this->commands);
return $this;
} | php | {
"resource": ""
} |
q262283 | IndexRequest.index | test | public function index($index)
{
$this->params['index'] = array();
$args = func_get_args();
foreach ($args as $arg) {
$this->params['index'][] = $arg;
}
return $this;
} | php | {
"resource": ""
} |
q262284 | IndexRequest.type | test | public function type($type)
{
$this->params['type'] = array();
$args = func_get_args();
foreach ($args as $arg) {
$this->params['type'][] = $arg;
}
return $this;
} | php | {
"resource": ""
} |
q262285 | IndexRequest.settings | test | public function settings($settings, $merge = true)
{
if ($settings instanceof \Sherlock\wrappers\IndexSettingsWrapper)
$newSettings = $settings->toArray();
else if (is_array($settings))
$newSettings = $settings;
else
throw new \Sherlock\common\exceptions\B... | php | {
"resource": ""
} |
q262286 | IndexRequest.delete | test | public function delete()
{
if (!isset($this->params['index']))
throw new exceptions\RuntimeException("Index cannot be empty.");
$index = implode(',', $this->params['index']);
$command = new Command();
$command->index($index)
->action('delete');
$th... | php | {
"resource": ""
} |
q262287 | IndexRequest.create | test | public function create()
{
if (!isset($this->params['index']))
throw new exceptions\RuntimeException("Index cannot be empty.");
$index = implode(',', $this->params['index']);
//Final JSON should be object properties, not an array. So we need to iterate
//through the a... | php | {
"resource": ""
} |
q262288 | IndexRequest.updateSettings | test | public function updateSettings()
{
if (!isset($this->params['index'])) {
throw new exceptions\RuntimeException("Index cannot be empty.");
}
$index = implode(',', $this->params['index']);
$body = array("index" => $this->params['indexSettings']);
$co... | php | {
"resource": ""
} |
q262289 | RawRequest.execute | test | public function execute()
{
if (!isset($this->params['uri'])) {
throw new exceptions\RuntimeException("URI is required for RawRequest");
}
if (!isset($this->params['method'])) {
throw new exceptions\RuntimeException("Method is required for Ra... | php | {
"resource": ""
} |
q262290 | RawRequest.toJSON | test | public function toJSON()
{
$finalQuery = "";
if (isset($this->params['body'])) {
$finalQuery = json_encode($this->params['body']);
}
return $finalQuery;
} | php | {
"resource": ""
} |
q262291 | SearchRequest.sort | test | public function sort($value)
{
$args = func_get_args();
//single param, array of sorts
if (count($args) == 1 && is_array($args[0])) {
$args = $args[0];
}
foreach ($args as $arg) {
if ($arg instanceof \Sherlock\components\SortInterface) {
... | php | {
"resource": ""
} |
q262292 | SearchRequest.facets | test | public function facets($facets)
{
$this->params['facets'] = array();
if (is_array($facets)){
$args = $facets;
}else{
$args = func_get_args();
}
foreach ($args as $arg) {
if ($arg instanceof FacetInterface) {
$this->params['f... | php | {
"resource": ""
} |
q262293 | SearchRequest.composeFinalQuery | test | private function composeFinalQuery()
{
$finalQuery = array();
if (isset($this->params['fields'])) {
$finalQuery['fields'] = $this->params['fields'];
}
if (isset($this->params['query']) && $this->params['query'] instanceof components\QueryInterface) {
$finalQ... | php | {
"resource": ""
} |
q262294 | BaseComponent.convertParams | test | protected function convertParams($params)
{
$paramArray = array();
foreach ($params as $param) {
if (isset($this->params[$param]) === true) {
$paramArray[$param] = $this->params[$param];
}
}
return $paramArray;
} | php | {
"resource": ""
} |
q262295 | Sherlock.addNode | test | public function addNode($host, $port = 9200)
{
$this->settings['cluster']->addNode($host, $port, $this->settings['cluster.autodetect']);
return $this;
} | php | {
"resource": ""
} |
q262296 | Bool.must | test | public function must($value)
{
$args = $this->normalizeFuncArgs(func_get_args());
foreach ($args as $arg) {
if ($arg instanceof FilterInterface) {
$this->params['must'][] = $arg->toArray();
}
}
return $this;
} | php | {
"resource": ""
} |
q262297 | DeleteDocumentRequest.document | test | public function document($id)
{
if (!$this->batch instanceof BatchCommand) {
throw new exceptions\RuntimeException("Cannot delete a document from an external BatchCommandInterface");
}
$command = new Command();
$command->id($id)
->action('delete')... | php | {
"resource": ""
} |
q262298 | DeleteDocumentRequest.documents | test | public function documents($values)
{
if ($values instanceof BatchCommandInterface) {
$this->batch = $values;
} elseif (is_array($values)) {
$isBatch = true;
$batch = new BatchCommand();
/**
* @param mixed $value
*/
... | php | {
"resource": ""
} |
q262299 | DeleteDocumentRequest.execute | test | public function execute()
{
//if this is an internal Sherlock BatchCommand, make sure index/types/action are filled
if ($this->batch instanceof BatchCommand) {
$this->batch->fillIndex($this->params['index'][0])
->fillType($this->params['type'][0]);
}
ret... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.