acelot/resolver

View on GitHub
src/Definition/Traits/ShareTrait.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php declare(strict_types=1);

namespace Acelot\Resolver\Definition\Traits;

trait ShareTrait
{
    /**
     * @var bool
     */
    protected $isShared = false;

    /**
     * @return bool
     */
    public function isShared(): bool
    {
        return $this->isShared;
    }

    /**
     * @param bool $shared
     *
     * @return static
     */
    public function shared(bool $shared = true)
    {
        $clone = clone $this;
        $clone->isShared = $shared;

        return $clone;
    }
}