Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (34 sloc) 1023 Bytes
<?php
namespace MovieApp {
class Lister {
public $dbFinder;
public function __construct(DbFinder $dbFinder){
$this->dbFinder = $dbFinder;
}
}
class DbFinder {
public $username, $password = null;
public function setCredentials($username, $password)
{
$this->username = $username;
$this->password = $password;
}
}
}
namespace {
// bootstrap
include 'zf2bootstrap' . ((stream_resolve_include_path('zf2bootstrap.php')) ? '.php' : '.dist.php');
$di = new Zend\Di\Di;
$lister = $di->get('MovieApp\Lister', array(
'username' => 'my-username',
'password' => 'my-password'
));
// expression to test
$works = (
$lister->dbFinder instanceof MovieApp\DbFinder
&& $lister->dbFinder->username == 'my-username'
&& $lister->dbFinder->password == 'my-password'
);
// display result
echo (($works) ? 'It works!' : 'It DOES NOT work!') . PHP_EOL;
}
Something went wrong with that request. Please try again.