for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace AlecRabbit\Accessories\Caller;
use AlecRabbit\Accessories\Caller;
use AlecRabbit\Accessories\Caller\Contracts\CallerConstants;
use AlecRabbit\Accessories\Caller\Contracts\CallerDataInterface;
class CallerData implements CallerDataInterface, CallerConstants
{
/** @var string */
protected $function;
/** @var int|null */
protected $line;
/** @var string|null */
protected $file;
protected $class;
/** @var object|null */
protected $object;
protected $type;
/** @var array|null */
protected $args;
public function __construct(
array $caller
) {
$this->function = $caller[self::FUNCTION];
$this->parse($caller);
}
protected function parse(array $caller): void
$this->line = $caller[self::LINE] ?? null;
$this->file = $caller[self::FILE] ?? null;
$this->class = $caller[self::CLS] ?? null;
$this->object = $caller[self::OBJECT] ?? null;
$this->type = $caller[self::TYPE] ?? null;
$this->args = $caller[self::ARGS] ?? null;
/**
* {@inheritdoc}
*/
public function __toString(): string
return Caller::getFormatter()->process($this);
public function getFunction(): string
return $this->function;
public function getLine(): ?int
return $this->line;
public function getFile(): ?string
return $this->file;
public function getClass(): ?string
return $this->class;
public function getObject(): ?object
return $this->object;
public function getType(): ?string
return $this->type;
public function getArgs(): ?array
return $this->args;