Implement a basic controller. DI looks to be working.
[rock.divinelegy.git] / Services / Foo.php
1 <?php
2 /**
3 * @package DIExample
4 * @copyright 2013 Internet Brands, Inc. All Rights Reserved.
5 */
6 namespace Domain\Entities;
7
8 /**
9 * Foo
10 *
11 * @author Michael Funk <mfunk@internetbrands.com>
12 */
13 class Foo
14 {
15
16 /**
17 * This just holds the injected instance of Bar
18 * @var MikeFunk\Test\Bar
19 */
20 protected $bar;
21
22 /**
23 * inject Bar into $bar and then $this->bar with type hinting. The Bar
24 * class is bound to the BarInterface in config/di.yml
25 *
26 * @return void
27 */
28 public function __construct(BarInterface $bar)
29 {
30 $this->bar = $bar;
31 }
32
33 /**
34 * Just return the string from Bar::returnMe()
35 *
36 * @return string
37 */
38 public function returnMe()
39 {
40 return $this->bar->returnMe();
41 }
42 }