/** * @param string $key * * @throws ParameterNotFoundException * * @return mixed */ public function get(string $key) { if ($this->has($key)) { return deep_clone($this->parameters[$key]); } throw ParameterNotFoundExceptionFactory::create($key); }
/** * @depends Nelmio\Alice\FixtureBagTest::testIsImmutable */ public function testIsImmutable() { $fixture = new MutableFixture('user0', 'Nelmio\\Alice\\Entity\\User', SpecificationBagFactory::create()); $originalFixture = deep_clone($fixture); $bag = (new TemplatingFixtureBag())->with($fixture); // Mutate injected value $fixture->setSpecs(SpecificationBagFactory::create(new FakeMethodCall())); // Mutate retrieved fixture $bag->getFixtures()->get('user0')->setSpecs(SpecificationBagFactory::create(new NoMethodCall())); $this->assertEquals($originalFixture, $bag->getFixtures()->get('user0')); }
public function testDeepCloneClosure() { $foo = new \stdClass(); $bar = new \stdClass(); $c1 = function () use($foo) { return $foo; }; $foo->name = 'foo'; $foo->bar = $bar; $bar->name = 'bar'; $bar->foo = $foo; $fooClone = deep_clone($c1)(); $this->assertSame($foo, $fooClone); $this->assertSame($bar, $fooClone->bar); }
/** * Creates a new instance of the bag with the given flag. If a flag with the same identifier already exists, the * existing value will be replaced. * * @param FlagInterface $flag * * @return FlagBag */ public function withFlag(FlagInterface $flag) : self { $clone = clone $this; $clone->flags[$flag->__toString()] = deep_clone($flag); return $clone; }
public function __get(string $name) { return deep_clone($name); }
public function getArguments() : array { return deep_clone($this->arguments); }
/** * @inheritdoc */ public function getInstance() { return deep_clone($this->instance); }
/** * {@inheritdoc} * * @return array The first element is the quantifier and the second the element. */ public function getValue() : array { return deep_clone($this->values); }
/** * @inheritdoc */ public function getValue() { return deep_clone($this->parameterKey); }
/** * @inheritdoc */ public function getValue() { return deep_clone($this->value); }
/** * @return string|ValueInterface */ public function getElement() { return deep_clone($this->element); }