_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q263100 | Order.generateUniqueHash | test | public function generateUniqueHash()
{
return md5(sprintf("%s.%s.%s.%s.%s.%s.%s",
$this->getCustomerId(),
$this->getCountryIso(),
$this->getCityId(),
$this->getCityPrefix(),
$this->getMapData()->getMapDetail(),
$this->getAutorenewEnable... | php | {
"resource": ""
} |
q263101 | ApiCredentials.generateAuthString | test | protected function generateAuthString()
{
if (empty($this->password) || empty($this->userName)) {
throw new ApiCredentialsException(" Undefined userName and/or password ");
}
$this->authString = $this->getTestMode() ? sha1($this->userName . $this->password . 'sandbox') : sha1($t... | php | {
"resource": ""
} |
q263102 | CDRInvoice.load | test | public function load()
{
$response = $this->call('callhistory_invoices', array(
'customer_id' => $this->getCustomerId(),
'from_date' => $this->getFromDate(),
'to_date' => $this->getToDate()
));
$this->fromArray($response);
return $this;
} | php | {
"resource": ""
} |
q263103 | ApiClient.call | test | public function call($method, $arguments = array())
{
$arguments = array_merge(array('auth_string' => self::getCredentials()->getAuthString()), $arguments);
$method = 'didww_' . $method;
$timeStart = microtime(true);
try {
$result = $this->_client->__soapCall($method, $a... | php | {
"resource": ""
} |
q263104 | Decoded.getFrame | test | public function getFrame($index = 0)
{
if (array_key_exists($index, $this->frames)) {
return $this->frames[$index];
}
throw new RuntimeException(
"Frame with index ({$index}) does not exists."
);
} | php | {
"resource": ""
} |
q263105 | Decoded.addOffset | test | public function addOffset($left, $top)
{
$offset = new \StdClass;
$offset->left = $left;
$offset->top = $top;
$this->addToFirstFrameWithoutProperty($offset, 'offset');
} | php | {
"resource": ""
} |
q263106 | Decoded.addSize | test | public function addSize($width, $height)
{
$size = new \StdClass;
$size->width = $width;
$size->height = $height;
$this->addToFirstFrameWithoutProperty($size, 'size');
} | php | {
"resource": ""
} |
q263107 | Decoded.getLoops | test | public function getLoops()
{
if ($this->netscapeExtension) {
$loops = substr($this->netscapeExtension, 14, 2);
$loops = unpack('C', $loops)[1];
return $loops;
}
return null;
} | php | {
"resource": ""
} |
q263108 | Decoded.hasGlobalColorTable | test | public function hasGlobalColorTable()
{
$byte = substr($this->logicalScreenDescriptor, 4, 1);
if (strlen($byte) == 1) {
$byte = unpack('C', $byte)[1];
$bit = $byte & bindec('10000000');
}
return isset($bit) ? (bool) $bit : false;
} | php | {
"resource": ""
} |
q263109 | Decoded.countGlobalColors | test | public function countGlobalColors()
{
$byte = substr($this->logicalScreenDescriptor, 4, 1);
if (strlen($byte) == 1) {
$byte = unpack('C', $byte)[1];
$bit = $byte & bindec('00000111');
}
// length of the global color table is 2^(N+1)
r... | php | {
"resource": ""
} |
q263110 | Decoded.getBackgroundColorIndex | test | public function getBackgroundColorIndex()
{
if ($this->logicalScreenDescriptor) {
$index = substr($this->logicalScreenDescriptor, 5, 1);
$index = unpack('C', $index)[1];
return $index;
}
return 0;
} | php | {
"resource": ""
} |
q263111 | Decoded.addToFirstFrameWithoutProperty | test | private function addToFirstFrameWithoutProperty($value, $property)
{
$added = false;
foreach ($this->frames as $key => $frame) {
if ( ! $frame->propertyIsSet($property)) {
$frame->setProperty($property, $value);
$added = true;
break;
... | php | {
"resource": ""
} |
q263112 | Decoded.newFrameWithProperty | test | private function newFrameWithProperty($property, $value)
{
$frame = new Frame;
$this->frames[] = $frame->setProperty($property, $value);
} | php | {
"resource": ""
} |
q263113 | Object.toArray | test | public function toArray($options = array())
{
$result = array();
foreach (get_object_vars($this) as $key => $value) {
if ($key[0] == '_') {
continue;
}
if ($value instanceof Object) {
$value = $value->toArray($options);
... | php | {
"resource": ""
} |
q263114 | Balance._getAllBalances | test | protected static function _getAllBalances()
{
$result = self::getClientInstance()->call('getprepaidbalancelist', array(
"customer_id" => '0'
));
$resellerSubAccount = (object)array('customer_id' => '0', 'prepaid_balance_amount' => '0.0000'); // 0 - is reseller's sub account
... | php | {
"resource": ""
} |
q263115 | Balance.getBalanceArray | test | public static function getBalanceArray()
{
$balances = array();
foreach (self::_getAllBalances() as $value) {
$balances[$value->customer_id] = $value->prepaid_balance_amount;
}
return $balances;
} | php | {
"resource": ""
} |
q263116 | Balance.getBalanceList | test | public static function getBalanceList()
{
$balances = array();
foreach (self::_getAllBalances() as $value) {
$value = (array)$value;
unset($value['result']);
unset($value['error']);
$balance = new Balance(array("prepaid_balance" => $value['prepaid_bala... | php | {
"resource": ""
} |
q263117 | Balance.changeBalance | test | function changeBalance($funds, $transactionId = NULL)
{
if (!$this->getCustomerId() > 0) {
throw new BalanceException("Customer is invalid");
}
if (!(is_numeric($funds))) {
throw new BalanceException("Funds value is invalid");
}
$this->_funds = $fund... | php | {
"resource": ""
} |
q263118 | Balance.synchronizePrepaidBalance | test | function synchronizePrepaidBalance()
{
if (!$this->getCustomerId()) {
throw new BalanceException("Customer Id is undefined");
}
$response = $this->call('getprepaidbalance', array(
"customer_id" => $this->getCustomerId()
));
$this->setPrepaidBalance($... | php | {
"resource": ""
} |
q263119 | Encoder.setCanvas | test | public function setCanvas($width, $height)
{
$this->canvasWidth = $width;
$this->canvasHeight = $height;
return $this;
} | php | {
"resource": ""
} |
q263120 | Encoder.setFromDecoded | test | public function setFromDecoded(Decoded $decoded, $frameIndex = null)
{
if (is_null($frameIndex)) {
// setup from all decoded data
$width = $decoded->getCanvasWidth();
$height = $decoded->getCanvasHeight();
$colorTable = $decoded->getGlobalColorTable();
... | php | {
"resource": ""
} |
q263121 | Encoder.createFrameFromGdResource | test | public function createFrameFromGdResource($resource, $delay = null)
{
// get imagedata from resource
$gifdata = $this->encodeGdResource($resource);
$decoder = new Decoder;
$gif = $decoder->initFromData($gifdata)->decode();
$frame = $gif->getFrames()[0];
$frame->setLo... | php | {
"resource": ""
} |
q263122 | Encoder.encode | test | public function encode()
{
// create gif
$encoded = $this->buildLogicalScreenDescriptor();
if ($this->hasGlobalColorTable()) {
$encoded .= $this->getGlobalColorTable();
}
// netscape extension
if ($this->isAnimated() && $this->doesLoop()) {
$... | php | {
"resource": ""
} |
q263123 | Encoder.buildLogicalScreenDescriptor | test | private function buildLogicalScreenDescriptor()
{
// gif header
$descriptor = 'GIF89a';
// canvas width/height
$descriptor .= pack('v*', $this->canvasWidth);
$descriptor .= pack('v*', $this->canvasHeight);
// packed field
$colorResolution = 111;
$sor... | php | {
"resource": ""
} |
q263124 | Encoder.buildNetscapeExtension | test | private function buildNetscapeExtension()
{
$extension = "\x21";
$extension .= "\xFF";
$extension .= "\x0B";
$extension .= 'NETSCAPE2.0';
$extension .= "\x03";
$extension .= "\x01";
$extension .= pack('v', $this->loops);
$extension .= "\x00";
... | php | {
"resource": ""
} |
q263125 | Encoder.buildFrame | test | private function buildFrame(Frame $frame)
{
// graphics control extensions
$encoded = $this->buildGraphicsControlExtension($frame);
// image descriptor
$encoded .= $this->buildImageDescriptor($frame);
// add image data
$encoded .= $frame->getImageData();
re... | php | {
"resource": ""
} |
q263126 | Encoder.buildGraphicsControlExtension | test | private function buildGraphicsControlExtension(Frame $frame)
{
// start
$extension = "\x21\xF9";
// byte size
$extension .= "\x04";
// packed field
$disposalMethod = decbin($frame->getDisposalMethod());
$disposalMethod = str_pad($disposalMeth... | php | {
"resource": ""
} |
q263127 | Encoder.buildImageDescriptor | test | private function buildImageDescriptor(Frame $frame)
{
// seperator
$descriptor = "\x2C";
// image left/top
$descriptor .= pack('v*',
$frame->offset->left,
$frame->offset->top
);
// image width/height
$descriptor .= pack('v*',
... | php | {
"resource": ""
} |
q263128 | DIDNumber.create | test | public static function create(Order $order)
{
$properties = self::getClientInstance()->call('ordercreate', $order->toArray(array('includeNumber' => false)));
$did = new DIDNumber($order);
$did->getOrder()->setCityId($properties['city_id']);
unset($properties['result'], $properties['a... | php | {
"resource": ""
} |
q263129 | DIDNumber.changeAutorenew | test | function changeAutorenew($flag)
{
$this->call('order_autorenew_status', array(
"customer_id" => $this->_order->getCustomerId(),
"did_number" => $this->getDIDNumber(),
"status" => (int)$flag
));
$this->_order->setAutorenewEnable($flag);
} | php | {
"resource": ""
} |
q263130 | DIDNumber.renew | test | public function renew()
{
$properties = $this->call('orderautorenew', array(
"customer_id" => $this->_order->getCustomerId(),
"did_number" => $this->getDIDNumber(),
"period" => $this->_order->getPeriod(),
"uniq_hash" => $this->generateUniqueHash()
));
... | php | {
"resource": ""
} |
q263131 | DIDNumber._reload | test | protected function _reload($didNumber = NULL, $orderId = NULL)
{
$properties = $this->call('getservicedetails', array(
"customer_id" => $this->_order->getCustomerId(),
"order_id" => $orderId,
"did_number" => $didNumber
));
unset($properties['result']);
... | php | {
"resource": ""
} |
q263132 | DIDNumber.updateMapping | test | public function updateMapping(Mapping $newMapping = NULL)
{
$mapping = empty($newMapping) ? $this->_order->getMapData() : $newMapping;
$this->call('updatemapping', array(
"customer_id" => $this->_order->getCustomerId(),
"did_number" => $this->getDIDNumber(),
"map_... | php | {
"resource": ""
} |
q263133 | DIDNumber.generateUniqueHash | test | protected function generateUniqueHash()
{
return $this->_order->getUniqHash() ?:
md5(sprintf("%s.%s.%s.%s.%s.%s",
$this->getDIDExpireDateGmt(),
$this->getOrderId(),
$this->getDIDMappingFormat(),
$this->getDIDPeriod(),
... | php | {
"resource": ""
} |
q263134 | AbstractOrigin.isIpInRange | test | protected function isIpInRange($targetIp, $rangeIp, $cidrMask)
{
$target = sprintf('%032b', ip2long($targetIp));
$range = sprintf('%032b', ip2long($rangeIp));
return 0 === substr_compare($target, $range, 0, $cidrMask);
} | php | {
"resource": ""
} |
q263135 | Container.getParameter | test | public function getParameter(string $name, $default = null)
{
return $this->hasParameter($name) ? $this->parameters[$name] : $default;
} | php | {
"resource": ""
} |
q263136 | Container.linkMetaService | test | private function linkMetaService(string $serviceName, string $key)
{
// make sure the service link is there
if (!isset($this->metadataService[$serviceName])) {
$this->metadataService[$serviceName] = [];
}
if (!in_array($key, $this->metadataService[$serviceName])) {
... | php | {
"resource": ""
} |
q263137 | Container.setMetaData | test | public function setMetaData(string $serviceName, string $key, array $values)
{
// make sure the service exists
if (!$this->has($serviceName)) {
throw new UnknownServiceException('There is no service named "' . $serviceName . '" specified.');
}
// make sure all elements... | php | {
"resource": ""
} |
q263138 | Container.addMetaData | test | public function addMetaData(string $serviceName, string $key, array $values)
{
// make sure the service exists
if (!$this->has($serviceName)) {
throw new UnknownServiceException('There is no service named "' . $serviceName . '" specified.');
}
// make sure the metadata ... | php | {
"resource": ""
} |
q263139 | Container.remove | test | public function remove(string $serviceName) : bool
{
if (!$this->has($serviceName)) {
return false; // can only remove services that exist
}
if ($serviceName === 'container') {
return false; // the container itself cannot be removed
}
// remove the a... | php | {
"resource": ""
} |
q263140 | Container.release | test | public function release(string $serviceName) : bool
{
if (isset($this->resolvedSharedServices[$serviceName]))
{
unset($this->resolvedSharedServices[$serviceName]); return true;
}
return false;
} | php | {
"resource": ""
} |
q263141 | Container.get | test | public function get(string $serviceName)
{
// if the service container itself is requested
if ($serviceName === 'container') {
return $this;
}
// check if the service name has a registered service type
if (!isset($this->serviceResolverType[$serviceName]))
... | php | {
"resource": ""
} |
q263142 | Container.createInstanceFromFactory | test | private function createInstanceFromFactory($factory)
{
if ($factory instanceof ServiceFactoryInterface)
{
return $factory->create($this);
}
elseif ($factory instanceof Closure)
{
return $factory($this);
}
// otherwise throw an excep... | php | {
"resource": ""
} |
q263143 | Container.resolveServiceProvider | test | private function resolveServiceProvider(string $name)
{
list($service, $isShared) = $this->serviceProviders[$name]->resolve($name, $this);
if ($isShared) {
$this->resolvedSharedServices[$name] = $service;
}
return $service;
} | php | {
"resource": ""
} |
q263144 | Container.register | test | public function register(ServiceProviderInterface $provider)
{
foreach($provider->provides() as $serviceName)
{
$this->setServiceResolverType($serviceName, static::RESOLVE_PROVIDER);
$this->serviceProviders[$serviceName] = $provider;
}
} | php | {
"resource": ""
} |
q263145 | Container.bind | test | public function bind(string $name, $factory, bool $shared = true)
{
if (is_string($factory)) {
return $this->bindClass($name, $factory, [], $shared);
} elseif ($shared) {
$this->bindFactoryShared($name, $factory);
} else {
$this->bindFactory($name, $factor... | php | {
"resource": ""
} |
q263146 | Container.bindClass | test | public function bindClass(string $name, string $factory, array $arguments = [], bool $shared = true) : ServiceFactory
{
$factory = new ServiceFactory($factory, $arguments);
if ($shared) {
$this->bindFactoryShared($name, $factory);
} else {
$this->bindFactory($name, $... | php | {
"resource": ""
} |
q263147 | Container.bindFactory | test | public function bindFactory(string $name, $factory)
{
$this->setServiceResolverType($name, static::RESOLVE_FACTORY);
$this->resolverFactories[$name] = $factory;
} | php | {
"resource": ""
} |
q263148 | Container.bindFactoryShared | test | public function bindFactoryShared(string $name, $factory)
{
$this->setServiceResolverType($name, static::RESOLVE_SHARED);
$this->resolverFactories[$name] = $factory;
} | php | {
"resource": ""
} |
q263149 | Container.getServiceResolverType | test | public function getServiceResolverType(string $serviceName) : int
{
if (!isset($this->serviceResolverType[$serviceName]))
{
throw new UnknownServiceException('There is no type for the service named "' . $serviceName . '" specified.');
}
return $this->serviceResolverType[... | php | {
"resource": ""
} |
q263150 | ServiceArguments.addArgument | test | private function addArgument($argumentValue, int $argumentType) : ServiceArguments
{
$this->arguments[] = [$argumentValue, $argumentType]; return $this;
} | php | {
"resource": ""
} |
q263151 | ServiceArguments.addArgumentsFromArray | test | public function addArgumentsFromArray(array $argumentsArray)
{
foreach($argumentsArray as $argument)
{
if (is_string($argument) && ($argument[0] === '@' || $argument[0] === ':'))
{
if ($argument[0] === '@') {
$this->addDependency(substr($a... | php | {
"resource": ""
} |
q263152 | ServiceArguments.resolve | test | public function resolve(Container $container) : array
{
$resolvedArguments = [];
foreach($this->arguments as list($argumentValue, $argumentType))
{
switch ($argumentType)
{
case static::RAW:
$resolvedArguments[] = $argumentValue;
... | php | {
"resource": ""
} |
q263153 | ServiceFactory.create | test | public function create(Container $container)
{
$instance = new $this->className(...$this->constructorArguments->resolve($container));
foreach($this->methodCallers as list($method, $arguments))
{
$instance->{$method}(... $arguments->resolve($container));
}
retur... | php | {
"resource": ""
} |
q263154 | ContainerParser.setTokens | test | public function setTokens(array $tokens)
{
// reset the keys
$this->tokens = array_values($tokens);
// count the real number of tokens
$this->tokenCount = count($this->tokens);
// reset the index
$this->index = 0;
} | php | {
"resource": ""
} |
q263155 | ContainerParser.currentToken | test | protected function currentToken() : T
{
if (!isset($this->tokens[$this->index]))
{
throw new ContainerParserException("The current token is of the available tokens range.");
}
return $this->tokens[$this->index];
} | php | {
"resource": ""
} |
q263156 | ContainerParser.nextToken | test | protected function nextToken(int $i = 1)
{
if (!isset($this->tokens[$this->index + $i])) {
return false;
}
return $this->tokens[$this->index + $i];
} | php | {
"resource": ""
} |
q263157 | ContainerParser.skipTokenOfType | test | protected function skipTokenOfType(array $types = [])
{
while ((!$this->parserIsDone()) && in_array($this->currentToken()->getType(), $types))
{
$this->skipToken();
}
} | php | {
"resource": ""
} |
q263158 | ContainerParser.getRemainingTokens | test | protected function getRemainingTokens(bool $skip = false) : array
{
$tokens = array();
while (!$this->parserIsDone())
{
$tokens[] = $this->currentToken(); $this->skipToken();
}
if (!$skip)
{
$this->index -= count($tokens);
}
... | php | {
"resource": ""
} |
q263159 | ContainerParser.getTokensUntil | test | protected function getTokensUntil(int $type, bool $ignoreScopes = false) : array
{
$tokens = array();
if (!is_array($type)) {
$type = array($type);
}
while (!$this->parserIsDone() && !in_array($this->currentToken()->getType(), $type))
{
// if scopes... | php | {
"resource": ""
} |
q263160 | ContainerParser.getTokensUntilClosingScope | test | protected function getTokensUntilClosingScope(bool $includeScope = false, int $openToken = T::TOKEN_BRACE_OPEN, int $closeToken = T::TOKEN_BRACE_CLOSE) : array
{
if ($this->currentToken()->getType() !== $openToken)
{
throw $this->errorUnexpectedToken($this->currentToken());
}
... | php | {
"resource": ""
} |
q263161 | ContainerParser.errorUnexpectedToken | test | protected function errorUnexpectedToken($token)
{
$class = new \ReflectionClass($token);
$constants = array_flip($class->getConstants());
return new ContainerParserException('unexpected "' . $constants[$token->getType()] . '" given at line ' . $token->getLine());
} | php | {
"resource": ""
} |
q263162 | ContainerParser.parseChild | test | protected function parseChild(string $parserClassName, $tokens = null, $skip = true)
{
if (is_null($tokens))
{
$tokens = $this->getRemainingTokens();
}
$parser = new $parserClassName($tokens);
$node = $parser->parse();
// Update the current index based ... | php | {
"resource": ""
} |
q263163 | ContainerParser.parse | test | public function parse()
{
// reset the result
$this->result = array();
// start parsing trought the tokens
while (!$this->parserIsDone())
{
$specialNode = $this->next();
if ($specialNode instanceof Node)
{
return $specia... | php | {
"resource": ""
} |
q263164 | ContainerBuilder.setContainerName | test | public function setContainerName(string $containerName)
{
if (empty($containerName) || !(preg_match('/^[a-zA-Z0-9\\\\_]*$/', $containerName)) || is_numeric($containerName[0]))
{
throw new ContainerBuilderException('The container name cannot be empty, start with a number or contain sepci... | php | {
"resource": ""
} |
q263165 | ContainerBuilder.add | test | public function add(string $serviceName, string $serviceClass, array $serviceArguments = [], bool $isShared = true) : ServiceDefinition
{
$service = new ServiceDefinition($serviceClass, $serviceArguments);
$this->addService($serviceName, $service, $isShared);
return $service;
} | php | {
"resource": ""
} |
q263166 | ContainerBuilder.addArray | test | public function addArray(array $servicesArray)
{
foreach($servicesArray as $serviceName => $serviceConfiguration)
{
$this->addService($serviceName, ServiceDefinition::fromArray($serviceConfiguration), $serviceConfiguration['shared'] ?? true);
}
} | php | {
"resource": ""
} |
q263167 | ContainerBuilder.addService | test | public function addService(string $serviceName, ServiceDefinitionInterface $serviceDefinition, bool $isShared = true)
{
if ($this->invalidServiceBuilderString($serviceName))
{
throw new ContainerBuilderException('The "'.$serviceName.'" servicename must be a string, cannot be numeric, em... | php | {
"resource": ""
} |
q263168 | ContainerBuilder.importNamespace | test | public function importNamespace(ContainerNamespace $namespace)
{
// import the parameters
$this->parameters = array_merge($this->parameters, $namespace->getParameters());
// import the service definitions
foreach($namespace->getServices() as $name => $service)
{
... | php | {
"resource": ""
} |
q263169 | ContainerBuilder.invalidServiceBuilderString | test | private function invalidServiceBuilderString(string $value) : bool
{
if (empty($value) || is_numeric($value)) {
return true;
}
// check for trailing / prepending whitespace ect.
if (trim($value) !== $value) {
return true;
}
// check for other... | php | {
"resource": ""
} |
q263170 | ContainerBuilder.generateNormalizedServiceName | test | private function generateNormalizedServiceName(string $serviceName)
{
$normalizedServiceName = $this->camelizeServiceName($serviceName);
$duplicateCounter = 0;
$countedNormalizedServiceName = $normalizedServiceName;
while(in_array($countedNormalizedServiceName, $this->normalizedSer... | php | {
"resource": ""
} |
q263171 | ContainerBuilder.generate | test | public function generate() : string
{
$buffer = "<?php\n\n";
// add namespace if needed
if (!is_null($this->containerNamespace))
{
$buffer .= "namespace " . $this->containerNamespace . ";\n\n";
}
// add use statement for the super container
$alia... | php | {
"resource": ""
} |
q263172 | ContainerBuilder.getResolverMethodName | test | private function getResolverMethodName(string $serviceName) : string
{
if (!isset($this->normalizedServiceNames[$serviceName]))
{
throw new ContainerBuilderException("The '" . $serviceName . "' service has never been definied.");
}
return 'resolve' . $this->normalizedSe... | php | {
"resource": ""
} |
q263173 | ContainerBuilder.generateArgumentsCode | test | private function generateArgumentsCode(ServiceArguments $arguments) : string
{
$buffer = [];
foreach($arguments->getAll() as list($argumentValue, $argumentType))
{
if ($argumentType === ServiceArguments::DEPENDENCY)
{
if ($argumentValue === 'container... | php | {
"resource": ""
} |
q263174 | ContainerBuilder.generateMetaData | test | private function generateMetaData() : string
{
$metaData = [];
$metaDataService = [];
foreach($this->services as $serviceName => $serviceDefinition)
{
foreach($serviceDefinition->getMetaData() as $key => $serviceMetaData)
{
if (!isset($metaDat... | php | {
"resource": ""
} |
q263175 | ContainerBuilder.generateResolverTypes | test | private function generateResolverTypes() : string
{
$types = [];
foreach($this->services as $serviceName => $serviceDefinition)
{
$types[] = var_export($serviceName, true) . ' => ' . Container::RESOLVE_METHOD;
}
return "protected \$serviceResolverType = [" . im... | php | {
"resource": ""
} |
q263176 | ContainerBuilder.generateResolverMappings | test | private function generateResolverMappings() : string
{
$mappings = [];
foreach($this->services as $serviceName => $serviceDefinition)
{
$mappings[] = var_export($serviceName, true) . ' => ' . var_export($this->getResolverMethodName($serviceName), true);
}
retur... | php | {
"resource": ""
} |
q263177 | ContainerBuilder.generateResolverMethods | test | private function generateResolverMethods() : string
{
$buffer = "";
foreach($this->services as $serviceName => $serviceDefinition)
{
$buffer .= "protected function " . $this->getResolverMethodName($serviceName) . "() {\n";
$serviceClassName = $serviceDefinition->get... | php | {
"resource": ""
} |
q263178 | ValueNode.fromToken | test | public static function fromToken(Token $token) : ValueNode
{
if (!$token->isValue())
{
throw new LogicalNodeException('Can only create ValueNode from a value type Token.');
}
return new ValueNode($token->getValue(), $token->getType());
} | php | {
"resource": ""
} |
q263179 | ValueNode.setType | test | public function setType(int $type)
{
if (!in_array($type, [
self::TYPE_STRING,
self::TYPE_NUMBER,
self::TYPE_BOOL_TRUE,
self::TYPE_BOOL_FALSE,
self::TYPE_NULL,
]))
{
throw new LogicalNodeException('Invalid value type ass... | php | {
"resource": ""
} |
q263180 | ComposerContainerFileLoader.generateMap | test | public static function generateMap(Event $event)
{
// prepare the container file mapping array
$mapping = [];
// get all available packages
$packages = $event->getComposer()->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
foreach ($packages as $packag... | php | {
"resource": ""
} |
q263181 | Token.getValue | test | public function getValue()
{
$value = $this->value;
switch ($this->type)
{
case self::TOKEN_BOOL_TRUE:
$value = true;
break;
case self::TOKEN_BOOL_FALSE:
$value = false;
break;
case self::... | php | {
"resource": ""
} |
q263182 | Token.isValue | test | public function isValue() : bool
{
return
$this->type === self::TOKEN_STRING ||
$this->type === self::TOKEN_NUMBER ||
$this->type === self::TOKEN_NULL ||
$this->type === self::TOKEN_BOOL_TRUE ||
$this->type === self::TOKEN_BOOL_FALSE;
} | php | {
"resource": ""
} |
q263183 | ArrayNode.has | test | public function has($key)
{
foreach ($this->elements as $element) {
if ($element->getKey() == $key) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q263184 | ArrayNode.push | test | public function push(AssignableNode $value)
{
// count the index up to find a free spot
while ($this->has($this->index)) {
$this->index++;
}
$this->addElement(new ArrayElementNode($this->index, $value));
} | php | {
"resource": ""
} |
q263185 | ArrayNode.convertToNativeArray | test | public function convertToNativeArray() : array
{
$array = [];
foreach($this->getElements() as $element)
{
$value = $element->getValue();
if ($value instanceof ValueNode) {
$array[$element->getKey()] = $value->getRawValue();
}
... | php | {
"resource": ""
} |
q263186 | ContainerLexer.next | test | protected function next()
{
if ($this->offset >= $this->length)
{
return false;
}
foreach ($this->tokenMap as $regex => $token)
{
if (preg_match($regex, substr($this->code, $this->offset), $matches))
{
if ($token === T::... | php | {
"resource": ""
} |
q263187 | ContainerLexer.tokens | test | public function tokens() : array
{
$tokens = [];
while ($token = $this->next())
{
// skip doublicated linebreaks
if (
$token->getType() === T::TOKEN_LINE &&
isset($tokens[count($tokens) - 1]) &&
$tokens[count($tokens... | php | {
"resource": ""
} |
q263188 | DeployController.index | test | public function index()
{
// set up logging to email
$this->log = Log::getMonolog();
if ($to = config('auto-deploy.notify')) {
$domain = parse_url(config('app.url'), PHP_URL_HOST);
$msg = \Swift_Message::newInstance('Project Deployed')
->setFrom(["... | php | {
"resource": ""
} |
q263189 | DeployController.ex | test | private function ex(CommandInterface $cmd)
{
// try to run the command
$this->shell->run($cmd);
$output = $this->shell->getOutput();
$returnValue = $this->shell->getReturnValue();
// record the result
$output = count($output) ? implode("\n", $output)."\n" : '';
... | php | {
"resource": ""
} |
q263190 | DeployController.backupDatabase | test | private function backupDatabase()
{
// get the name of the DB to backed up and the connection to use
$dbdir = database_path();
$dbconn = config('database.default');
$dbname = config("database.connections.$dbconn.database");
// make a directory for the backup file and switch ... | php | {
"resource": ""
} |
q263191 | DeployController.pull | test | private function pull()
{
if (is_writable(dirname($this->installDir))) {
$cmd = new Command('mkdir');
$cmd->addFlag('p')
->addParam($this->installDir);
if ($this->ex($cmd)) {
$cmd = new Command('cd');
$cmd->addParam($this->i... | php | {
"resource": ""
} |
q263192 | DeployController.copyEnv | test | private function copyEnv()
{
$cmd = new Command('cp');
$cmd->addParam($this->webroot.'./env')
->addParam($this->installDir.'/.env');
return $this->ex($cmd);
} | php | {
"resource": ""
} |
q263193 | DeployController.composer | test | private function composer()
{
$cmd = new Command('cd');
$cmd->addParam($this->installDir)
->addSubCommand('&&')
->addSubCommand('composer')
->addParam('self-update')
->addSubCommand('&&')
->addSubCommand('composer')
->addParam('... | php | {
"resource": ""
} |
q263194 | DeployController.npm | test | private function npm()
{
$cmd = new Command('cd');
$cmd->addParam($this->installDir)
->addSubCommand('&&')
->addSubCommand('npm')
->addParam('update');
return $this->ex($cmd);
} | php | {
"resource": ""
} |
q263195 | DeployController.seed | test | private function seed()
{
$cmd = new Command('cd');
$cmd->addParam($this->installDir)
->addSubCommand('&&')
->addSubCommand('php')
->addSubCommand('artisan')
->addParam('db:seed');
return $this->ex($cmd);
} | php | {
"resource": ""
} |
q263196 | DeployController.deploy | test | private function deploy()
{
$cmd = new Command('cd');
$cmd->addParam(dirname($this->webroot))
->addSubCommand('&&')
->addSubCommand('ln')
->addFlag('fs')
->addParam($this->installDir)
->addParam($this->webroot);
return $this->ex($c... | php | {
"resource": ""
} |
q263197 | ServiceProviderArray.resolve | test | public function resolve(string $serviceName, Container $container) : array
{
if (!isset($this->services[$serviceName]))
{
throw new UnknownServiceException('The service provider "' . get_class($this) . '" does not support service resolving of the service "' . $serviceName . '"');
... | php | {
"resource": ""
} |
q263198 | ContainerFactory.setCacheDirecotry | test | public function setCacheDirecotry(string $cacheDirectory)
{
if (substr($cacheDirectory, -1) !== DIRECTORY_SEPARATOR)
{
$cacheDirectory .= DIRECTORY_SEPARATOR;
}
$this->cacheDirectory = $cacheDirectory;
} | php | {
"resource": ""
} |
q263199 | ContainerFactory.create | test | public function create(string $containerName, callable $builderCallback, array $initalParameters = []) : Container
{
if (class_exists($containerName))
{
return new $containerName;
}
$fileName = basename(str_replace("\\", '/', $containerName));
$cacheFile = $this-... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.