repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
chrisboulton/php-resque | lib/Resque/Job.php | Resque_Job.create | public static function create($queue, $class, $args = null, $monitor = false, $id = null)
{
if (is_null($id)) {
$id = Resque::generateJobId();
}
if($args !== null && !is_array($args)) {
throw new InvalidArgumentException(
'Supplied $args must be an array.'
);
}
Resque::push($queue, array(
'c... | php | public static function create($queue, $class, $args = null, $monitor = false, $id = null)
{
if (is_null($id)) {
$id = Resque::generateJobId();
}
if($args !== null && !is_array($args)) {
throw new InvalidArgumentException(
'Supplied $args must be an array.'
);
}
Resque::push($queue, array(
'c... | [
"public",
"static",
"function",
"create",
"(",
"$",
"queue",
",",
"$",
"class",
",",
"$",
"args",
"=",
"null",
",",
"$",
"monitor",
"=",
"false",
",",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"id",
")",
")",
"{",
"$",
... | Create a new job and save it to the specified queue.
@param string $queue The name of the queue to place the job in.
@param string $class The name of the class that contains the code to execute the job.
@param array $args Any optional arguments that should be passed when the job is executed.
@param boolean $monitor Se... | [
"Create",
"a",
"new",
"job",
"and",
"save",
"it",
"to",
"the",
"specified",
"queue",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Job.php#L60-L83 |
chrisboulton/php-resque | lib/Resque/Job.php | Resque_Job.reserve | public static function reserve($queue)
{
$payload = Resque::pop($queue);
if(!is_array($payload)) {
return false;
}
return new Resque_Job($queue, $payload);
} | php | public static function reserve($queue)
{
$payload = Resque::pop($queue);
if(!is_array($payload)) {
return false;
}
return new Resque_Job($queue, $payload);
} | [
"public",
"static",
"function",
"reserve",
"(",
"$",
"queue",
")",
"{",
"$",
"payload",
"=",
"Resque",
"::",
"pop",
"(",
"$",
"queue",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"payload",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
... | Find the next available job from the specified queue and return an
instance of Resque_Job for it.
@param string $queue The name of the queue to check for a job in.
@return false|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found. | [
"Find",
"the",
"next",
"available",
"job",
"from",
"the",
"specified",
"queue",
"and",
"return",
"an",
"instance",
"of",
"Resque_Job",
"for",
"it",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Job.php#L92-L100 |
chrisboulton/php-resque | lib/Resque/Job.php | Resque_Job.reserveBlocking | public static function reserveBlocking(array $queues, $timeout = null)
{
$item = Resque::blpop($queues, $timeout);
if(!is_array($item)) {
return false;
}
return new Resque_Job($item['queue'], $item['payload']);
} | php | public static function reserveBlocking(array $queues, $timeout = null)
{
$item = Resque::blpop($queues, $timeout);
if(!is_array($item)) {
return false;
}
return new Resque_Job($item['queue'], $item['payload']);
} | [
"public",
"static",
"function",
"reserveBlocking",
"(",
"array",
"$",
"queues",
",",
"$",
"timeout",
"=",
"null",
")",
"{",
"$",
"item",
"=",
"Resque",
"::",
"blpop",
"(",
"$",
"queues",
",",
"$",
"timeout",
")",
";",
"if",
"(",
"!",
"is_array",
"(",... | Find the next available job from the specified queues using blocking list pop
and return an instance of Resque_Job for it.
@param array $queues
@param int $timeout
@return false|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found. | [
"Find",
"the",
"next",
"available",
"job",
"from",
"the",
"specified",
"queues",
"using",
"blocking",
"list",
"pop",
"and",
"return",
"an",
"instance",
"of",
"Resque_Job",
"for",
"it",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Job.php#L110-L119 |
chrisboulton/php-resque | lib/Resque/Job.php | Resque_Job.updateStatus | public function updateStatus($status)
{
if(empty($this->payload['id'])) {
return;
}
$statusInstance = new Resque_Job_Status($this->payload['id']);
$statusInstance->update($status);
} | php | public function updateStatus($status)
{
if(empty($this->payload['id'])) {
return;
}
$statusInstance = new Resque_Job_Status($this->payload['id']);
$statusInstance->update($status);
} | [
"public",
"function",
"updateStatus",
"(",
"$",
"status",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"payload",
"[",
"'id'",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"statusInstance",
"=",
"new",
"Resque_Job_Status",
"(",
"$",
"this",
... | Update the status of the current job.
@param int $status Status constant from Resque_Job_Status indicating the current status of a job. | [
"Update",
"the",
"status",
"of",
"the",
"current",
"job",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Job.php#L126-L134 |
chrisboulton/php-resque | lib/Resque/Job.php | Resque_Job.getInstance | public function getInstance()
{
if (!is_null($this->instance)) {
return $this->instance;
}
$this->instance = $this->getJobFactory()->create($this->payload['class'], $this->getArguments(), $this->queue);
$this->instance->job = $this;
return $this->instance;
} | php | public function getInstance()
{
if (!is_null($this->instance)) {
return $this->instance;
}
$this->instance = $this->getJobFactory()->create($this->payload['class'], $this->getArguments(), $this->queue);
$this->instance->job = $this;
return $this->instance;
} | [
"public",
"function",
"getInstance",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"instance",
")",
")",
"{",
"return",
"$",
"this",
"->",
"instance",
";",
"}",
"$",
"this",
"->",
"instance",
"=",
"$",
"this",
"->",
"getJobFactory... | Get the instantiated object for this job that will be performing work.
@return Resque_JobInterface Instance of the object that this job belongs to.
@throws Resque_Exception | [
"Get",
"the",
"instantiated",
"object",
"for",
"this",
"job",
"that",
"will",
"be",
"performing",
"work",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Job.php#L166-L175 |
chrisboulton/php-resque | lib/Resque/Job.php | Resque_Job.perform | public function perform()
{
try {
Resque_Event::trigger('beforePerform', $this);
$instance = $this->getInstance();
if(method_exists($instance, 'setUp')) {
$instance->setUp();
}
$instance->perform();
if(method_exists($instance, 'tearDown')) {
$instance->tearDown();
}
Resque_Event::... | php | public function perform()
{
try {
Resque_Event::trigger('beforePerform', $this);
$instance = $this->getInstance();
if(method_exists($instance, 'setUp')) {
$instance->setUp();
}
$instance->perform();
if(method_exists($instance, 'tearDown')) {
$instance->tearDown();
}
Resque_Event::... | [
"public",
"function",
"perform",
"(",
")",
"{",
"try",
"{",
"Resque_Event",
"::",
"trigger",
"(",
"'beforePerform'",
",",
"$",
"this",
")",
";",
"$",
"instance",
"=",
"$",
"this",
"->",
"getInstance",
"(",
")",
";",
"if",
"(",
"method_exists",
"(",
"$"... | Actually execute a job by calling the perform method on the class
associated with the job with the supplied arguments.
@return bool
@throws Resque_Exception When the job's class could not be found or it does not contain a perform method. | [
"Actually",
"execute",
"a",
"job",
"by",
"calling",
"the",
"perform",
"method",
"on",
"the",
"class",
"associated",
"with",
"the",
"job",
"with",
"the",
"supplied",
"arguments",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Job.php#L184-L208 |
chrisboulton/php-resque | lib/Resque/Job.php | Resque_Job.fail | public function fail($exception)
{
Resque_Event::trigger('onFailure', array(
'exception' => $exception,
'job' => $this,
));
$this->updateStatus(Resque_Job_Status::STATUS_FAILED);
Resque_Failure::create(
$this->payload,
$exception,
$this->worker,
$this->queue
);
Resque_Stat::incr('failed'... | php | public function fail($exception)
{
Resque_Event::trigger('onFailure', array(
'exception' => $exception,
'job' => $this,
));
$this->updateStatus(Resque_Job_Status::STATUS_FAILED);
Resque_Failure::create(
$this->payload,
$exception,
$this->worker,
$this->queue
);
Resque_Stat::incr('failed'... | [
"public",
"function",
"fail",
"(",
"$",
"exception",
")",
"{",
"Resque_Event",
"::",
"trigger",
"(",
"'onFailure'",
",",
"array",
"(",
"'exception'",
"=>",
"$",
"exception",
",",
"'job'",
"=>",
"$",
"this",
",",
")",
")",
";",
"$",
"this",
"->",
"updat... | Mark the current job as having failed.
@param $exception | [
"Mark",
"the",
"current",
"job",
"as",
"having",
"failed",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Job.php#L215-L231 |
chrisboulton/php-resque | lib/Resque/Job/Status.php | Resque_Job_Status.create | public static function create($id)
{
$statusPacket = array(
'status' => self::STATUS_WAITING,
'updated' => time(),
'started' => time(),
);
Resque::redis()->set('job:' . $id . ':status', json_encode($statusPacket));
} | php | public static function create($id)
{
$statusPacket = array(
'status' => self::STATUS_WAITING,
'updated' => time(),
'started' => time(),
);
Resque::redis()->set('job:' . $id . ':status', json_encode($statusPacket));
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"id",
")",
"{",
"$",
"statusPacket",
"=",
"array",
"(",
"'status'",
"=>",
"self",
"::",
"STATUS_WAITING",
",",
"'updated'",
"=>",
"time",
"(",
")",
",",
"'started'",
"=>",
"time",
"(",
")",
",",
")",
... | Create a new status monitor item for the supplied job ID. Will create
all necessary keys in Redis to monitor the status of a job.
@param string $id The ID of the job to monitor the status of. | [
"Create",
"a",
"new",
"status",
"monitor",
"item",
"for",
"the",
"supplied",
"job",
"ID",
".",
"Will",
"create",
"all",
"necessary",
"keys",
"in",
"Redis",
"to",
"monitor",
"the",
"status",
"of",
"a",
"job",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Job/Status.php#L51-L59 |
chrisboulton/php-resque | lib/Resque/Job/Status.php | Resque_Job_Status.isTracking | public function isTracking()
{
if($this->isTracking === false) {
return false;
}
if(!Resque::redis()->exists((string)$this)) {
$this->isTracking = false;
return false;
}
$this->isTracking = true;
return true;
} | php | public function isTracking()
{
if($this->isTracking === false) {
return false;
}
if(!Resque::redis()->exists((string)$this)) {
$this->isTracking = false;
return false;
}
$this->isTracking = true;
return true;
} | [
"public",
"function",
"isTracking",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isTracking",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"Resque",
"::",
"redis",
"(",
")",
"->",
"exists",
"(",
"(",
"string",
")",
"$",
... | Check if we're actually checking the status of the loaded job status
instance.
@return boolean True if the status is being monitored, false if not. | [
"Check",
"if",
"we",
"re",
"actually",
"checking",
"the",
"status",
"of",
"the",
"loaded",
"job",
"status",
"instance",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Job/Status.php#L67-L80 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.all | public static function all()
{
$workers = Resque::redis()->smembers('workers');
if(!is_array($workers)) {
$workers = array();
}
$instances = array();
foreach($workers as $workerId) {
$instances[] = self::find($workerId);
}
return $instances;
} | php | public static function all()
{
$workers = Resque::redis()->smembers('workers');
if(!is_array($workers)) {
$workers = array();
}
$instances = array();
foreach($workers as $workerId) {
$instances[] = self::find($workerId);
}
return $instances;
} | [
"public",
"static",
"function",
"all",
"(",
")",
"{",
"$",
"workers",
"=",
"Resque",
"::",
"redis",
"(",
")",
"->",
"smembers",
"(",
"'workers'",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"workers",
")",
")",
"{",
"$",
"workers",
"=",
"array"... | Return all workers known to Resque as instantiated instances.
@return array | [
"Return",
"all",
"workers",
"known",
"to",
"Resque",
"as",
"instantiated",
"instances",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L83-L95 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.find | public static function find($workerId)
{
if(!self::exists($workerId) || false === strpos($workerId, ":")) {
return false;
}
list($hostname, $pid, $queues) = explode(':', $workerId, 3);
$queues = explode(',', $queues);
$worker = new self($queues);
$worker->setId($workerId);
return $worker;
} | php | public static function find($workerId)
{
if(!self::exists($workerId) || false === strpos($workerId, ":")) {
return false;
}
list($hostname, $pid, $queues) = explode(':', $workerId, 3);
$queues = explode(',', $queues);
$worker = new self($queues);
$worker->setId($workerId);
return $worker;
} | [
"public",
"static",
"function",
"find",
"(",
"$",
"workerId",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"exists",
"(",
"$",
"workerId",
")",
"||",
"false",
"===",
"strpos",
"(",
"$",
"workerId",
",",
"\":\"",
")",
")",
"{",
"return",
"false",
";",
"}... | Given a worker ID, find it and return an instantiated worker class for it.
@param string $workerId The ID of the worker.
@return Resque_Worker Instance of the worker. False if the worker does not exist. | [
"Given",
"a",
"worker",
"ID",
"find",
"it",
"and",
"return",
"an",
"instantiated",
"worker",
"class",
"for",
"it",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L114-L125 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.work | public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)
{
$this->updateProcLine('Starting');
$this->startup();
while(true) {
if($this->shutdown) {
break;
}
// Attempt to find and reserve a job
$job = false;
if(!$this->paused) {
if($blocking === true) {
$this->l... | php | public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)
{
$this->updateProcLine('Starting');
$this->startup();
while(true) {
if($this->shutdown) {
break;
}
// Attempt to find and reserve a job
$job = false;
if(!$this->paused) {
if($blocking === true) {
$this->l... | [
"public",
"function",
"work",
"(",
"$",
"interval",
"=",
"Resque",
"::",
"DEFAULT_INTERVAL",
",",
"$",
"blocking",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"updateProcLine",
"(",
"'Starting'",
")",
";",
"$",
"this",
"->",
"startup",
"(",
")",
";",
"w... | The primary loop for a worker which when called on an instance starts
the worker's life cycle.
Queues are checked every $interval (seconds) for new jobs.
@param int $interval How often to check for new jobs across the queues. | [
"The",
"primary",
"loop",
"for",
"a",
"worker",
"which",
"when",
"called",
"on",
"an",
"instance",
"starts",
"the",
"worker",
"s",
"life",
"cycle",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L145-L229 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.perform | public function perform(Resque_Job $job)
{
try {
Resque_Event::trigger('afterFork', $job);
$job->perform();
}
catch(Exception $e) {
$this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {stack}', array('job' => $job, 'stack' => $e));
$job->fail($e);
return;
}
$job->updateStatus(Res... | php | public function perform(Resque_Job $job)
{
try {
Resque_Event::trigger('afterFork', $job);
$job->perform();
}
catch(Exception $e) {
$this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {stack}', array('job' => $job, 'stack' => $e));
$job->fail($e);
return;
}
$job->updateStatus(Res... | [
"public",
"function",
"perform",
"(",
"Resque_Job",
"$",
"job",
")",
"{",
"try",
"{",
"Resque_Event",
"::",
"trigger",
"(",
"'afterFork'",
",",
"$",
"job",
")",
";",
"$",
"job",
"->",
"perform",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e"... | Process a single job.
@param Resque_Job $job The job to be processed. | [
"Process",
"a",
"single",
"job",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L236-L250 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.queues | public function queues($fetch = true)
{
if(!in_array('*', $this->queues) || $fetch == false) {
return $this->queues;
}
$queues = Resque::queues();
sort($queues);
return $queues;
} | php | public function queues($fetch = true)
{
if(!in_array('*', $this->queues) || $fetch == false) {
return $this->queues;
}
$queues = Resque::queues();
sort($queues);
return $queues;
} | [
"public",
"function",
"queues",
"(",
"$",
"fetch",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"'*'",
",",
"$",
"this",
"->",
"queues",
")",
"||",
"$",
"fetch",
"==",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"queues",
";",
"}",... | Return an array containing all of the queues that this worker should use
when searching for jobs.
If * is found in the list of queues, every queue will be searched in
alphabetic order. (@see $fetch)
@param boolean $fetch If true, and the queue is set to *, will fetch
all queue names from redis.
@return array Array of... | [
"Return",
"an",
"array",
"containing",
"all",
"of",
"the",
"queues",
"that",
"this",
"worker",
"should",
"use",
"when",
"searching",
"for",
"jobs",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L295-L304 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.startup | private function startup()
{
$this->registerSigHandlers();
$this->pruneDeadWorkers();
Resque_Event::trigger('beforeFirstFork', $this);
$this->registerWorker();
} | php | private function startup()
{
$this->registerSigHandlers();
$this->pruneDeadWorkers();
Resque_Event::trigger('beforeFirstFork', $this);
$this->registerWorker();
} | [
"private",
"function",
"startup",
"(",
")",
"{",
"$",
"this",
"->",
"registerSigHandlers",
"(",
")",
";",
"$",
"this",
"->",
"pruneDeadWorkers",
"(",
")",
";",
"Resque_Event",
"::",
"trigger",
"(",
"'beforeFirstFork'",
",",
"$",
"this",
")",
";",
"$",
"t... | Perform necessary actions to start a worker. | [
"Perform",
"necessary",
"actions",
"to",
"start",
"a",
"worker",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L309-L315 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.updateProcLine | private function updateProcLine($status)
{
$processTitle = 'resque-' . Resque::VERSION . ': ' . $status;
if(function_exists('cli_set_process_title') && PHP_OS !== 'Darwin') {
cli_set_process_title($processTitle);
}
else if(function_exists('setproctitle')) {
setproctitle($processTitle);
}
} | php | private function updateProcLine($status)
{
$processTitle = 'resque-' . Resque::VERSION . ': ' . $status;
if(function_exists('cli_set_process_title') && PHP_OS !== 'Darwin') {
cli_set_process_title($processTitle);
}
else if(function_exists('setproctitle')) {
setproctitle($processTitle);
}
} | [
"private",
"function",
"updateProcLine",
"(",
"$",
"status",
")",
"{",
"$",
"processTitle",
"=",
"'resque-'",
".",
"Resque",
"::",
"VERSION",
".",
"': '",
".",
"$",
"status",
";",
"if",
"(",
"function_exists",
"(",
"'cli_set_process_title'",
")",
"&&",
"PHP_... | On supported systems (with the PECL proctitle module installed), update
the name of the currently running process to indicate the current state
of a worker.
@param string $status The updated process title. | [
"On",
"supported",
"systems",
"(",
"with",
"the",
"PECL",
"proctitle",
"module",
"installed",
")",
"update",
"the",
"name",
"of",
"the",
"currently",
"running",
"process",
"to",
"indicate",
"the",
"current",
"state",
"of",
"a",
"worker",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L324-L333 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.pauseProcessing | public function pauseProcessing()
{
$this->logger->log(Psr\Log\LogLevel::NOTICE, 'USR2 received; pausing job processing');
$this->paused = true;
} | php | public function pauseProcessing()
{
$this->logger->log(Psr\Log\LogLevel::NOTICE, 'USR2 received; pausing job processing');
$this->paused = true;
} | [
"public",
"function",
"pauseProcessing",
"(",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"log",
"(",
"Psr",
"\\",
"Log",
"\\",
"LogLevel",
"::",
"NOTICE",
",",
"'USR2 received; pausing job processing'",
")",
";",
"$",
"this",
"->",
"paused",
"=",
"true",
... | Signal handler callback for USR2, pauses processing of new jobs. | [
"Signal",
"handler",
"callback",
"for",
"USR2",
"pauses",
"processing",
"of",
"new",
"jobs",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L361-L365 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.unPauseProcessing | public function unPauseProcessing()
{
$this->logger->log(Psr\Log\LogLevel::NOTICE, 'CONT received; resuming job processing');
$this->paused = false;
} | php | public function unPauseProcessing()
{
$this->logger->log(Psr\Log\LogLevel::NOTICE, 'CONT received; resuming job processing');
$this->paused = false;
} | [
"public",
"function",
"unPauseProcessing",
"(",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"log",
"(",
"Psr",
"\\",
"Log",
"\\",
"LogLevel",
"::",
"NOTICE",
",",
"'CONT received; resuming job processing'",
")",
";",
"$",
"this",
"->",
"paused",
"=",
"false... | Signal handler callback for CONT, resumes worker allowing it to pick
up new jobs. | [
"Signal",
"handler",
"callback",
"for",
"CONT",
"resumes",
"worker",
"allowing",
"it",
"to",
"pick",
"up",
"new",
"jobs",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L371-L375 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.shutdown | public function shutdown()
{
$this->shutdown = true;
$this->logger->log(Psr\Log\LogLevel::NOTICE, 'Shutting down');
} | php | public function shutdown()
{
$this->shutdown = true;
$this->logger->log(Psr\Log\LogLevel::NOTICE, 'Shutting down');
} | [
"public",
"function",
"shutdown",
"(",
")",
"{",
"$",
"this",
"->",
"shutdown",
"=",
"true",
";",
"$",
"this",
"->",
"logger",
"->",
"log",
"(",
"Psr",
"\\",
"Log",
"\\",
"LogLevel",
"::",
"NOTICE",
",",
"'Shutting down'",
")",
";",
"}"
] | Schedule a worker for shutdown. Will finish processing the current job
and when the timeout interval is reached, the worker will shut down. | [
"Schedule",
"a",
"worker",
"for",
"shutdown",
".",
"Will",
"finish",
"processing",
"the",
"current",
"job",
"and",
"when",
"the",
"timeout",
"interval",
"is",
"reached",
"the",
"worker",
"will",
"shut",
"down",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L381-L385 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.killChild | public function killChild()
{
if(!$this->child) {
$this->logger->log(Psr\Log\LogLevel::DEBUG, 'No child to kill.');
return;
}
$this->logger->log(Psr\Log\LogLevel::INFO, 'Killing child at {child}', array('child' => $this->child));
if(exec('ps -o pid,state -p ' . $this->child, $output, $returnCode) && $re... | php | public function killChild()
{
if(!$this->child) {
$this->logger->log(Psr\Log\LogLevel::DEBUG, 'No child to kill.');
return;
}
$this->logger->log(Psr\Log\LogLevel::INFO, 'Killing child at {child}', array('child' => $this->child));
if(exec('ps -o pid,state -p ' . $this->child, $output, $returnCode) && $re... | [
"public",
"function",
"killChild",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"child",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"log",
"(",
"Psr",
"\\",
"Log",
"\\",
"LogLevel",
"::",
"DEBUG",
",",
"'No child to kill.'",
")",
";",
"return"... | Kill a forked child job immediately. The job it is processing will not
be completed. | [
"Kill",
"a",
"forked",
"child",
"job",
"immediately",
".",
"The",
"job",
"it",
"is",
"processing",
"will",
"not",
"be",
"completed",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L401-L418 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.pruneDeadWorkers | public function pruneDeadWorkers()
{
$workerPids = $this->workerPids();
$workers = self::all();
foreach($workers as $worker) {
if (is_object($worker)) {
list($host, $pid, $queues) = explode(':', (string)$worker, 3);
if($host != $this->hostname || in_array($pid, $workerPids) || $pid == getmypid()) {
... | php | public function pruneDeadWorkers()
{
$workerPids = $this->workerPids();
$workers = self::all();
foreach($workers as $worker) {
if (is_object($worker)) {
list($host, $pid, $queues) = explode(':', (string)$worker, 3);
if($host != $this->hostname || in_array($pid, $workerPids) || $pid == getmypid()) {
... | [
"public",
"function",
"pruneDeadWorkers",
"(",
")",
"{",
"$",
"workerPids",
"=",
"$",
"this",
"->",
"workerPids",
"(",
")",
";",
"$",
"workers",
"=",
"self",
"::",
"all",
"(",
")",
";",
"foreach",
"(",
"$",
"workers",
"as",
"$",
"worker",
")",
"{",
... | Look for any workers which should be running on this server and if
they're not, remove them from Redis.
This is a form of garbage collection to handle cases where the
server may have been killed and the Resque workers did not die gracefully
and therefore leave state information in Redis. | [
"Look",
"for",
"any",
"workers",
"which",
"should",
"be",
"running",
"on",
"this",
"server",
"and",
"if",
"they",
"re",
"not",
"remove",
"them",
"from",
"Redis",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L428-L442 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.workerPids | public function workerPids()
{
$pids = array();
exec('ps -A -o pid,command | grep [r]esque', $cmdOutput);
foreach($cmdOutput as $line) {
list($pids[],) = explode(' ', trim($line), 2);
}
return $pids;
} | php | public function workerPids()
{
$pids = array();
exec('ps -A -o pid,command | grep [r]esque', $cmdOutput);
foreach($cmdOutput as $line) {
list($pids[],) = explode(' ', trim($line), 2);
}
return $pids;
} | [
"public",
"function",
"workerPids",
"(",
")",
"{",
"$",
"pids",
"=",
"array",
"(",
")",
";",
"exec",
"(",
"'ps -A -o pid,command | grep [r]esque'",
",",
"$",
"cmdOutput",
")",
";",
"foreach",
"(",
"$",
"cmdOutput",
"as",
"$",
"line",
")",
"{",
"list",
"(... | Return an array of process IDs for all of the Resque workers currently
running on this machine.
@return array Array of Resque worker process IDs. | [
"Return",
"an",
"array",
"of",
"process",
"IDs",
"for",
"all",
"of",
"the",
"Resque",
"workers",
"currently",
"running",
"on",
"this",
"machine",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L450-L458 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.workingOn | public function workingOn(Resque_Job $job)
{
$job->worker = $this;
$this->currentJob = $job;
$job->updateStatus(Resque_Job_Status::STATUS_RUNNING);
$data = json_encode(array(
'queue' => $job->queue,
'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'),
'payload' => $job->payload
));
Resque::redis()->se... | php | public function workingOn(Resque_Job $job)
{
$job->worker = $this;
$this->currentJob = $job;
$job->updateStatus(Resque_Job_Status::STATUS_RUNNING);
$data = json_encode(array(
'queue' => $job->queue,
'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'),
'payload' => $job->payload
));
Resque::redis()->se... | [
"public",
"function",
"workingOn",
"(",
"Resque_Job",
"$",
"job",
")",
"{",
"$",
"job",
"->",
"worker",
"=",
"$",
"this",
";",
"$",
"this",
"->",
"currentJob",
"=",
"$",
"job",
";",
"$",
"job",
"->",
"updateStatus",
"(",
"Resque_Job_Status",
"::",
"STA... | Tell Redis which job we're currently working on.
@param object $job Resque_Job instance containing the job we're working on. | [
"Tell",
"Redis",
"which",
"job",
"we",
"re",
"currently",
"working",
"on",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L491-L502 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.doneWorking | public function doneWorking()
{
$this->currentJob = null;
Resque_Stat::incr('processed');
Resque_Stat::incr('processed:' . (string)$this);
Resque::redis()->del('worker:' . (string)$this);
} | php | public function doneWorking()
{
$this->currentJob = null;
Resque_Stat::incr('processed');
Resque_Stat::incr('processed:' . (string)$this);
Resque::redis()->del('worker:' . (string)$this);
} | [
"public",
"function",
"doneWorking",
"(",
")",
"{",
"$",
"this",
"->",
"currentJob",
"=",
"null",
";",
"Resque_Stat",
"::",
"incr",
"(",
"'processed'",
")",
";",
"Resque_Stat",
"::",
"incr",
"(",
"'processed:'",
".",
"(",
"string",
")",
"$",
"this",
")",... | Notify Redis that we've finished working on a job, clearing the working
state and incrementing the job stats. | [
"Notify",
"Redis",
"that",
"we",
"ve",
"finished",
"working",
"on",
"a",
"job",
"clearing",
"the",
"working",
"state",
"and",
"incrementing",
"the",
"job",
"stats",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L508-L514 |
chrisboulton/php-resque | lib/Resque/Worker.php | Resque_Worker.job | public function job()
{
$job = Resque::redis()->get('worker:' . $this);
if(!$job) {
return array();
}
else {
return json_decode($job, true);
}
} | php | public function job()
{
$job = Resque::redis()->get('worker:' . $this);
if(!$job) {
return array();
}
else {
return json_decode($job, true);
}
} | [
"public",
"function",
"job",
"(",
")",
"{",
"$",
"job",
"=",
"Resque",
"::",
"redis",
"(",
")",
"->",
"get",
"(",
"'worker:'",
".",
"$",
"this",
")",
";",
"if",
"(",
"!",
"$",
"job",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"else",
"{... | Return an object describing the job this worker is currently working on.
@return object Object with details of current job. | [
"Return",
"an",
"object",
"describing",
"the",
"job",
"this",
"worker",
"is",
"currently",
"working",
"on",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Worker.php#L531-L540 |
chrisboulton/php-resque | lib/Resque/Event.php | Resque_Event.trigger | public static function trigger($event, $data = null)
{
if (!is_array($data)) {
$data = array($data);
}
if (empty(self::$events[$event])) {
return true;
}
foreach (self::$events[$event] as $callback) {
if (!is_callable($callback)) {
continue;
}
call_user_func_array($callback, $data);
... | php | public static function trigger($event, $data = null)
{
if (!is_array($data)) {
$data = array($data);
}
if (empty(self::$events[$event])) {
return true;
}
foreach (self::$events[$event] as $callback) {
if (!is_callable($callback)) {
continue;
}
call_user_func_array($callback, $data);
... | [
"public",
"static",
"function",
"trigger",
"(",
"$",
"event",
",",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"$",
"data",
")",
";",
"}",
"if",
"(",
"empty",
... | Raise a given event with the supplied data.
@param string $event Name of event to be raised.
@param mixed $data Optional, any data that should be passed to each callback.
@return true | [
"Raise",
"a",
"given",
"event",
"with",
"the",
"supplied",
"data",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Event.php#L23-L41 |
chrisboulton/php-resque | lib/Resque/Event.php | Resque_Event.listen | public static function listen($event, $callback)
{
if (!isset(self::$events[$event])) {
self::$events[$event] = array();
}
self::$events[$event][] = $callback;
return true;
} | php | public static function listen($event, $callback)
{
if (!isset(self::$events[$event])) {
self::$events[$event] = array();
}
self::$events[$event][] = $callback;
return true;
} | [
"public",
"static",
"function",
"listen",
"(",
"$",
"event",
",",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"events",
"[",
"$",
"event",
"]",
")",
")",
"{",
"self",
"::",
"$",
"events",
"[",
"$",
"event",
"]",
... | Listen in on a given event to have a specified callback fired.
@param string $event Name of event to listen on.
@param mixed $callback Any callback callable by call_user_func_array.
@return true | [
"Listen",
"in",
"on",
"a",
"given",
"event",
"to",
"have",
"a",
"specified",
"callback",
"fired",
"."
] | train | https://github.com/chrisboulton/php-resque/blob/968b7e6a307a2079051dfc571d2fc2be0546209f/lib/Resque/Event.php#L50-L58 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/SimpleParser.php | SimpleParser.parseToken | private function parseToken(array $parsedTokens, TokenParserInterface $parser, Token $token): array
{
$parsedToken = $parser->parse($token);
if ($parsedToken instanceof FunctionCallValue) {
// Check if the pattern was something like @value_<func()> in which case the function call should... | php | private function parseToken(array $parsedTokens, TokenParserInterface $parser, Token $token): array
{
$parsedToken = $parser->parse($token);
if ($parsedToken instanceof FunctionCallValue) {
// Check if the pattern was something like @value_<func()> in which case the function call should... | [
"private",
"function",
"parseToken",
"(",
"array",
"$",
"parsedTokens",
",",
"TokenParserInterface",
"$",
"parser",
",",
"Token",
"$",
"token",
")",
":",
"array",
"{",
"$",
"parsedToken",
"=",
"$",
"parser",
"->",
"parse",
"(",
"$",
"token",
")",
";",
"i... | Parses the given token. If the value returned is a ListValue, its values will be merged to the list of parsed
tokens instead of adding the value itself. Another check is done to ensure that successive string tokens are
merged.
@return ValueInterface[]|string[] Parsed tokens | [
"Parses",
"the",
"given",
"token",
".",
"If",
"the",
"value",
"returned",
"is",
"a",
"ListValue",
"its",
"values",
"will",
"be",
"merged",
"to",
"the",
"list",
"of",
"parsed",
"tokens",
"instead",
"of",
"adding",
"the",
"value",
"itself",
".",
"Another",
... | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/SimpleParser.php#L77-L108 |
nelmio/alice | src/Definition/MethodCallBag.php | MethodCallBag.mergeWith | public function mergeWith(self $methodCallsBag): self
{
$clone = clone $methodCallsBag;
foreach ($this->methodCalls as $methodCall) {
$clone->methodCalls[] = $methodCall;
}
return $clone;
} | php | public function mergeWith(self $methodCallsBag): self
{
$clone = clone $methodCallsBag;
foreach ($this->methodCalls as $methodCall) {
$clone->methodCalls[] = $methodCall;
}
return $clone;
} | [
"public",
"function",
"mergeWith",
"(",
"self",
"$",
"methodCallsBag",
")",
":",
"self",
"{",
"$",
"clone",
"=",
"clone",
"$",
"methodCallsBag",
";",
"foreach",
"(",
"$",
"this",
"->",
"methodCalls",
"as",
"$",
"methodCall",
")",
"{",
"$",
"clone",
"->",... | Creates a new instance to which the given properties have been merged. In case of conflicts, the existing values
are kept. | [
"Creates",
"a",
"new",
"instance",
"to",
"which",
"the",
"given",
"properties",
"have",
"been",
"merged",
".",
"In",
"case",
"of",
"conflicts",
"the",
"existing",
"values",
"are",
"kept",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Definition/MethodCallBag.php#L35-L43 |
nelmio/alice | src/Parser/IncludeProcessor/IncludeDataMerger.php | IncludeDataMerger.mergeInclude | public function mergeInclude(array $data, array $includeData): array
{
foreach ($data as $class => $fixtures) {
// $class is either a FQCN or 'parameters'
$includeData[$class] = (
array_key_exists($class, $includeData)
&& is_array($includeData[... | php | public function mergeInclude(array $data, array $includeData): array
{
foreach ($data as $class => $fixtures) {
// $class is either a FQCN or 'parameters'
$includeData[$class] = (
array_key_exists($class, $includeData)
&& is_array($includeData[... | [
"public",
"function",
"mergeInclude",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"includeData",
")",
":",
"array",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"class",
"=>",
"$",
"fixtures",
")",
"{",
"// $class is either a FQCN or 'parameters'",
"$",
"i... | Merges a parsed file data with another. If some data overlaps, the existent data is kept, i.e. the included data
is discarded.
@param array $data Parsed file data
@param array $includeData Parsed file data to merge | [
"Merges",
"a",
"parsed",
"file",
"data",
"with",
"another",
".",
"If",
"some",
"data",
"overlaps",
"the",
"existent",
"data",
"is",
"kept",
"i",
".",
"e",
".",
"the",
"included",
"data",
"is",
"discarded",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Parser/IncludeProcessor/IncludeDataMerger.php#L29-L44 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/ListValueResolver.php | ListValueResolver.resolve | public function resolve(
ValueInterface $list,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->resolver) {
throw ResolverNotFoundExceptionFactory::crea... | php | public function resolve(
ValueInterface $list,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->resolver) {
throw ResolverNotFoundExceptionFactory::crea... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"list",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet",... | {@inheritdoc}
@param ListValue $list | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/ListValueResolver.php#L64-L101 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/WildcardReferenceTokenParser.php | WildcardReferenceTokenParser.parse | public function parse(Token $token)
{
$value = $token->getValue();
$fixtureId = substr($value, 1, strlen($value) - 2);
if (false === $fixtureId) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
return FixtureMatchReferenceValue::cre... | php | public function parse(Token $token)
{
$value = $token->getValue();
$fixtureId = substr($value, 1, strlen($value) - 2);
if (false === $fixtureId) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
return FixtureMatchReferenceValue::cre... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
"{",
"$",
"value",
"=",
"$",
"token",
"->",
"getValue",
"(",
")",
";",
"$",
"fixtureId",
"=",
"substr",
"(",
"$",
"value",
",",
"1",
",",
"strlen",
"(",
"$",
"value",
")",
"-",
"2",
... | Parses expressions such as '$username'.
{@inheritdoc}
@throws ParseException | [
"Parses",
"expressions",
"such",
"as",
"$username",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/WildcardReferenceTokenParser.php#L46-L55 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTokenizer.php | FunctionTokenizer.tokenize | public function tokenize(string $value): string
{
$tokens = $this->tokenizer->tokenize($value);
$tree = $this->buildTree($value, $tokens);
$tokenizedValue = '';
foreach ($tree as $node) {
$tokenizedValue .= ($this->tokenizer->isOpeningToken($node))
? spri... | php | public function tokenize(string $value): string
{
$tokens = $this->tokenizer->tokenize($value);
$tree = $this->buildTree($value, $tokens);
$tokenizedValue = '';
foreach ($tree as $node) {
$tokenizedValue .= ($this->tokenizer->isOpeningToken($node))
? spri... | [
"public",
"function",
"tokenize",
"(",
"string",
"$",
"value",
")",
":",
"string",
"{",
"$",
"tokens",
"=",
"$",
"this",
"->",
"tokenizer",
"->",
"tokenize",
"(",
"$",
"value",
")",
";",
"$",
"tree",
"=",
"$",
"this",
"->",
"buildTree",
"(",
"$",
"... | {@inheritdoc}
@throws MalformedFunctionException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTokenizer.php#L42-L56 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTokenizer.php | FunctionTokenizer.buildTree | private function buildTree(string $originalValue, array $tokens): array
{
$tree = [];
$functions = [];
foreach ($tokens as $key => $value) {
if ($this->tokenizer->isOpeningToken($value)) {
$functions[$key] = null; // The value here is ignored
... | php | private function buildTree(string $originalValue, array $tokens): array
{
$tree = [];
$functions = [];
foreach ($tokens as $key => $value) {
if ($this->tokenizer->isOpeningToken($value)) {
$functions[$key] = null; // The value here is ignored
... | [
"private",
"function",
"buildTree",
"(",
"string",
"$",
"originalValue",
",",
"array",
"$",
"tokens",
")",
":",
"array",
"{",
"$",
"tree",
"=",
"[",
"]",
";",
"$",
"functions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"tokens",
"as",
"$",
"key",
"=... | Regroup tokens together by detecting when the function starts, closes or when it is nested. | [
"Regroup",
"tokens",
"together",
"by",
"detecting",
"when",
"the",
"function",
"starts",
"closes",
"or",
"when",
"it",
"is",
"nested",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTokenizer.php#L77-L122 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Lexer/ReferenceLexer.php | ReferenceLexer.lex | public function lex(string $value): array
{
foreach (self::PATTERNS as $pattern => $tokenTypeConstant) {
if (1 === preg_match($pattern, $value, $matches)) {
if (null === $tokenTypeConstant) {
throw InvalidArgumentExceptionFactory::createForInvalidExpressionLan... | php | public function lex(string $value): array
{
foreach (self::PATTERNS as $pattern => $tokenTypeConstant) {
if (1 === preg_match($pattern, $value, $matches)) {
if (null === $tokenTypeConstant) {
throw InvalidArgumentExceptionFactory::createForInvalidExpressionLan... | [
"public",
"function",
"lex",
"(",
"string",
"$",
"value",
")",
":",
"array",
"{",
"foreach",
"(",
"self",
"::",
"PATTERNS",
"as",
"$",
"pattern",
"=>",
"$",
"tokenTypeConstant",
")",
"{",
"if",
"(",
"1",
"===",
"preg_match",
"(",
"$",
"pattern",
",",
... | Lex a value with the mask "@X" where X is a valid possible reference
{@inheritdoc}
@throws LexException | [
"Lex",
"a",
"value",
"with",
"the",
"mask",
"@X",
"where",
"X",
"is",
"a",
"valid",
"possible",
"reference"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Lexer/ReferenceLexer.php#L50-L63 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FixtureMethodReferenceTokenParser.php | FixtureMethodReferenceTokenParser.parse | public function parse(Token $token)
{
parent::parse($token);
$values = preg_split('/->/', $token->getValue());
if (2 !== count($values)) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
$fixture = $this->parser->parse($values[0]);
... | php | public function parse(Token $token)
{
parent::parse($token);
$values = preg_split('/->/', $token->getValue());
if (2 !== count($values)) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
$fixture = $this->parser->parse($values[0]);
... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
"{",
"parent",
"::",
"parse",
"(",
"$",
"token",
")",
";",
"$",
"values",
"=",
"preg_split",
"(",
"'/->/'",
",",
"$",
"token",
"->",
"getValue",
"(",
")",
")",
";",
"if",
"(",
"2",
"... | Parses expressions such as "@username->getName()".
{@inheritdoc}
@throws ParseException | [
"Parses",
"expressions",
"such",
"as",
"@username",
"-",
">",
"getName",
"()",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FixtureMethodReferenceTokenParser.php#L45-L62 |
nelmio/alice | src/FixtureBuilder/Denormalizer/Fixture/Chainable/NullListNameDenormalizer.php | NullListNameDenormalizer.buildIds | public function buildIds(string $id): array
{
$matches = [];
if (false === $this->canDenormalize($id, $matches)) {
throw LogicExceptionFactory::createForCannotDenormalizerForChainableFixtureBuilderDenormalizer(__METHOD__);
}
$listElements = preg_split('/\s*,\s*/', $match... | php | public function buildIds(string $id): array
{
$matches = [];
if (false === $this->canDenormalize($id, $matches)) {
throw LogicExceptionFactory::createForCannotDenormalizerForChainableFixtureBuilderDenormalizer(__METHOD__);
}
$listElements = preg_split('/\s*,\s*/', $match... | [
"public",
"function",
"buildIds",
"(",
"string",
"$",
"id",
")",
":",
"array",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"canDenormalize",
"(",
"$",
"id",
",",
"$",
"matches",
")",
")",
"{",
"throw",
"... | @return string[]
@example
'user_{alice, bob}' => [
'user_alice',
'user_bob',
] | [
"@return",
"string",
"[]"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/Denormalizer/Fixture/Chainable/NullListNameDenormalizer.php#L62-L83 |
nelmio/alice | src/FixtureBuilder/Denormalizer/Fixture/Chainable/NullRangeNameDenormalizer.php | NullRangeNameDenormalizer.buildIds | public function buildIds(string $id): array
{
$ids = [];
$range = $this->buildRange($id);
$from = $range->getFrom();
$to = $range->getTo();
$step = $range->getStep();
for ($currentIndex = $from; $currentIndex <= $to; $currentIndex += $step) {
$ids[
... | php | public function buildIds(string $id): array
{
$ids = [];
$range = $this->buildRange($id);
$from = $range->getFrom();
$to = $range->getTo();
$step = $range->getStep();
for ($currentIndex = $from; $currentIndex <= $to; $currentIndex += $step) {
$ids[
... | [
"public",
"function",
"buildIds",
"(",
"string",
"$",
"id",
")",
":",
"array",
"{",
"$",
"ids",
"=",
"[",
"]",
";",
"$",
"range",
"=",
"$",
"this",
"->",
"buildRange",
"(",
"$",
"id",
")",
";",
"$",
"from",
"=",
"$",
"range",
"->",
"getFrom",
"... | @return string[]
@example
'user_{1..2}' => [
'user_1',
'user_2',
]
@example
'user_{1..3, 2}' => [
'user_1',
'user_3',
] | [
"@return",
"string",
"[]"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/Denormalizer/Fixture/Chainable/NullRangeNameDenormalizer.php#L74-L93 |
nelmio/alice | src/Generator/Resolver/Fixture/TemplateFixtureResolver.php | TemplateFixtureResolver.resolve | public function resolve(
TemplatingFixture $fixture,
FixtureBag $unresolvedFixtures,
TemplatingFixtureBag $resolvedFixtures,
ResolvingContext $context
): TemplatingFixtureBag {
$context->checkForCircularReference($fixture->getId());
if (false === $fixture->extendsFix... | php | public function resolve(
TemplatingFixture $fixture,
FixtureBag $unresolvedFixtures,
TemplatingFixtureBag $resolvedFixtures,
ResolvingContext $context
): TemplatingFixtureBag {
$context->checkForCircularReference($fixture->getId());
if (false === $fixture->extendsFix... | [
"public",
"function",
"resolve",
"(",
"TemplatingFixture",
"$",
"fixture",
",",
"FixtureBag",
"$",
"unresolvedFixtures",
",",
"TemplatingFixtureBag",
"$",
"resolvedFixtures",
",",
"ResolvingContext",
"$",
"context",
")",
":",
"TemplatingFixtureBag",
"{",
"$",
"context... | Resolves a given fixture. The resolution of a fixture may result in the resolution of several fixtures.
@param TemplatingFixture|FixtureInterface $fixture Fixture to resolve
@throws FixtureNotFoundException | [
"Resolves",
"a",
"given",
"fixture",
".",
"The",
"resolution",
"of",
"a",
"fixture",
"may",
"result",
"in",
"the",
"resolution",
"of",
"several",
"fixtures",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Fixture/TemplateFixtureResolver.php#L37-L63 |
nelmio/alice | src/Generator/Resolver/Fixture/TemplateFixtureResolver.php | TemplateFixtureResolver.resolveExtendedFixtures | private function resolveExtendedFixtures(
TemplatingFixture $fixture,
array $extendedFixtureReferences,
FixtureBag $unresolvedFixtures,
TemplatingFixtureBag $resolvedFixtures,
ResolvingContext $context
): array {
$fixtures = new FixtureBag();
foreach ($extende... | php | private function resolveExtendedFixtures(
TemplatingFixture $fixture,
array $extendedFixtureReferences,
FixtureBag $unresolvedFixtures,
TemplatingFixtureBag $resolvedFixtures,
ResolvingContext $context
): array {
$fixtures = new FixtureBag();
foreach ($extende... | [
"private",
"function",
"resolveExtendedFixtures",
"(",
"TemplatingFixture",
"$",
"fixture",
",",
"array",
"$",
"extendedFixtureReferences",
",",
"FixtureBag",
"$",
"unresolvedFixtures",
",",
"TemplatingFixtureBag",
"$",
"resolvedFixtures",
",",
"ResolvingContext",
"$",
"c... | @param FixtureReference[] $extendedFixtureReferences
@throws FixtureNotFoundException
@return array The first element is a FixtureBag with all the extended fixtures and the second is a
TemplatingFixtureBag which may contain new fixtures (from the resolution) | [
"@param",
"FixtureReference",
"[]",
"$extendedFixtureReferences"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Fixture/TemplateFixtureResolver.php#L73-L119 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/EvaluatedValueResolver.php | EvaluatedValueResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
// Scope exclusive to the evaluated expression
// We make use of the underscore... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
// Scope exclusive to the evaluated expression
// We make use of the underscore... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param EvaluatedValue $value
@throws UnresolvableValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/EvaluatedValueResolver.php#L48-L88 |
nelmio/alice | src/Generator/Caller/Chainable/OptionalMethodCallProcessor.php | OptionalMethodCallProcessor.process | public function process(
ObjectInterface $object,
ResolvedFixtureSet $fixtureSet,
GenerationContext $context,
MethodCallInterface $methodCall
): ResolvedFixtureSet {
if (false === ($methodCall instanceof OptionalMethodCall)) {
throw new \LogicException('TODO');
... | php | public function process(
ObjectInterface $object,
ResolvedFixtureSet $fixtureSet,
GenerationContext $context,
MethodCallInterface $methodCall
): ResolvedFixtureSet {
if (false === ($methodCall instanceof OptionalMethodCall)) {
throw new \LogicException('TODO');
... | [
"public",
"function",
"process",
"(",
"ObjectInterface",
"$",
"object",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"GenerationContext",
"$",
"context",
",",
"MethodCallInterface",
"$",
"methodCall",
")",
":",
"ResolvedFixtureSet",
"{",
"if",
"(",
"false",
... | {@inheritdoc}
@param OptionalMethodCall $methodCall | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Caller/Chainable/OptionalMethodCallProcessor.php#L61-L85 |
nelmio/alice | src/Generator/Instantiator/InstantiatorResolver.php | InstantiatorResolver.instantiate | public function instantiate(
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
GenerationContext $context
): ResolvedFixtureSet {
list($fixture, $fixtureSet) = $this->resolveFixtureConstructor($fixture, $fixtureSet, $context);
return $this->instantiator->instantiate... | php | public function instantiate(
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
GenerationContext $context
): ResolvedFixtureSet {
list($fixture, $fixtureSet) = $this->resolveFixtureConstructor($fixture, $fixtureSet, $context);
return $this->instantiator->instantiate... | [
"public",
"function",
"instantiate",
"(",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedFixtureSet",
"{",
"list",
"(",
"$",
"fixture",
",",
"$",
"fixtureSet",
")",
"... | Resolves the fixture constructor arguments before instantiating it.
{@inheritdoc}
@throws UnresolvableValueDuringGenerationException | [
"Resolves",
"the",
"fixture",
"constructor",
"arguments",
"before",
"instantiating",
"it",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Instantiator/InstantiatorResolver.php#L73-L81 |
nelmio/alice | src/Generator/Instantiator/InstantiatorResolver.php | InstantiatorResolver.resolveArguments | private function resolveArguments(
array $arguments,
ValueResolverInterface $resolver,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
GenerationContext $context
): array {
$scope = $fixtureSet->getParameters()->toArray();
$argumentPosition = 1;
... | php | private function resolveArguments(
array $arguments,
ValueResolverInterface $resolver,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
GenerationContext $context
): array {
$scope = $fixtureSet->getParameters()->toArray();
$argumentPosition = 1;
... | [
"private",
"function",
"resolveArguments",
"(",
"array",
"$",
"arguments",
",",
"ValueResolverInterface",
"$",
"resolver",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"GenerationContext",
"$",
"context",
")",
":",
"arr... | @throws UnresolvableValueDuringGenerationException
@return array The first element is an array ($arguments) which is the resolved arguments and the second the new
ResolvedFixtureSet which may contains new fixtures (from the arguments resolution) | [
"@throws",
"UnresolvableValueDuringGenerationException"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Instantiator/InstantiatorResolver.php#L126-L159 |
nelmio/alice | src/Definition/SpecificationBag.php | SpecificationBag.mergeWith | public function mergeWith(self $specs): self
{
$clone = clone $this;
if (null === $clone->constructor) {
$clone->constructor = $specs->constructor;
}
$clone->properties = $this->properties->mergeWith($specs->properties);
$clone->calls = $this->calls->merg... | php | public function mergeWith(self $specs): self
{
$clone = clone $this;
if (null === $clone->constructor) {
$clone->constructor = $specs->constructor;
}
$clone->properties = $this->properties->mergeWith($specs->properties);
$clone->calls = $this->calls->merg... | [
"public",
"function",
"mergeWith",
"(",
"self",
"$",
"specs",
")",
":",
"self",
"{",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"if",
"(",
"null",
"===",
"$",
"clone",
"->",
"constructor",
")",
"{",
"$",
"clone",
"->",
"constructor",
"=",
"$",
"... | Creates a new instance to which the given specs have been merged. In case of conflicts, the existing values are
kept. | [
"Creates",
"a",
"new",
"instance",
"to",
"which",
"the",
"given",
"specs",
"have",
"been",
"merged",
".",
"In",
"case",
"of",
"conflicts",
"the",
"existing",
"values",
"are",
"kept",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Definition/SpecificationBag.php#L77-L88 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/UnresolvedFixtureReferenceIdResolver.php | UnresolvedFixtureReferenceIdResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->resolver) {
throw ResolverNotFoundExceptionFactory::cre... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->resolver) {
throw ResolverNotFoundExceptionFactory::cre... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param FixtureReferenceValue $value
@throws UnresolvableValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/UnresolvedFixtureReferenceIdResolver.php#L97-L124 |
nelmio/alice | src/Parser/Chainable/PhpParser.php | PhpParser.parse | public function parse(string $file): array
{
if (false === file_exists($file)) {
throw InvalidArgumentExceptionFactory::createForFileCouldNotBeFound($file);
}
$data = include $file;
if (false === is_array($data)) {
throw TypeErrorFactory::createForInvalidFix... | php | public function parse(string $file): array
{
if (false === file_exists($file)) {
throw InvalidArgumentExceptionFactory::createForFileCouldNotBeFound($file);
}
$data = include $file;
if (false === is_array($data)) {
throw TypeErrorFactory::createForInvalidFix... | [
"public",
"function",
"parse",
"(",
"string",
"$",
"file",
")",
":",
"array",
"{",
"if",
"(",
"false",
"===",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"InvalidArgumentExceptionFactory",
"::",
"createForFileCouldNotBeFound",
"(",
"$",
"file",
... | {@inheritDoc}
@param string $file Local PHP file | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Parser/Chainable/PhpParser.php#L45-L58 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/ParameterValueResolver.php | ParameterValueResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
$parameterKey = $value->getValue();
$parameters = $fixtureSet->getParameters();... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
$parameterKey = $value->getValue();
$parameters = $fixtureSet->getParameters();... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param ParameterValue $value
@throws UnresolvableValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/ParameterValueResolver.php#L46-L63 |
nelmio/alice | src/Parser/Chainable/JsonParser.php | JsonParser.parse | public function parse(string $file): array
{
if (false === file_exists($file)) {
throw InvalidArgumentExceptionFactory::createForFileCouldNotBeFound($file);
}
try {
$data = json_decode(file_get_contents($file), true);
if (null === $data) {
... | php | public function parse(string $file): array
{
if (false === file_exists($file)) {
throw InvalidArgumentExceptionFactory::createForFileCouldNotBeFound($file);
}
try {
$data = json_decode(file_get_contents($file), true);
if (null === $data) {
... | [
"public",
"function",
"parse",
"(",
"string",
"$",
"file",
")",
":",
"array",
"{",
"if",
"(",
"false",
"===",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"InvalidArgumentExceptionFactory",
"::",
"createForFileCouldNotBeFound",
"(",
"$",
"file",
... | {@inheritDoc}
@param string $file Local JSON file
@throws UnparsableFileException | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Parser/Chainable/JsonParser.php#L47-L68 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/SelfFixtureReferenceResolver.php | SelfFixtureReferenceResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if ('self' === $value->getValue()) {
return new ResolvedValueWithFixtureSet... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if ('self' === $value->getValue()) {
return new ResolvedValueWithFixtureSet... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param FixtureReferenceValue $value
@throws UnresolvableValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/SelfFixtureReferenceResolver.php#L85-L100 |
nelmio/alice | src/Definition/PropertyBag.php | PropertyBag.mergeWith | public function mergeWith(self $propertyBag): self
{
$clone = clone $propertyBag;
foreach ($this->properties as $name => $property) {
$clone->properties[$name] = $property;
}
return $clone;
} | php | public function mergeWith(self $propertyBag): self
{
$clone = clone $propertyBag;
foreach ($this->properties as $name => $property) {
$clone->properties[$name] = $property;
}
return $clone;
} | [
"public",
"function",
"mergeWith",
"(",
"self",
"$",
"propertyBag",
")",
":",
"self",
"{",
"$",
"clone",
"=",
"clone",
"$",
"propertyBag",
";",
"foreach",
"(",
"$",
"this",
"->",
"properties",
"as",
"$",
"name",
"=>",
"$",
"property",
")",
"{",
"$",
... | Creates a new instance to which the given properties have been merged. In case of conflicts, the existing values
are kept.
@param PropertyBag $propertyBag
@return PropertyBag | [
"Creates",
"a",
"new",
"instance",
"to",
"which",
"the",
"given",
"properties",
"have",
"been",
"merged",
".",
"In",
"case",
"of",
"conflicts",
"the",
"existing",
"values",
"are",
"kept",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Definition/PropertyBag.php#L39-L47 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/VariableValueResolver.php | VariableValueResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
$variableName = $value->getValue();
if (array_key_exists($variableName, $scope)... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
$variableName = $value->getValue();
if (array_key_exists($variableName, $scope)... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param VariableValue $value
@throws UnresolvableValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/VariableValueResolver.php#L46-L62 |
nelmio/alice | src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Constructor/ConstructorDenormalizer.php | ConstructorDenormalizer.denormalize | public function denormalize(
FixtureInterface $scope,
FlagParserInterface $parser,
array $unparsedConstructor
): MethodCallInterface {
return new SimpleMethodCall(
'__construct',
$this->argumentDenormalizer->denormalize($scope, $parser, $unparsedConstructor)
... | php | public function denormalize(
FixtureInterface $scope,
FlagParserInterface $parser,
array $unparsedConstructor
): MethodCallInterface {
return new SimpleMethodCall(
'__construct',
$this->argumentDenormalizer->denormalize($scope, $parser, $unparsedConstructor)
... | [
"public",
"function",
"denormalize",
"(",
"FixtureInterface",
"$",
"scope",
",",
"FlagParserInterface",
"$",
"parser",
",",
"array",
"$",
"unparsedConstructor",
")",
":",
"MethodCallInterface",
"{",
"return",
"new",
"SimpleMethodCall",
"(",
"'__construct'",
",",
"$"... | {@inheritdoc}
@throws UnexpectedValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Constructor/ConstructorDenormalizer.php#L44-L53 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/UniqueValueResolver.php | UniqueValueResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context,
int $tryCounter = 0
): ResolvedValueWithFixtureSet {
$this->checkResolver(__METHOD__);
$tryCounter = $t... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context,
int $tryCounter = 0
): ResolvedValueWithFixtureSet {
$this->checkResolver(__METHOD__);
$tryCounter = $t... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
",",
"int",
"$",
"tryCounter",
"=",... | {@inheritdoc}
@param UniqueValue $value
@throws UniqueValueGenerationLimitReachedException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/UniqueValueResolver.php#L85-L109 |
nelmio/alice | src/PropertyAccess/ReflectionPropertyAccessor.php | ReflectionPropertyAccessor.setValue | public function setValue(&$objectOrArray, $propertyPath, $value)
{
try {
$this->decoratedPropertyAccessor->setValue($objectOrArray, $propertyPath, $value);
} catch (NoSuchPropertyException $exception) {
$propertyReflectionProperty = $this->getPropertyReflectionProperty($objec... | php | public function setValue(&$objectOrArray, $propertyPath, $value)
{
try {
$this->decoratedPropertyAccessor->setValue($objectOrArray, $propertyPath, $value);
} catch (NoSuchPropertyException $exception) {
$propertyReflectionProperty = $this->getPropertyReflectionProperty($objec... | [
"public",
"function",
"setValue",
"(",
"&",
"$",
"objectOrArray",
",",
"$",
"propertyPath",
",",
"$",
"value",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"decoratedPropertyAccessor",
"->",
"setValue",
"(",
"$",
"objectOrArray",
",",
"$",
"propertyPath",
",",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/PropertyAccess/ReflectionPropertyAccessor.php#L42-L70 |
nelmio/alice | src/PropertyAccess/ReflectionPropertyAccessor.php | ReflectionPropertyAccessor.getValue | public function getValue($objectOrArray, $propertyPath)
{
try {
return $this->decoratedPropertyAccessor->getValue($objectOrArray, $propertyPath);
} catch (NoSuchPropertyException $exception) {
$propertyReflectionProperty = $this->getPropertyReflectionProperty($objectOrArray, ... | php | public function getValue($objectOrArray, $propertyPath)
{
try {
return $this->decoratedPropertyAccessor->getValue($objectOrArray, $propertyPath);
} catch (NoSuchPropertyException $exception) {
$propertyReflectionProperty = $this->getPropertyReflectionProperty($objectOrArray, ... | [
"public",
"function",
"getValue",
"(",
"$",
"objectOrArray",
",",
"$",
"propertyPath",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"decoratedPropertyAccessor",
"->",
"getValue",
"(",
"$",
"objectOrArray",
",",
"$",
"propertyPath",
")",
";",
"}",
"catc... | {@inheritdoc} | [
"{"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/PropertyAccess/ReflectionPropertyAccessor.php#L75-L101 |
nelmio/alice | src/PropertyAccess/ReflectionPropertyAccessor.php | ReflectionPropertyAccessor.isWritable | public function isWritable($objectOrArray, $propertyPath)
{
return $this->decoratedPropertyAccessor->isWritable($objectOrArray, $propertyPath) || $this->propertyExists($objectOrArray, $propertyPath);
} | php | public function isWritable($objectOrArray, $propertyPath)
{
return $this->decoratedPropertyAccessor->isWritable($objectOrArray, $propertyPath) || $this->propertyExists($objectOrArray, $propertyPath);
} | [
"public",
"function",
"isWritable",
"(",
"$",
"objectOrArray",
",",
"$",
"propertyPath",
")",
"{",
"return",
"$",
"this",
"->",
"decoratedPropertyAccessor",
"->",
"isWritable",
"(",
"$",
"objectOrArray",
",",
"$",
"propertyPath",
")",
"||",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/PropertyAccess/ReflectionPropertyAccessor.php#L106-L109 |
nelmio/alice | src/PropertyAccess/ReflectionPropertyAccessor.php | ReflectionPropertyAccessor.isReadable | public function isReadable($objectOrArray, $propertyPath)
{
return $this->decoratedPropertyAccessor->isReadable($objectOrArray, $propertyPath) || $this->propertyExists($objectOrArray, $propertyPath);
} | php | public function isReadable($objectOrArray, $propertyPath)
{
return $this->decoratedPropertyAccessor->isReadable($objectOrArray, $propertyPath) || $this->propertyExists($objectOrArray, $propertyPath);
} | [
"public",
"function",
"isReadable",
"(",
"$",
"objectOrArray",
",",
"$",
"propertyPath",
")",
"{",
"return",
"$",
"this",
"->",
"decoratedPropertyAccessor",
"->",
"isReadable",
"(",
"$",
"objectOrArray",
",",
"$",
"propertyPath",
")",
"||",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/PropertyAccess/ReflectionPropertyAccessor.php#L114-L117 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Lexer/EmptyValueLexer.php | EmptyValueLexer.lex | public function lex(string $value): array
{
if ('' === $value) {
return [new Token('', new TokenType(TokenType::STRING_TYPE))];
}
return $this->lexer->lex($value);
} | php | public function lex(string $value): array
{
if ('' === $value) {
return [new Token('', new TokenType(TokenType::STRING_TYPE))];
}
return $this->lexer->lex($value);
} | [
"public",
"function",
"lex",
"(",
"string",
"$",
"value",
")",
":",
"array",
"{",
"if",
"(",
"''",
"===",
"$",
"value",
")",
"{",
"return",
"[",
"new",
"Token",
"(",
"''",
",",
"new",
"TokenType",
"(",
"TokenType",
"::",
"STRING_TYPE",
")",
")",
"]... | {@inheritdoc} | [
"{"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Lexer/EmptyValueLexer.php#L38-L45 |
nelmio/alice | src/Generator/GenerationContext.php | GenerationContext.getCachedValue | public function getCachedValue(string $key)
{
if (false === array_key_exists($key, $this->cache)) {
throw CachedValueNotFound::create($key);
}
return $this->cache[$key];
} | php | public function getCachedValue(string $key)
{
if (false === array_key_exists($key, $this->cache)) {
throw CachedValueNotFound::create($key);
}
return $this->cache[$key];
} | [
"public",
"function",
"getCachedValue",
"(",
"string",
"$",
"key",
")",
"{",
"if",
"(",
"false",
"===",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"cache",
")",
")",
"{",
"throw",
"CachedValueNotFound",
"::",
"create",
"(",
"$",
"key",
... | @throws CachedValueNotFound
@return mixed | [
"@throws",
"CachedValueNotFound"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/GenerationContext.php#L112-L119 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/TolerantFunctionTokenParser.php | TolerantFunctionTokenParser.parse | public function parse(Token $token)
{
parent::parse($token);
$split = preg_split(self::REGEX, $token->getValue(), 2, PREG_SPLIT_DELIM_CAPTURE + PREG_SPLIT_NO_EMPTY);
$splitSize = count($split);
if (1 === $splitSize) {
return $this->functionTokenParser->parse($token);
... | php | public function parse(Token $token)
{
parent::parse($token);
$split = preg_split(self::REGEX, $token->getValue(), 2, PREG_SPLIT_DELIM_CAPTURE + PREG_SPLIT_NO_EMPTY);
$splitSize = count($split);
if (1 === $splitSize) {
return $this->functionTokenParser->parse($token);
... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
"{",
"parent",
"::",
"parse",
"(",
"$",
"token",
")",
";",
"$",
"split",
"=",
"preg_split",
"(",
"self",
"::",
"REGEX",
",",
"$",
"token",
"->",
"getValue",
"(",
")",
",",
"2",
",",
... | Handle cases like '<f()> <g()>' by trying to break down the token.
{@inheritdoc}
@throws LexException
@TODO: handle redundant ListValue tokens
@return FunctionCallValue|ListValue | [
"Handle",
"cases",
"like",
"<f",
"()",
">",
"<g",
"()",
">",
"by",
"trying",
"to",
"break",
"down",
"the",
"token",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/TolerantFunctionTokenParser.php#L83-L110 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/VariableReferenceTokenParser.php | VariableReferenceTokenParser.parse | public function parse(Token $token): FixtureReferenceValue
{
$parts = explode('$', $token->getValue());
$variable = $parts[1];
try {
return new FixtureReferenceValue(
new ListValue([
substr($parts[0], 1),
'current' === $va... | php | public function parse(Token $token): FixtureReferenceValue
{
$parts = explode('$', $token->getValue());
$variable = $parts[1];
try {
return new FixtureReferenceValue(
new ListValue([
substr($parts[0], 1),
'current' === $va... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
":",
"FixtureReferenceValue",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'$'",
",",
"$",
"token",
"->",
"getValue",
"(",
")",
")",
";",
"$",
"variable",
"=",
"$",
"parts",
"[",
"1",
"]",
... | Parses expressions such as "@user$foo".
{@inheritdoc} | [
"Parses",
"expressions",
"such",
"as",
"@user$foo",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/VariableReferenceTokenParser.php#L48-L69 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/DynamicArrayValueResolver.php | DynamicArrayValueResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
$this->checkResolver(__METHOD__);
$quantifier = $value->getQuantifier();
... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
$this->checkResolver(__METHOD__);
$quantifier = $value->getQuantifier();
... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param DynamicArrayValue $value | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/DynamicArrayValueResolver.php#L64-L99 |
nelmio/alice | src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/UniqueValueDenormalizer.php | UniqueValueDenormalizer.denormalize | public function denormalize(FixtureInterface $scope, FlagBag $flags = null, $value)
{
$value = $this->denormalizer->denormalize($scope, $flags, $value);
if (false === $this->requiresUnique($flags)) {
return $value;
}
return $this->generateValue($scope, $flags, $value);
... | php | public function denormalize(FixtureInterface $scope, FlagBag $flags = null, $value)
{
$value = $this->denormalizer->denormalize($scope, $flags, $value);
if (false === $this->requiresUnique($flags)) {
return $value;
}
return $this->generateValue($scope, $flags, $value);
... | [
"public",
"function",
"denormalize",
"(",
"FixtureInterface",
"$",
"scope",
",",
"FlagBag",
"$",
"flags",
"=",
"null",
",",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"denormalizer",
"->",
"denormalize",
"(",
"$",
"scope",
",",
"$",
... | {@inheritdoc}
@throws InvalidScopeException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/UniqueValueDenormalizer.php#L48-L57 |
nelmio/alice | src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/UniqueValueDenormalizer.php | UniqueValueDenormalizer.generateValue | private function generateValue(FixtureInterface $scope, FlagBag $flags, $value): ValueInterface
{
$uniqueId = sprintf('%s#%s', $scope->getClassName(), $flags->getKey());
if ('temporary_id' === substr($scope->getId(), 0, 12)) {
throw DenormalizerExceptionFactory::createForInvalidScopeForU... | php | private function generateValue(FixtureInterface $scope, FlagBag $flags, $value): ValueInterface
{
$uniqueId = sprintf('%s#%s', $scope->getClassName(), $flags->getKey());
if ('temporary_id' === substr($scope->getId(), 0, 12)) {
throw DenormalizerExceptionFactory::createForInvalidScopeForU... | [
"private",
"function",
"generateValue",
"(",
"FixtureInterface",
"$",
"scope",
",",
"FlagBag",
"$",
"flags",
",",
"$",
"value",
")",
":",
"ValueInterface",
"{",
"$",
"uniqueId",
"=",
"sprintf",
"(",
"'%s#%s'",
",",
"$",
"scope",
"->",
"getClassName",
"(",
... | @param mixed|ValueInterface $value
@throws InvalidScopeException | [
"@param",
"mixed|ValueInterface",
"$value"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/UniqueValueDenormalizer.php#L79-L109 |
nelmio/alice | src/FixtureBuilder/Denormalizer/Fixture/Chainable/CollectionDenormalizerWithTemporaryFixture.php | CollectionDenormalizerWithTemporaryFixture.denormalizeTemporaryFixture | private function denormalizeTemporaryFixture(
FixtureBag $builtFixtures,
string $className,
array $specs,
FlagBag $flags
): array {
$tempFixtureId = uniqid('temporary_id');
$builtFixtures = $this->denormalizer->denormalize(
$builtFixtures,
$cla... | php | private function denormalizeTemporaryFixture(
FixtureBag $builtFixtures,
string $className,
array $specs,
FlagBag $flags
): array {
$tempFixtureId = uniqid('temporary_id');
$builtFixtures = $this->denormalizer->denormalize(
$builtFixtures,
$cla... | [
"private",
"function",
"denormalizeTemporaryFixture",
"(",
"FixtureBag",
"$",
"builtFixtures",
",",
"string",
"$",
"className",
",",
"array",
"$",
"specs",
",",
"FlagBag",
"$",
"flags",
")",
":",
"array",
"{",
"$",
"tempFixtureId",
"=",
"uniqid",
"(",
"'tempor... | Helper method which uses the denormalizer to denormalize a fixture with the given properties but with a random
ID. The ID used and with the fixtures are returned.
This helper is used to optimize the number of call made on the decorated denormalizer: instead of building the
IDs from the list or the range, and then deno... | [
"Helper",
"method",
"which",
"uses",
"the",
"denormalizer",
"to",
"denormalize",
"a",
"fixture",
"with",
"the",
"given",
"properties",
"but",
"with",
"a",
"random",
"ID",
".",
"The",
"ID",
"used",
"and",
"with",
"the",
"fixtures",
"are",
"returned",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/Denormalizer/Fixture/Chainable/CollectionDenormalizerWithTemporaryFixture.php#L158-L177 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FixtureRangeReferenceTokenParser.php | FixtureRangeReferenceTokenParser.parse | public function parse(Token $token)
{
$range = $this->buildRange($token);
$references = [];
$from = $range->getFrom();
$to = $range->getTo();
$step = $range->getStep();
for ($currentIndex = $from; $currentIndex <= $to; $currentIndex += $step) {
$fixtureId ... | php | public function parse(Token $token)
{
$range = $this->buildRange($token);
$references = [];
$from = $range->getFrom();
$to = $range->getTo();
$step = $range->getStep();
for ($currentIndex = $from; $currentIndex <= $to; $currentIndex += $step) {
$fixtureId ... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
"{",
"$",
"range",
"=",
"$",
"this",
"->",
"buildRange",
"(",
"$",
"token",
")",
";",
"$",
"references",
"=",
"[",
"]",
";",
"$",
"from",
"=",
"$",
"range",
"->",
"getFrom",
"(",
")"... | Parses expressions such as '$username'.
{@inheritdoc}
@throws ParseException | [
"Parses",
"expressions",
"such",
"as",
"$username",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FixtureRangeReferenceTokenParser.php#L62-L75 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FixtureRangeReferenceTokenParser.php | FixtureRangeReferenceTokenParser.buildRange | private function buildRange(Token $token): RangeName
{
$matches = [];
$name = substr($token->getValue(), 1);
if (1 !== preg_match(self::REGEX, (string) $name, $matches)) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
$reference =... | php | private function buildRange(Token $token): RangeName
{
$matches = [];
$name = substr($token->getValue(), 1);
if (1 !== preg_match(self::REGEX, (string) $name, $matches)) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
$reference =... | [
"private",
"function",
"buildRange",
"(",
"Token",
"$",
"token",
")",
":",
"RangeName",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"$",
"name",
"=",
"substr",
"(",
"$",
"token",
"->",
"getValue",
"(",
")",
",",
"1",
")",
";",
"if",
"(",
"1",
"!==",... | @throws ParseException
@example
"@user{1..10}" => new RangeName('user', 1, 10) | [
"@throws",
"ParseException"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FixtureRangeReferenceTokenParser.php#L83-L101 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/FixtureWildcardReferenceResolver.php | FixtureWildcardReferenceResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->resolver) {
throw ResolverNotFoundExceptionFactory::cre... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->resolver) {
throw ResolverNotFoundExceptionFactory::cre... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param FixtureMatchReferenceValue $value
@throws UnresolvableValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/FixtureWildcardReferenceResolver.php#L73-L97 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/FixtureWildcardReferenceResolver.php | FixtureWildcardReferenceResolver.getSuitableIds | private function getSuitableIds(
FixtureMatchReferenceValue $value,
ResolvedFixtureSet $fixtureSet,
GenerationContext $context
): array {
$pattern = $value->getValue();
try {
$cache = $context->getCachedValue(self::IDS_BY_PATTERN_CACHE_KEY);
} catch (Cach... | php | private function getSuitableIds(
FixtureMatchReferenceValue $value,
ResolvedFixtureSet $fixtureSet,
GenerationContext $context
): array {
$pattern = $value->getValue();
try {
$cache = $context->getCachedValue(self::IDS_BY_PATTERN_CACHE_KEY);
} catch (Cach... | [
"private",
"function",
"getSuitableIds",
"(",
"FixtureMatchReferenceValue",
"$",
"value",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"GenerationContext",
"$",
"context",
")",
":",
"array",
"{",
"$",
"pattern",
"=",
"$",
"value",
"->",
"getValue",
"(",
")... | Gets all the fixture IDs suitable for the given value.
@return string[] | [
"Gets",
"all",
"the",
"fixture",
"IDs",
"suitable",
"for",
"the",
"given",
"value",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/FixtureWildcardReferenceResolver.php#L104-L127 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/ParameterTokenParser.php | ParameterTokenParser.parse | public function parse(Token $token): ParameterValue
{
$value = $token->getValue();
try {
$paramKey = substr($value, 2, strlen($value) - 4);
return new ParameterValue($paramKey);
} catch (\TypeError $error) {
throw ExpressionLanguageExceptionFactory::creat... | php | public function parse(Token $token): ParameterValue
{
$value = $token->getValue();
try {
$paramKey = substr($value, 2, strlen($value) - 4);
return new ParameterValue($paramKey);
} catch (\TypeError $error) {
throw ExpressionLanguageExceptionFactory::creat... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
":",
"ParameterValue",
"{",
"$",
"value",
"=",
"$",
"token",
"->",
"getValue",
"(",
")",
";",
"try",
"{",
"$",
"paramKey",
"=",
"substr",
"(",
"$",
"value",
",",
"2",
",",
"strlen",
"(... | Parses '<{paramKey}>', '<{nested_<{param}>}>', etc.
{@inheritdoc}
@throws ParseException | [
"Parses",
"<",
"{",
"paramKey",
"}",
">",
"<",
"{",
"nested_<",
"{",
"param",
"}",
">",
"}",
">",
"etc",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/ParameterTokenParser.php#L46-L56 |
nelmio/alice | src/ObjectBag.php | ObjectBag.with | public function with(ObjectInterface $object): self
{
$clone = clone $this;
$clone->objects[$object->getId()] = $object;
$clone->array[$object->getId()] = $object->getInstance();
return $clone;
} | php | public function with(ObjectInterface $object): self
{
$clone = clone $this;
$clone->objects[$object->getId()] = $object;
$clone->array[$object->getId()] = $object->getInstance();
return $clone;
} | [
"public",
"function",
"with",
"(",
"ObjectInterface",
"$",
"object",
")",
":",
"self",
"{",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"$",
"clone",
"->",
"objects",
"[",
"$",
"object",
"->",
"getId",
"(",
")",
"]",
"=",
"$",
"object",
";",
"$",... | Creates a new instance which will contain the given object. If an object with the same reference already exists,
it will be overridden by the new object. | [
"Creates",
"a",
"new",
"instance",
"which",
"will",
"contain",
"the",
"given",
"object",
".",
"If",
"an",
"object",
"with",
"the",
"same",
"reference",
"already",
"exists",
"it",
"will",
"be",
"overridden",
"by",
"the",
"new",
"object",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/ObjectBag.php#L62-L69 |
nelmio/alice | src/ObjectBag.php | ObjectBag.mergeWith | public function mergeWith(self $objects): self
{
$clone = clone $this;
foreach ($objects->objects as $reference => $object) {
$clone->objects[$reference] = $object;
$clone->array[$reference] = $object->getInstance();
}
return $clone;
} | php | public function mergeWith(self $objects): self
{
$clone = clone $this;
foreach ($objects->objects as $reference => $object) {
$clone->objects[$reference] = $object;
$clone->array[$reference] = $object->getInstance();
}
return $clone;
} | [
"public",
"function",
"mergeWith",
"(",
"self",
"$",
"objects",
")",
":",
"self",
"{",
"$",
"clone",
"=",
"clone",
"$",
"this",
";",
"foreach",
"(",
"$",
"objects",
"->",
"objects",
"as",
"$",
"reference",
"=>",
"$",
"object",
")",
"{",
"$",
"clone",... | Creates a new instance with the new objects. If objects with the same reference already exists, they will be
overridden by the new ones.
@param ObjectBag $objects | [
"Creates",
"a",
"new",
"instance",
"with",
"the",
"new",
"objects",
".",
"If",
"objects",
"with",
"the",
"same",
"reference",
"already",
"exists",
"they",
"will",
"be",
"overridden",
"by",
"the",
"new",
"ones",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/ObjectBag.php#L91-L100 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/FixturePropertyReferenceResolver.php | FixturePropertyReferenceResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->resolver) {
throw ResolverNotFoundExceptionFactory::cre... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->resolver) {
throw ResolverNotFoundExceptionFactory::cre... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param FixturePropertyValue $value
@throws NoSuchPropertyException
@throws UnresolvableValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/FixturePropertyReferenceResolver.php#L78-L108 |
nelmio/alice | src/Bridge/Symfony/DependencyInjection/NelmioAliceExtension.php | NelmioAliceExtension.loadConfig | private function loadConfig(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$processedConfiguration = $this->processConfiguration($configuration, $configs);
foreach ($processedConfiguration as $key => $value) {
$container->setParameter(
... | php | private function loadConfig(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$processedConfiguration = $this->processConfiguration($configuration, $configs);
foreach ($processedConfiguration as $key => $value) {
$container->setParameter(
... | [
"private",
"function",
"loadConfig",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"processedConfiguration",
"=",
"$",
"this",
"->",
"processConfiguration... | Loads alice configuration and add the configuration values to the application parameters.
@throws \InvalidArgumentException | [
"Loads",
"alice",
"configuration",
"and",
"add",
"the",
"configuration",
"values",
"to",
"the",
"application",
"parameters",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Bridge/Symfony/DependencyInjection/NelmioAliceExtension.php#L44-L55 |
nelmio/alice | src/Bridge/Symfony/DependencyInjection/NelmioAliceExtension.php | NelmioAliceExtension.loadServices | private function loadServices(ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(self::SERVICES_DIR));
$finder = new Finder();
$finder->files()->in(self::SERVICES_DIR);
foreach ($finder as $file) {
$loader->load(
$file... | php | private function loadServices(ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(self::SERVICES_DIR));
$finder = new Finder();
$finder->files()->in(self::SERVICES_DIR);
foreach ($finder as $file) {
$loader->load(
$file... | [
"private",
"function",
"loadServices",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"loader",
"=",
"new",
"XmlFileLoader",
"(",
"$",
"container",
",",
"new",
"FileLocator",
"(",
"self",
"::",
"SERVICES_DIR",
")",
")",
";",
"$",
"finder",
"=",
... | Loads all the services declarations. | [
"Loads",
"all",
"the",
"services",
"declarations",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Bridge/Symfony/DependencyInjection/NelmioAliceExtension.php#L60-L78 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/PropertyReferenceTokenParser.php | PropertyReferenceTokenParser.parse | public function parse(Token $token): FixturePropertyValue
{
parent::parse($token);
$explodedValue = explode('->', $token->getValue());
if (count($explodedValue) !== 2) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
$reference = $... | php | public function parse(Token $token): FixturePropertyValue
{
parent::parse($token);
$explodedValue = explode('->', $token->getValue());
if (count($explodedValue) !== 2) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
$reference = $... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
":",
"FixturePropertyValue",
"{",
"parent",
"::",
"parse",
"(",
"$",
"token",
")",
";",
"$",
"explodedValue",
"=",
"explode",
"(",
"'->'",
",",
"$",
"token",
"->",
"getValue",
"(",
")",
")... | Parses tokens values like "@user->username".
{@inheritdoc}
@throws ParseException | [
"Parses",
"tokens",
"values",
"like",
"@user",
"-",
">",
"username",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/PropertyReferenceTokenParser.php#L43-L61 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/FixtureReferenceResolver.php | FixtureReferenceResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->generator) {
throw ObjectGeneratorNotFoundExceptionFact... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->generator) {
throw ObjectGeneratorNotFoundExceptionFact... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param FixtureReferenceValue $value
@throws UnresolvableValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/FixtureReferenceResolver.php#L77-L96 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/OptionalTokenParser.php | OptionalTokenParser.parse | public function parse(Token $token): OptionalValue
{
parent::parse($token);
if (1 !== preg_match(self::REGEX, $token->getValue(), $matches)) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
return new OptionalValue(
$this->pars... | php | public function parse(Token $token): OptionalValue
{
parent::parse($token);
if (1 !== preg_match(self::REGEX, $token->getValue(), $matches)) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
}
return new OptionalValue(
$this->pars... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
":",
"OptionalValue",
"{",
"parent",
"::",
"parse",
"(",
"$",
"token",
")",
";",
"if",
"(",
"1",
"!==",
"preg_match",
"(",
"self",
"::",
"REGEX",
",",
"$",
"token",
"->",
"getValue",
"("... | Parses expressions such as '60%? foo: bar'.
{@inheritdoc}
@throws ParseException | [
"Parses",
"expressions",
"such",
"as",
"60%?",
"foo",
":",
"bar",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/OptionalTokenParser.php#L45-L60 |
nelmio/alice | src/FixtureBuilder/Denormalizer/Parameter/SimpleParameterBagDenormalizer.php | SimpleParameterBagDenormalizer.denormalize | public function denormalize(array $data): ParameterBag
{
if (false === array_key_exists('parameters', $data)
|| null === $fixturesParameters = $data['parameters']
) {
return new ParameterBag();
}
if (false === is_array($fixturesParameters)) {
thro... | php | public function denormalize(array $data): ParameterBag
{
if (false === array_key_exists('parameters', $data)
|| null === $fixturesParameters = $data['parameters']
) {
return new ParameterBag();
}
if (false === is_array($fixturesParameters)) {
thro... | [
"public",
"function",
"denormalize",
"(",
"array",
"$",
"data",
")",
":",
"ParameterBag",
"{",
"if",
"(",
"false",
"===",
"array_key_exists",
"(",
"'parameters'",
",",
"$",
"data",
")",
"||",
"null",
"===",
"$",
"fixturesParameters",
"=",
"$",
"data",
"[",... | {@inheritdoc}
@param array $data Full set of parsed data, will look for the parameter subset itself. | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/Denormalizer/Parameter/SimpleParameterBagDenormalizer.php#L30-L43 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/PhpFunctionCallValueResolver.php | PhpFunctionCallValueResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
$functionName = $value->getName();
if (false === function_exists($functionName)... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
$functionName = $value->getName();
if (false === function_exists($functionName)... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param ResolvedFunctionCallValue $value | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/PhpFunctionCallValueResolver.php#L63-L83 |
nelmio/alice | src/Parser/Chainable/YamlParser.php | YamlParser.parse | public function parse(string $file): array
{
if (false === file_exists($file)) {
throw InvalidArgumentExceptionFactory::createForFileCouldNotBeFound($file);
}
try {
$data = defined('Symfony\\Component\\Yaml\\Yaml::PARSE_CONSTANT')
? $this->yamlParser-... | php | public function parse(string $file): array
{
if (false === file_exists($file)) {
throw InvalidArgumentExceptionFactory::createForFileCouldNotBeFound($file);
}
try {
$data = defined('Symfony\\Component\\Yaml\\Yaml::PARSE_CONSTANT')
? $this->yamlParser-... | [
"public",
"function",
"parse",
"(",
"string",
"$",
"file",
")",
":",
"array",
"{",
"if",
"(",
"false",
"===",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"InvalidArgumentExceptionFactory",
"::",
"createForFileCouldNotBeFound",
"(",
"$",
"file",
... | {@inheritDoc}
@param string $file Local YAML file
@throws UnparsableFileException | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Parser/Chainable/YamlParser.php#L61-L81 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Lexer/ReferenceEscaperLexer.php | ReferenceEscaperLexer.lex | public function lex(string $value): array
{
$escapedValue = preg_replace('/(\\p{L})@/', '$1\\@', $value);
return $this->lexer->lex($escapedValue);
} | php | public function lex(string $value): array
{
$escapedValue = preg_replace('/(\\p{L})@/', '$1\\@', $value);
return $this->lexer->lex($escapedValue);
} | [
"public",
"function",
"lex",
"(",
"string",
"$",
"value",
")",
":",
"array",
"{",
"$",
"escapedValue",
"=",
"preg_replace",
"(",
"'/(\\\\p{L})@/'",
",",
"'$1\\\\@'",
",",
"$",
"value",
")",
";",
"return",
"$",
"this",
"->",
"lexer",
"->",
"lex",
"(",
"... | {@inheritdoc}
@throws LexException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Lexer/ReferenceEscaperLexer.php#L45-L50 |
nelmio/alice | src/Generator/Resolver/ResolvingContext.php | ResolvingContext.createFrom | public static function createFrom(self $resolving = null, string $key): self
{
$instance = null === $resolving ? new self() : $resolving;
if (false === $instance->has($key)) {
$instance->add($key);
}
return $instance;
} | php | public static function createFrom(self $resolving = null, string $key): self
{
$instance = null === $resolving ? new self() : $resolving;
if (false === $instance->has($key)) {
$instance->add($key);
}
return $instance;
} | [
"public",
"static",
"function",
"createFrom",
"(",
"self",
"$",
"resolving",
"=",
"null",
",",
"string",
"$",
"key",
")",
":",
"self",
"{",
"$",
"instance",
"=",
"null",
"===",
"$",
"resolving",
"?",
"new",
"self",
"(",
")",
":",
"$",
"resolving",
";... | Returns the existing instance if is an object or create a new one otherwise. It also ensure that the key will be
added also it won't increment the counter if already present.
@param self|null $resolving | [
"Returns",
"the",
"existing",
"instance",
"if",
"is",
"an",
"object",
"or",
"create",
"a",
"new",
"one",
"otherwise",
".",
"It",
"also",
"ensure",
"that",
"the",
"key",
"will",
"be",
"added",
"also",
"it",
"won",
"t",
"increment",
"the",
"counter",
"if",... | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/ResolvingContext.php#L42-L50 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FunctionTokenParser.php | FunctionTokenParser.parse | public function parse(Token $token): FunctionCallValue
{
if (null === $this->parser) {
throw ExpressionLanguageExceptionFactory::createForExpectedMethodCallOnlyIfHasAParser(__METHOD__);
}
if (1 !== preg_match(self::REGEX, $token->getValue(), $matches)) {
throw Expres... | php | public function parse(Token $token): FunctionCallValue
{
if (null === $this->parser) {
throw ExpressionLanguageExceptionFactory::createForExpectedMethodCallOnlyIfHasAParser(__METHOD__);
}
if (1 !== preg_match(self::REGEX, $token->getValue(), $matches)) {
throw Expres... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
":",
"FunctionCallValue",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"parser",
")",
"{",
"throw",
"ExpressionLanguageExceptionFactory",
"::",
"createForExpectedMethodCallOnlyIfHasAParser",
"(",
... | Parses expressions such as '<foo()>', '<foo(arg1, arg2)>'.
{@inheritdoc}
@throws ParseException | [
"Parses",
"expressions",
"such",
"as",
"<foo",
"()",
">",
"<foo",
"(",
"arg1",
"arg2",
")",
">",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FunctionTokenParser.php#L77-L107 |
nelmio/alice | src/Generator/Caller/Chainable/MethodCallWithReferenceProcessor.php | MethodCallWithReferenceProcessor.process | public function process(
ObjectInterface $object,
ResolvedFixtureSet $fixtureSet,
GenerationContext $context,
MethodCallInterface $methodCall
): ResolvedFixtureSet {
/** @var StaticReference $reference */
$reference = $methodCall->getCaller();
if (false === (... | php | public function process(
ObjectInterface $object,
ResolvedFixtureSet $fixtureSet,
GenerationContext $context,
MethodCallInterface $methodCall
): ResolvedFixtureSet {
/** @var StaticReference $reference */
$reference = $methodCall->getCaller();
if (false === (... | [
"public",
"function",
"process",
"(",
"ObjectInterface",
"$",
"object",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"GenerationContext",
"$",
"context",
",",
"MethodCallInterface",
"$",
"methodCall",
")",
":",
"ResolvedFixtureSet",
"{",
"/** @var StaticReference ... | {@inheritdoc}
@param MethodCallWithReference $methodCall | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Caller/Chainable/MethodCallWithReferenceProcessor.php#L46-L68 |
nelmio/alice | src/Generator/Instantiator/Chainable/AbstractChainableInstantiator.php | AbstractChainableInstantiator.instantiate | public function instantiate(
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
GenerationContext $context
): ResolvedFixtureSet {
try {
$instance = $this->createInstance($fixture);
} catch (InstantiationThrowable $throwable) {
throw $throwable... | php | public function instantiate(
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
GenerationContext $context
): ResolvedFixtureSet {
try {
$instance = $this->createInstance($fixture);
} catch (InstantiationThrowable $throwable) {
throw $throwable... | [
"public",
"function",
"instantiate",
"(",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedFixtureSet",
"{",
"try",
"{",
"$",
"instance",
"=",
"$",
"this",
"->",
"creat... | {@inheritdoc}
@throws InstantiationException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Instantiator/Chainable/AbstractChainableInstantiator.php#L38-L59 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionLexer.php | FunctionLexer.lex | public function lex(string $value): array
{
if (false === $this->functionTokenizer->isTokenized($value)) {
$value = $this->functionTokenizer->tokenize($value);
}
return $this->decoratedLexer->lex($value);
} | php | public function lex(string $value): array
{
if (false === $this->functionTokenizer->isTokenized($value)) {
$value = $this->functionTokenizer->tokenize($value);
}
return $this->decoratedLexer->lex($value);
} | [
"public",
"function",
"lex",
"(",
"string",
"$",
"value",
")",
":",
"array",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"functionTokenizer",
"->",
"isTokenized",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"functio... | {@inheritdoc}
@throws MalformedFunctionException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionLexer.php#L51-L58 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/FixtureMethodCallReferenceResolver.php | FixtureMethodCallReferenceResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->argumentResolver) {
throw ResolverNotFoundExceptionFact... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->argumentResolver) {
throw ResolverNotFoundExceptionFact... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param FixtureMethodCallValue $value
@throws NoSuchPropertyException
@throws UnresolvableValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/FixtureMethodCallReferenceResolver.php#L70-L113 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTreeTokenizer.php | FunctionTreeTokenizer.tokenize | public function tokenize(string $value): array
{
$value = preg_replace(
'/(.*?)<((?:.*?:)?(?:\p{L}|_|[0-9])+?)\((.*?)/',
sprintf('$1%1$sFUNCTION_START__$2__%1$s$3', self::DELIMITER),
$value
);
$value = preg_replace(
'/<\(/',
sprintf... | php | public function tokenize(string $value): array
{
$value = preg_replace(
'/(.*?)<((?:.*?:)?(?:\p{L}|_|[0-9])+?)\((.*?)/',
sprintf('$1%1$sFUNCTION_START__$2__%1$s$3', self::DELIMITER),
$value
);
$value = preg_replace(
'/<\(/',
sprintf... | [
"public",
"function",
"tokenize",
"(",
"string",
"$",
"value",
")",
":",
"array",
"{",
"$",
"value",
"=",
"preg_replace",
"(",
"'/(.*?)<((?:.*?:)?(?:\\p{L}|_|[0-9])+?)\\((.*?)/'",
",",
"sprintf",
"(",
"'$1%1$sFUNCTION_START__$2__%1$s$3'",
",",
"self",
"::",
"DELIMITER... | Replaces the function delimiters by tokens to easily identify them in the future and return the value splat into
tokens.
Example:
'foo <f(<g()>)> bar'
will result in:
[
'foo ',
'FUNCTION_START__f__',
'FUNCTION_START__g__',
'IDENTITY_OR_FUNCTION_END',
'IDENTITY_OR_FUNCTION_END',
' bar',
] | [
"Replaces",
"the",
"function",
"delimiters",
"by",
"tokens",
"to",
"easily",
"identify",
"them",
"in",
"the",
"future",
"and",
"return",
"the",
"value",
"splat",
"into",
"tokens",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTreeTokenizer.php#L44-L63 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTreeTokenizer.php | FunctionTreeTokenizer.detokenize | public function detokenize(string $value): string
{
$count = 1;
while ($count !== 0) {
$value = preg_replace(
'/FUNCTION_START__(.*?)__/',
'<$1(',
$value,
1,
$count
);
}
$value = ... | php | public function detokenize(string $value): string
{
$count = 1;
while ($count !== 0) {
$value = preg_replace(
'/FUNCTION_START__(.*?)__/',
'<$1(',
$value,
1,
$count
);
}
$value = ... | [
"public",
"function",
"detokenize",
"(",
"string",
"$",
"value",
")",
":",
"string",
"{",
"$",
"count",
"=",
"1",
";",
"while",
"(",
"$",
"count",
"!==",
"0",
")",
"{",
"$",
"value",
"=",
"preg_replace",
"(",
"'/FUNCTION_START__(.*?)__/'",
",",
"'<$1('",... | Replaces the tokens by their original values. | [
"Replaces",
"the",
"tokens",
"by",
"their",
"original",
"values",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTreeTokenizer.php#L68-L93 |
nelmio/alice | src/FixtureBuilder/Denormalizer/Fixture/Chainable/ReferenceRangeNameDenormalizer.php | ReferenceRangeNameDenormalizer.buildReferencedValues | private function buildReferencedValues(
FixtureBag $builtFixtures,
string $referencedName,
bool $allFlag
): array {
if (false === $allFlag) {
$fixture = $builtFixtures->get($referencedName);
return [$referencedName => $fixture];
}
$matchedFix... | php | private function buildReferencedValues(
FixtureBag $builtFixtures,
string $referencedName,
bool $allFlag
): array {
if (false === $allFlag) {
$fixture = $builtFixtures->get($referencedName);
return [$referencedName => $fixture];
}
$matchedFix... | [
"private",
"function",
"buildReferencedValues",
"(",
"FixtureBag",
"$",
"builtFixtures",
",",
"string",
"$",
"referencedName",
",",
"bool",
"$",
"allFlag",
")",
":",
"array",
"{",
"if",
"(",
"false",
"===",
"$",
"allFlag",
")",
"{",
"$",
"fixture",
"=",
"$... | @param FixtureBag $builtFixtures
@param string $referencedName
@param bool $allFlag
@return TemplatingFixture[] | [
"@param",
"FixtureBag",
"$builtFixtures",
"@param",
"string",
"$referencedName",
"@param",
"bool",
"$allFlag"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/Denormalizer/Fixture/Chainable/ReferenceRangeNameDenormalizer.php#L124-L144 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/SimpleReferenceTokenParser.php | SimpleReferenceTokenParser.parse | public function parse(Token $token): FixtureReferenceValue
{
$value = $token->getValue();
try {
return new FixtureReferenceValue(substr($value, 1));
} catch (InvalidArgumentException $exception) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($to... | php | public function parse(Token $token): FixtureReferenceValue
{
$value = $token->getValue();
try {
return new FixtureReferenceValue(substr($value, 1));
} catch (InvalidArgumentException $exception) {
throw ExpressionLanguageExceptionFactory::createForUnparsableToken($to... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
":",
"FixtureReferenceValue",
"{",
"$",
"value",
"=",
"$",
"token",
"->",
"getValue",
"(",
")",
";",
"try",
"{",
"return",
"new",
"FixtureReferenceValue",
"(",
"substr",
"(",
"$",
"value",
"... | Parses expressions such as "@user".
{@inheritdoc} | [
"Parses",
"expressions",
"such",
"as",
"@user",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/SimpleReferenceTokenParser.php#L44-L53 |
nelmio/alice | src/Bridge/Symfony/NelmioAliceBundle.php | NelmioAliceBundle.build | public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new RegisterFakerProvidersPass());
$container->addCompilerPass(
new RegisterTagServicesPass(
'nelmio_alice.file_parser.registry',
'nelmio_a... | php | public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new RegisterFakerProvidersPass());
$container->addCompilerPass(
new RegisterTagServicesPass(
'nelmio_alice.file_parser.registry',
'nelmio_a... | [
"public",
"function",
"build",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"parent",
"::",
"build",
"(",
"$",
"container",
")",
";",
"$",
"container",
"->",
"addCompilerPass",
"(",
"new",
"RegisterFakerProvidersPass",
"(",
")",
")",
";",
"$",
"conta... | {@inheritdoc} | [
"{"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Bridge/Symfony/NelmioAliceBundle.php#L26-L85 |
nelmio/alice | src/Generator/Resolver/Value/Chainable/OptionalValueResolver.php | OptionalValueResolver.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->resolver) {
throw ResolverNotFoundExceptionFactory::cre... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
if (null === $this->resolver) {
throw ResolverNotFoundExceptionFactory::cre... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@param OptionalValue $value
@throws UnresolvableValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/Chainable/OptionalValueResolver.php#L67-L97 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Lexer/StringThenReferenceLexer.php | StringThenReferenceLexer.lex | public function lex(string $value): array
{
$tokens = $this->decoratedLexer->lex($value);
$idx = 0;
do {
$token = $tokens[$idx] ?? false;
$nextToken = $tokens[$idx + 1] ?? false;
if (!($token instanceof Token) || !($nextToken instanceof Token)) {
... | php | public function lex(string $value): array
{
$tokens = $this->decoratedLexer->lex($value);
$idx = 0;
do {
$token = $tokens[$idx] ?? false;
$nextToken = $tokens[$idx + 1] ?? false;
if (!($token instanceof Token) || !($nextToken instanceof Token)) {
... | [
"public",
"function",
"lex",
"(",
"string",
"$",
"value",
")",
":",
"array",
"{",
"$",
"tokens",
"=",
"$",
"this",
"->",
"decoratedLexer",
"->",
"lex",
"(",
"$",
"value",
")",
";",
"$",
"idx",
"=",
"0",
";",
"do",
"{",
"$",
"token",
"=",
"$",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Lexer/StringThenReferenceLexer.php#L41-L71 |
nelmio/alice | src/Generator/Resolver/Value/ValueResolverRegistry.php | ValueResolverRegistry.resolve | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
foreach ($this->resolvers as $resolver) {
if ($resolver->canResolve($value)... | php | public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
ResolvedFixtureSet $fixtureSet,
array $scope,
GenerationContext $context
): ResolvedValueWithFixtureSet {
foreach ($this->resolvers as $resolver) {
if ($resolver->canResolve($value)... | [
"public",
"function",
"resolve",
"(",
"ValueInterface",
"$",
"value",
",",
"FixtureInterface",
"$",
"fixture",
",",
"ResolvedFixtureSet",
"$",
"fixtureSet",
",",
"array",
"$",
"scope",
",",
"GenerationContext",
"$",
"context",
")",
":",
"ResolvedValueWithFixtureSet"... | {@inheritdoc}
@throws ResolverNotFoundException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/Generator/Resolver/Value/ValueResolverRegistry.php#L75-L89 |
nelmio/alice | src/FixtureBuilder/Denormalizer/Fixture/SimpleFixtureBagDenormalizer.php | SimpleFixtureBagDenormalizer.denormalize | public function denormalize(array $data): FixtureBag
{
$fixtures = new FixtureBag();
$alreadyRetried = [];
while ($result = array_splice($data, 0, 1)) {
$fqcnWithFlags = key($result);
$rawFixtureSet = current($result);
$flags = $this->flagParser->parse($... | php | public function denormalize(array $data): FixtureBag
{
$fixtures = new FixtureBag();
$alreadyRetried = [];
while ($result = array_splice($data, 0, 1)) {
$fqcnWithFlags = key($result);
$rawFixtureSet = current($result);
$flags = $this->flagParser->parse($... | [
"public",
"function",
"denormalize",
"(",
"array",
"$",
"data",
")",
":",
"FixtureBag",
"{",
"$",
"fixtures",
"=",
"new",
"FixtureBag",
"(",
")",
";",
"$",
"alreadyRetried",
"=",
"[",
"]",
";",
"while",
"(",
"$",
"result",
"=",
"array_splice",
"(",
"$"... | {@inheritdoc}
@param array $data subset of PHP data coming from the parser (does not contains any parameters)
@example
$data = [
'Nelmio\Alice\Entity\User' => [
'user0' => [
'username' => 'bob',
],
],
]; | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/Denormalizer/Fixture/SimpleFixtureBagDenormalizer.php#L57-L103 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Lexer/GlobalPatternsLexer.php | GlobalPatternsLexer.lex | public function lex(string $value): array
{
foreach (self::PATTERNS as $pattern => $tokenTypeConstant) {
if (1 === preg_match($pattern, $value, $matches)) {
if (null === $tokenTypeConstant) {
throw InvalidArgumentExceptionFactory::createForInvalidExpressionLan... | php | public function lex(string $value): array
{
foreach (self::PATTERNS as $pattern => $tokenTypeConstant) {
if (1 === preg_match($pattern, $value, $matches)) {
if (null === $tokenTypeConstant) {
throw InvalidArgumentExceptionFactory::createForInvalidExpressionLan... | [
"public",
"function",
"lex",
"(",
"string",
"$",
"value",
")",
":",
"array",
"{",
"foreach",
"(",
"self",
"::",
"PATTERNS",
"as",
"$",
"pattern",
"=>",
"$",
"tokenTypeConstant",
")",
"{",
"if",
"(",
"1",
"===",
"preg_match",
"(",
"$",
"pattern",
",",
... | {@inheritdoc}
@throws LexException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Lexer/GlobalPatternsLexer.php#L51-L64 |
nelmio/alice | src/FixtureBuilder/ExpressionLanguage/Parser/StringMergerParser.php | StringMergerParser.parse | public function parse(string $value)
{
$parsedValue = $this->parser->parse($value);
if (false === $parsedValue instanceof ListValue) {
return $parsedValue;
}
$mergedValues = array_reduce(
$parsedValue->getValue(),
[$this, 'mergeStrings'],
... | php | public function parse(string $value)
{
$parsedValue = $this->parser->parse($value);
if (false === $parsedValue instanceof ListValue) {
return $parsedValue;
}
$mergedValues = array_reduce(
$parsedValue->getValue(),
[$this, 'mergeStrings'],
... | [
"public",
"function",
"parse",
"(",
"string",
"$",
"value",
")",
"{",
"$",
"parsedValue",
"=",
"$",
"this",
"->",
"parser",
"->",
"parse",
"(",
"$",
"value",
")",
";",
"if",
"(",
"false",
"===",
"$",
"parsedValue",
"instanceof",
"ListValue",
")",
"{",
... | Uses the decorated parser to parse the value and then walk through the list of values to merge two successive
strings.
{@inheritdoc} | [
"Uses",
"the",
"decorated",
"parser",
"to",
"parse",
"the",
"value",
"and",
"then",
"walk",
"through",
"the",
"list",
"of",
"values",
"to",
"merge",
"two",
"successive",
"strings",
"."
] | train | https://github.com/nelmio/alice/blob/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce/src/FixtureBuilder/ExpressionLanguage/Parser/StringMergerParser.php#L43-L60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.