vendor/armin/scssphp-bundle/src/Scss/Result.php line 6

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Armin\ScssphpBundle\Scss;
  3. use ScssPhp\ScssPhp\Compiler;
  4. class Result
  5. {
  6.     /**
  7.      * @var Job
  8.      */
  9.     private $job;
  10.     /**
  11.      * @var bool
  12.      */
  13.     private $successful false;
  14.     /**
  15.      * @var \DateTime
  16.      */
  17.     private $executedAt;
  18.     /**
  19.      * @var float
  20.      */
  21.     private $duration;
  22.     /**
  23.      * @var string
  24.      */
  25.     private $errorMessage;
  26.     /**
  27.      * @var array
  28.      */
  29.     private $parsedFiles = [];
  30.     /**
  31.      * @var array
  32.      */
  33.     private $compilerOptions = [];
  34.     /**
  35.      * @var bool
  36.      */
  37.     private $assetExistedBefore;
  38.     /**
  39.      * @var int
  40.      */
  41.     private $compiledSize 0;
  42.     public function __construct(Job $job)
  43.     {
  44.         $this->job $job;
  45.         $this->assetExistedBefore file_exists($job->getDestinationPath());
  46.         $this->executedAt = new \DateTime();
  47.     }
  48.     public function markAsSuccessful(Compiler $compilerfloat $durationint $size): self
  49.     {
  50.         $this->successful true;
  51.         $this->duration $duration;
  52.         $this->compiledSize $size;
  53.         $this->parsedFiles $compiler->getParsedFiles();
  54.         $this->compilerOptions $compiler->getCompileOptions();
  55.         return $this;
  56.     }
  57.     public function markAsFailed(\Exception $exceptionfloat $duration): self
  58.     {
  59.         $this->successful false;
  60.         $this->duration $duration;
  61.         $messageLines explode("\n"$exception->getMessage());
  62.         $this->errorMessage reset($messageLines); // Get first line from exception message
  63.         return $this;
  64.     }
  65.     public function isSuccessful(): bool
  66.     {
  67.         return $this->successful;
  68.     }
  69.     public function getExecutedAt(): \DateTime
  70.     {
  71.         return $this->executedAt;
  72.     }
  73.     public function getParsedFiles(): array
  74.     {
  75.         return $this->parsedFiles;
  76.     }
  77.     public function getCompilerOptions(): array
  78.     {
  79.         return $this->compilerOptions;
  80.     }
  81.     public function getJob(): Job
  82.     {
  83.         return $this->job;
  84.     }
  85.     public function getDuration(): ?float
  86.     {
  87.         return $this->duration;
  88.     }
  89.     public function getErrorMessage(): ?string
  90.     {
  91.         return $this->errorMessage;
  92.     }
  93.     public function hasAssetExistedBefore(): bool
  94.     {
  95.         return $this->assetExistedBefore;
  96.     }
  97.     public function getCompiledSize() : int
  98.     {
  99.         return $this->compiledSize;
  100.     }
  101. }