id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
42,400 | tienvx/mbt-bundle | src/PathReducer/PathReducerManager.php | PathReducerManager.getPathReducer | public function getPathReducer($name): PathReducerInterface
{
if (isset($this->pathReducers[$name])) {
return $this->pathReducers[$name];
}
throw new Exception(sprintf('Path reducer %s does not exist.', $name));
} | php | public function getPathReducer($name): PathReducerInterface
{
if (isset($this->pathReducers[$name])) {
return $this->pathReducers[$name];
}
throw new Exception(sprintf('Path reducer %s does not exist.', $name));
} | [
"public",
"function",
"getPathReducer",
"(",
"$",
"name",
")",
":",
"PathReducerInterface",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"pathReducers",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"pathReducers",
"[",
"$",
"n... | Returns one path reducer by name.
@param $name
@return PathReducerInterface
@throws Exception | [
"Returns",
"one",
"path",
"reducer",
"by",
"name",
"."
] | 45299305732a77a5e4c077b4a33c5fbb64c596ca | https://github.com/tienvx/mbt-bundle/blob/45299305732a77a5e4c077b4a33c5fbb64c596ca/src/PathReducer/PathReducerManager.php#L28-L35 |
42,401 | tienvx/mbt-bundle | src/Generator/GeneratorManager.php | GeneratorManager.getGenerator | public function getGenerator($name): GeneratorInterface
{
if (isset($this->generators[$name])) {
return $this->generators[$name];
}
throw new Exception(sprintf('Generator %s does not exist.', $name));
} | php | public function getGenerator($name): GeneratorInterface
{
if (isset($this->generators[$name])) {
return $this->generators[$name];
}
throw new Exception(sprintf('Generator %s does not exist.', $name));
} | [
"public",
"function",
"getGenerator",
"(",
"$",
"name",
")",
":",
"GeneratorInterface",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"generators",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"generators",
"[",
"$",
"name",
... | Returns one generator by name.
@param $name
@return GeneratorInterface
@throws Exception | [
"Returns",
"one",
"generator",
"by",
"name",
"."
] | 45299305732a77a5e4c077b4a33c5fbb64c596ca | https://github.com/tienvx/mbt-bundle/blob/45299305732a77a5e4c077b4a33c5fbb64c596ca/src/Generator/GeneratorManager.php#L28-L35 |
42,402 | maiorano84/shortcodes | src/Contracts/Traits/ContainerAware.php | ContainerAware.hasShortcode | public function hasShortcode(string $content): bool
{
if (!($this->isBound())) {
throw RegisterException::missing($this->name);
}
return $this->manager->hasShortcode($content, $this->getContext());
} | php | public function hasShortcode(string $content): bool
{
if (!($this->isBound())) {
throw RegisterException::missing($this->name);
}
return $this->manager->hasShortcode($content, $this->getContext());
} | [
"public",
"function",
"hasShortcode",
"(",
"string",
"$",
"content",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"isBound",
"(",
")",
")",
")",
"{",
"throw",
"RegisterException",
"::",
"missing",
"(",
"$",
"this",
"->",
"name",
")"... | Convenience method
Utilizes manager's implementation of hasShortcode
Limits search to this shortcode's context.
@param string $content
@throws RegisterException
@return bool | [
"Convenience",
"method",
"Utilizes",
"manager",
"s",
"implementation",
"of",
"hasShortcode",
"Limits",
"search",
"to",
"this",
"shortcode",
"s",
"context",
"."
] | 806d3e21fcba9def8aa25d8b370bcd7de446cd0a | https://github.com/maiorano84/shortcodes/blob/806d3e21fcba9def8aa25d8b370bcd7de446cd0a/src/Contracts/Traits/ContainerAware.php#L50-L57 |
42,403 | maiorano84/shortcodes | src/Contracts/Traits/ContainerAware.php | ContainerAware.doShortcode | public function doShortcode(string $content, bool $deep = false): string
{
if (!($this->isBound())) {
throw RegisterException::missing($this->name);
}
return $this->manager->doShortcode($content, $this->getContext(), $deep);
} | php | public function doShortcode(string $content, bool $deep = false): string
{
if (!($this->isBound())) {
throw RegisterException::missing($this->name);
}
return $this->manager->doShortcode($content, $this->getContext(), $deep);
} | [
"public",
"function",
"doShortcode",
"(",
"string",
"$",
"content",
",",
"bool",
"$",
"deep",
"=",
"false",
")",
":",
"string",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"isBound",
"(",
")",
")",
")",
"{",
"throw",
"RegisterException",
"::",
"miss... | Convenience method
Utilizes manager's implementation of doShortcode
Limits search to this shortcode's context.
@param string $content
@param bool $deep
@throws RegisterException
@return string | [
"Convenience",
"method",
"Utilizes",
"manager",
"s",
"implementation",
"of",
"doShortcode",
"Limits",
"search",
"to",
"this",
"shortcode",
"s",
"context",
"."
] | 806d3e21fcba9def8aa25d8b370bcd7de446cd0a | https://github.com/maiorano84/shortcodes/blob/806d3e21fcba9def8aa25d8b370bcd7de446cd0a/src/Contracts/Traits/ContainerAware.php#L71-L78 |
42,404 | maiorano84/shortcodes | src/Contracts/Traits/ContainerAware.php | ContainerAware.getContext | private function getContext(): array
{
$context = [$this->name];
if ($this instanceof AliasInterface) {
$context = array_unique(array_merge($context, $this->getAlias()));
}
return $context;
} | php | private function getContext(): array
{
$context = [$this->name];
if ($this instanceof AliasInterface) {
$context = array_unique(array_merge($context, $this->getAlias()));
}
return $context;
} | [
"private",
"function",
"getContext",
"(",
")",
":",
"array",
"{",
"$",
"context",
"=",
"[",
"$",
"this",
"->",
"name",
"]",
";",
"if",
"(",
"$",
"this",
"instanceof",
"AliasInterface",
")",
"{",
"$",
"context",
"=",
"array_unique",
"(",
"array_merge",
... | Utility method.
@return array | [
"Utility",
"method",
"."
] | 806d3e21fcba9def8aa25d8b370bcd7de446cd0a | https://github.com/maiorano84/shortcodes/blob/806d3e21fcba9def8aa25d8b370bcd7de446cd0a/src/Contracts/Traits/ContainerAware.php#L93-L101 |
42,405 | gigablah/silex-oauth | src/EventListener/UserProviderListener.php | UserProviderListener.onGetUser | public function onGetUser(GetUserForTokenEvent $event)
{
$userProvider = $event->getUserProvider();
if (!$userProvider instanceof OAuthUserProviderInterface) {
return;
}
$token = $event->getToken();
if ($user = $userProvider->loadUserByOAuthCredentials($token)) {
$token->setUser($user);
}
} | php | public function onGetUser(GetUserForTokenEvent $event)
{
$userProvider = $event->getUserProvider();
if (!$userProvider instanceof OAuthUserProviderInterface) {
return;
}
$token = $event->getToken();
if ($user = $userProvider->loadUserByOAuthCredentials($token)) {
$token->setUser($user);
}
} | [
"public",
"function",
"onGetUser",
"(",
"GetUserForTokenEvent",
"$",
"event",
")",
"{",
"$",
"userProvider",
"=",
"$",
"event",
"->",
"getUserProvider",
"(",
")",
";",
"if",
"(",
"!",
"$",
"userProvider",
"instanceof",
"OAuthUserProviderInterface",
")",
"{",
"... | Populate the security token with a user from the local database.
@param GetUserForTokenEvent $event | [
"Populate",
"the",
"security",
"token",
"with",
"a",
"user",
"from",
"the",
"local",
"database",
"."
] | 29beb1ed60110cd6838b606277037d53980ba25e | https://github.com/gigablah/silex-oauth/blob/29beb1ed60110cd6838b606277037d53980ba25e/src/EventListener/UserProviderListener.php#L22-L35 |
42,406 | gigablah/silex-oauth | src/OAuthServiceRegistry.php | OAuthServiceRegistry.getService | public function getService($service)
{
$service = $this->mapServiceName($service);
if (isset($this->services[$service])) {
return $this->services[$service];
}
return $this->services[$service] = $this->createService($service);
} | php | public function getService($service)
{
$service = $this->mapServiceName($service);
if (isset($this->services[$service])) {
return $this->services[$service];
}
return $this->services[$service] = $this->createService($service);
} | [
"public",
"function",
"getService",
"(",
"$",
"service",
")",
"{",
"$",
"service",
"=",
"$",
"this",
"->",
"mapServiceName",
"(",
"$",
"service",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"services",
"[",
"$",
"service",
"]",
")",
")",
... | Retrieve a service by name.
@param string $service
@return ServiceInterface | [
"Retrieve",
"a",
"service",
"by",
"name",
"."
] | 29beb1ed60110cd6838b606277037d53980ba25e | https://github.com/gigablah/silex-oauth/blob/29beb1ed60110cd6838b606277037d53980ba25e/src/OAuthServiceRegistry.php#L55-L64 |
42,407 | gigablah/silex-oauth | src/OAuthServiceRegistry.php | OAuthServiceRegistry.getServiceName | public static function getServiceName(ServiceInterface $oauthService)
{
if ($oauthService instanceof AbstractService) {
return $oauthService->service();
}
return preg_replace('/^.*\\\\/', '', get_class($oauthService));
} | php | public static function getServiceName(ServiceInterface $oauthService)
{
if ($oauthService instanceof AbstractService) {
return $oauthService->service();
}
return preg_replace('/^.*\\\\/', '', get_class($oauthService));
} | [
"public",
"static",
"function",
"getServiceName",
"(",
"ServiceInterface",
"$",
"oauthService",
")",
"{",
"if",
"(",
"$",
"oauthService",
"instanceof",
"AbstractService",
")",
"{",
"return",
"$",
"oauthService",
"->",
"service",
"(",
")",
";",
"}",
"return",
"... | Retrieve the name from a service instance.
@param ServiceInterface $oauthService
@return string | [
"Retrieve",
"the",
"name",
"from",
"a",
"service",
"instance",
"."
] | 29beb1ed60110cd6838b606277037d53980ba25e | https://github.com/gigablah/silex-oauth/blob/29beb1ed60110cd6838b606277037d53980ba25e/src/OAuthServiceRegistry.php#L85-L92 |
42,408 | gigablah/silex-oauth | src/OAuthServiceRegistry.php | OAuthServiceRegistry.createService | protected function createService($service)
{
if (!isset($this->config[$service])) {
throw new \InvalidArgumentException(sprintf('OAuth configuration not defined for the "%s" service.', $service));
}
$referenceType = true;
$urlGeneratorInterface = 'Symfony\Component\Routing\Generator\UrlGeneratorInterface';
if (defined(sprintf('%s::ABSOLUTE_URL', $urlGeneratorInterface))) {
$referenceType = $urlGeneratorInterface::ABSOLUTE_URL;
}
$credentials = new Credentials(
$this->config[$service]['key'],
$this->config[$service]['secret'],
$this->urlGenerator->generate($this->options['callback_route'], array(
'service' => strtolower($service)
), $referenceType)
);
$scope = isset($this->config[$service]['scope']) ? $this->config[$service]['scope'] : array();
$uri = isset($this->config[$service]['uri']) ? new Uri($this->config[$service]['uri']) : null;
if (isset($this->config[$service]['class'])) {
$this->oauthServiceFactory->registerService($service, $this->config[$service]['class']);
unset($this->config[$service]['class']);
}
return $this->oauthServiceFactory->createService(
$service,
$credentials,
$this->oauthStorage,
$scope,
$uri
);
} | php | protected function createService($service)
{
if (!isset($this->config[$service])) {
throw new \InvalidArgumentException(sprintf('OAuth configuration not defined for the "%s" service.', $service));
}
$referenceType = true;
$urlGeneratorInterface = 'Symfony\Component\Routing\Generator\UrlGeneratorInterface';
if (defined(sprintf('%s::ABSOLUTE_URL', $urlGeneratorInterface))) {
$referenceType = $urlGeneratorInterface::ABSOLUTE_URL;
}
$credentials = new Credentials(
$this->config[$service]['key'],
$this->config[$service]['secret'],
$this->urlGenerator->generate($this->options['callback_route'], array(
'service' => strtolower($service)
), $referenceType)
);
$scope = isset($this->config[$service]['scope']) ? $this->config[$service]['scope'] : array();
$uri = isset($this->config[$service]['uri']) ? new Uri($this->config[$service]['uri']) : null;
if (isset($this->config[$service]['class'])) {
$this->oauthServiceFactory->registerService($service, $this->config[$service]['class']);
unset($this->config[$service]['class']);
}
return $this->oauthServiceFactory->createService(
$service,
$credentials,
$this->oauthStorage,
$scope,
$uri
);
} | [
"protected",
"function",
"createService",
"(",
"$",
"service",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"config",
"[",
"$",
"service",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'OAuth co... | Instantiate a service by name.
@param string $service
@return ServiceInterface | [
"Instantiate",
"a",
"service",
"by",
"name",
"."
] | 29beb1ed60110cd6838b606277037d53980ba25e | https://github.com/gigablah/silex-oauth/blob/29beb1ed60110cd6838b606277037d53980ba25e/src/OAuthServiceRegistry.php#L101-L135 |
42,409 | gigablah/silex-oauth | src/EventListener/UserInfoListener.php | UserInfoListener.onFilterToken | public function onFilterToken(FilterTokenEvent $event)
{
$token = $event->getToken();
$service = $token->getService();
$oauthService = $this->registry->getService($service);
$config = $this->config[$service];
$serviceName = OAuthServiceRegistry::getServiceName($oauthService);
$accessToken = $oauthService->getStorage()->retrieveAccessToken($serviceName);
$token->setAccessToken($accessToken);
$callback = isset($config['user_callback']) && is_callable($config['user_callback']) ? $config['user_callback'] : array($this, 'defaultUserCallback');
if (isset($config['user_endpoint'])) {
$rawUserInfo = json_decode($oauthService->request($config['user_endpoint']), true);
}
call_user_func($callback, $token, $rawUserInfo, $oauthService);
} | php | public function onFilterToken(FilterTokenEvent $event)
{
$token = $event->getToken();
$service = $token->getService();
$oauthService = $this->registry->getService($service);
$config = $this->config[$service];
$serviceName = OAuthServiceRegistry::getServiceName($oauthService);
$accessToken = $oauthService->getStorage()->retrieveAccessToken($serviceName);
$token->setAccessToken($accessToken);
$callback = isset($config['user_callback']) && is_callable($config['user_callback']) ? $config['user_callback'] : array($this, 'defaultUserCallback');
if (isset($config['user_endpoint'])) {
$rawUserInfo = json_decode($oauthService->request($config['user_endpoint']), true);
}
call_user_func($callback, $token, $rawUserInfo, $oauthService);
} | [
"public",
"function",
"onFilterToken",
"(",
"FilterTokenEvent",
"$",
"event",
")",
"{",
"$",
"token",
"=",
"$",
"event",
"->",
"getToken",
"(",
")",
";",
"$",
"service",
"=",
"$",
"token",
"->",
"getService",
"(",
")",
";",
"$",
"oauthService",
"=",
"$... | When the security token is created, populate it with user information from the service API.
@param FilterTokenEvent $event | [
"When",
"the",
"security",
"token",
"is",
"created",
"populate",
"it",
"with",
"user",
"information",
"from",
"the",
"service",
"API",
"."
] | 29beb1ed60110cd6838b606277037d53980ba25e | https://github.com/gigablah/silex-oauth/blob/29beb1ed60110cd6838b606277037d53980ba25e/src/EventListener/UserInfoListener.php#L37-L54 |
42,410 | imbo/imboclient-php | src/ImboClient/Query.php | Query.page | public function page($page = null) {
if ($page === null) {
return $this->page;
}
$this->page = (int) $page;
return $this;
} | php | public function page($page = null) {
if ($page === null) {
return $this->page;
}
$this->page = (int) $page;
return $this;
} | [
"public",
"function",
"page",
"(",
"$",
"page",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"page",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"page",
";",
"}",
"$",
"this",
"->",
"page",
"=",
"(",
"int",
")",
"$",
"page",
";",
"return",
... | Set or get the page property
@param int $page Give this a value to set the page property
@return int|self | [
"Set",
"or",
"get",
"the",
"page",
"property"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Query.php#L40-L48 |
42,411 | imbo/imboclient-php | src/ImboClient/EventSubscriber/Authenticate.php | Authenticate.signRequest | public function signRequest(Event $event) {
$command = $event['command'];
switch ($command->getName()) {
case 'AddImage':
case 'DeleteImage':
case 'ReplaceMetadata':
case 'EditMetadata':
case 'DeleteMetadata':
case 'GenerateShortUrl':
case 'EditResourceGroup':
case 'DeleteResourceGroup':
case 'EditPublicKey':
case 'DeletePublicKey':
case 'AddAccessControlRules':
case 'DeleteAccessControlRule':
// Add the auth headers
$this->addAuthenticationHeaders($command->getRequest());
break;
}
} | php | public function signRequest(Event $event) {
$command = $event['command'];
switch ($command->getName()) {
case 'AddImage':
case 'DeleteImage':
case 'ReplaceMetadata':
case 'EditMetadata':
case 'DeleteMetadata':
case 'GenerateShortUrl':
case 'EditResourceGroup':
case 'DeleteResourceGroup':
case 'EditPublicKey':
case 'DeletePublicKey':
case 'AddAccessControlRules':
case 'DeleteAccessControlRule':
// Add the auth headers
$this->addAuthenticationHeaders($command->getRequest());
break;
}
} | [
"public",
"function",
"signRequest",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"command",
"=",
"$",
"event",
"[",
"'command'",
"]",
";",
"switch",
"(",
"$",
"command",
"->",
"getName",
"(",
")",
")",
"{",
"case",
"'AddImage'",
":",
"case",
"'DeleteIma... | Sign the request by adding some special request headers
@param Event $event The current event | [
"Sign",
"the",
"request",
"by",
"adding",
"some",
"special",
"request",
"headers"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/EventSubscriber/Authenticate.php#L42-L62 |
42,412 | imbo/imboclient-php | src/ImboClient/EventSubscriber/Authenticate.php | Authenticate.addAuthenticationHeaders | private function addAuthenticationHeaders(Request $request) {
$client = $request->getClient();
// Get a GMT/UTC timestamp
$timestamp = gmdate('Y-m-d\TH:i:s\Z');
// Build the data to base the hash on
$data = $request->getMethod() . '|' .
$request->getUrl() . '|' .
$client->getConfig('publicKey') . '|' .
$timestamp;
// Generate signature
$signature = hash_hmac('sha256', $data, $client->getConfig('privateKey'));
// Add relevant request headers (overwriting once that might already exist)
$request->setHeader('X-Imbo-Authenticate-Signature', $signature);
$request->setHeader('X-Imbo-Authenticate-Timestamp', $timestamp);
} | php | private function addAuthenticationHeaders(Request $request) {
$client = $request->getClient();
// Get a GMT/UTC timestamp
$timestamp = gmdate('Y-m-d\TH:i:s\Z');
// Build the data to base the hash on
$data = $request->getMethod() . '|' .
$request->getUrl() . '|' .
$client->getConfig('publicKey') . '|' .
$timestamp;
// Generate signature
$signature = hash_hmac('sha256', $data, $client->getConfig('privateKey'));
// Add relevant request headers (overwriting once that might already exist)
$request->setHeader('X-Imbo-Authenticate-Signature', $signature);
$request->setHeader('X-Imbo-Authenticate-Timestamp', $timestamp);
} | [
"private",
"function",
"addAuthenticationHeaders",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"client",
"=",
"$",
"request",
"->",
"getClient",
"(",
")",
";",
"// Get a GMT/UTC timestamp",
"$",
"timestamp",
"=",
"gmdate",
"(",
"'Y-m-d\\TH:i:s\\Z'",
")",
";",... | Sign the current request for write operations
@param Request $request The current request | [
"Sign",
"the",
"current",
"request",
"for",
"write",
"operations"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/EventSubscriber/Authenticate.php#L69-L87 |
42,413 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.blur | public function blur(array $params) {
$mode = isset($params['mode']) ? $params['mode'] : null;
$required = array('radius', 'sigma');
if ($mode === 'motion') {
$required[] = 'angle';
} else if ($mode === 'radial') {
$required = array('angle');
}
$transformation = $mode ? array('mode=' . $mode) : array();
foreach ($required as $param) {
if (!isset($params[$param])) {
throw new InvalidArgumentException('`' . $param . '` must be specified');
}
$transformation[] = $param . '=' . $params[$param];
}
return $this->addTransformation(sprintf('blur:%s', implode(',', $transformation)));
} | php | public function blur(array $params) {
$mode = isset($params['mode']) ? $params['mode'] : null;
$required = array('radius', 'sigma');
if ($mode === 'motion') {
$required[] = 'angle';
} else if ($mode === 'radial') {
$required = array('angle');
}
$transformation = $mode ? array('mode=' . $mode) : array();
foreach ($required as $param) {
if (!isset($params[$param])) {
throw new InvalidArgumentException('`' . $param . '` must be specified');
}
$transformation[] = $param . '=' . $params[$param];
}
return $this->addTransformation(sprintf('blur:%s', implode(',', $transformation)));
} | [
"public",
"function",
"blur",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"mode",
"=",
"isset",
"(",
"$",
"params",
"[",
"'mode'",
"]",
")",
"?",
"$",
"params",
"[",
"'mode'",
"]",
":",
"null",
";",
"$",
"required",
"=",
"array",
"(",
"'radius'",
... | Add a blur transformation
Parameters:
`mode` - `gaussian`, `adaptive`, `motion` or `radial`. Default: `guassian`
`radius` - Radius of the gaussian, in pixels, not counting the center pixel.
Required for `gaussian`, `adaptive` and `motion`-modes
`sigma` - The standard deviation of the gaussian, in pixels.
Required for `gaussian`, `adaptive` and `motion`-modes
`angle` - Angle of the radial blur. Only used in `radial`-mode.
@param array $params Array of parameters
@return self | [
"Add",
"a",
"blur",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L112-L133 |
42,414 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.border | public function border($color = '000000', $width = 1, $height = 1, $mode = 'outbound') {
return $this->addTransformation(
sprintf('border:color=%s,width=%d,height=%d,mode=%s', $color, (int) $width, (int) $height, $mode)
);
} | php | public function border($color = '000000', $width = 1, $height = 1, $mode = 'outbound') {
return $this->addTransformation(
sprintf('border:color=%s,width=%d,height=%d,mode=%s', $color, (int) $width, (int) $height, $mode)
);
} | [
"public",
"function",
"border",
"(",
"$",
"color",
"=",
"'000000'",
",",
"$",
"width",
"=",
"1",
",",
"$",
"height",
"=",
"1",
",",
"$",
"mode",
"=",
"'outbound'",
")",
"{",
"return",
"$",
"this",
"->",
"addTransformation",
"(",
"sprintf",
"(",
"'bor... | Add a border transformation
@param string $color Color of the border
@param int $width Width of the left and right sides of the border
@param int $height Height of the top and bottom sides of the border
@param string $mode The mode of the border, "inline" or "outbound"
@return self | [
"Add",
"a",
"border",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L144-L148 |
42,415 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.canvas | public function canvas($width, $height, $mode = null, $x = null, $y = null, $bg = null) {
if (!$width || !$height) {
throw new InvalidArgumentException('width and height must be specified');
}
$params = array(
'width=' . (int) $width,
'height=' . (int) $height,
);
if ($mode) {
$params[] = 'mode=' . $mode;
}
if ($x) {
$params[] = 'x=' . (int) $x;
}
if ($y) {
$params[] = 'y=' . (int) $y;
}
if ($bg) {
$params[] = 'bg=' . $bg;
}
return $this->addTransformation(sprintf('canvas:%s', implode(',', $params)));
} | php | public function canvas($width, $height, $mode = null, $x = null, $y = null, $bg = null) {
if (!$width || !$height) {
throw new InvalidArgumentException('width and height must be specified');
}
$params = array(
'width=' . (int) $width,
'height=' . (int) $height,
);
if ($mode) {
$params[] = 'mode=' . $mode;
}
if ($x) {
$params[] = 'x=' . (int) $x;
}
if ($y) {
$params[] = 'y=' . (int) $y;
}
if ($bg) {
$params[] = 'bg=' . $bg;
}
return $this->addTransformation(sprintf('canvas:%s', implode(',', $params)));
} | [
"public",
"function",
"canvas",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"mode",
"=",
"null",
",",
"$",
"x",
"=",
"null",
",",
"$",
"y",
"=",
"null",
",",
"$",
"bg",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"width",
"||",
"!",
"$... | Add a canvas transformation
@param int $width Width of the canvas
@param int $height Height of the canvas
@param string $mode The placement mode, "free", "center", "center-x" or "center-y"
@param int $x X coordinate of the placement of the upper left corner of the existing image
@param int $y Y coordinate of the placement of the upper left corner of the existing image
@param string $bg Background color of the canvas
@return self
@throws InvalidArgumentException | [
"Add",
"a",
"canvas",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L162-L189 |
42,416 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.contrast | public function contrast($alpha = null, $beta = null) {
$params = array();
if ($alpha !== null) {
$params[] = 'alpha=' . (float) $alpha;
}
if ($beta !== null) {
$params[] = 'beta=' . (float) min(1, max(0, $beta));
}
return $this->addTransformation(
'contrast' . ($params ? ':' . implode(',', $params) : '')
);
} | php | public function contrast($alpha = null, $beta = null) {
$params = array();
if ($alpha !== null) {
$params[] = 'alpha=' . (float) $alpha;
}
if ($beta !== null) {
$params[] = 'beta=' . (float) min(1, max(0, $beta));
}
return $this->addTransformation(
'contrast' . ($params ? ':' . implode(',', $params) : '')
);
} | [
"public",
"function",
"contrast",
"(",
"$",
"alpha",
"=",
"null",
",",
"$",
"beta",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"alpha",
"!==",
"null",
")",
"{",
"$",
"params",
"[",
"]",
"=",
"'alpha='",
"... | Add a contrast transformation
@param float $alpha Adjusts intensity differences between lighter and darker elements
@param float $beta Where the midpoint of the gradient will be. Range: 0 to 1
@return self | [
"Add",
"a",
"contrast",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L208-L222 |
42,417 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.crop | public function crop($x = null, $y = null, $width = null, $height = null, $mode = null) {
if ($mode === null && ($x === null || $y === null)) {
throw new InvalidArgumentException('x and y needs to be specified without a crop mode');
}
if ($mode === 'center-x' && $y === null) {
throw new InvalidArgumentException('y needs to be specified when mode is center-x');
}
if ($mode === 'center-y' && $x === null) {
throw new InvalidArgumentException('x needs to be specified when mode is center-y');
}
if ($width === null || $height === null) {
throw new InvalidArgumentException('width and height needs to be specified');
}
$params = array(
'width=' . (int) $width,
'height=' . (int) $height,
);
if ($x) {
$params[] = 'x=' . (int) $x;
}
if ($y) {
$params[] = 'y=' . (int) $y;
}
if ($mode) {
$params[] = 'mode=' . $mode;
}
return $this->addTransformation('crop:' . implode(',', $params));
} | php | public function crop($x = null, $y = null, $width = null, $height = null, $mode = null) {
if ($mode === null && ($x === null || $y === null)) {
throw new InvalidArgumentException('x and y needs to be specified without a crop mode');
}
if ($mode === 'center-x' && $y === null) {
throw new InvalidArgumentException('y needs to be specified when mode is center-x');
}
if ($mode === 'center-y' && $x === null) {
throw new InvalidArgumentException('x needs to be specified when mode is center-y');
}
if ($width === null || $height === null) {
throw new InvalidArgumentException('width and height needs to be specified');
}
$params = array(
'width=' . (int) $width,
'height=' . (int) $height,
);
if ($x) {
$params[] = 'x=' . (int) $x;
}
if ($y) {
$params[] = 'y=' . (int) $y;
}
if ($mode) {
$params[] = 'mode=' . $mode;
}
return $this->addTransformation('crop:' . implode(',', $params));
} | [
"public",
"function",
"crop",
"(",
"$",
"x",
"=",
"null",
",",
"$",
"y",
"=",
"null",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
",",
"$",
"mode",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"mode",
"===",
"null",
"&&",
"(",
... | Add a crop transformation
@param int $x X coordinate of the top left corner of the crop
@param int $y Y coordinate of the top left corner of the crop
@param int $width Width of the crop
@param int $height Height of the crop
@param string $mode The crop mode. Available in Imbo >= 1.1.0.
@return self
@throws InvalidArgumentException | [
"Add",
"a",
"crop",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L265-L300 |
42,418 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.histogram | public function histogram($scale = null, $ratio = null, $red = null, $green = null, $blue = null) {
$params = array();
if ($scale) {
$params[] = 'scale=' . (int) $scale;
}
if ($ratio) {
$params[] = 'ratio=' . (float) $ratio;
}
if ($red) {
$params[] = 'red=' . $red;
}
if ($green) {
$params[] = 'green=' . $green;
}
if ($blue) {
$params[] = 'blue=' . $blue;
}
return $this->addTransformation('histogram' . ($params ? ':' . implode(',', $params) : ''));
} | php | public function histogram($scale = null, $ratio = null, $red = null, $green = null, $blue = null) {
$params = array();
if ($scale) {
$params[] = 'scale=' . (int) $scale;
}
if ($ratio) {
$params[] = 'ratio=' . (float) $ratio;
}
if ($red) {
$params[] = 'red=' . $red;
}
if ($green) {
$params[] = 'green=' . $green;
}
if ($blue) {
$params[] = 'blue=' . $blue;
}
return $this->addTransformation('histogram' . ($params ? ':' . implode(',', $params) : ''));
} | [
"public",
"function",
"histogram",
"(",
"$",
"scale",
"=",
"null",
",",
"$",
"ratio",
"=",
"null",
",",
"$",
"red",
"=",
"null",
",",
"$",
"green",
"=",
"null",
",",
"$",
"blue",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";"... | Add a histogram transformation
@param int $scale The amount to scale the histogram
@param float $ratio The ratio to use when calculating the height of the image
@param string $red The color to use when drawing the graph for the red channel
@param string $green The color to use when drawing the graph for the green channel
@param string $blue The color to use when drawing the graph for the blue channel
@return self | [
"Add",
"a",
"histogram",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L368-L392 |
42,419 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.level | public function level($amount = 1, $channel = null) {
$params = array('amount=' . $amount);
if ($channel) {
$params[] = 'channel=' . $channel;
}
return $this->addTransformation('level:' . implode(',', $params));
} | php | public function level($amount = 1, $channel = null) {
$params = array('amount=' . $amount);
if ($channel) {
$params[] = 'channel=' . $channel;
}
return $this->addTransformation('level:' . implode(',', $params));
} | [
"public",
"function",
"level",
"(",
"$",
"amount",
"=",
"1",
",",
"$",
"channel",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'amount='",
".",
"$",
"amount",
")",
";",
"if",
"(",
"$",
"channel",
")",
"{",
"$",
"params",
"[",
"]",
... | Add a level transformation to the image, adjusting the levels of an image
@param int $amount Amount to adjust, on a scale from -100 to 100
@param string $channel Optional channel to adjust. Possible values:
r, g, b, c, m, y, k - can be combined to adjust multiple.
@return self | [
"Add",
"a",
"level",
"transformation",
"to",
"the",
"image",
"adjusting",
"the",
"levels",
"of",
"an",
"image"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L402-L410 |
42,420 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.maxSize | public function maxSize($maxWidth = null, $maxHeight = null) {
$params = array();
if ($maxWidth) {
$params[] = 'width=' . (int) $maxWidth;
}
if ($maxHeight) {
$params[] = 'height=' . (int) $maxHeight;
}
if (!$params) {
throw new InvalidArgumentException('width and/or height must be specified');
}
return $this->addTransformation(sprintf('maxSize:%s', implode(',', $params)));
} | php | public function maxSize($maxWidth = null, $maxHeight = null) {
$params = array();
if ($maxWidth) {
$params[] = 'width=' . (int) $maxWidth;
}
if ($maxHeight) {
$params[] = 'height=' . (int) $maxHeight;
}
if (!$params) {
throw new InvalidArgumentException('width and/or height must be specified');
}
return $this->addTransformation(sprintf('maxSize:%s', implode(',', $params)));
} | [
"public",
"function",
"maxSize",
"(",
"$",
"maxWidth",
"=",
"null",
",",
"$",
"maxHeight",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"maxWidth",
")",
"{",
"$",
"params",
"[",
"]",
"=",
"'width='",
".",
"("... | Add a maxSize transformation
@param int $maxWidth Max width of the resized image
@param int $maxHeight Max height of the resized image
@return self
@throws InvalidArgumentException | [
"Add",
"a",
"maxSize",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L420-L436 |
42,421 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.modulate | public function modulate($brightness = null, $saturation = null, $hue = null) {
$params = array();
if ($brightness) {
$params[] = 'b=' . (int) $brightness;
}
if ($saturation) {
$params[] = 's=' . (int) $saturation;
}
if ($hue) {
$params[] = 'h=' . (int) $hue;
}
if (!$params) {
throw new InvalidArgumentException('brightness, saturation and/or hue must be specified');
}
return $this->addTransformation(sprintf('modulate:%s', implode(',', $params)));
} | php | public function modulate($brightness = null, $saturation = null, $hue = null) {
$params = array();
if ($brightness) {
$params[] = 'b=' . (int) $brightness;
}
if ($saturation) {
$params[] = 's=' . (int) $saturation;
}
if ($hue) {
$params[] = 'h=' . (int) $hue;
}
if (!$params) {
throw new InvalidArgumentException('brightness, saturation and/or hue must be specified');
}
return $this->addTransformation(sprintf('modulate:%s', implode(',', $params)));
} | [
"public",
"function",
"modulate",
"(",
"$",
"brightness",
"=",
"null",
",",
"$",
"saturation",
"=",
"null",
",",
"$",
"hue",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"brightness",
")",
"{",
"$",
"params",
... | Add a modulate transformation
@param int $brightness Brightness of the image in percent
@param int $saturation Saturation of the image in percent
@param int $hue Hue percentage
@return self
@throws InvalidArgumentException | [
"Add",
"a",
"modulate",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L447-L467 |
42,422 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.resize | public function resize($width = null, $height = null) {
$params = array();
if ($width) {
$params[] = 'width=' . (int) $width;
}
if ($height) {
$params[] = 'height=' . (int) $height;
}
if (!$params) {
throw new InvalidArgumentException('width and/or height must be specified');
}
return $this->addTransformation(sprintf('resize:%s', implode(',', $params)));
} | php | public function resize($width = null, $height = null) {
$params = array();
if ($width) {
$params[] = 'width=' . (int) $width;
}
if ($height) {
$params[] = 'height=' . (int) $height;
}
if (!$params) {
throw new InvalidArgumentException('width and/or height must be specified');
}
return $this->addTransformation(sprintf('resize:%s', implode(',', $params)));
} | [
"public",
"function",
"resize",
"(",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"width",
")",
"{",
"$",
"params",
"[",
"]",
"=",
"'width='",
".",
"(",
"int",... | Add a resize transformation
@param int $width Width of the resized image
@param int $height Height of the resized image
@return self
@throws InvalidArgumentException | [
"Add",
"a",
"resize",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L486-L502 |
42,423 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.rotate | public function rotate($angle, $bg = '000000') {
if (!$angle) {
throw new InvalidArgumentException('angle must be specified');
}
return $this->addTransformation(sprintf('rotate:angle=%d,bg=%s', (int) $angle, $bg));
} | php | public function rotate($angle, $bg = '000000') {
if (!$angle) {
throw new InvalidArgumentException('angle must be specified');
}
return $this->addTransformation(sprintf('rotate:angle=%d,bg=%s', (int) $angle, $bg));
} | [
"public",
"function",
"rotate",
"(",
"$",
"angle",
",",
"$",
"bg",
"=",
"'000000'",
")",
"{",
"if",
"(",
"!",
"$",
"angle",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'angle must be specified'",
")",
";",
"}",
"return",
"$",
"this",
"->"... | Add a rotate transformation
@param float $angle The angle to rotate
@param string $bg Background color of the rotated image
@return self
@throws InvalidArgumentException | [
"Add",
"a",
"rotate",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L512-L518 |
42,424 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.sharpen | public function sharpen(array $params = null) {
$options = array('preset', 'radius', 'sigma', 'threshold', 'gain');
$transformation = array();
foreach ($options as $param) {
if (!isset($params[$param])) {
continue;
}
$transformation[] = $param . '=' . $params[$param];
}
return $this->addTransformation(
'sharpen' . ($transformation ? ':' . implode(',', $transformation) : '')
);
} | php | public function sharpen(array $params = null) {
$options = array('preset', 'radius', 'sigma', 'threshold', 'gain');
$transformation = array();
foreach ($options as $param) {
if (!isset($params[$param])) {
continue;
}
$transformation[] = $param . '=' . $params[$param];
}
return $this->addTransformation(
'sharpen' . ($transformation ? ':' . implode(',', $transformation) : '')
);
} | [
"public",
"function",
"sharpen",
"(",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"'preset'",
",",
"'radius'",
",",
"'sigma'",
",",
"'threshold'",
",",
"'gain'",
")",
";",
"$",
"transformation",
"=",
"array",
"(",
... | Add a sharpen transformation
Parameters:
`preset` - `light`, `moderate`, `strong`, `extreme`.
`radius` - Radius of the gaussian, in pixels
`sigma` - Standard deviation of the gaussian, in pixels
`threshold` - The threshold in pixels needed to apply the difference gain
`gain` - Percentage of difference between original and the blur image
that is added back into the original
@param array $params Parameters for the transformation
@return self | [
"Add",
"a",
"sharpen",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L544-L559 |
42,425 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.smartSize | public function smartSize($width, $height, $crop = null, $poi = null) {
if (!$width || !$height) {
throw new InvalidArgumentException('width and height must be specified');
}
$params = array(
'width=' . (int) $width,
'height=' . (int) $height,
);
if ($crop) {
$params[] = 'crop=' . $crop;
}
if ($poi) {
$params[] = 'poi=' . $poi;
}
return $this->addTransformation(sprintf('smartSize:%s', implode(',', $params)));
} | php | public function smartSize($width, $height, $crop = null, $poi = null) {
if (!$width || !$height) {
throw new InvalidArgumentException('width and height must be specified');
}
$params = array(
'width=' . (int) $width,
'height=' . (int) $height,
);
if ($crop) {
$params[] = 'crop=' . $crop;
}
if ($poi) {
$params[] = 'poi=' . $poi;
}
return $this->addTransformation(sprintf('smartSize:%s', implode(',', $params)));
} | [
"public",
"function",
"smartSize",
"(",
"$",
"width",
",",
"$",
"height",
",",
"$",
"crop",
"=",
"null",
",",
"$",
"poi",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"width",
"||",
"!",
"$",
"height",
")",
"{",
"throw",
"new",
"InvalidArgumentExcep... | Add a smartSize transformation
@param int $width Width of the resized image
@param int $height Height of the resized image
@param string $crop Closeness of crop (`close`, `medium` or `wide`). Optional.
@param string $poi POI-coordinate to crop around (as `x,y`).
Optional if POI-metadata exists for the image.
@return self | [
"Add",
"a",
"smartSize",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L571-L590 |
42,426 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.thumbnail | public function thumbnail($width = 50, $height = 50, $fit = 'outbound') {
return $this->addTransformation(
sprintf('thumbnail:width=%d,height=%s,fit=%s', (int) $width, (int) $height, $fit)
);
} | php | public function thumbnail($width = 50, $height = 50, $fit = 'outbound') {
return $this->addTransformation(
sprintf('thumbnail:width=%d,height=%s,fit=%s', (int) $width, (int) $height, $fit)
);
} | [
"public",
"function",
"thumbnail",
"(",
"$",
"width",
"=",
"50",
",",
"$",
"height",
"=",
"50",
",",
"$",
"fit",
"=",
"'outbound'",
")",
"{",
"return",
"$",
"this",
"->",
"addTransformation",
"(",
"sprintf",
"(",
"'thumbnail:width=%d,height=%s,fit=%s'",
",",... | Add a thumbnail transformation
@param int $width Width of the thumbnail
@param int $height Height of the thumbnail
@param string $fit Fit type. 'outbound' or 'inset'
@return self | [
"Add",
"a",
"thumbnail",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L609-L613 |
42,427 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.vignette | public function vignette($scale = null, $outerColor = null, $innerColor = null) {
$params = array();
if ($scale) {
$params[] = 'scale=' . $scale;
}
if ($outerColor) {
$params[] = 'outer=' . $outerColor;
}
if ($innerColor) {
$params[] = 'inner=' . $innerColor;
}
return $this->addTransformation(
'vignette' . ($params ? ':' . implode(',', $params) : '')
);
} | php | public function vignette($scale = null, $outerColor = null, $innerColor = null) {
$params = array();
if ($scale) {
$params[] = 'scale=' . $scale;
}
if ($outerColor) {
$params[] = 'outer=' . $outerColor;
}
if ($innerColor) {
$params[] = 'inner=' . $innerColor;
}
return $this->addTransformation(
'vignette' . ($params ? ':' . implode(',', $params) : '')
);
} | [
"public",
"function",
"vignette",
"(",
"$",
"scale",
"=",
"null",
",",
"$",
"outerColor",
"=",
"null",
",",
"$",
"innerColor",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"scale",
")",
"{",
"$",
"params",
"[... | Add a vignette transformation
@param float $scale Scale factor of vignette. 2 means twice the size of the original image
@param string $outerColor Color at the edge of the image
@param string $innerColor Color at the center of the image
@return self | [
"Add",
"a",
"vignette",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L641-L659 |
42,428 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.watermark | public function watermark($img = null, $width = null, $height = null, $position = 'top-left', $x = 0, $y = 0) {
$params = array(
'position=' . $position,
'x=' . (int) $x,
'y=' . (int) $y,
);
if ($img !== null) {
$params[] = 'img=' . $img;
}
if ($width !== null) {
$params[] = 'width=' . (int) $width;
}
if ($height !== null) {
$params[] = 'height=' . (int) $height;
}
return $this->addTransformation(sprintf('watermark:%s', implode(',', $params)));
} | php | public function watermark($img = null, $width = null, $height = null, $position = 'top-left', $x = 0, $y = 0) {
$params = array(
'position=' . $position,
'x=' . (int) $x,
'y=' . (int) $y,
);
if ($img !== null) {
$params[] = 'img=' . $img;
}
if ($width !== null) {
$params[] = 'width=' . (int) $width;
}
if ($height !== null) {
$params[] = 'height=' . (int) $height;
}
return $this->addTransformation(sprintf('watermark:%s', implode(',', $params)));
} | [
"public",
"function",
"watermark",
"(",
"$",
"img",
"=",
"null",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
",",
"$",
"position",
"=",
"'top-left'",
",",
"$",
"x",
"=",
"0",
",",
"$",
"y",
"=",
"0",
")",
"{",
"$",
"params"... | Add a watermark transformation
@param string $img The identifier of the image to be used as a watermark. Can be omitted if
the server is configured with a default watermark.
@param int $width The width of the watermark
@param int $height The height of the watermark
@param string $position The position of the watermark on the original image, 'top-left',
'top-right', 'bottom-left', 'bottom-right' or 'center'. Defaults to
'top-left'.
@param int $x Offset in the X-axis relative to the $position parameter. Defaults to 0
@param int $y Offset in the Y-axis relative to the $position parameter. Defaults to 0
@return self | [
"Add",
"a",
"watermark",
"transformation"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L675-L695 |
42,429 | imbo/imboclient-php | src/ImboClient/Http/ImageUrl.php | ImageUrl.reset | public function reset() {
if ($this->transformations) {
// Remove image transformations
$this->transformations = array();
$this->query->remove('t');
}
if ($this->extension) {
// Remove the extension
$this->path = str_replace('.' . $this->extension, '', $this->path);
$this->extension = null;
}
return $this;
} | php | public function reset() {
if ($this->transformations) {
// Remove image transformations
$this->transformations = array();
$this->query->remove('t');
}
if ($this->extension) {
// Remove the extension
$this->path = str_replace('.' . $this->extension, '', $this->path);
$this->extension = null;
}
return $this;
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"transformations",
")",
"{",
"// Remove image transformations",
"$",
"this",
"->",
"transformations",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"query",
"->",
"remove",
"(",
... | Reset the URL
Effectively removes added transformations and an optional extension.
@return self | [
"Reset",
"the",
"URL"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Http/ImageUrl.php#L750-L764 |
42,430 | imbo/imboclient-php | src/ImboClient/EventSubscriber/PublicKey.php | PublicKey.addPublicKey | public function addPublicKey(Event $event) {
$command = $event['command'];
$request = $command->getRequest();
$url = $request->getUrl(true);
// Don't add public key if query string already contains public key
if ($url->getQuery()->hasKey('publicKey')) {
return;
}
$client = $request->getClient();
$publicKey = $client->getPublicKey();
$user = $client->getUser();
// No need for the header if the user and public key matches
if ($user && $user === $publicKey) {
return;
}
$request->setHeader('X-Imbo-PublicKey', $publicKey);
} | php | public function addPublicKey(Event $event) {
$command = $event['command'];
$request = $command->getRequest();
$url = $request->getUrl(true);
// Don't add public key if query string already contains public key
if ($url->getQuery()->hasKey('publicKey')) {
return;
}
$client = $request->getClient();
$publicKey = $client->getPublicKey();
$user = $client->getUser();
// No need for the header if the user and public key matches
if ($user && $user === $publicKey) {
return;
}
$request->setHeader('X-Imbo-PublicKey', $publicKey);
} | [
"public",
"function",
"addPublicKey",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"command",
"=",
"$",
"event",
"[",
"'command'",
"]",
";",
"$",
"request",
"=",
"$",
"command",
"->",
"getRequest",
"(",
")",
";",
"$",
"url",
"=",
"$",
"request",
"->",
... | Add a public key header to the request
@param Event $event The current event | [
"Add",
"a",
"public",
"key",
"header",
"to",
"the",
"request"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/EventSubscriber/PublicKey.php#L42-L62 |
42,431 | imbo/imboclient-php | src/ImboClient/Helper/PublicKeyFallback.php | PublicKeyFallback.fallback | public static function fallback($info) {
$user = isset($info['user']) ? $info['user'] : null;
$publicKey = isset($info['publicKey']) ? $info['publicKey'] : null;
if (!$user && $publicKey) {
$info['user'] = $publicKey;
} else if (!$publicKey && $user) {
$info['publicKey'] = $user;
}
return $info;
} | php | public static function fallback($info) {
$user = isset($info['user']) ? $info['user'] : null;
$publicKey = isset($info['publicKey']) ? $info['publicKey'] : null;
if (!$user && $publicKey) {
$info['user'] = $publicKey;
} else if (!$publicKey && $user) {
$info['publicKey'] = $user;
}
return $info;
} | [
"public",
"static",
"function",
"fallback",
"(",
"$",
"info",
")",
"{",
"$",
"user",
"=",
"isset",
"(",
"$",
"info",
"[",
"'user'",
"]",
")",
"?",
"$",
"info",
"[",
"'user'",
"]",
":",
"null",
";",
"$",
"publicKey",
"=",
"isset",
"(",
"$",
"info"... | For backwards-compatibility, we provide both `user` and `publicKey`.
In future version of ImboClient, the `publicKey` will be removed.
@param array $info
@return array | [
"For",
"backwards",
"-",
"compatibility",
"we",
"provide",
"both",
"user",
"and",
"publicKey",
".",
"In",
"future",
"version",
"of",
"ImboClient",
"the",
"publicKey",
"will",
"be",
"removed",
"."
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/Helper/PublicKeyFallback.php#L28-L39 |
42,432 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.addImageFromUrl | public function addImageFromUrl($url) {
if (is_string($url)) {
// URL specified as a string. Create a URL instance
$url = GuzzleUrl::factory($url);
}
if (!($url instanceof GuzzleUrl)) {
// Invalid argument
throw new InvalidArgumentException(
'Parameter must be a string or an instance of Guzzle\Http\Url'
);
}
if (!$url->getScheme()) {
throw new InvalidArgumentException('URL is missing scheme: ' . (string) $url);
}
// Fetch the image we want to add
$image = (string) $this->get($url)->send()->getBody();
return $this->addImageFromString($image);
} | php | public function addImageFromUrl($url) {
if (is_string($url)) {
// URL specified as a string. Create a URL instance
$url = GuzzleUrl::factory($url);
}
if (!($url instanceof GuzzleUrl)) {
// Invalid argument
throw new InvalidArgumentException(
'Parameter must be a string or an instance of Guzzle\Http\Url'
);
}
if (!$url->getScheme()) {
throw new InvalidArgumentException('URL is missing scheme: ' . (string) $url);
}
// Fetch the image we want to add
$image = (string) $this->get($url)->send()->getBody();
return $this->addImageFromString($image);
} | [
"public",
"function",
"addImageFromUrl",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"url",
")",
")",
"{",
"// URL specified as a string. Create a URL instance",
"$",
"url",
"=",
"GuzzleUrl",
"::",
"factory",
"(",
"$",
"url",
")",
";",
"}",
... | Add an image from a URL
@param GuzzleUrl|string $url A URL to an image
@return Model
@throws InvalidArgumentException | [
"Add",
"an",
"image",
"from",
"a",
"URL"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L181-L202 |
42,433 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.addImageFromString | public function addImageFromString($image) {
if (empty($image)) {
throw new InvalidArgumentException('Specified image is empty');
}
return $this->getCommand('AddImage', array(
'user' => $this->getUser(),
'image' => $image,
))->execute();
} | php | public function addImageFromString($image) {
if (empty($image)) {
throw new InvalidArgumentException('Specified image is empty');
}
return $this->getCommand('AddImage', array(
'user' => $this->getUser(),
'image' => $image,
))->execute();
} | [
"public",
"function",
"addImageFromString",
"(",
"$",
"image",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"image",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Specified image is empty'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"getComm... | Add an image from memory
@param string $image An image in memory
@return Model
@throws InvalidArgumentException | [
"Add",
"an",
"image",
"from",
"memory"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L211-L220 |
42,434 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getUserInfo | public function getUserInfo() {
$userInfo = $this->getCommand('GetUserInfo', array(
'user' => $this->getUser(),
))->execute();
return PublicKeyFallback::fallback($userInfo);
} | php | public function getUserInfo() {
$userInfo = $this->getCommand('GetUserInfo', array(
'user' => $this->getUser(),
))->execute();
return PublicKeyFallback::fallback($userInfo);
} | [
"public",
"function",
"getUserInfo",
"(",
")",
"{",
"$",
"userInfo",
"=",
"$",
"this",
"->",
"getCommand",
"(",
"'GetUserInfo'",
",",
"array",
"(",
"'user'",
"=>",
"$",
"this",
"->",
"getUser",
"(",
")",
",",
")",
")",
"->",
"execute",
"(",
")",
";",... | Fetch the user info of the current user
@return Model | [
"Fetch",
"the",
"user",
"info",
"of",
"the",
"current",
"user"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L245-L251 |
42,435 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.editMetadata | public function editMetadata($imageIdentifier, array $metadata) {
return $this->getCommand('EditMetadata', array(
'user' => $this->getUser(),
'imageIdentifier' => $imageIdentifier,
'metadata' => json_encode($metadata),
))->execute();
} | php | public function editMetadata($imageIdentifier, array $metadata) {
return $this->getCommand('EditMetadata', array(
'user' => $this->getUser(),
'imageIdentifier' => $imageIdentifier,
'metadata' => json_encode($metadata),
))->execute();
} | [
"public",
"function",
"editMetadata",
"(",
"$",
"imageIdentifier",
",",
"array",
"$",
"metadata",
")",
"{",
"return",
"$",
"this",
"->",
"getCommand",
"(",
"'EditMetadata'",
",",
"array",
"(",
"'user'",
"=>",
"$",
"this",
"->",
"getUser",
"(",
")",
",",
... | Edit metadata of an image
@param string $imageIdentifier The identifier of the image
@param array $metadata The metadata to set
@return Model | [
"Edit",
"metadata",
"of",
"an",
"image"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L286-L292 |
42,436 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.replaceMetadata | public function replaceMetadata($imageIdentifier, array $metadata) {
return $this->getCommand('ReplaceMetadata', array(
'user' => $this->getUser(),
'imageIdentifier' => $imageIdentifier,
'metadata' => json_encode($metadata),
))->execute();
} | php | public function replaceMetadata($imageIdentifier, array $metadata) {
return $this->getCommand('ReplaceMetadata', array(
'user' => $this->getUser(),
'imageIdentifier' => $imageIdentifier,
'metadata' => json_encode($metadata),
))->execute();
} | [
"public",
"function",
"replaceMetadata",
"(",
"$",
"imageIdentifier",
",",
"array",
"$",
"metadata",
")",
"{",
"return",
"$",
"this",
"->",
"getCommand",
"(",
"'ReplaceMetadata'",
",",
"array",
"(",
"'user'",
"=>",
"$",
"this",
"->",
"getUser",
"(",
")",
"... | Replace metadata of an image
@param string $imageIdentifier The identifier of the image
@param array $metadata The metadata to set
@return Model | [
"Replace",
"metadata",
"of",
"an",
"image"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L301-L307 |
42,437 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getImages | public function getImages(ImagesQuery $query = null) {
if (!$query) {
$query = new ImagesQuery();
}
$params = array(
'user' => $this->getUser(),
'page' => $query->page(),
'limit' => $query->limit(),
);
if ($query->metadata()) {
$params['metadata'] = true;
}
if ($from = $query->from()) {
$params['from'] = $from;
}
if ($to = $query->to()) {
$params['to'] = $to;
}
if ($fields = $query->fields()) {
$params['fields'] = $fields;
}
if ($sort = $query->sort()) {
$params['sort'] = $sort;
}
if ($ids = $query->ids()) {
$params['ids'] = $ids;
}
if ($checksums = $query->checksums()) {
$params['checksums'] = $checksums;
}
if ($originalChecksums = $query->originalChecksums()) {
$params['originalChecksums'] = $originalChecksums;
}
$response = $this->getCommand('GetImages', $params)->execute();
$response['images'] = array_map(
array('ImboClient\Helper\PublicKeyFallback', 'fallback'),
$response['images']
);
return $response;
} | php | public function getImages(ImagesQuery $query = null) {
if (!$query) {
$query = new ImagesQuery();
}
$params = array(
'user' => $this->getUser(),
'page' => $query->page(),
'limit' => $query->limit(),
);
if ($query->metadata()) {
$params['metadata'] = true;
}
if ($from = $query->from()) {
$params['from'] = $from;
}
if ($to = $query->to()) {
$params['to'] = $to;
}
if ($fields = $query->fields()) {
$params['fields'] = $fields;
}
if ($sort = $query->sort()) {
$params['sort'] = $sort;
}
if ($ids = $query->ids()) {
$params['ids'] = $ids;
}
if ($checksums = $query->checksums()) {
$params['checksums'] = $checksums;
}
if ($originalChecksums = $query->originalChecksums()) {
$params['originalChecksums'] = $originalChecksums;
}
$response = $this->getCommand('GetImages', $params)->execute();
$response['images'] = array_map(
array('ImboClient\Helper\PublicKeyFallback', 'fallback'),
$response['images']
);
return $response;
} | [
"public",
"function",
"getImages",
"(",
"ImagesQuery",
"$",
"query",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"query",
")",
"{",
"$",
"query",
"=",
"new",
"ImagesQuery",
"(",
")",
";",
"}",
"$",
"params",
"=",
"array",
"(",
"'user'",
"=>",
"$",
... | Get images owned by a user
@param ImagesQuery $query An optional images query object
@return Model | [
"Get",
"images",
"owned",
"by",
"a",
"user"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L328-L378 |
42,438 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.generateShortUrl | public function generateShortUrl(Http\ImageUrl $imageUrl) {
$transformations = $imageUrl->getTransformations();
if ($transformations) {
$transformations = '?t[]=' . implode('&t[]=', $transformations);
} else {
$transformations = null;
}
$params = array(
'user' => $this->getUser(),
'imageIdentifier' => $imageUrl->getImageIdentifier(),
'extension' => $imageUrl->getExtension(),
'query' => $transformations,
);
return $this->getCommand('GenerateShortUrl', array(
'user' => $this->getUser(),
'imageIdentifier' => $imageUrl->getImageIdentifier(),
'params' => json_encode($params),
))->execute();
} | php | public function generateShortUrl(Http\ImageUrl $imageUrl) {
$transformations = $imageUrl->getTransformations();
if ($transformations) {
$transformations = '?t[]=' . implode('&t[]=', $transformations);
} else {
$transformations = null;
}
$params = array(
'user' => $this->getUser(),
'imageIdentifier' => $imageUrl->getImageIdentifier(),
'extension' => $imageUrl->getExtension(),
'query' => $transformations,
);
return $this->getCommand('GenerateShortUrl', array(
'user' => $this->getUser(),
'imageIdentifier' => $imageUrl->getImageIdentifier(),
'params' => json_encode($params),
))->execute();
} | [
"public",
"function",
"generateShortUrl",
"(",
"Http",
"\\",
"ImageUrl",
"$",
"imageUrl",
")",
"{",
"$",
"transformations",
"=",
"$",
"imageUrl",
"->",
"getTransformations",
"(",
")",
";",
"if",
"(",
"$",
"transformations",
")",
"{",
"$",
"transformations",
... | Generate a short URL
@param Http\ImageUrl $imageUrl An instance of an imageUrl
@return Model | [
"Generate",
"a",
"short",
"URL"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L399-L420 |
42,439 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getResourceGroups | public function getResourceGroups(Query $query = null) {
if (!$query) {
$query = new Query();
}
return $this->getCommand('GetResourceGroups', array(
'page' => $query->page(),
'limit' => $query->limit(),
))->execute();
} | php | public function getResourceGroups(Query $query = null) {
if (!$query) {
$query = new Query();
}
return $this->getCommand('GetResourceGroups', array(
'page' => $query->page(),
'limit' => $query->limit(),
))->execute();
} | [
"public",
"function",
"getResourceGroups",
"(",
"Query",
"$",
"query",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"query",
")",
"{",
"$",
"query",
"=",
"new",
"Query",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"getCommand",
"(",
"'GetResource... | Get the available resource groups
@param Query $query An optional query object
@return Model | [
"Get",
"the",
"available",
"resource",
"groups"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L428-L437 |
42,440 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.addResourceGroup | public function addResourceGroup($groupName, array $resources) {
$this->validateResourceGroupName($groupName);
if ($this->resourceGroupExists($groupName)) {
throw new InvalidArgumentException(
'Resource group with name "' . $groupName . '" already exists'
);
}
return $this->editResourceGroup($groupName, $resources);
} | php | public function addResourceGroup($groupName, array $resources) {
$this->validateResourceGroupName($groupName);
if ($this->resourceGroupExists($groupName)) {
throw new InvalidArgumentException(
'Resource group with name "' . $groupName . '" already exists'
);
}
return $this->editResourceGroup($groupName, $resources);
} | [
"public",
"function",
"addResourceGroup",
"(",
"$",
"groupName",
",",
"array",
"$",
"resources",
")",
"{",
"$",
"this",
"->",
"validateResourceGroupName",
"(",
"$",
"groupName",
")",
";",
"if",
"(",
"$",
"this",
"->",
"resourceGroupExists",
"(",
"$",
"groupN... | Add a new resource group
@param string $groupName Name of the group to create
@param array $resources Array of resource names the group should contain
@return Model
@throws InvalidArgumentException Throw when group name is invalid or group already exists | [
"Add",
"a",
"new",
"resource",
"group"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L462-L472 |
42,441 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.editResourceGroup | public function editResourceGroup($groupName, array $resources) {
$this->validateResourceGroupName($groupName);
return $this->getCommand('EditResourceGroup', array(
'groupName' => $groupName,
'resources' => json_encode($resources),
))->execute();
} | php | public function editResourceGroup($groupName, array $resources) {
$this->validateResourceGroupName($groupName);
return $this->getCommand('EditResourceGroup', array(
'groupName' => $groupName,
'resources' => json_encode($resources),
))->execute();
} | [
"public",
"function",
"editResourceGroup",
"(",
"$",
"groupName",
",",
"array",
"$",
"resources",
")",
"{",
"$",
"this",
"->",
"validateResourceGroupName",
"(",
"$",
"groupName",
")",
";",
"return",
"$",
"this",
"->",
"getCommand",
"(",
"'EditResourceGroup'",
... | Edit a resource group
Note: If the resource group does not already exist, it will be created
@param string $groupName Name of the group to edit
@param array $resources Array of resource names the group should contain
@return Model
@throws InvalidArgumentException Thrown when group name is invalid or group already exists | [
"Edit",
"a",
"resource",
"group"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L484-L491 |
42,442 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.resourceGroupExists | public function resourceGroupExists($groupName) {
$this->validateResourceGroupName($groupName);
return $this->resourceExists($this->getResourceGroupUrl($groupName));
} | php | public function resourceGroupExists($groupName) {
$this->validateResourceGroupName($groupName);
return $this->resourceExists($this->getResourceGroupUrl($groupName));
} | [
"public",
"function",
"resourceGroupExists",
"(",
"$",
"groupName",
")",
"{",
"$",
"this",
"->",
"validateResourceGroupName",
"(",
"$",
"groupName",
")",
";",
"return",
"$",
"this",
"->",
"resourceExists",
"(",
"$",
"this",
"->",
"getResourceGroupUrl",
"(",
"$... | Checks if a given group exists on the server already
@param string $groupName Name of the group
@throws InvalidArgumentException Throws an exception if group name is invalid
@return boolean | [
"Checks",
"if",
"a",
"given",
"group",
"exists",
"on",
"the",
"server",
"already"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L515-L519 |
42,443 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.publicKeyExists | public function publicKeyExists($publicKey) {
$this->validatePublicKeyName($publicKey);
return $this->resourceExists($this->getKeyUrl($publicKey));
} | php | public function publicKeyExists($publicKey) {
$this->validatePublicKeyName($publicKey);
return $this->resourceExists($this->getKeyUrl($publicKey));
} | [
"public",
"function",
"publicKeyExists",
"(",
"$",
"publicKey",
")",
"{",
"$",
"this",
"->",
"validatePublicKeyName",
"(",
"$",
"publicKey",
")",
";",
"return",
"$",
"this",
"->",
"resourceExists",
"(",
"$",
"this",
"->",
"getKeyUrl",
"(",
"$",
"publicKey",
... | Checks if a given public key exists on the server already
@param string $publicKey Public key
@return boolean
@throws InvalidArgumentException If the public key name is invalid | [
"Checks",
"if",
"a",
"given",
"public",
"key",
"exists",
"on",
"the",
"server",
"already"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L583-L587 |
42,444 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getAccessControlRule | public function getAccessControlRule($publicKey, $ruleId) {
$this->validatePublicKeyName($publicKey);
return $this->getCommand('GetAccessControlRule', array(
'publicKey' => $publicKey,
'id' => $ruleId,
))->execute();
} | php | public function getAccessControlRule($publicKey, $ruleId) {
$this->validatePublicKeyName($publicKey);
return $this->getCommand('GetAccessControlRule', array(
'publicKey' => $publicKey,
'id' => $ruleId,
))->execute();
} | [
"public",
"function",
"getAccessControlRule",
"(",
"$",
"publicKey",
",",
"$",
"ruleId",
")",
"{",
"$",
"this",
"->",
"validatePublicKeyName",
"(",
"$",
"publicKey",
")",
";",
"return",
"$",
"this",
"->",
"getCommand",
"(",
"'GetAccessControlRule'",
",",
"arra... | Get the access control rule with the given ID which belongs to the given public key
@param string $publicKey Public key
@param string $ruleId ID of the rule to retrieve
@return Model
@throws InvalidArgumentException If the public key name is invalid | [
"Get",
"the",
"access",
"control",
"rule",
"with",
"the",
"given",
"ID",
"which",
"belongs",
"to",
"the",
"given",
"public",
"key"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L612-L619 |
42,445 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.addAccessControlRules | public function addAccessControlRules($publicKey, $rules) {
$this->validatePublicKeyName($publicKey);
return $this->getCommand('AddAccessControlRules', array(
'publicKey' => $publicKey,
'rules' => json_encode($rules),
))->execute();
} | php | public function addAccessControlRules($publicKey, $rules) {
$this->validatePublicKeyName($publicKey);
return $this->getCommand('AddAccessControlRules', array(
'publicKey' => $publicKey,
'rules' => json_encode($rules),
))->execute();
} | [
"public",
"function",
"addAccessControlRules",
"(",
"$",
"publicKey",
",",
"$",
"rules",
")",
"{",
"$",
"this",
"->",
"validatePublicKeyName",
"(",
"$",
"publicKey",
")",
";",
"return",
"$",
"this",
"->",
"getCommand",
"(",
"'AddAccessControlRules'",
",",
"arr... | Add access control rules to the given public key
@param string $publicKey Public key to add rules to
@param array $rules Rules to add
@return Model
@throws InvalidArgumentException If the public key name is invalid | [
"Add",
"access",
"control",
"rules",
"to",
"the",
"given",
"public",
"key"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L641-L648 |
42,446 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.deleteAccessControlRule | public function deleteAccessControlRule($publicKey, $ruleId) {
$this->validatePublicKeyName($publicKey);
return $this->getCommand('DeleteAccessControlRule', array(
'publicKey' => $publicKey,
'id' => $ruleId,
))->execute();
} | php | public function deleteAccessControlRule($publicKey, $ruleId) {
$this->validatePublicKeyName($publicKey);
return $this->getCommand('DeleteAccessControlRule', array(
'publicKey' => $publicKey,
'id' => $ruleId,
))->execute();
} | [
"public",
"function",
"deleteAccessControlRule",
"(",
"$",
"publicKey",
",",
"$",
"ruleId",
")",
"{",
"$",
"this",
"->",
"validatePublicKeyName",
"(",
"$",
"publicKey",
")",
";",
"return",
"$",
"this",
"->",
"getCommand",
"(",
"'DeleteAccessControlRule'",
",",
... | Delete an access control rule
@param string $publicKey Name of the public key which owns the rule
@param string $ruleId ID of the rule to delete
@return Model
@throws InvalidArgumentException Thrown if the public key name is invalid | [
"Delete",
"an",
"access",
"control",
"rule"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L658-L665 |
42,447 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getResourceGroupsUrl | public function getResourceGroupsUrl() {
return Http\ResourceGroupsUrl::factory(
$this->getBaseUrl() . '/groups.json',
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | php | public function getResourceGroupsUrl() {
return Http\ResourceGroupsUrl::factory(
$this->getBaseUrl() . '/groups.json',
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | [
"public",
"function",
"getResourceGroupsUrl",
"(",
")",
"{",
"return",
"Http",
"\\",
"ResourceGroupsUrl",
"::",
"factory",
"(",
"$",
"this",
"->",
"getBaseUrl",
"(",
")",
".",
"'/groups.json'",
",",
"$",
"this",
"->",
"getConfig",
"(",
"'privateKey'",
")",
"... | Get a URL for the groups endpoint
@return Http\GroupsUrl | [
"Get",
"a",
"URL",
"for",
"the",
"groups",
"endpoint"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L699-L705 |
42,448 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getResourceGroupUrl | public function getResourceGroupUrl($groupName) {
$url = sprintf($this->getBaseUrl() . '/groups/%s.json', $groupName);
return Http\ResourceGroupUrl::factory(
$url,
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | php | public function getResourceGroupUrl($groupName) {
$url = sprintf($this->getBaseUrl() . '/groups/%s.json', $groupName);
return Http\ResourceGroupUrl::factory(
$url,
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | [
"public",
"function",
"getResourceGroupUrl",
"(",
"$",
"groupName",
")",
"{",
"$",
"url",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"getBaseUrl",
"(",
")",
".",
"'/groups/%s.json'",
",",
"$",
"groupName",
")",
";",
"return",
"Http",
"\\",
"ResourceGroupUrl",
... | Get a URL for the group endpoint
@param string $groupName Name of group
@return Http\GroupUrl | [
"Get",
"a",
"URL",
"for",
"the",
"group",
"endpoint"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L713-L721 |
42,449 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getKeysUrl | public function getKeysUrl() {
return Http\KeysUrl::factory(
$this->getBaseUrl() . '/keys.json',
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | php | public function getKeysUrl() {
return Http\KeysUrl::factory(
$this->getBaseUrl() . '/keys.json',
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | [
"public",
"function",
"getKeysUrl",
"(",
")",
"{",
"return",
"Http",
"\\",
"KeysUrl",
"::",
"factory",
"(",
"$",
"this",
"->",
"getBaseUrl",
"(",
")",
".",
"'/keys.json'",
",",
"$",
"this",
"->",
"getConfig",
"(",
"'privateKey'",
")",
",",
"$",
"this",
... | Get a URL for the keys endpoint
@return Http\KeysUrl | [
"Get",
"a",
"URL",
"for",
"the",
"keys",
"endpoint"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L728-L734 |
42,450 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getKeyUrl | public function getKeyUrl($publicKey) {
$url = sprintf($this->getBaseUrl() . '/keys/%s', $publicKey);
return Http\KeyUrl::factory(
$url,
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | php | public function getKeyUrl($publicKey) {
$url = sprintf($this->getBaseUrl() . '/keys/%s', $publicKey);
return Http\KeyUrl::factory(
$url,
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | [
"public",
"function",
"getKeyUrl",
"(",
"$",
"publicKey",
")",
"{",
"$",
"url",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"getBaseUrl",
"(",
")",
".",
"'/keys/%s'",
",",
"$",
"publicKey",
")",
";",
"return",
"Http",
"\\",
"KeyUrl",
"::",
"factory",
"(",
... | Get a URL for the key endpoint
@param string $publicKey Public key
@return Http\KeyUrl | [
"Get",
"a",
"URL",
"for",
"the",
"key",
"endpoint"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L742-L750 |
42,451 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getUserUrl | public function getUserUrl() {
$url = sprintf($this->getBaseUrl() . '/users/%s.json', $this->getUser());
return Http\UserUrl::factory(
$url,
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | php | public function getUserUrl() {
$url = sprintf($this->getBaseUrl() . '/users/%s.json', $this->getUser());
return Http\UserUrl::factory(
$url,
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | [
"public",
"function",
"getUserUrl",
"(",
")",
"{",
"$",
"url",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"getBaseUrl",
"(",
")",
".",
"'/users/%s.json'",
",",
"$",
"this",
"->",
"getUser",
"(",
")",
")",
";",
"return",
"Http",
"\\",
"UserUrl",
"::",
"f... | Get a URL for the user endpoint
@return Http\UserUrl | [
"Get",
"a",
"URL",
"for",
"the",
"user",
"endpoint"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L757-L765 |
42,452 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getImagesUrl | public function getImagesUrl() {
$url = sprintf($this->getBaseUrl() . '/users/%s/images.json', $this->getUser());
return Http\ImagesUrl::factory(
$url,
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | php | public function getImagesUrl() {
$url = sprintf($this->getBaseUrl() . '/users/%s/images.json', $this->getUser());
return Http\ImagesUrl::factory(
$url,
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | [
"public",
"function",
"getImagesUrl",
"(",
")",
"{",
"$",
"url",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"getBaseUrl",
"(",
")",
".",
"'/users/%s/images.json'",
",",
"$",
"this",
"->",
"getUser",
"(",
")",
")",
";",
"return",
"Http",
"\\",
"ImagesUrl",
... | Get a URL for the images resource
@return Http\ImagesUrl | [
"Get",
"a",
"URL",
"for",
"the",
"images",
"resource"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L772-L780 |
42,453 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getImageUrl | public function getImageUrl($imageIdentifier) {
if (empty($imageIdentifier)) {
throw new InvalidArgumentException('Missing image identifier');
}
$url = sprintf(
$this->getHostForImageIdentifier($imageIdentifier) . '/users/%s/images/%s',
$this->getUser(),
$imageIdentifier
);
return Http\ImageUrl::factory(
$url,
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | php | public function getImageUrl($imageIdentifier) {
if (empty($imageIdentifier)) {
throw new InvalidArgumentException('Missing image identifier');
}
$url = sprintf(
$this->getHostForImageIdentifier($imageIdentifier) . '/users/%s/images/%s',
$this->getUser(),
$imageIdentifier
);
return Http\ImageUrl::factory(
$url,
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | [
"public",
"function",
"getImageUrl",
"(",
"$",
"imageIdentifier",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"imageIdentifier",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Missing image identifier'",
")",
";",
"}",
"$",
"url",
"=",
"sprintf"... | Get a URL for the image resource
@throws InvalidArgumentException
@param string $imageIdentifier An image identifier
@return Http\ImageUrl | [
"Get",
"a",
"URL",
"for",
"the",
"image",
"resource"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L789-L805 |
42,454 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getMetadataUrl | public function getMetadataUrl($imageIdentifier) {
$url = sprintf(
$this->getHostForImageIdentifier($imageIdentifier) . '/users/%s/images/%s/metadata.json',
$this->getUser(),
$imageIdentifier
);
return Http\MetadataUrl::factory(
$url,
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | php | public function getMetadataUrl($imageIdentifier) {
$url = sprintf(
$this->getHostForImageIdentifier($imageIdentifier) . '/users/%s/images/%s/metadata.json',
$this->getUser(),
$imageIdentifier
);
return Http\MetadataUrl::factory(
$url,
$this->getConfig('privateKey'),
$this->getPublicKey()
);
} | [
"public",
"function",
"getMetadataUrl",
"(",
"$",
"imageIdentifier",
")",
"{",
"$",
"url",
"=",
"sprintf",
"(",
"$",
"this",
"->",
"getHostForImageIdentifier",
"(",
"$",
"imageIdentifier",
")",
".",
"'/users/%s/images/%s/metadata.json'",
",",
"$",
"this",
"->",
... | Get a URL for the metadata resource
@param string $imageIdentifier An image identifier
@return Http\MetadataUrl | [
"Get",
"a",
"URL",
"for",
"the",
"metadata",
"resource"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L813-L825 |
42,455 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.imageExists | public function imageExists($path) {
$this->validateLocalFile($path);
$checksum = md5_file($path);
$query = new ImagesQuery();
$query->originalChecksums(array($checksum))
->limit(1);
$response = $this->getImages($query);
return (boolean) $response['search']['hits'];
} | php | public function imageExists($path) {
$this->validateLocalFile($path);
$checksum = md5_file($path);
$query = new ImagesQuery();
$query->originalChecksums(array($checksum))
->limit(1);
$response = $this->getImages($query);
return (boolean) $response['search']['hits'];
} | [
"public",
"function",
"imageExists",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"validateLocalFile",
"(",
"$",
"path",
")",
";",
"$",
"checksum",
"=",
"md5_file",
"(",
"$",
"path",
")",
";",
"$",
"query",
"=",
"new",
"ImagesQuery",
"(",
")",
";",... | Checks if a given image exists on the server already by specifying a local path
@param string $path Path to the local image
@throws InvalidArgumentException Throws an exception if the specified file does not exist or
is of zero length
@return boolean | [
"Checks",
"if",
"a",
"given",
"image",
"exists",
"on",
"the",
"server",
"already",
"by",
"specifying",
"a",
"local",
"path"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L874-L884 |
42,456 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getImageDataFromUrl | public function getImageDataFromUrl(Http\ImageUrl $imageUrl) {
return (string) $this->get((string) $imageUrl)->send()->getBody();
} | php | public function getImageDataFromUrl(Http\ImageUrl $imageUrl) {
return (string) $this->get((string) $imageUrl)->send()->getBody();
} | [
"public",
"function",
"getImageDataFromUrl",
"(",
"Http",
"\\",
"ImageUrl",
"$",
"imageUrl",
")",
"{",
"return",
"(",
"string",
")",
"$",
"this",
"->",
"get",
"(",
"(",
"string",
")",
"$",
"imageUrl",
")",
"->",
"send",
"(",
")",
"->",
"getBody",
"(",
... | Get the binary data of an image stored on the server
@param Url\ImageInterface $url URL instance for the image you want to retrieve
@return string | [
"Get",
"the",
"binary",
"data",
"of",
"an",
"image",
"stored",
"on",
"the",
"server"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L912-L914 |
42,457 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.getHostForImageIdentifier | private function getHostForImageIdentifier($imageIdentifier) {
$dec = ord(substr($imageIdentifier, -1));
// If this is an old image identifier (32 character hex string),
// maintain backwards compatibility
if (preg_match('#^[a-f0-9]{32}$#', $imageIdentifier)) {
$dec = hexdec($imageIdentifier[0] . $imageIdentifier[1]);
}
return $this->serverUrls[$dec % count($this->serverUrls)];
} | php | private function getHostForImageIdentifier($imageIdentifier) {
$dec = ord(substr($imageIdentifier, -1));
// If this is an old image identifier (32 character hex string),
// maintain backwards compatibility
if (preg_match('#^[a-f0-9]{32}$#', $imageIdentifier)) {
$dec = hexdec($imageIdentifier[0] . $imageIdentifier[1]);
}
return $this->serverUrls[$dec % count($this->serverUrls)];
} | [
"private",
"function",
"getHostForImageIdentifier",
"(",
"$",
"imageIdentifier",
")",
"{",
"$",
"dec",
"=",
"ord",
"(",
"substr",
"(",
"$",
"imageIdentifier",
",",
"-",
"1",
")",
")",
";",
"// If this is an old image identifier (32 character hex string),",
"// maintai... | Get a predictable hostname for the given image identifier
@param string $imageIdentifier The image identifier
@return string | [
"Get",
"a",
"predictable",
"hostname",
"for",
"the",
"given",
"image",
"identifier"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L922-L932 |
42,458 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.parseUrls | private function parseUrls($urls) {
$urls = (array) $urls;
$result = array();
$counter = 0;
foreach ($urls as $serverUrl) {
if (!preg_match('|^https?://|', $serverUrl)) {
$serverUrl = 'http://' . $serverUrl;
}
$parts = parse_url($serverUrl);
// Remove the port from the server URL if it's equal to 80 when scheme is http, or if
// it's equal to 443 when the scheme is https
if (
isset($parts['port']) && (
($parts['scheme'] === 'http' && $parts['port'] == 80) ||
($parts['scheme'] === 'https' && $parts['port'] == 443)
)
) {
if (empty($parts['path'])) {
$parts['path'] = '';
}
$serverUrl = $parts['scheme'] . '://' . $parts['host'] . $parts['path'];
}
$serverUrl = rtrim($serverUrl, '/');
if (!isset($result[$serverUrl])) {
$result[$serverUrl] = $counter++;
}
}
return array_flip($result);
} | php | private function parseUrls($urls) {
$urls = (array) $urls;
$result = array();
$counter = 0;
foreach ($urls as $serverUrl) {
if (!preg_match('|^https?://|', $serverUrl)) {
$serverUrl = 'http://' . $serverUrl;
}
$parts = parse_url($serverUrl);
// Remove the port from the server URL if it's equal to 80 when scheme is http, or if
// it's equal to 443 when the scheme is https
if (
isset($parts['port']) && (
($parts['scheme'] === 'http' && $parts['port'] == 80) ||
($parts['scheme'] === 'https' && $parts['port'] == 443)
)
) {
if (empty($parts['path'])) {
$parts['path'] = '';
}
$serverUrl = $parts['scheme'] . '://' . $parts['host'] . $parts['path'];
}
$serverUrl = rtrim($serverUrl, '/');
if (!isset($result[$serverUrl])) {
$result[$serverUrl] = $counter++;
}
}
return array_flip($result);
} | [
"private",
"function",
"parseUrls",
"(",
"$",
"urls",
")",
"{",
"$",
"urls",
"=",
"(",
"array",
")",
"$",
"urls",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"counter",
"=",
"0",
";",
"foreach",
"(",
"$",
"urls",
"as",
"$",
"serverUrl",... | Parse server URLs and prepare them for usage
@param array|string $urls One or more URLs to an Imbo server
@return array Returns an array of URLs | [
"Parse",
"server",
"URLs",
"and",
"prepare",
"them",
"for",
"usage"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L940-L975 |
42,459 | imbo/imboclient-php | src/ImboClient/ImboClient.php | ImboClient.validateLocalFile | private function validateLocalFile($path) {
if (!is_file($path)) {
throw new InvalidArgumentException('File does not exist: ' . $path);
}
if (!filesize($path)) {
throw new InvalidArgumentException('File is of zero length: ' . $path);
}
} | php | private function validateLocalFile($path) {
if (!is_file($path)) {
throw new InvalidArgumentException('File does not exist: ' . $path);
}
if (!filesize($path)) {
throw new InvalidArgumentException('File is of zero length: ' . $path);
}
} | [
"private",
"function",
"validateLocalFile",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'File does not exist: '",
".",
"$",
"path",
")",
";",
"}",
"if",
"(",
"!... | Helper method to make sure a local file exists, and that it is not empty
@param string $path The path to a local file
@throws InvalidArgumentException | [
"Helper",
"method",
"to",
"make",
"sure",
"a",
"local",
"file",
"exists",
"and",
"that",
"it",
"is",
"not",
"empty"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImboClient.php#L983-L991 |
42,460 | imbo/imboclient-php | src/ImboClient/ImagesQuery.php | ImagesQuery.metadata | public function metadata($metadata = null) {
if ($metadata === null) {
return $this->metadata;
}
$this->metadata = (bool) $metadata;
return $this;
} | php | public function metadata($metadata = null) {
if ($metadata === null) {
return $this->metadata;
}
$this->metadata = (bool) $metadata;
return $this;
} | [
"public",
"function",
"metadata",
"(",
"$",
"metadata",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"metadata",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"metadata",
";",
"}",
"$",
"this",
"->",
"metadata",
"=",
"(",
"bool",
")",
"$",
"metad... | Set or get the metadata flag
@param boolean $metadata Give this a value to set the metadata flag
@return boolean|self | [
"Set",
"or",
"get",
"the",
"metadata",
"flag"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImagesQuery.php#L82-L90 |
42,461 | imbo/imboclient-php | src/ImboClient/ImagesQuery.php | ImagesQuery.from | public function from($from = null) {
if ($from === null) {
return $this->from;
}
$this->from = (int) $from;
return $this;
} | php | public function from($from = null) {
if ($from === null) {
return $this->from;
}
$this->from = (int) $from;
return $this;
} | [
"public",
"function",
"from",
"(",
"$",
"from",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"from",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"from",
";",
"}",
"$",
"this",
"->",
"from",
"=",
"(",
"int",
")",
"$",
"from",
";",
"return",
... | Set or get the from attribute
@param int $from Give this a value to set the from property
@return int|self | [
"Set",
"or",
"get",
"the",
"from",
"attribute"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImagesQuery.php#L98-L106 |
42,462 | imbo/imboclient-php | src/ImboClient/ImagesQuery.php | ImagesQuery.to | public function to($to = null) {
if ($to === null) {
return $this->to;
}
$this->to = (int) $to;
return $this;
} | php | public function to($to = null) {
if ($to === null) {
return $this->to;
}
$this->to = (int) $to;
return $this;
} | [
"public",
"function",
"to",
"(",
"$",
"to",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"to",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"to",
";",
"}",
"$",
"this",
"->",
"to",
"=",
"(",
"int",
")",
"$",
"to",
";",
"return",
"$",
"th... | Set or get the to attribute
@param int $to Give this a value to set the to property
@return int|self | [
"Set",
"or",
"get",
"the",
"to",
"attribute"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImagesQuery.php#L114-L122 |
42,463 | imbo/imboclient-php | src/ImboClient/ImagesQuery.php | ImagesQuery.fields | public function fields(array $fields = null) {
if ($fields === null) {
return $this->fields;
}
$this->fields = $fields;
return $this;
} | php | public function fields(array $fields = null) {
if ($fields === null) {
return $this->fields;
}
$this->fields = $fields;
return $this;
} | [
"public",
"function",
"fields",
"(",
"array",
"$",
"fields",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"fields",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"fields",
";",
"}",
"$",
"this",
"->",
"fields",
"=",
"$",
"fields",
";",
"return",
... | Set or get the fields attribute
@param string[] $fields Give this a value to set the fields property
@return string[]|self | [
"Set",
"or",
"get",
"the",
"fields",
"attribute"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImagesQuery.php#L130-L138 |
42,464 | imbo/imboclient-php | src/ImboClient/ImagesQuery.php | ImagesQuery.sort | public function sort(array $sort = null) {
if ($sort === null) {
return $this->sort;
}
$this->sort = $sort;
return $this;
} | php | public function sort(array $sort = null) {
if ($sort === null) {
return $this->sort;
}
$this->sort = $sort;
return $this;
} | [
"public",
"function",
"sort",
"(",
"array",
"$",
"sort",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"sort",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"sort",
";",
"}",
"$",
"this",
"->",
"sort",
"=",
"$",
"sort",
";",
"return",
"$",
"th... | Set or get the sort attribute
@param string[] $sort Give this a value to set the sort property
@return string[]|self | [
"Set",
"or",
"get",
"the",
"sort",
"attribute"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImagesQuery.php#L146-L154 |
42,465 | imbo/imboclient-php | src/ImboClient/ImagesQuery.php | ImagesQuery.ids | public function ids(array $ids = null) {
if ($ids === null) {
return $this->ids;
}
$this->ids = $ids;
return $this;
} | php | public function ids(array $ids = null) {
if ($ids === null) {
return $this->ids;
}
$this->ids = $ids;
return $this;
} | [
"public",
"function",
"ids",
"(",
"array",
"$",
"ids",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"ids",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"ids",
";",
"}",
"$",
"this",
"->",
"ids",
"=",
"$",
"ids",
";",
"return",
"$",
"this",
... | Set or get the ids attribute
@param string[] $ids Give this a value to set the ids property
@return string[]|self | [
"Set",
"or",
"get",
"the",
"ids",
"attribute"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImagesQuery.php#L162-L170 |
42,466 | imbo/imboclient-php | src/ImboClient/ImagesQuery.php | ImagesQuery.checksums | public function checksums(array $checksums = null) {
if ($checksums === null) {
return $this->checksums;
}
$this->checksums = $checksums;
return $this;
} | php | public function checksums(array $checksums = null) {
if ($checksums === null) {
return $this->checksums;
}
$this->checksums = $checksums;
return $this;
} | [
"public",
"function",
"checksums",
"(",
"array",
"$",
"checksums",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"checksums",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"checksums",
";",
"}",
"$",
"this",
"->",
"checksums",
"=",
"$",
"checksums",
... | Set or get the checksums attribute
@param string[] $checksums Give this a value to set the checksums property
@return string[]|self | [
"Set",
"or",
"get",
"the",
"checksums",
"attribute"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImagesQuery.php#L178-L186 |
42,467 | imbo/imboclient-php | src/ImboClient/ImagesQuery.php | ImagesQuery.originalChecksums | public function originalChecksums(array $checksums = null) {
if ($checksums === null) {
return $this->originalChecksums;
}
$this->originalChecksums = $checksums;
return $this;
} | php | public function originalChecksums(array $checksums = null) {
if ($checksums === null) {
return $this->originalChecksums;
}
$this->originalChecksums = $checksums;
return $this;
} | [
"public",
"function",
"originalChecksums",
"(",
"array",
"$",
"checksums",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"checksums",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"originalChecksums",
";",
"}",
"$",
"this",
"->",
"originalChecksums",
"=",... | Set or get the originalChecksums attribute
@param string[] $checksums Give this a value to set the originalChecksums property
@return string[]|self | [
"Set",
"or",
"get",
"the",
"originalChecksums",
"attribute"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/ImagesQuery.php#L194-L202 |
42,468 | imbo/imboclient-php | src/ImboClient/EventSubscriber/AccessToken.php | AccessToken.appendAccessToken | public function appendAccessToken(Event $event) {
$command = $event['command'];
switch ($command->getName()) {
case 'GetResourceGroup':
case 'GetResourceGroups':
case 'GetAccessControlRule':
case 'GetAccessControlRules':
case 'GetUserInfo':
case 'GetImages':
case 'GetImageProperties':
case 'GetMetadata':
$request = $command->getRequest();
// Generate an access token
$accessToken = $this->getAccessToken(urldecode($request->getUrl()), $request->getClient()->getConfig('privateKey'));
// Add as query parameter
$request->getQuery()->set('accessToken', $accessToken);
break;
}
} | php | public function appendAccessToken(Event $event) {
$command = $event['command'];
switch ($command->getName()) {
case 'GetResourceGroup':
case 'GetResourceGroups':
case 'GetAccessControlRule':
case 'GetAccessControlRules':
case 'GetUserInfo':
case 'GetImages':
case 'GetImageProperties':
case 'GetMetadata':
$request = $command->getRequest();
// Generate an access token
$accessToken = $this->getAccessToken(urldecode($request->getUrl()), $request->getClient()->getConfig('privateKey'));
// Add as query parameter
$request->getQuery()->set('accessToken', $accessToken);
break;
}
} | [
"public",
"function",
"appendAccessToken",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"command",
"=",
"$",
"event",
"[",
"'command'",
"]",
";",
"switch",
"(",
"$",
"command",
"->",
"getName",
"(",
")",
")",
"{",
"case",
"'GetResourceGroup'",
":",
"case",... | Append an access token query parameter to the request URL
@param Event $event The current event | [
"Append",
"an",
"access",
"token",
"query",
"parameter",
"to",
"the",
"request",
"URL"
] | 41287eb61bf11054822468dd6cc2cdf0e220e115 | https://github.com/imbo/imboclient-php/blob/41287eb61bf11054822468dd6cc2cdf0e220e115/src/ImboClient/EventSubscriber/AccessToken.php#L41-L62 |
42,469 | nglasl/silverstripe-extensible-search | src/controllers/ExtensibleSearchPageController.php | ExtensibleSearchPageController.index | public function index() {
// Determine whether a search engine has been selected.
$engine = $this->data()->SearchEngine;
$classes = Config::inst()->get(FulltextSearchable::class, 'searchable_classes');
if(!$engine || (($engine !== 'Full-Text') && !ClassInfo::exists($engine)) || (($engine === 'Full-Text') && (!is_array($classes) || (count($classes) === 0)))) {
// The search engine has not been selected.
return $this->httpError(404);
}
// Determine whether the search page should start with a listing.
if($this->data()->StartWithListing) {
// Display some search results.
$request = $this->getRequest();
return $this->getSearchResults(array(
'Search' => $request->getVar('Search'),
'SortBy' => $request->getVar('SortBy'),
'SortDirection' => $request->getVar('SortDirection')
), $this->getForm($request));
}
else {
// Instantiate some default templates.
$templates = array(
'ExtensibleSearch',
'ExtensibleSearchPage',
'Page'
);
// Instantiate the search engine specific templates.
if($engine !== 'Full-Text') {
$explode = explode('\\', $engine);
$explode = end($explode);
$templates = array_merge(array(
$explode,
"{$explode}Page"
), $templates);
}
// Determine the template to use.
$this->extend('updateTemplates', $templates);
return $this->renderWith($templates);
}
} | php | public function index() {
// Determine whether a search engine has been selected.
$engine = $this->data()->SearchEngine;
$classes = Config::inst()->get(FulltextSearchable::class, 'searchable_classes');
if(!$engine || (($engine !== 'Full-Text') && !ClassInfo::exists($engine)) || (($engine === 'Full-Text') && (!is_array($classes) || (count($classes) === 0)))) {
// The search engine has not been selected.
return $this->httpError(404);
}
// Determine whether the search page should start with a listing.
if($this->data()->StartWithListing) {
// Display some search results.
$request = $this->getRequest();
return $this->getSearchResults(array(
'Search' => $request->getVar('Search'),
'SortBy' => $request->getVar('SortBy'),
'SortDirection' => $request->getVar('SortDirection')
), $this->getForm($request));
}
else {
// Instantiate some default templates.
$templates = array(
'ExtensibleSearch',
'ExtensibleSearchPage',
'Page'
);
// Instantiate the search engine specific templates.
if($engine !== 'Full-Text') {
$explode = explode('\\', $engine);
$explode = end($explode);
$templates = array_merge(array(
$explode,
"{$explode}Page"
), $templates);
}
// Determine the template to use.
$this->extend('updateTemplates', $templates);
return $this->renderWith($templates);
}
} | [
"public",
"function",
"index",
"(",
")",
"{",
"// Determine whether a search engine has been selected.",
"$",
"engine",
"=",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"SearchEngine",
";",
"$",
"classes",
"=",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"... | Determine whether the search page should start with a listing. | [
"Determine",
"whether",
"the",
"search",
"page",
"should",
"start",
"with",
"a",
"listing",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/controllers/ExtensibleSearchPageController.php#L38-L90 |
42,470 | nglasl/silverstripe-extensible-search | src/controllers/ExtensibleSearchPageController.php | ExtensibleSearchPageController.getForm | public function getForm($request = null, $sorting = true) {
// Determine whether a search engine has been selected.
$engine = $this->data()->SearchEngine;
$configuration = Config::inst();
$classes = $configuration->get(FulltextSearchable::class, 'searchable_classes');
if(!$engine || (($engine !== 'Full-Text') && !ClassInfo::exists($engine)) || (($engine === 'Full-Text') && (!is_array($classes) || (count($classes) === 0)))) {
// The search engine has not been selected.
return null;
}
// Determine whether the request has been passed through.
if(is_null($request)) {
$request = $this->getRequest();
}
// Display the search.
$fields = FieldList::create(
TextField::create(
'Search',
_t('EXTENSIBLE_SEARCH.SEARCH', 'Search'),
$request->getVar('Search')
)->addExtraClass('extensible-search')->setAttribute('data-suggestions-enabled', $configuration->get(ExtensibleSearchSuggestion::class, 'enable_suggestions') ? 'true' : 'false')->setAttribute('data-extensible-search-page', $this->data()->ID)
);
// Determine whether sorting has been passed through from the template.
if(is_string($sorting)) {
$sorting = ($sorting === 'true');
}
// Determine whether to display the sorting selection.
if($sorting) {
// Display the sorting selection.
$fields->push(DropdownField::create(
'SortBy',
_t('EXTENSIBLE_SEARCH.SORT_BY', 'Sort By'),
$this->data()->getSelectableFields(),
$request->getVar('SortBy') ? $request->getVar('SortBy') : $this->data()->SortBy
)->setHasEmptyDefault(true));
$fields->push(DropdownField::create(
'SortDirection',
_t('EXTENSIBLE_SEARCH.SORT_DIRECTION', 'Sort Direction'),
array(
'DESC' => _t('EXTENSIBLE_SEARCH.DESCENDING', 'Descending'),
'ASC' => _t('EXTENSIBLE_SEARCH.ASCENDING', 'Ascending')
),
$request->getVar('SortDirection') ? $request->getVar('SortDirection') : $this->data()->SortDirection
)->setHasEmptyDefault(true));
}
// Instantiate the search form.
$form = SearchForm::create(
$this,
'getForm',
$fields,
FieldList::create(
FormAction::create(
'getSearchResults',
_t('EXTENSIBLE_SEARCH.GO', 'Go')
)
)
);
// When using the full-text search engine, the classes to search needs to be initialised.
if($engine === 'Full-Text') {
$form->classesToSearch($classes);
}
// Allow extension customisation.
$this->extend('updateExtensibleSearchForm', $form);
return $form;
} | php | public function getForm($request = null, $sorting = true) {
// Determine whether a search engine has been selected.
$engine = $this->data()->SearchEngine;
$configuration = Config::inst();
$classes = $configuration->get(FulltextSearchable::class, 'searchable_classes');
if(!$engine || (($engine !== 'Full-Text') && !ClassInfo::exists($engine)) || (($engine === 'Full-Text') && (!is_array($classes) || (count($classes) === 0)))) {
// The search engine has not been selected.
return null;
}
// Determine whether the request has been passed through.
if(is_null($request)) {
$request = $this->getRequest();
}
// Display the search.
$fields = FieldList::create(
TextField::create(
'Search',
_t('EXTENSIBLE_SEARCH.SEARCH', 'Search'),
$request->getVar('Search')
)->addExtraClass('extensible-search')->setAttribute('data-suggestions-enabled', $configuration->get(ExtensibleSearchSuggestion::class, 'enable_suggestions') ? 'true' : 'false')->setAttribute('data-extensible-search-page', $this->data()->ID)
);
// Determine whether sorting has been passed through from the template.
if(is_string($sorting)) {
$sorting = ($sorting === 'true');
}
// Determine whether to display the sorting selection.
if($sorting) {
// Display the sorting selection.
$fields->push(DropdownField::create(
'SortBy',
_t('EXTENSIBLE_SEARCH.SORT_BY', 'Sort By'),
$this->data()->getSelectableFields(),
$request->getVar('SortBy') ? $request->getVar('SortBy') : $this->data()->SortBy
)->setHasEmptyDefault(true));
$fields->push(DropdownField::create(
'SortDirection',
_t('EXTENSIBLE_SEARCH.SORT_DIRECTION', 'Sort Direction'),
array(
'DESC' => _t('EXTENSIBLE_SEARCH.DESCENDING', 'Descending'),
'ASC' => _t('EXTENSIBLE_SEARCH.ASCENDING', 'Ascending')
),
$request->getVar('SortDirection') ? $request->getVar('SortDirection') : $this->data()->SortDirection
)->setHasEmptyDefault(true));
}
// Instantiate the search form.
$form = SearchForm::create(
$this,
'getForm',
$fields,
FieldList::create(
FormAction::create(
'getSearchResults',
_t('EXTENSIBLE_SEARCH.GO', 'Go')
)
)
);
// When using the full-text search engine, the classes to search needs to be initialised.
if($engine === 'Full-Text') {
$form->classesToSearch($classes);
}
// Allow extension customisation.
$this->extend('updateExtensibleSearchForm', $form);
return $form;
} | [
"public",
"function",
"getForm",
"(",
"$",
"request",
"=",
"null",
",",
"$",
"sorting",
"=",
"true",
")",
"{",
"// Determine whether a search engine has been selected.",
"$",
"engine",
"=",
"$",
"this",
"->",
"data",
"(",
")",
"->",
"SearchEngine",
";",
"$",
... | Instantiate the search form.
@parameter <{REQUEST}> http request
@parameter <{DISPLAY_SORTING}> boolean
@return search form | [
"Instantiate",
"the",
"search",
"form",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/controllers/ExtensibleSearchPageController.php#L100-L183 |
42,471 | nglasl/silverstripe-extensible-search | src/pages/ExtensibleSearchPage.php | ExtensibleSearchPage.requireDefaultRecords | public function requireDefaultRecords() {
parent::requireDefaultRecords();
$stage = Versioned::get_stage() ?: 'Stage';
Versioned::set_stage('Stage');
// Determine whether pages should be created.
if(!self::config()->create_default_pages) {
return;
}
// This is required to support multiple sites.
if(ClassInfo::exists(Multisites::class)) {
foreach(Site::get() as $site) {
// The problem is that class name mapping happens after this, but we need it right now to query pages.
if(!SiteTree::get()->filter(array(
'ClassName' => array(
ExtensibleSearchPage::class,
'ExtensibleSearchPage'
),
'SiteID' => $site->ID
))->first()) {
// Instantiate an extensible search page.
$page = ExtensibleSearchPage::create();
$page->ParentID = $site->ID;
$page->Title = 'Search Page';
$page->write();
DB::alteration_message("\"{$site->Title}\" Extensible Search Page", 'created');
}
}
}
else {
// The problem is that class name mapping happens after this, but we need it right now to query pages.
if(!SiteTree::get()->filter('ClassName', array(
ExtensibleSearchPage::class,
'ExtensibleSearchPage'
))->first()) {
// Instantiate an extensible search page.
$page = ExtensibleSearchPage::create();
$page->Title = 'Search Page';
$page->write();
DB::alteration_message('"Default" Extensible Search Page', 'created');
}
}
Versioned::set_stage($stage);
} | php | public function requireDefaultRecords() {
parent::requireDefaultRecords();
$stage = Versioned::get_stage() ?: 'Stage';
Versioned::set_stage('Stage');
// Determine whether pages should be created.
if(!self::config()->create_default_pages) {
return;
}
// This is required to support multiple sites.
if(ClassInfo::exists(Multisites::class)) {
foreach(Site::get() as $site) {
// The problem is that class name mapping happens after this, but we need it right now to query pages.
if(!SiteTree::get()->filter(array(
'ClassName' => array(
ExtensibleSearchPage::class,
'ExtensibleSearchPage'
),
'SiteID' => $site->ID
))->first()) {
// Instantiate an extensible search page.
$page = ExtensibleSearchPage::create();
$page->ParentID = $site->ID;
$page->Title = 'Search Page';
$page->write();
DB::alteration_message("\"{$site->Title}\" Extensible Search Page", 'created');
}
}
}
else {
// The problem is that class name mapping happens after this, but we need it right now to query pages.
if(!SiteTree::get()->filter('ClassName', array(
ExtensibleSearchPage::class,
'ExtensibleSearchPage'
))->first()) {
// Instantiate an extensible search page.
$page = ExtensibleSearchPage::create();
$page->Title = 'Search Page';
$page->write();
DB::alteration_message('"Default" Extensible Search Page', 'created');
}
}
Versioned::set_stage($stage);
} | [
"public",
"function",
"requireDefaultRecords",
"(",
")",
"{",
"parent",
"::",
"requireDefaultRecords",
"(",
")",
";",
"$",
"stage",
"=",
"Versioned",
"::",
"get_stage",
"(",
")",
"?",
":",
"'Stage'",
";",
"Versioned",
"::",
"set_stage",
"(",
"'Stage'",
")",
... | Instantiate a search page, should one not exist. | [
"Instantiate",
"a",
"search",
"page",
"should",
"one",
"not",
"exist",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/pages/ExtensibleSearchPage.php#L86-L141 |
42,472 | nglasl/silverstripe-extensible-search | src/pages/ExtensibleSearchPage.php | ExtensibleSearchPage.getSelectableFields | public function getSelectableFields() {
// Instantiate some default selectable fields, just in case the search engine does not provide any.
$selectable = array(
'LastEdited' => _t('EXTENSIBLE_SEARCH.LAST_EDITED', 'Last Edited'),
'ID' => _t('EXTENSIBLE_SEARCH.CREATED', 'Created'),
'ClassName' => _t('EXTENSIBLE_SEARCH.TYPE', 'Type')
);
// Determine the search engine that has been selected.
if(($this->SearchEngine !== 'Full-Text') && ClassInfo::exists($this->SearchEngine)) {
// Determine the search engine specific selectable fields.
$fields = singleton($this->SearchEngine)->getSelectableFields($this) ?: array();
return $fields + $selectable;
}
else if(($this->SearchEngine === 'Full-Text') && is_array($classes = Config::inst()->get(FulltextSearchable::class, 'searchable_classes')) && (count($classes) > 0)) {
// Determine the full-text specific selectable fields.
$selectable = array(
'Relevance' => _t('EXTENSIBLE_SEARCH.RELEVANCE', 'Relevance')
) + $selectable;
foreach($classes as $class) {
$fields = DataObject::getSchema()->databaseFields($class);
// Determine the most appropriate fields, primarily for sorting.
if(isset($fields['Title'])) {
$selectable['Title'] = _t('EXTENSIBLE_SEARCH.TITLE', 'Title');
}
if(isset($fields['MenuTitle'])) {
$selectable['MenuTitle'] = _t('EXTENSIBLE_SEARCH.NAVIGATION_TITLE', 'Navigation Title');
}
if(isset($fields['Sort'])) {
$selectable['Sort'] = _t('EXTENSIBLE_SEARCH.DISPLAY_ORDER', 'Display Order');
}
// This is specific to file searching.
if(isset($fields['Name'])) {
$selectable['Name'] = _t('EXTENSIBLE_SEARCH.FILE_NAME', 'File Name');
}
}
}
// Allow extension customisation, so custom fields may be selectable.
$this->extend('updateExtensibleSearchPageSelectableFields', $selectable);
return $selectable;
} | php | public function getSelectableFields() {
// Instantiate some default selectable fields, just in case the search engine does not provide any.
$selectable = array(
'LastEdited' => _t('EXTENSIBLE_SEARCH.LAST_EDITED', 'Last Edited'),
'ID' => _t('EXTENSIBLE_SEARCH.CREATED', 'Created'),
'ClassName' => _t('EXTENSIBLE_SEARCH.TYPE', 'Type')
);
// Determine the search engine that has been selected.
if(($this->SearchEngine !== 'Full-Text') && ClassInfo::exists($this->SearchEngine)) {
// Determine the search engine specific selectable fields.
$fields = singleton($this->SearchEngine)->getSelectableFields($this) ?: array();
return $fields + $selectable;
}
else if(($this->SearchEngine === 'Full-Text') && is_array($classes = Config::inst()->get(FulltextSearchable::class, 'searchable_classes')) && (count($classes) > 0)) {
// Determine the full-text specific selectable fields.
$selectable = array(
'Relevance' => _t('EXTENSIBLE_SEARCH.RELEVANCE', 'Relevance')
) + $selectable;
foreach($classes as $class) {
$fields = DataObject::getSchema()->databaseFields($class);
// Determine the most appropriate fields, primarily for sorting.
if(isset($fields['Title'])) {
$selectable['Title'] = _t('EXTENSIBLE_SEARCH.TITLE', 'Title');
}
if(isset($fields['MenuTitle'])) {
$selectable['MenuTitle'] = _t('EXTENSIBLE_SEARCH.NAVIGATION_TITLE', 'Navigation Title');
}
if(isset($fields['Sort'])) {
$selectable['Sort'] = _t('EXTENSIBLE_SEARCH.DISPLAY_ORDER', 'Display Order');
}
// This is specific to file searching.
if(isset($fields['Name'])) {
$selectable['Name'] = _t('EXTENSIBLE_SEARCH.FILE_NAME', 'File Name');
}
}
}
// Allow extension customisation, so custom fields may be selectable.
$this->extend('updateExtensibleSearchPageSelectableFields', $selectable);
return $selectable;
} | [
"public",
"function",
"getSelectableFields",
"(",
")",
"{",
"// Instantiate some default selectable fields, just in case the search engine does not provide any.",
"$",
"selectable",
"=",
"array",
"(",
"'LastEdited'",
"=>",
"_t",
"(",
"'EXTENSIBLE_SEARCH.LAST_EDITED'",
",",
"'Last... | Determine the search engine specific selectable fields, primarily for sorting.
@return array(string, string) | [
"Determine",
"the",
"search",
"engine",
"specific",
"selectable",
"fields",
"primarily",
"for",
"sorting",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/pages/ExtensibleSearchPage.php#L418-L471 |
42,473 | nglasl/silverstripe-extensible-search | src/pages/ExtensibleSearchPage.php | ExtensibleSearchPage.getHistorySummary | public function getHistorySummary() {
$history = $this->History();
$query = new SQLSelect(
"Term, COUNT(*) AS Frequency, ((COUNT(*) * 100.00) / {$history->count()}) AS FrequencyPercentage, AVG(Time) AS AverageTimeTaken, (Results > 0) AS Results",
'ExtensibleSearch',
"ExtensibleSearchPageID = {$this->ID}",
array(
'Frequency' => 'DESC',
'Term' => 'ASC'
),
array(
'Term',
'Results'
)
);
// These will require display formatting.
$analytics = ArrayList::create();
foreach($query->execute() as $result) {
$result = ArrayData::create(
$result
);
$result->FrequencyPercentage = sprintf('%.2f %%', $result->FrequencyPercentage);
$result->AverageTimeTaken = sprintf('%.5f', $result->AverageTimeTaken);
$result->Results = $result->Results ? _t('EXTENSIBLE_SEARCH.TRUE', 'true') : _t('EXTENSIBLE_SEARCH.FALSE', 'false');
$analytics->push($result);
}
return $analytics;
} | php | public function getHistorySummary() {
$history = $this->History();
$query = new SQLSelect(
"Term, COUNT(*) AS Frequency, ((COUNT(*) * 100.00) / {$history->count()}) AS FrequencyPercentage, AVG(Time) AS AverageTimeTaken, (Results > 0) AS Results",
'ExtensibleSearch',
"ExtensibleSearchPageID = {$this->ID}",
array(
'Frequency' => 'DESC',
'Term' => 'ASC'
),
array(
'Term',
'Results'
)
);
// These will require display formatting.
$analytics = ArrayList::create();
foreach($query->execute() as $result) {
$result = ArrayData::create(
$result
);
$result->FrequencyPercentage = sprintf('%.2f %%', $result->FrequencyPercentage);
$result->AverageTimeTaken = sprintf('%.5f', $result->AverageTimeTaken);
$result->Results = $result->Results ? _t('EXTENSIBLE_SEARCH.TRUE', 'true') : _t('EXTENSIBLE_SEARCH.FALSE', 'false');
$analytics->push($result);
}
return $analytics;
} | [
"public",
"function",
"getHistorySummary",
"(",
")",
"{",
"$",
"history",
"=",
"$",
"this",
"->",
"History",
"(",
")",
";",
"$",
"query",
"=",
"new",
"SQLSelect",
"(",
"\"Term, COUNT(*) AS Frequency, ((COUNT(*) * 100.00) / {$history->count()}) AS FrequencyPercentage, AVG(... | Determine the search page specific analytics.
@return array list | [
"Determine",
"the",
"search",
"page",
"specific",
"analytics",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/pages/ExtensibleSearchPage.php#L479-L509 |
42,474 | nglasl/silverstripe-extensible-search | src/objects/ExtensibleSearch.php | ExtensibleSearch.getSearchEngineSummary | public function getSearchEngineSummary() {
$configuration = Config::inst()->get(ExtensibleSearchPage::class, 'custom_search_engines');
return isset($configuration[$this->SearchEngine]) ? $configuration[$this->SearchEngine] : $this->SearchEngine;
} | php | public function getSearchEngineSummary() {
$configuration = Config::inst()->get(ExtensibleSearchPage::class, 'custom_search_engines');
return isset($configuration[$this->SearchEngine]) ? $configuration[$this->SearchEngine] : $this->SearchEngine;
} | [
"public",
"function",
"getSearchEngineSummary",
"(",
")",
"{",
"$",
"configuration",
"=",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
"(",
"ExtensibleSearchPage",
"::",
"class",
",",
"'custom_search_engines'",
")",
";",
"return",
"isset",
"(",
"$",
"configu... | Retrieve the search engine for display purposes.
@return string | [
"Retrieve",
"the",
"search",
"engine",
"for",
"display",
"purposes",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/objects/ExtensibleSearch.php#L77-L81 |
42,475 | nglasl/silverstripe-extensible-search | src/services/ExtensibleSearchService.php | ExtensibleSearchService.logSearch | public function logSearch($term, $results, $time, $engine, $pageID) {
// Make sure the search analytics are enabled.
if(!Config::inst()->get(ExtensibleSearch::class, 'enable_analytics')) {
return null;
}
// Log the details of the user search.
$search = ExtensibleSearch::create(
array(
'Term' => $term,
'Results' => $results,
'Time' => $time,
'SearchEngine' => $engine,
'ExtensibleSearchPageID' => $pageID
)
);
$search->write();
// Log the details of the user search as a suggestion.
if($results > 0) {
$this->logSuggestion($term, $pageID);
}
return $search;
} | php | public function logSearch($term, $results, $time, $engine, $pageID) {
// Make sure the search analytics are enabled.
if(!Config::inst()->get(ExtensibleSearch::class, 'enable_analytics')) {
return null;
}
// Log the details of the user search.
$search = ExtensibleSearch::create(
array(
'Term' => $term,
'Results' => $results,
'Time' => $time,
'SearchEngine' => $engine,
'ExtensibleSearchPageID' => $pageID
)
);
$search->write();
// Log the details of the user search as a suggestion.
if($results > 0) {
$this->logSuggestion($term, $pageID);
}
return $search;
} | [
"public",
"function",
"logSearch",
"(",
"$",
"term",
",",
"$",
"results",
",",
"$",
"time",
",",
"$",
"engine",
",",
"$",
"pageID",
")",
"{",
"// Make sure the search analytics are enabled.",
"if",
"(",
"!",
"Config",
"::",
"inst",
"(",
")",
"->",
"get",
... | Log the details of a user search for analytics.
@parameter <{SEARCH_TERM}> string
@parameter <{NUMBER_OF_SEARCH_RESULTS}> integer
@parameter <{SEARCH_TIME}> float
@parameter <{SEARCH_ENGINE}> string
@parameter <{EXTENSIBLE_SEARCH_PAGE_ID}> integer
@return extensible search | [
"Log",
"the",
"details",
"of",
"a",
"user",
"search",
"for",
"analytics",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/services/ExtensibleSearchService.php#L26-L53 |
42,476 | nglasl/silverstripe-extensible-search | src/services/ExtensibleSearchService.php | ExtensibleSearchService.logSuggestion | public function logSuggestion($term, $pageID) {
// Make sure the search matches the minimum autocomplete length.
if(strlen($term) < 3) {
return null;
}
// Make sure the suggestion doesn't already exist.
$term = strtolower($term);
$filter = array(
'Term' => $term,
'ExtensibleSearchPageID' => $pageID
);
$suggestion = ExtensibleSearchSuggestion::get()->filter($filter)->first();
// Store the frequency to make search suggestion relevance more efficient.
$frequency = ExtensibleSearch::get()->filter($filter)->count();
if($suggestion) {
$suggestion->Frequency = $frequency;
}
else {
// Log the suggestion.
$suggestion = ExtensibleSearchSuggestion::create(
array(
'Term' => $term,
'Frequency' => $frequency,
'Approved' => (int)Config::inst()->get(ExtensibleSearchSuggestion::class, 'automatic_approval'),
'ExtensibleSearchPageID' => $pageID
)
);
}
// The suggestion might now exist.
try {
$suggestion->write();
}
catch(ValidationException $exception) {
// This indicates a possible race condition.
$suggestions = ExtensibleSearchSuggestion::get()->filter($filter);
while($suggestions->count() > 1) {
$suggestions->last()->delete();
}
$suggestion = $suggestions->first();
$frequency = ExtensibleSearch::get()->filter($filter)->count();
$suggestion->Frequency = $frequency;
$suggestion->write();
}
return $suggestion;
} | php | public function logSuggestion($term, $pageID) {
// Make sure the search matches the minimum autocomplete length.
if(strlen($term) < 3) {
return null;
}
// Make sure the suggestion doesn't already exist.
$term = strtolower($term);
$filter = array(
'Term' => $term,
'ExtensibleSearchPageID' => $pageID
);
$suggestion = ExtensibleSearchSuggestion::get()->filter($filter)->first();
// Store the frequency to make search suggestion relevance more efficient.
$frequency = ExtensibleSearch::get()->filter($filter)->count();
if($suggestion) {
$suggestion->Frequency = $frequency;
}
else {
// Log the suggestion.
$suggestion = ExtensibleSearchSuggestion::create(
array(
'Term' => $term,
'Frequency' => $frequency,
'Approved' => (int)Config::inst()->get(ExtensibleSearchSuggestion::class, 'automatic_approval'),
'ExtensibleSearchPageID' => $pageID
)
);
}
// The suggestion might now exist.
try {
$suggestion->write();
}
catch(ValidationException $exception) {
// This indicates a possible race condition.
$suggestions = ExtensibleSearchSuggestion::get()->filter($filter);
while($suggestions->count() > 1) {
$suggestions->last()->delete();
}
$suggestion = $suggestions->first();
$frequency = ExtensibleSearch::get()->filter($filter)->count();
$suggestion->Frequency = $frequency;
$suggestion->write();
}
return $suggestion;
} | [
"public",
"function",
"logSuggestion",
"(",
"$",
"term",
",",
"$",
"pageID",
")",
"{",
"// Make sure the search matches the minimum autocomplete length.",
"if",
"(",
"strlen",
"(",
"$",
"term",
")",
"<",
"3",
")",
"{",
"return",
"null",
";",
"}",
"// Make sure t... | Log a user search generated suggestion.
@parameter <{SEARCH_TERM}> string
@parameter <{EXTENSIBLE_SEARCH_PAGE_ID}> integer
@return extensible search suggestion | [
"Log",
"a",
"user",
"search",
"generated",
"suggestion",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/services/ExtensibleSearchService.php#L63-L119 |
42,477 | nglasl/silverstripe-extensible-search | src/services/ExtensibleSearchService.php | ExtensibleSearchService.getPageSuggestions | public function getPageSuggestions($pageID, $limit = 0, $approved = true) {
// Make sure the current user has appropriate permission.
$pageID = (int)$pageID;
if(($page = ExtensibleSearchPage::get_by_id(ExtensibleSearchPage::class, $pageID)) && $page->canView()) {
// Retrieve the search suggestions.
$suggestions = ExtensibleSearchSuggestion::get()->filter(array(
'Approved' => (int)$approved,
'ExtensibleSearchPageID' => $pageID
))->sort('Frequency', 'DESC');
if($limit) {
$suggestions = $suggestions->limit($limit);
}
// Make sure the search suggestions are unique.
return $suggestions->column('Term');
}
return array();
} | php | public function getPageSuggestions($pageID, $limit = 0, $approved = true) {
// Make sure the current user has appropriate permission.
$pageID = (int)$pageID;
if(($page = ExtensibleSearchPage::get_by_id(ExtensibleSearchPage::class, $pageID)) && $page->canView()) {
// Retrieve the search suggestions.
$suggestions = ExtensibleSearchSuggestion::get()->filter(array(
'Approved' => (int)$approved,
'ExtensibleSearchPageID' => $pageID
))->sort('Frequency', 'DESC');
if($limit) {
$suggestions = $suggestions->limit($limit);
}
// Make sure the search suggestions are unique.
return $suggestions->column('Term');
}
return array();
} | [
"public",
"function",
"getPageSuggestions",
"(",
"$",
"pageID",
",",
"$",
"limit",
"=",
"0",
",",
"$",
"approved",
"=",
"true",
")",
"{",
"// Make sure the current user has appropriate permission.",
"$",
"pageID",
"=",
"(",
"int",
")",
"$",
"pageID",
";",
"if"... | Retrieve the search suggestions for a page.
@parameter <{EXTENSIBLE_SEARCH_PAGE_ID}> integer
@parameter <{LIMIT}> integer
@parameter <{APPROVED_ONLY}> boolean
@return array | [
"Retrieve",
"the",
"search",
"suggestions",
"for",
"a",
"page",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/services/ExtensibleSearchService.php#L157-L179 |
42,478 | nglasl/silverstripe-extensible-search | src/services/ExtensibleSearchService.php | ExtensibleSearchService.getSuggestions | public function getSuggestions($term, $pageID, $limit = 5, $approved = true) {
// Make sure the search matches the minimum autocomplete length.
if($term && (strlen($term) > 2)) {
// Make sure the current user has appropriate permission.
$pageID = (int)$pageID;
if(($page = ExtensibleSearchPage::get_by_id(ExtensibleSearchPage::class, $pageID)) && $page->canView()) {
// Retrieve the search suggestions.
$suggestions = ExtensibleSearchSuggestion::get()->filter(array(
'Term:StartsWith' => $term,
'Approved' => (int)$approved,
'ExtensibleSearchPageID' => $pageID
))->sort('Frequency', 'DESC')->limit($limit);
// Make sure the search suggestions are unique.
return $suggestions->column('Term');
}
}
return array();
} | php | public function getSuggestions($term, $pageID, $limit = 5, $approved = true) {
// Make sure the search matches the minimum autocomplete length.
if($term && (strlen($term) > 2)) {
// Make sure the current user has appropriate permission.
$pageID = (int)$pageID;
if(($page = ExtensibleSearchPage::get_by_id(ExtensibleSearchPage::class, $pageID)) && $page->canView()) {
// Retrieve the search suggestions.
$suggestions = ExtensibleSearchSuggestion::get()->filter(array(
'Term:StartsWith' => $term,
'Approved' => (int)$approved,
'ExtensibleSearchPageID' => $pageID
))->sort('Frequency', 'DESC')->limit($limit);
// Make sure the search suggestions are unique.
return $suggestions->column('Term');
}
}
return array();
} | [
"public",
"function",
"getSuggestions",
"(",
"$",
"term",
",",
"$",
"pageID",
",",
"$",
"limit",
"=",
"5",
",",
"$",
"approved",
"=",
"true",
")",
"{",
"// Make sure the search matches the minimum autocomplete length.",
"if",
"(",
"$",
"term",
"&&",
"(",
"strl... | Retrieve the most relevant search suggestions.
@parameter <{SEARCH_TERM}> string
@parameter <{EXTENSIBLE_SEARCH_PAGE_ID}> integer
@parameter <{LIMIT}> integer
@parameter <{APPROVED_ONLY}> boolean
@return array | [
"Retrieve",
"the",
"most",
"relevant",
"search",
"suggestions",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/services/ExtensibleSearchService.php#L191-L216 |
42,479 | nglasl/silverstripe-extensible-search | src/extensions/ExtensibleSearchExtension.php | ExtensibleSearchExtension.getSearchPage | public function getSearchPage() {
$pages = ExtensibleSearchPage::get();
// This is required to support multiple sites.
if(ClassInfo::exists(Multisites::class)) {
$pages = $pages->filter('SiteID', $this->owner->SiteID);
}
return $pages->first();
} | php | public function getSearchPage() {
$pages = ExtensibleSearchPage::get();
// This is required to support multiple sites.
if(ClassInfo::exists(Multisites::class)) {
$pages = $pages->filter('SiteID', $this->owner->SiteID);
}
return $pages->first();
} | [
"public",
"function",
"getSearchPage",
"(",
")",
"{",
"$",
"pages",
"=",
"ExtensibleSearchPage",
"::",
"get",
"(",
")",
";",
"// This is required to support multiple sites.",
"if",
"(",
"ClassInfo",
"::",
"exists",
"(",
"Multisites",
"::",
"class",
")",
")",
"{"... | Retrieve the search page.
@return extensible search page | [
"Retrieve",
"the",
"search",
"page",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/extensions/ExtensibleSearchExtension.php#L42-L52 |
42,480 | nglasl/silverstripe-extensible-search | src/objects/ExtensibleSearchSuggestion.php | ExtensibleSearchSuggestion.validate | public function validate() {
$result = parent::validate();
// Confirm that the current search suggestion matches the minimum autocomplete length and doesn't already exist.
if($result->isValid() && (strlen($this->Term) < 3)) {
$result->addError('Minimum autocomplete length required!');
}
else if($result->isValid() && ExtensibleSearchSuggestion::get_one(ExtensibleSearchSuggestion::class, array(
'ID != ?' => (int)$this->ID,
'Term = ?' => $this->Term,
'ExtensibleSearchPageID = ?' => $this->ExtensibleSearchPageID
))) {
$result->addError('Suggestion already exists!');
}
// Allow extension customisation.
$this->extend('validateExtensibleSearchSuggestion', $result);
return $result;
} | php | public function validate() {
$result = parent::validate();
// Confirm that the current search suggestion matches the minimum autocomplete length and doesn't already exist.
if($result->isValid() && (strlen($this->Term) < 3)) {
$result->addError('Minimum autocomplete length required!');
}
else if($result->isValid() && ExtensibleSearchSuggestion::get_one(ExtensibleSearchSuggestion::class, array(
'ID != ?' => (int)$this->ID,
'Term = ?' => $this->Term,
'ExtensibleSearchPageID = ?' => $this->ExtensibleSearchPageID
))) {
$result->addError('Suggestion already exists!');
}
// Allow extension customisation.
$this->extend('validateExtensibleSearchSuggestion', $result);
return $result;
} | [
"public",
"function",
"validate",
"(",
")",
"{",
"$",
"result",
"=",
"parent",
"::",
"validate",
"(",
")",
";",
"// Confirm that the current search suggestion matches the minimum autocomplete length and doesn't already exist.",
"if",
"(",
"$",
"result",
"->",
"isValid",
"... | Confirm that the current search suggestion is valid. | [
"Confirm",
"that",
"the",
"current",
"search",
"suggestion",
"is",
"valid",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/objects/ExtensibleSearchSuggestion.php#L126-L147 |
42,481 | nglasl/silverstripe-extensible-search | src/objects/ExtensibleSearchSuggestion.php | ExtensibleSearchSuggestion.getFrequencyPercentage | public function getFrequencyPercentage() {
$history = ExtensibleSearch::get()->filter('ExtensibleSearchPageID', $this->ExtensibleSearchPageID);
return $this->Frequency ? sprintf('%.2f %%', ($this->Frequency / $history->count()) * 100) : '-';
} | php | public function getFrequencyPercentage() {
$history = ExtensibleSearch::get()->filter('ExtensibleSearchPageID', $this->ExtensibleSearchPageID);
return $this->Frequency ? sprintf('%.2f %%', ($this->Frequency / $history->count()) * 100) : '-';
} | [
"public",
"function",
"getFrequencyPercentage",
"(",
")",
"{",
"$",
"history",
"=",
"ExtensibleSearch",
"::",
"get",
"(",
")",
"->",
"filter",
"(",
"'ExtensibleSearchPageID'",
",",
"$",
"this",
"->",
"ExtensibleSearchPageID",
")",
";",
"return",
"$",
"this",
"... | Retrieve the frequency percentage.
@return string | [
"Retrieve",
"the",
"frequency",
"percentage",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/objects/ExtensibleSearchSuggestion.php#L176-L180 |
42,482 | nglasl/silverstripe-extensible-search | src/objects/ExtensibleSearchSuggestion.php | ExtensibleSearchSuggestion.getApprovedField | public function getApprovedField() {
$approved = CheckboxField::create(
'Approved',
'',
$this->Approved
)->addExtraClass('approved');
// Restrict this field appropriately.
$user = Member::currentUserID();
if(!Permission::checkMember($user, 'EXTENSIBLE_SEARCH_SUGGESTIONS')) {
$approved->setAttribute('disabled', 'true');
}
return $approved;
} | php | public function getApprovedField() {
$approved = CheckboxField::create(
'Approved',
'',
$this->Approved
)->addExtraClass('approved');
// Restrict this field appropriately.
$user = Member::currentUserID();
if(!Permission::checkMember($user, 'EXTENSIBLE_SEARCH_SUGGESTIONS')) {
$approved->setAttribute('disabled', 'true');
}
return $approved;
} | [
"public",
"function",
"getApprovedField",
"(",
")",
"{",
"$",
"approved",
"=",
"CheckboxField",
"::",
"create",
"(",
"'Approved'",
",",
"''",
",",
"$",
"this",
"->",
"Approved",
")",
"->",
"addExtraClass",
"(",
"'approved'",
")",
";",
"// Restrict this field a... | Retrieve the approved field for update purposes.
@return string | [
"Retrieve",
"the",
"approved",
"field",
"for",
"update",
"purposes",
"."
] | 07f1150e6214fc2780723353f02f4aadd77d0dc2 | https://github.com/nglasl/silverstripe-extensible-search/blob/07f1150e6214fc2780723353f02f4aadd77d0dc2/src/objects/ExtensibleSearchSuggestion.php#L188-L203 |
42,483 | unicodeveloper/jusibe-php-lib | src/Jusibe.php | Jusibe.sendSMS | public function sendSMS($payload = [])
{
if (empty($payload)) {
throw IsEmpty::create("Message Payload can not be empty. Please fill the appropriate details");
}
$this->performPostRequest('/smsapi/send_sms', $payload);
return $this;
} | php | public function sendSMS($payload = [])
{
if (empty($payload)) {
throw IsEmpty::create("Message Payload can not be empty. Please fill the appropriate details");
}
$this->performPostRequest('/smsapi/send_sms', $payload);
return $this;
} | [
"public",
"function",
"sendSMS",
"(",
"$",
"payload",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"payload",
")",
")",
"{",
"throw",
"IsEmpty",
"::",
"create",
"(",
"\"Message Payload can not be empty. Please fill the appropriate details\"",
")",
";",... | Send SMS using the Jusibe API
@param array $payload
@return $this | [
"Send",
"SMS",
"using",
"the",
"Jusibe",
"API"
] | 084729ebae0ad48048ae83c1124f0ff7ef8bb671 | https://github.com/unicodeveloper/jusibe-php-lib/blob/084729ebae0ad48048ae83c1124f0ff7ef8bb671/src/Jusibe.php#L109-L118 |
42,484 | unicodeveloper/jusibe-php-lib | src/Jusibe.php | Jusibe.checkDeliveryStatus | public function checkDeliveryStatus($messageID = null)
{
if (is_null($messageID)) {
throw IsNull::create("Message ID can not be empty.");
}
$this->performGetRequest("/smsapi/delivery_status?message_id={$messageID}");
return $this;
} | php | public function checkDeliveryStatus($messageID = null)
{
if (is_null($messageID)) {
throw IsNull::create("Message ID can not be empty.");
}
$this->performGetRequest("/smsapi/delivery_status?message_id={$messageID}");
return $this;
} | [
"public",
"function",
"checkDeliveryStatus",
"(",
"$",
"messageID",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"messageID",
")",
")",
"{",
"throw",
"IsNull",
"::",
"create",
"(",
"\"Message ID can not be empty.\"",
")",
";",
"}",
"$",
"this",
"... | Check the delivery status of a sent SMS
@param string $messageID
@return $this | [
"Check",
"the",
"delivery",
"status",
"of",
"a",
"sent",
"SMS"
] | 084729ebae0ad48048ae83c1124f0ff7ef8bb671 | https://github.com/unicodeveloper/jusibe-php-lib/blob/084729ebae0ad48048ae83c1124f0ff7ef8bb671/src/Jusibe.php#L136-L145 |
42,485 | MageTest/MageSpec | src/Mage/Core/Controller/Request/Http.php | Mage_Core_Controller_Request_Http.setPathInfo | public function setPathInfo($pathInfo = null)
{
if ($pathInfo === null) {
$requestUri = $this->getRequestUri();
if (null === $requestUri) {
return $this;
}
// Remove the query string from REQUEST_URI
$pos = strpos($requestUri, '?');
if ($pos) {
$requestUri = substr($requestUri, 0, $pos);
}
$baseUrl = $this->getBaseUrl();
$pathInfo = substr($requestUri, strlen($baseUrl));
if ((null !== $baseUrl) && (false === $pathInfo)) {
$pathInfo = '';
} elseif (null === $baseUrl) {
$pathInfo = $requestUri;
}
if ($this->_canBeStoreCodeInUrl()) {
$pathParts = explode('/', ltrim($pathInfo, '/'), 2);
$storeCode = $pathParts[0];
if (!$this->isDirectAccessFrontendName($storeCode)) {
$stores = Mage::app()->getStores(true, true);
if ($storeCode!=='' && isset($stores[$storeCode])) {
Mage::app()->setCurrentStore($storeCode);
$pathInfo = '/'.(isset($pathParts[1]) ? $pathParts[1] : '');
} elseif ($storeCode !== '') {
$this->setActionName('noRoute');
}
}
}
$this->_originalPathInfo = (string) $pathInfo;
$this->_requestString = $pathInfo . ($pos!==false ? substr($requestUri, $pos) : '');
}
$this->_pathInfo = (string) $pathInfo;
return $this;
} | php | public function setPathInfo($pathInfo = null)
{
if ($pathInfo === null) {
$requestUri = $this->getRequestUri();
if (null === $requestUri) {
return $this;
}
// Remove the query string from REQUEST_URI
$pos = strpos($requestUri, '?');
if ($pos) {
$requestUri = substr($requestUri, 0, $pos);
}
$baseUrl = $this->getBaseUrl();
$pathInfo = substr($requestUri, strlen($baseUrl));
if ((null !== $baseUrl) && (false === $pathInfo)) {
$pathInfo = '';
} elseif (null === $baseUrl) {
$pathInfo = $requestUri;
}
if ($this->_canBeStoreCodeInUrl()) {
$pathParts = explode('/', ltrim($pathInfo, '/'), 2);
$storeCode = $pathParts[0];
if (!$this->isDirectAccessFrontendName($storeCode)) {
$stores = Mage::app()->getStores(true, true);
if ($storeCode!=='' && isset($stores[$storeCode])) {
Mage::app()->setCurrentStore($storeCode);
$pathInfo = '/'.(isset($pathParts[1]) ? $pathParts[1] : '');
} elseif ($storeCode !== '') {
$this->setActionName('noRoute');
}
}
}
$this->_originalPathInfo = (string) $pathInfo;
$this->_requestString = $pathInfo . ($pos!==false ? substr($requestUri, $pos) : '');
}
$this->_pathInfo = (string) $pathInfo;
return $this;
} | [
"public",
"function",
"setPathInfo",
"(",
"$",
"pathInfo",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"pathInfo",
"===",
"null",
")",
"{",
"$",
"requestUri",
"=",
"$",
"this",
"->",
"getRequestUri",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"requestU... | Set the PATH_INFO string
Set the ORIGINAL_PATH_INFO string
@param string|null $pathInfo
@return Zend_Controller_Request_Http | [
"Set",
"the",
"PATH_INFO",
"string",
"Set",
"the",
"ORIGINAL_PATH_INFO",
"string"
] | c97ac743504e65d39e80bca86bbd3bba4764082f | https://github.com/MageTest/MageSpec/blob/c97ac743504e65d39e80bca86bbd3bba4764082f/src/Mage/Core/Controller/Request/Http.php#L137-L182 |
42,486 | MageTest/MageSpec | src/Mage/Core/Controller/Request/Http.php | Mage_Core_Controller_Request_Http.rewritePathInfo | public function rewritePathInfo($pathInfo)
{
if (($pathInfo != $this->getPathInfo()) && ($this->_rewritedPathInfo === null)) {
$this->_rewritedPathInfo = explode('/', trim($this->getPathInfo(), '/'));
}
$this->setPathInfo($pathInfo);
return $this;
} | php | public function rewritePathInfo($pathInfo)
{
if (($pathInfo != $this->getPathInfo()) && ($this->_rewritedPathInfo === null)) {
$this->_rewritedPathInfo = explode('/', trim($this->getPathInfo(), '/'));
}
$this->setPathInfo($pathInfo);
return $this;
} | [
"public",
"function",
"rewritePathInfo",
"(",
"$",
"pathInfo",
")",
"{",
"if",
"(",
"(",
"$",
"pathInfo",
"!=",
"$",
"this",
"->",
"getPathInfo",
"(",
")",
")",
"&&",
"(",
"$",
"this",
"->",
"_rewritedPathInfo",
"===",
"null",
")",
")",
"{",
"$",
"th... | Specify new path info
It happen when occur rewrite based on configuration
@param string $pathInfo
@return Mage_Core_Controller_Request_Http | [
"Specify",
"new",
"path",
"info",
"It",
"happen",
"when",
"occur",
"rewrite",
"based",
"on",
"configuration"
] | c97ac743504e65d39e80bca86bbd3bba4764082f | https://github.com/MageTest/MageSpec/blob/c97ac743504e65d39e80bca86bbd3bba4764082f/src/Mage/Core/Controller/Request/Http.php#L191-L198 |
42,487 | MageTest/MageSpec | src/Mage/Core/Controller/Request/Http.php | Mage_Core_Controller_Request_Http.getDirectFrontNames | public function getDirectFrontNames()
{
if (is_null($this->_directFrontNames)) {
$names = Mage::getConfig()->getNode(self::XML_NODE_DIRECT_FRONT_NAMES);
if ($names) {
$this->_directFrontNames = $names->asArray();
} else {
return [];
}
}
return $this->_directFrontNames;
} | php | public function getDirectFrontNames()
{
if (is_null($this->_directFrontNames)) {
$names = Mage::getConfig()->getNode(self::XML_NODE_DIRECT_FRONT_NAMES);
if ($names) {
$this->_directFrontNames = $names->asArray();
} else {
return [];
}
}
return $this->_directFrontNames;
} | [
"public",
"function",
"getDirectFrontNames",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_directFrontNames",
")",
")",
"{",
"$",
"names",
"=",
"Mage",
"::",
"getConfig",
"(",
")",
"->",
"getNode",
"(",
"self",
"::",
"XML_NODE_DIRECT_FRONT... | Get list of front names available with access without store code
@return array | [
"Get",
"list",
"of",
"front",
"names",
"available",
"with",
"access",
"without",
"store",
"code"
] | c97ac743504e65d39e80bca86bbd3bba4764082f | https://github.com/MageTest/MageSpec/blob/c97ac743504e65d39e80bca86bbd3bba4764082f/src/Mage/Core/Controller/Request/Http.php#L228-L239 |
42,488 | MageTest/MageSpec | src/Mage/Core/Controller/Request/Http.php | Mage_Core_Controller_Request_Http.initForward | public function initForward()
{
if (empty($this->_beforeForwardInfo)) {
$this->_beforeForwardInfo = [
'params' => $this->getParams(),
'action_name' => $this->getActionName(),
'controller_name' => $this->getControllerName(),
'module_name' => $this->getModuleName()
];
}
return $this;
} | php | public function initForward()
{
if (empty($this->_beforeForwardInfo)) {
$this->_beforeForwardInfo = [
'params' => $this->getParams(),
'action_name' => $this->getActionName(),
'controller_name' => $this->getControllerName(),
'module_name' => $this->getModuleName()
];
}
return $this;
} | [
"public",
"function",
"initForward",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_beforeForwardInfo",
")",
")",
"{",
"$",
"this",
"->",
"_beforeForwardInfo",
"=",
"[",
"'params'",
"=>",
"$",
"this",
"->",
"getParams",
"(",
")",
",",
"'a... | Collect properties changed by _forward in protected storage
before _forward was called first time.
@return Mage_Core_Controller_Request_Http | [
"Collect",
"properties",
"changed",
"by",
"_forward",
"in",
"protected",
"storage",
"before",
"_forward",
"was",
"called",
"first",
"time",
"."
] | c97ac743504e65d39e80bca86bbd3bba4764082f | https://github.com/MageTest/MageSpec/blob/c97ac743504e65d39e80bca86bbd3bba4764082f/src/Mage/Core/Controller/Request/Http.php#L481-L493 |
42,489 | MageTest/MageSpec | src/Mage/Core/Controller/Request/Http.php | Mage_Core_Controller_Request_Http.getBeforeForwardInfo | public function getBeforeForwardInfo($name = null)
{
if (is_null($name)) {
return $this->_beforeForwardInfo;
} elseif (isset($this->_beforeForwardInfo[$name])) {
return $this->_beforeForwardInfo[$name];
}
return null;
} | php | public function getBeforeForwardInfo($name = null)
{
if (is_null($name)) {
return $this->_beforeForwardInfo;
} elseif (isset($this->_beforeForwardInfo[$name])) {
return $this->_beforeForwardInfo[$name];
}
return null;
} | [
"public",
"function",
"getBeforeForwardInfo",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_beforeForwardInfo",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"this",
"->",
... | Retrieve property's value which was before _forward call.
If property was not changed during _forward call null will be returned.
If passed name will be null whole state array will be returned.
@param string $name
@return array|string|null | [
"Retrieve",
"property",
"s",
"value",
"which",
"was",
"before",
"_forward",
"call",
".",
"If",
"property",
"was",
"not",
"changed",
"during",
"_forward",
"call",
"null",
"will",
"be",
"returned",
".",
"If",
"passed",
"name",
"will",
"be",
"null",
"whole",
... | c97ac743504e65d39e80bca86bbd3bba4764082f | https://github.com/MageTest/MageSpec/blob/c97ac743504e65d39e80bca86bbd3bba4764082f/src/Mage/Core/Controller/Request/Http.php#L503-L512 |
42,490 | MageTest/MageSpec | src/Mage/Core/Controller/Request/Http.php | Mage_Core_Controller_Request_Http.isAjax | public function isAjax()
{
if ($this->isXmlHttpRequest()) {
return true;
}
if ($this->getParam('ajax') || $this->getParam('isAjax')) {
return true;
}
return false;
} | php | public function isAjax()
{
if ($this->isXmlHttpRequest()) {
return true;
}
if ($this->getParam('ajax') || $this->getParam('isAjax')) {
return true;
}
return false;
} | [
"public",
"function",
"isAjax",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isXmlHttpRequest",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getParam",
"(",
"'ajax'",
")",
"||",
"$",
"this",
"->",
"getParam",
"(",... | Check is Request from AJAX
@return boolean | [
"Check",
"is",
"Request",
"from",
"AJAX"
] | c97ac743504e65d39e80bca86bbd3bba4764082f | https://github.com/MageTest/MageSpec/blob/c97ac743504e65d39e80bca86bbd3bba4764082f/src/Mage/Core/Controller/Request/Http.php#L533-L542 |
42,491 | agentsib/diadoc-php | src/Api/Proto/ForwardDocumentEvent.php | ForwardDocumentEvent.setTimestamp | public function setTimestamp(\AgentSIB\Diadoc\Api\Proto\Timestamp $value = null)
{
$this->Timestamp = $value;
} | php | public function setTimestamp(\AgentSIB\Diadoc\Api\Proto\Timestamp $value = null)
{
$this->Timestamp = $value;
} | [
"public",
"function",
"setTimestamp",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Timestamp",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"Timestamp",
"=",
"$",
"value",
";",
"}"
] | Set 'Timestamp' value
@param \AgentSIB\Diadoc\Api\Proto\Timestamp $value | [
"Set",
"Timestamp",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/ForwardDocumentEvent.php#L66-L69 |
42,492 | agentsib/diadoc-php | src/Api/Proto/Docflow/InvoiceCorrectionDocumentInfo.php | InvoiceCorrectionDocumentInfo.setOriginalInvoiceRevisionDateAndNumber | public function setOriginalInvoiceRevisionDateAndNumber(\AgentSIB\Diadoc\Api\Proto\Docflow\DocumentDateAndNumber $value = null)
{
$this->OriginalInvoiceRevisionDateAndNumber = $value;
} | php | public function setOriginalInvoiceRevisionDateAndNumber(\AgentSIB\Diadoc\Api\Proto\Docflow\DocumentDateAndNumber $value = null)
{
$this->OriginalInvoiceRevisionDateAndNumber = $value;
} | [
"public",
"function",
"setOriginalInvoiceRevisionDateAndNumber",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Docflow",
"\\",
"DocumentDateAndNumber",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"OriginalInvoiceRevisionDateAn... | Set 'OriginalInvoiceRevisionDateAndNumber' value
@param \AgentSIB\Diadoc\Api\Proto\Docflow\DocumentDateAndNumber $value | [
"Set",
"OriginalInvoiceRevisionDateAndNumber",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Docflow/InvoiceCorrectionDocumentInfo.php#L289-L292 |
42,493 | agentsib/diadoc-php | src/Api/Proto/Docflow/InvoiceCorrectionDocumentInfo.php | InvoiceCorrectionDocumentInfo.setOriginalInvoiceCorrectionDateAndNumber | public function setOriginalInvoiceCorrectionDateAndNumber(\AgentSIB\Diadoc\Api\Proto\Docflow\DocumentDateAndNumber $value = null)
{
$this->OriginalInvoiceCorrectionDateAndNumber = $value;
} | php | public function setOriginalInvoiceCorrectionDateAndNumber(\AgentSIB\Diadoc\Api\Proto\Docflow\DocumentDateAndNumber $value = null)
{
$this->OriginalInvoiceCorrectionDateAndNumber = $value;
} | [
"public",
"function",
"setOriginalInvoiceCorrectionDateAndNumber",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Docflow",
"\\",
"DocumentDateAndNumber",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"OriginalInvoiceCorrectionDa... | Set 'OriginalInvoiceCorrectionDateAndNumber' value
@param \AgentSIB\Diadoc\Api\Proto\Docflow\DocumentDateAndNumber $value | [
"Set",
"OriginalInvoiceCorrectionDateAndNumber",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Docflow/InvoiceCorrectionDocumentInfo.php#L319-L322 |
42,494 | agentsib/diadoc-php | src/Api/Proto/Docflow/InboundInvoiceReceiptDocflow.php | InboundInvoiceReceiptDocflow.setReceiptAttachment | public function setReceiptAttachment(\AgentSIB\Diadoc\Api\Proto\Docflow\SignedAttachment $value = null)
{
$this->ReceiptAttachment = $value;
} | php | public function setReceiptAttachment(\AgentSIB\Diadoc\Api\Proto\Docflow\SignedAttachment $value = null)
{
$this->ReceiptAttachment = $value;
} | [
"public",
"function",
"setReceiptAttachment",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Docflow",
"\\",
"SignedAttachment",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"ReceiptAttachment",
"=",
"$",
"value",
";",
... | Set 'ReceiptAttachment' value
@param \AgentSIB\Diadoc\Api\Proto\Docflow\SignedAttachment $value | [
"Set",
"ReceiptAttachment",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Docflow/InboundInvoiceReceiptDocflow.php#L104-L107 |
42,495 | agentsib/diadoc-php | src/Api/Proto/Docflow/InboundInvoiceReceiptDocflow.php | InboundInvoiceReceiptDocflow.setConfirmationDocflow | public function setConfirmationDocflow(\AgentSIB\Diadoc\Api\Proto\Docflow\InvoiceConfirmationDocflow $value = null)
{
$this->ConfirmationDocflow = $value;
} | php | public function setConfirmationDocflow(\AgentSIB\Diadoc\Api\Proto\Docflow\InvoiceConfirmationDocflow $value = null)
{
$this->ConfirmationDocflow = $value;
} | [
"public",
"function",
"setConfirmationDocflow",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Docflow",
"\\",
"InvoiceConfirmationDocflow",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"ConfirmationDocflow",
"=",
"$",
"va... | Set 'ConfirmationDocflow' value
@param \AgentSIB\Diadoc\Api\Proto\Docflow\InvoiceConfirmationDocflow $value | [
"Set",
"ConfirmationDocflow",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Docflow/InboundInvoiceReceiptDocflow.php#L134-L137 |
42,496 | agentsib/diadoc-php | src/Api/Proto/Docflow/RecipientSignatureRejectionDocflow.php | RecipientSignatureRejectionDocflow.setRecipientSignatureRejectionAttachment | public function setRecipientSignatureRejectionAttachment(\AgentSIB\Diadoc\Api\Proto\Docflow\SignedAttachment $value = null)
{
$this->RecipientSignatureRejectionAttachment = $value;
} | php | public function setRecipientSignatureRejectionAttachment(\AgentSIB\Diadoc\Api\Proto\Docflow\SignedAttachment $value = null)
{
$this->RecipientSignatureRejectionAttachment = $value;
} | [
"public",
"function",
"setRecipientSignatureRejectionAttachment",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Docflow",
"\\",
"SignedAttachment",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"RecipientSignatureRejectionAttach... | Set 'RecipientSignatureRejectionAttachment' value
@param \AgentSIB\Diadoc\Api\Proto\Docflow\SignedAttachment $value | [
"Set",
"RecipientSignatureRejectionAttachment",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Docflow/RecipientSignatureRejectionDocflow.php#L104-L107 |
42,497 | agentsib/diadoc-php | src/Api/Proto/Docflow/RecipientSignatureRejectionDocflow.php | RecipientSignatureRejectionDocflow.setDeliveryTimestamp | public function setDeliveryTimestamp(\AgentSIB\Diadoc\Api\Proto\Timestamp $value = null)
{
$this->DeliveryTimestamp = $value;
} | php | public function setDeliveryTimestamp(\AgentSIB\Diadoc\Api\Proto\Timestamp $value = null)
{
$this->DeliveryTimestamp = $value;
} | [
"public",
"function",
"setDeliveryTimestamp",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Timestamp",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"DeliveryTimestamp",
"=",
"$",
"value",
";",
"}"
] | Set 'DeliveryTimestamp' value
@param \AgentSIB\Diadoc\Api\Proto\Timestamp $value | [
"Set",
"DeliveryTimestamp",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Docflow/RecipientSignatureRejectionDocflow.php#L134-L137 |
42,498 | agentsib/diadoc-php | src/Api/Proto/Invoicing/Organizations/ExtendedOrganizationInfo.php | ExtendedOrganizationInfo.setAddress | public function setAddress(\AgentSIB\Diadoc\Api\Proto\Address $value = null)
{
$this->Address = $value;
} | php | public function setAddress(\AgentSIB\Diadoc\Api\Proto\Address $value = null)
{
$this->Address = $value;
} | [
"public",
"function",
"setAddress",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Address",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"Address",
"=",
"$",
"value",
";",
"}"
] | Set 'Address' value
@param \AgentSIB\Diadoc\Api\Proto\Address $value | [
"Set",
"Address",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/Organizations/ExtendedOrganizationInfo.php#L313-L316 |
42,499 | agentsib/diadoc-php | src/Api/Proto/Invoicing/Organizations/ExtendedOrganizationInfo.php | ExtendedOrganizationInfo.setOrgType | public function setOrgType(\AgentSIB\Diadoc\Api\Proto\Invoicing\Organizations\OrgType $value)
{
$this->OrgType = $value;
} | php | public function setOrgType(\AgentSIB\Diadoc\Api\Proto\Invoicing\Organizations\OrgType $value)
{
$this->OrgType = $value;
} | [
"public",
"function",
"setOrgType",
"(",
"\\",
"AgentSIB",
"\\",
"Diadoc",
"\\",
"Api",
"\\",
"Proto",
"\\",
"Invoicing",
"\\",
"Organizations",
"\\",
"OrgType",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"OrgType",
"=",
"$",
"value",
";",
"}"
] | Set 'OrgType' value
@param \AgentSIB\Diadoc\Api\Proto\Invoicing\Organizations\OrgType $value | [
"Set",
"OrgType",
"value"
] | 0dbfe63397a1f3083c4815ad7033bcb986904979 | https://github.com/agentsib/diadoc-php/blob/0dbfe63397a1f3083c4815ad7033bcb986904979/src/Api/Proto/Invoicing/Organizations/ExtendedOrganizationInfo.php#L373-L376 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.