Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
9 / 9
GetTrait
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
4
100.00% covered (success)
100.00%
9 / 9
 get
100.00% covered (success)
100.00%
1 / 1
4
100.00% covered (success)
100.00%
9 / 9
<?php
declare(strict_types=1);
namespace Korobochkin\WPKit\DataComponents\Traits;
trait GetTrait
{
    /**
     * @inheritdoc
     */
    public function get()
    {
        /**
         * @var $this \Korobochkin\WPKit\Options\OptionInterface|\Korobochkin\WPKit\Transients\TransientInterface
         */
        if ($this->hasLocalValue()) {
            return $this->getLocalValue();
        }
        $raw = $this->getValueFromWordPress();
        if ($raw !== false) {
            $transformer = $this->getDataTransformer();
            if ($transformer) {
                return $transformer->reverseTransform($raw);
            }
            return $raw;
        }
        return $this->getDefaultValue();
    }
}