phabel/src/Composer/Traits/Constraint.php

36 lines
562 B
PHP
Raw Normal View History

2020-11-04 16:24:45 +01:00
<?php
namespace Phabel\Composer\Traits;
trait Constraint
{
/**
2020-11-04 16:54:36 +01:00
* Phabel config.
2020-11-04 16:24:45 +01:00
*/
private array $config;
/**
2020-11-04 16:54:36 +01:00
* Get phabel config.
2020-11-04 16:24:45 +01:00
*
* @return array
*/
public function getConfig(): array
{
return $this->config;
}
/**
2020-11-04 16:54:36 +01:00
* Set phabel config.
2020-11-04 16:24:45 +01:00
*
2020-11-04 16:54:36 +01:00
* @param array $config Phabel config
2020-11-04 16:24:45 +01:00
*
* @return self
*/
2020-11-04 16:54:36 +01:00
public function setConfig($config): self
2020-11-04 16:24:45 +01:00
{
2020-11-04 16:54:36 +01:00
$this->config = is_string($config) ? json_decode($config, true) : $config;
2020-11-04 16:24:45 +01:00
return $this;
}
}