Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

40 lines (34 sloc) 1.024 kB
<?php
namespace MovieApp {
class Lister {
public $dbFinder;
public function __construct(DbFinder $dbFinder){
$this->dbFinder = $dbFinder;
}
}
class DbFinder {
public $username, $password = null;
public function __construct($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;
}
Jump to Line
Something went wrong with that request. Please try again.