sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function getSurveyResponses($surveyId, $detailed = false, array $filters = []) { if ($detailed) { return $this->sendRequest( $this->createRequest('GET', sprintf('surveys/%d/responses/bulk', $surveyId), [ 'query' => $filters ]) ); } else { return $this->sendRequest( $this->createR...
getSurveyResponses @param int $surveyId @param bool $detailed - Defaults to false @param array $filters - Available filters: page, per_page, start_created_at, end_created_at, start_modified_at, end_modified_at, status, email, first_name, last_name, ip, custom, total_time_max, total_time_min, total_time_units, sort_ord...
entailment
public function getCollectorResponses($collectorId, $detailed = false, array $filters = []) { if ($detailed) { return $this->sendRequest( $this->createRequest('GET', sprintf('collectors/%d/responses/bulk', $collectorId), [ 'query' => $filters ]) ); } else { return $this->sendRequest( $t...
getCollectorResponses @param int $collectorId @param bool $detailed - Defaults to false @param array $filters - Available filters: page, per_page, start_created_at, end_created_at, start_modified_at, end_modified_at, status, email, first_name, last_name, ip, custom, total_time_max, total_time_min, total_time_units, so...
entailment
public function createCollectorResponse($collectorId, array $data = []) { return $this->sendRequest( $this->createRequest('POST', sprintf('collectors/%d/responses', $collectorId), [], $data) ); }
createCollectorResponse @param int $collectorId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function getCollectorResponse($collectorId, $responseId, $detailed = false) { if ($detailed) { return $this->sendRequest( $this->createRequest('GET', sprintf('collectors/%d/responses/%d', $collectorId, $responseId)) ); } else { return $this->sendRequest( $this->createRequest('GET', sprintf(...
getCollectorResponse @param int $collectorId @param int $responseId @param bool $detailed @return @see Client::sendRequest
entailment
public function updateCollectorResponse($collectorId, $responseId, array $data = []) { return $this->sendRequest( $this->createRequest('PATCH', sprintf('collectors/%s/responses/%s', $collectorId, $responseId), [], $data) ); }
updateCollectorResponse @param int $collectorId @param int $responseId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function replaceCollectorResponse($collectorId, $responseId, array $data = []) { return $this->sendRequest( $this->createRequest('PUT', sprintf('collectors/%s/responses/%s', $collectorId, $responseId), [], $data) ); }
replaceCollectorResponse @param int $collectorId @param int $responseId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function deleteCollectorResponse($collectorId, $responseId) { return $this->sendRequest( $this->createRequest('DELETE', sprintf('collectors/%s/responses/%s', $collectorId, $responseId)) ); }
deleteCollectorResponse @param int $collectorId @param int $responseId @return @see Client::sendRequest
entailment
public function getSurveyResponse($surveyId, $responseId, $detailed = false, array $filters = []) { if ($detailed) { return $this->sendRequest( $this->createRequest('GET', sprintf('surveys/%s/responses/%s/details', $surveyId, $responseId), [ 'query' => $filters ]) ); } else { return $this->...
getSurveyResponse @param int $collectorId @param int $responseId @param bool $detailed @return @see Client::sendRequest
entailment
public function updateSurveyResponse($surveyId, $responseId, array $data = []) { return $this->sendRequest( $this->createRequest('PATCH', sprintf('surveys/%s/responses/%s', $surveyId, $responseId), [], $data) ); }
updateSurveyResponse @param int $surveyId @param int $responseId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function replaceSurveyResponse($surveyId, $responseId, array $data = []) { return $this->sendRequest( $this->createRequest('PUT', sprintf('surveys/%s/responses/%s', $surveyId, $responseId), [], $data) ); }
replaceSurveyResponse @param int $surveyId @param int $responseId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function deleteSurveyResponse($surveyId, $responseId) { return $this->sendRequest( $this->createRequest('DELETE', sprintf('surveys/%s/responses/%s', $surveyId, $responseId)) ); }
deleteSurveyResponse @param int $surveyId @param int $responseId @return @see Client::sendRequest
entailment
protected function get($key) { $this->checkForNonEmptyKey($key); if (!isset($this->getBackEndUser()->uc[self::PHPUNIT_SETTINGS_KEY][$key])) { return null; } return $this->getBackEndUser()->uc[self::PHPUNIT_SETTINGS_KEY][$key]; }
Returns the value stored for the key $key. @param string $key the key of the value to retrieve, must not be empty @return mixed the value for the given key, will be NULL if there is no value for the given key
entailment
public function set($key, $value) { $this->checkForNonEmptyKey($key); $this->getBackEndUser()->uc[self::PHPUNIT_SETTINGS_KEY][$key] = $value; $this->getBackEndUser()->writeUC(); }
Sets the value for the key $key. @param string $key the key of the value to set, must not be empty @param mixed $value the value to set @return void
entailment
public function isActive($key) { switch ($key) { case 'codeCoverage': $isActive = extension_loaded('xdebug'); break; case 'runSeleniumTests': $isActive = $this->seleniumService->isSeleniumServerRunning(); break; ...
Returns whether the given setting is active/allowed. @param string $key @return bool
entailment
public function getMetadataFor($value) { $metaData = new ClassMetadata(get_class($value)); $fullClass = $this->getClassValidator($value); if (empty($fullClass)) { return $metaData; } /** @var $loader LoaderMetadataInterface */ $loader = new $fullClass();...
Returns the metadata for the given value. @param mixed $value Some value @return MetadataInterface The metadata for the value @throws NoSuchMetadataException If no metadata exists for the given value
entailment
private function getClassValidator($value) { $classModel = get_class($value); $className = substr(strrchr($classModel, '\\'), 1); $fullClass = 'Greenter\\Validator\\Loader\\'.$className.'Loader'; if (!class_exists($fullClass)) { return false; } return $f...
@param $value @return bool|string
entailment
protected function renderTag($tagName, array $attributes = [], $content = '') { if (empty($tagName)) { throw new \InvalidArgumentException('$tagName must not be NULL or empty.', 1343763729); } $output = '<' . htmlspecialchars($tagName); foreach ($attributes as $key => $...
Renders any HTML tag with its own parameter either around some content. If the content is empty, the tag gets rendered as a self-closing tag. @param string $tagName @param string[] $attributes use HTML attribute as key, must not be empty use attribute value as array value, might be empty @param string $content @retu...
entailment
protected function getPublicHolidays($year) { $timezone = $this->timezone; /** @var Holiday[] $data */ $data = array(); $easter = $this->getEaster($year); $data[] = new Holiday($easter, "Karfreitag", $timezone); $data[0]->modify("-2 days"); $data[] = new Holi...
Get _public holidays_ only. Not in all states of Germany days from getSpecial() are public holidays. Moved to dedicated method in order to retain compatibility of getHolidays() with existing code. @param int $year Year @return Holiday[]
entailment
public function updateContactList($contactListId, array $data = []) { return $this->sendRequest( $this->createRequest('PATCH', sprintf('contact_lists/%d', $contactListId), [], $data) ); }
updateContactList @param int $contactListId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function replaceContactList($contactListId, array $data = []) { return $this->sendRequest( $this->createRequest('PUT', sprintf('contact_lists/%d', $contactListId), [], $data) ); }
replaceContactList @param int $contactListId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function mergeContactList($contactListId, $intoContactListId) { return $this->sendRequest( $this->createRequest('POST', sprintf('contact_lists/%d/merge', $contactListId), [], [ 'list_id' => $intoContactListId ]) ); }
mergeContactList @param int $contactListId @param int $intoContactListId @return @see Client::sendRequest
entailment
public function getContactsInList($contactListId, array $filters = []) { return $this->sendRequest( $this->createRequest('GET', sprintf('contact_lists/%d/contacts', $contactListId), [ 'query' => $filters ]) ); }
getContactsInList @param int $contactListId @param array $filters - Available filters: page, per_page, status, sort_by, sort_order, search_by @return @see Client::sendRequest
entailment
public function createContactInList($contactListId, array $data = []) { return $this->sendRequest( $this->createRequest('POST', sprintf('contact_lists/%d/contacts', $contactListId), [], $data) ); }
createContactInList @param int $contactListId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function createContactsInList($contactListId, array $data = []) { return $this->sendRequest( $this->createRequest('POST', sprintf('contact_lists/%d/contacts/bulk', $contactListId), [], $data) ); }
createContactsInList @param int $contactListId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function updateContact($contactId, array $data = []) { return $this->sendRequest( $this->createRequest('PATCH', sprintf('contacts/%d', $contactId), [], $data) ); }
updateContact @param int $contactId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function replaceContact($contactId, array $data = []) { return $this->sendRequest( $this->createRequest('PUT', sprintf('contacts/%d', $contactId), [], $data) ); }
replaceContact @param int $contactId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function updateContactField($contactFieldId, array $data = []) { return $this->sendRequest( $this->createRequest('PATCH', sprintf('contact_fields/%d', $contactFieldId), [], $data) ); }
updateContactField @param int $contactFieldId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function generate(string $class, \ReflectionClass $sourceClass, BindInterface $bind) : string { $methods = $this->codeGenMethod->getMethods($sourceClass, $bind); $classStmt = $this->buildClass($class, $sourceClass, $methods); $classStmt = $this->addClassDocComment($classStmt, $sourceC...
{@inheritdoc}
entailment
private function getPhpFileStmt(\ReflectionClass $class) : array { $traverser = new NodeTraverser(); $visitor = new CodeGenVisitor(); $traverser->addVisitor($visitor); $fileName = $class->getFileName(); if (is_bool($fileName)) { throw new InvalidSourceClassExcepti...
Return "declare()" and "use" statement code @return Stmt[]
entailment
private function getClass(BuilderFactory $factory, string $newClassName, \ReflectionClass $class) : Builder { $parentClass = $class->name; $builder = $factory ->class($newClassName) ->extend($parentClass) ->implement('Ray\Aop\WeavedInterface'); $builder = ...
Return class statement
entailment
private function addClassDocComment(Class_ $node, \ReflectionClass $class) : Class_ { $docComment = $class->getDocComment(); if ($docComment) { $node->setDocComment(new Doc($docComment)); } return $node; }
Add class doc comment
entailment
private function addSerialisedAnnotationProp(Builder $builder, \ReflectionClass $class) : Builder { $builder->addStmt( $this->factory ->property('methodAnnotations') ->setDefault($this->getMethodAnnotations($class)) ->makePublic() )->addStm...
Add serialised
entailment
public function bind(string $class, array $pointcuts) : BindInterface { $pointcuts = $this->getAnnotationPointcuts($pointcuts); $this->annotatedMethodsMatch(new \ReflectionClass($class), $pointcuts); return $this; }
{@inheritdoc} @throws \ReflectionException
entailment
public function bindInterceptors(string $method, array $interceptors) : BindInterface { $this->bindings[$method] = ! array_key_exists($method, $this->bindings) ? $interceptors : array_merge( $this->bindings[$method], $interceptors ); return $this; }
{@inheritdoc}
entailment
public function toString($salt) : string { unset($salt); return strtr(rtrim(base64_encode(pack('H*', sprintf('%u', crc32(serialize($this->bindings))))), '='), '+/', '-_'); }
{@inheritdoc}
entailment
public function getAnnotationPointcuts(array &$pointcuts) : array { $keyPointcuts = []; foreach ($pointcuts as $key => $pointcut) { if ($pointcut->methodMatcher instanceof AnnotatedMatcher) { $key = $pointcut->methodMatcher->annotation; } $keyPoint...
@param Pointcut[] $pointcuts @return Pointcut[]
entailment
public function isSeleniumServerRunning() { $seleniumServerIsRunning = false; $errorLevel = 0; $errorMessage = ''; $timeout = 1; $socket = @fsockopen( $this->getSeleniumHost(), $this->getSeleniumPort(), $errorLevel, $errorMessa...
Tests if the Selenium RC server is running. @return bool TRUE if the server is reachable by opening a socket, FALSE otherwise
entailment
public function getSeleniumBrowserUrl() { return $this->extensionSettingsService->hasString('selenium_browserurl') ? $this->extensionSettingsService->getAsString('selenium_browserurl') : rtrim(GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), '/'); }
Returns the configured Selenium RC browser starting URL. This functions returns the TYPO3_SITE_URL if no URL is configured. @return string Selenium RC Browser URL, will not be empty
entailment
public function getMethod() : ReflectionMethod { if ($this->object instanceof WeavedInterface) { $class = (new \ReflectionObject($this->object))->getParentClass(); if (! $class instanceof \ReflectionClass) { throw new \LogicException; // @codeCoverageIgnore ...
{@inheritdoc} @throws \ReflectionException
entailment
public function getNamedArguments() : \ArrayObject { $args = $this->getArguments(); $paramas = $this->getMethod()->getParameters(); $namedParams = new \ArrayObject; foreach ($paramas as $param) { $namedParams[$param->getName()] = $args[$param->getPosition()]; } ...
{@inheritdoc} @throws \ReflectionException
entailment
public function proceed() { if ($this->interceptors === [] && \is_callable($this->callable)) { return call_user_func_array($this->callable, (array) $this->arguments); } $interceptor = array_shift($this->interceptors); if ($interceptor instanceof MethodInterceptor) { ...
{@inheritdoc}
entailment
public function matchesClass(\ReflectionClass $class, array $arguments) : bool { $isAnd = true; foreach ($arguments as $matcher) { /* @var $matcher AbstractMatcher */ $isAnd = $isAnd && $matcher->matchesClass($class, $matcher->getArguments()); } return $isAnd...
{@inheritdoc}
entailment
public function matchesMethod(\ReflectionMethod $method, array $arguments) : bool { $isAnd = true; foreach ($arguments as $matcher) { /* @var $matcher AbstractMatcher */ $isAnd = $isAnd && $matcher->matchesMethod($method, $matcher->getArguments()); } return $...
{@inheritdoc}
entailment
public function matchesClass(\ReflectionClass $class, array $arguments) : bool { foreach ($arguments as $matcher) { /* @var $matcher AbstractMatcher */ $isMatch = $matcher->matchesClass($class, $matcher->getArguments()); if ($isMatch === true) { return tru...
{@inheritdoc}
entailment
public function matchesMethod(\ReflectionMethod $method, array $arguments) : bool { foreach ($arguments as $matcher) { /* @var $matcher AbstractMatcher */ $isMatch = $matcher->matchesMethod($method, $matcher->getArguments()); if ($isMatch === true) { retur...
{@inheritdoc}
entailment
protected function get($key) { $this->checkForNonEmptyKey($key); if (!$this->settingsHaveBeenRetrieved) { $this->retrieveSettings(); } if (!isset($this->cachedSettings[$key])) { return null; } return $this->cachedSettings[$key]; }
Returns the value stored for the key $key. @param string $key the key of the value to retrieve, must not be empty @return mixed the value for the given key, will be NULL if there is no value for the given key
entailment
protected function retrieveSettings() { if (isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['phpunit'])) { $this->cachedSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['phpunit']); } else { $this->cachedSettings = []; } $this->setting...
Retrieves the EM configuration for the PHPUnit extension. @return void
entailment
public function getAsArray($key) { $rawValue = $this->get($key); if (!is_array($rawValue)) { $rawValue = []; } return $rawValue; }
Returns the array value stored for the key $key. @param string $key the key of the value to retrieve, must not be empty @return array the value for the given key, will be empty if there is no array value for the given key
entailment
public function matchesClass(\ReflectionClass $class, array $arguments) : bool { list($matcher) = $arguments; /* @var $matcher AbstractMatcher */ return ! $matcher->matchesClass($class, $matcher->getArguments()); }
{@inheritdoc}
entailment
public function matchesMethod(\ReflectionMethod $method, array $arguments) : bool { list($matcher) = $arguments; /* @var $matcher AbstractMatcher */ return ! $matcher->matchesMethod($method, [$arguments]); }
{@inheritdoc}
entailment
public function getGraceTtl() { if (!isset($this->graceTtl)) { $this->graceTtl = self::DEFAULT_GRACE_TTL; } return $this->graceTtl; }
Gets grace period @return int
entailment
public function isSuccess() { $data = $this->getData(); if (!$data) { return false; } if (isset($data['error'])) { return false; } return true; }
isSuccess @return bool
entailment
private function getMethod(\ReflectionMethod $method) { $methodStmt = $this->factory->method($method->name); $params = $method->getParameters(); foreach ($params as $param) { $methodStmt = $this->getMethodStatement($param, $methodStmt); } $returnType = $method->ge...
Return method statement @return \PhpParser\Node\Stmt\ClassMethod
entailment
private function getMethodStatement(\ReflectionParameter $param, Method $methodStmt) : Method { /* @var $paramStmt Param */ $paramStmt = $this->factory->param($param->name); /* @var $param \ReflectionParameter */ $this->setParameterType($param, $paramStmt); $this->setDefault(...
Return parameter reflection
entailment
public function createSurveyFromTemplate($templateId, array $data = []) { return $this->sendRequest( $this->createRequest('POST', 'surveys', [], array_merge($data, [ 'from_template_id' => $templateId ])) ); }
createSurveyFromTemplate - Create a new survey from an existing template @param int $templateId - See template ID to use @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function createSurveyFromExisting($surveyId, array $data = []) { return $this->sendRequest( $this->createRequest('POST', 'surveys', [], array_merge($data, [ 'from_survey_id' => $surveyId ])) ); }
createSurveyFromTemplate - Create a new survey from an existing survey @param int $surveyId - See survey ID to use @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function getSurvey($surveyId, $includePages = false) { if ($includePages) { return $this->sendRequest( $this->createRequest('GET', sprintf('surveys/%d/details', $surveyId)) ); } else { return $this->sendRequest( $this->createRequest('GET', sprintf('surveys/%d', $surveyId)) ); } }
getSurvey - Get information on a survey @param int $surveyId - See survey ID to use @param bool $includePages - Include page details or not @return @see Client::sendRequest
entailment
public function updateSurvey($surveyId, array $data = []) { return $this->sendRequest( $this->createRequest('PATCH', sprintf('surveys/%d', $surveyId), [], $data) ); }
updateSurvey - Updates a survey @param int $surveyId - The survey to update @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function replaceSurvey($surveyId, array $data = []) { return $this->sendRequest( $this->createRequest('PUT', sprintf('surveys/%d', $surveyId), [], $data) ); }
replaceSurvey - Replaces a survey @param int $surveyId - The survey to replace @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function getSurveyPages($surveyId, array $filters = []) { return $this->sendRequest( $this->createRequest('GET', sprintf('surveys/%d/pages', $surveyId), [ 'query' => $filters ]) ); }
getSurveyPages - Gets all pages for a given survey @param int $surveyId - The survey to get the pages from @param array $filters - Available filters: page, per_page @return @see Client::sendRequest
entailment
public function createSurveyPage($surveyId, array $data = []) { return $this->sendRequest( $this->createRequest('POST', sprintf('surveys/%d/pages', $surveyId), [], $data) ); }
createSurveyPage - Creates a new survey page @param int $surveyId - The survey to get the pages from @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function getSurveyPage($surveyId, $pageId) { return $this->sendRequest( $this->createRequest('GET', sprintf('surveys/%d/pages/%d', $surveyId, $pageId)) ); }
getSurveyPage - Get a single survey page @param int $surveyId - The survey to get the page from @param int $pageId - The page to get @return @see Client::sendRequest
entailment
public function updateSurveyPage($surveyId, $pageId, array $data = []) { return $this->sendRequest( $this->createRequest('PATCH', sprintf('surveys/%d/pages/%d', $surveyId, $pageId), [], $data) ); }
updateSurveyPage - Updates a survey page @param int $surveyId - The survey to get the page from @param int $pageId - The page to update @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function replaceSurveyPage($surveyId, $pageId, array $data = []) { return $this->sendRequest( $this->createRequest('PUT', sprintf('surveys/%d/pages/%d', $surveyId, $pageId), [], $data) ); }
replaceSurveyPage - Replaces a survey page @param int $surveyId - The survey to get the page from @param int $pageId - The page to replace @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function deleteSurveyPage($surveyId, $pageId) { return $this->sendRequest( $this->createRequest('DELETE', sprintf('surveys/%d/pages/%d', $surveyId, $pageId)) ); }
deleteSurveyPage - Delete a survey page @param int $surveyId - The survey to get the page from @param int $pageId - The page to delete @return @see Client::sendRequest
entailment
public function getSurveyPageQuestions($surveyId, $pageId, array $filters = []) { return $this->sendRequest( $this->createRequest('GET', sprintf('surveys/%d/pages/%d/questions', $surveyId, $pageId), [ 'query' => $filters ]) ); }
getSurveyPageQuestions - Get questions for a given survey page @param int $surveyId - The survey to get the page from @param int $pageId - The page to get the qeustions from @param array $filters - Available filters: page, per_page @return @see Client::sendRequest
entailment
public function createSurveyPageQuestion($surveyId, $pageId, array $data = []) { return $this->sendRequest( $this->createRequest('POST', sprintf('surveys/%d/pages/%d/questions', $surveyId, $pageId), [], $data) ); }
createSurveyPageQuestion - Create a questions for a given survey page @param int $surveyId - The survey to get the page from @param int $pageId - The page to add the question to @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function getSurveyPageQuestion($surveyId, $pageId, $questionId) { return $this->sendRequest( $this->createRequest('GET', sprintf('surveys/%d/pages/%d/questions/%d', $surveyId, $pageId, $questionId)) ); }
getSurveyPageQuestion - Get a single survey page question @param int $surveyId - The survey to get the page from @param int $pageId - The page the question is on @param int $questionId - The question to get @return @see Client::sendRequest
entailment
public function updateSurveyPageQuestion($surveyId, $pageId, $questionId, array $data = []) { return $this->sendRequest( $this->createRequest('PATCH', sprintf('surveys/%d/pages/%d/questions/%d', $surveyId, $pageId, $questionId), [], $data) ); }
updateSurveyPageQuestion - Update a survey page question @param int $surveyId - The survey to get the page from @param int $pageId - The page the question is on @param int $questionId - The question to update @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function deleteSurveyPageQuestion($surveyId, $pageId, $questionId) { return $this->sendRequest( $this->createRequest('DELETE', sprintf('surveys/%d/pages/%d/questions/%d', $surveyId, $pageId, $questionId)) ); }
deleteSurveyPageQuestion - Delete a survey page question @param int $surveyId - The survey to get the page from @param int $pageId - The page the question is on @param int $questionId - The question to delete @return @see Client::sendRequest
entailment
public function usersGet(array $ids = [], AccessToken $token = null, array $params = []) { if (empty($ids) && !$token) { throw new \InvalidArgumentException('Some of parameters usersIds OR access_token are required'); } $default = [ 'user_ids' => implode(',', $id...
@see https://vk.com/dev/users.get @param integer[] $ids @param AccessToken|null $token Current user if empty @param array $params @return User[]
entailment
public function friendsGet($userId, AccessToken $token = null, array $params = []) { $default = [ 'user_id' => $userId, 'fields' => $this->userFields, 'access_token' => $token ? $token->getToken() : null, 'v' => $this->version, ...
@see https://vk.com/dev/friends.get @param integer $userId @param AccessToken|null $token @param array $params @return User[]
entailment
protected function getEaster($year) { $easter = new \DateTime('now', $this->timezone); $easter->setDate($year, 3, 21); $easter->setTime(0, 0, 0); $easter->modify('+' . \easter_days($year) . 'days'); return $easter; }
Provides a DateTime object that represents easter sunday for this year. The DateTime object is always set to the current default timezone and not UTC and time is set 0:00. @param int $year The year for which to calculate the easter sunday date. @return \DateTime TODO: add timezone calculation
entailment
public function between(\DateTime $start, \DateTime $end) { // Comparing DateTime also looks at the time. So we need to make sure the time is 0, // but don't modify the original referenced DateTime parameters $start = clone $start; $end = clone $end; $start->setTime(0, 0, 0);...
Returns all holidays in the given time period. @param \DateTime $start The start date @param \DateTime $end The end date @return array
entailment
public function newInstance(string $class, array $args, BindInterface $bind) { $compiledClass = $this->compile($class, $bind); $instance = (new ReflectionClass($compiledClass))->newInstanceArgs($args); $instance->bindings = $bind->getBindings(); return $instance; }
{@inheritdoc} @throws \ReflectionException
entailment
public function compile(string $class, BindInterface $bind) : string { if ($this->hasNoBinding($class, $bind)) { return $class; } $newClass = $this->getNewClassName($class, $bind); if (class_exists($newClass)) { return $newClass; } $file = "{$t...
{@inheritdoc} @throws \ReflectionException
entailment
public function analyzeSurveyQuestions($benchmarkBundleId, array $questionids, array $filters = []) { return $this->sendRequest( $this->createRequest('GET', sprintf('benchmark_bundles/%d/analyze', $benchmarkBundleId). [ 'query' => array_merge($filters, [ 'question_ids' => implode(',', $questionIds) ]...
analyzeSurveyQuestions @param int $benchmarkBundleId @param int $questionids @param array $filters - Available filters: percentile_start, percentile_end @return @see Client::sendRequest
entailment
public function getQuestionBenchmarkResult($surveyId, $pageId, $questionId, array $filters = []) { return $this->sendRequest( $this->createRequest('GET', sprintf('surveys/%d/pages/%d/questions/%d/benchmark', $surveyId, $pageId, $questionId), [ 'query' => $filters ]) ); }
getQuestionBenchmarkResult @param int $surveyId @param int $pageId @param int $questionids @param array $filters - Available filters: percentile_start, percentile_end @return @see Client::sendRequest
entailment
public function getToken($code) { $request = new Request('POST', 'token', [], http_build_query([ 'redirect_uri' => $this->getRedirectUri(), 'client_id' => $this->getClientId(), 'client_secret' => $this->getClientSecret(), 'grant_type' => 'authorization_code', 'code' => $code ])); try { ...
getToken @param string $code - Code received from redirect from SurveyMonkey after pointing the user to getAuthorizeUrl() @return array
entailment
private function createRequest($method, $uri, array $options = [], $body = null) { if (empty($body)) { // Empty arrays and NULL data inputs both need casting to an empty JSON object. // See https://stackoverflow.com/a/41150809/2803757 $bodyString = '{}'; } elseif ...
createRequest @param string $method @param string $uri @param array $options Guzzle compatible request options @param array|null $body Request body if applicable, using associative arrays for named properties & numeric arrays for array data types. @return RequestInterface
entailment
public function matchesClass(\ReflectionClass $class, array $arguments) : bool { list($annotation) = $arguments; $annotation = $this->reader->getClassAnnotation($class, $annotation); return $annotation ? true : false; }
{@inheritdoc}
entailment
public function matchesMethod(\ReflectionMethod $method, array $arguments) : bool { list($annotation) = $arguments; $annotation = $this->reader->getMethodAnnotation($method, $annotation); return $annotation ? true : false; }
{@inheritdoc}
entailment
protected function _list_tables($prefix_limit = FALSE) { $sql = 'SELECT "NAME" FROM "SQLITE_MASTER" WHERE "TYPE" = \'table\''; if ($prefix_limit === TRUE && $this->dbprefix !== '') { return $sql.' AND "NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' " .sprintf($this->_like_escape_str, $this->_...
Show table query Generates a platform-specific query string so that the table names can be fetched @param bool $prefix_limit @return string
entailment
public function list_fields($table) { // Is there a cached result? if (isset($this->data_cache['field_names'][$table])) { return $this->data_cache['field_names'][$table]; } if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) { retur...
Fetch Field Names @param string $table Table name @return array
entailment
public function field_data($table) { if (($query = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) { return FALSE; } $query = $query->result_array(); if (empty($query)) { return FALSE; } $retval = array(); for ($i = 0, $c = count($query...
Returns an object with field data @param string $table @return array
entailment
public function db_connect($persistent = FALSE) { $this->options[PDO::ATTR_PERSISTENT] = $persistent; try { return new PDO($this->dsn, $this->username, $this->password, $this->options); } catch (PDOException $e) { if ($this->db_debug && empty($this->failover)) { $this->display_error($e->getMe...
Database connection @param bool $persistent @return object
entailment
public function version() { if (isset($this->data_cache['version'])) { return $this->data_cache['version']; } // Not all subdrivers support the getAttribute() method try { return $this->data_cache['version'] = $this->conn_id->getAttribute(PDO::ATTR_SERVER_VERSION); } catch (PDOException $e) { ...
Database version number @return string
entailment
protected function _escape_str($str) { // Escape the string $str = $this->conn_id->quote($str); // If there are duplicated quotes, trim them away return ($str[0] === "'") ? substr($str, 1, -1) : $str; }
Platform-dependant string escape @param string @return string
entailment
public function error() { $error = array('code' => '00000', 'message' => ''); $pdo_error = $this->conn_id->errorInfo(); if (empty($pdo_error[0])) { return $error; } $error['code'] = isset($pdo_error[1]) ? $pdo_error[0].'/'.$pdo_error[1] : $pdo_error[0]; if (isset($pdo_error[2])) { $error['mess...
Error Returns an array containing code and message of the last database error that has occured. @return array
entailment
protected function _update_batch($table, $values, $index) { $ids = array(); foreach ($values as $key => $val) { $ids[] = $val[$index]; foreach (array_keys($val) as $field) { if ($field !== $index) { $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field]; } } } ...
Update_Batch statement Generates a platform-specific batch update string from the supplied data @param string $table Table name @param array $values Update data @param string $index WHERE key @return string
entailment
protected function _alter_table($alter_type, $table, $field) { if ($alter_type === 'CHANGE') { $alter_type = 'MODIFY'; } return parent::_alter_table($alter_type, $table, $field); }
ALTER TABLE @param string $alter_type ALTER type @param string $table Table name @param mixed $field Column definition @return string|string[]
entailment
public function getHttpClient() { if (!is_object($this->_httpClient)) { $this->_httpClient = new Client([ 'requestConfig' => [ 'options' => [ 'timeout' => 30, ] ], 'responseConfig' => ...
获取Http Client @return Client
entailment
public function getToken($forceRefresh = false) { $cacheKey = [__CLASS__, 'appId' => Yii::$app->wechat->appId]; if ($forceRefresh || ($accessToken = Yii::$app->wechat->cache->get($cacheKey)) === false) { $token = $this->getTokenFromServer(); Yii::$app->wechat->cache->set($cac...
Get token from WeChat API. @param bool $forceRefresh @return string @throws Exception
entailment
public function setToken($token, $expires = 7200) { Yii::$app->wechat->cache->set([__CLASS__, 'appId' => Yii::$app->wechat->appId], $token, $expires - 1500); return $this; }
设置自定义 token. @param string $token @param int $expires @return $this
entailment
public function getTokenFromServer() { $params = ['appid' => Yii::$app->wechat->appId, 'secret' => Yii::$app->wechat->appSecret, 'grant_type' => 'client_credential',]; $response = $this->getHttpClient()->createRequest() ->setUrl(self::API_TOKEN_GET) ->setMethod('GET') ...
从微信服务器获取Token @return array|mixed @throws Exception
entailment
public function add(array $buttons, array $matchRule = []) { if (!empty($matchRule)) { return $this->json(self::API_CONDITIONAL_CREATE, [ 'button' => $buttons, 'matchrule' => $matchRule, ]); } return $this->json(self::API_CREATE,['butt...
添加菜单 @param array $buttons @param array $matchRule @return array @throws \yii\httpclient\Exception
entailment
public function destroy($menuId = null) { if ($menuId !== null) { return $this->json(self::API_CONDITIONAL_DELETE,['menuid' => $menuId]); } return $this->get(self::API_DELETE); }
Destroy menu. @param int $menuId @return array @throws \yii\httpclient\Exception
entailment
protected function _alter_table($alter_type, $table, $field) { if (in_array($alter_type, array('DROP', 'ADD'), TRUE)) { return parent::_alter_table($alter_type, $table, $field); } $sql = 'ALTER TABLE '.$this->db->escape_identifiers($table); $sqls = array(); for ($i = 0, $c = count($field); $i < $c; $i...
ALTER TABLE @param string $alter_type ALTER type @param string $table Table name @param mixed $field Column definition @return string|string[]
entailment
protected function _attr_type(&$attributes) { // Reset field lenghts for data types that don't support it if (isset($attributes['CONSTRAINT']) && stripos($attributes['TYPE'], 'int') !== FALSE) { $attributes['CONSTRAINT'] = NULL; } switch (strtoupper($attributes['TYPE'])) { case 'TINYINT': $attri...
Field attribute TYPE Performs a data type mapping between different databases. @param array &$attributes @return void
entailment
public function db_connect($persistent = FALSE) { $this->conn_id = ($persistent) ? mssql_pconnect($this->hostname, $this->username, $this->password) : mssql_connect($this->hostname, $this->username, $this->password); if ( ! $this->conn_id) { return FALSE; } // -----------------------------------...
Non-persistent database connection @param bool $persistent @return resource
entailment