Last active
December 26, 2015 04:49
-
-
Save piotrbelina/7096701 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class B {} | |
class A { | |
protected $b; | |
public function __construct() | |
{ | |
$this->b = new B(); | |
} | |
} | |
$a = new A(); | |
?> | |
<?php | |
class B {} | |
class A | |
{ | |
protected $b; | |
public function __construct(B $b) | |
{ | |
$this->b = $b; | |
} | |
} | |
$b = new B(); | |
$a = new A($b); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<parameters> | |
<parameter key="a.class">A</parameter> | |
<parameter key="b.class">B</parameter> | |
</parameters> | |
<services> | |
<service id="b" class="%b.class%"> | |
</service> | |
<service id="a" class="%a.class%"> | |
<argument type="service" id="b"/> | |
</service> | |
</services> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parameters: | |
a.class: A | |
b.class: B | |
services: | |
b: | |
class: %b.class% | |
a: | |
class: %a.class% | |
arguments: [@b] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = $container->get('a'); | |
// $a = new A(new B()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Baobaz_Training_Model_Profile_Catalog_Import_Simple extends BFlow_Core_Model_Flow_Profile | |
{ | |
public function __construct( | |
BFlow_Core_Model_Flow_Action $validatorAction, | |
BFlow_Core_Model_Flow_Action $parserAction, | |
BFlow_Core_Model_Flow_Action $writerAction, | |
\Psr\Log\LoggerInterface $logger | |
) { | |
$this->validatorAction = $validatorAction; | |
$this->parserAction = $parserAction; | |
$this->writerAction = $writerAction; | |
$this->logger = $logger; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment