本文整理汇总了PHP中Director::construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Director::construct方法的具体用法?PHP Director::construct怎么用?PHP Director::construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Director
的用法示例。
在下文中一共展示了Director::construct方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBuilder
public function testBuilder()
{
$expect = "<header>Header</header>\n" + "<article>Content</article>\n" + "<footer>Footer</footer>\n";
$product = new Product();
$director = new Director(new ConcreteBuilder($product));
$director->construct();
$result = $product->show();
$this->assertEquals($result, $expect);
}
示例2: photo
public static function photo($reference, $maxWidth = 0)
{
if ((int) $maxWidth === 0) {
$maxWidth = \App\Lib\Api\GooglePlace\Config::radius();
}
$photoBuilder = new BuilderPhoto();
$photoBuilder->setupMaxWidth($maxWidth);
$photoBuilder->setupPhotoReference($reference);
$photoBuilder->setupDataType();
$director = new Director($photoBuilder);
$director->construct();
$request = $director->getResult();
$response = $request->send();
return $response;
}
示例3: buildPartA
public function buildPartA()
{
$this->result->add("Part X");
}
public function buildPartB()
{
$this->result->add("Part Y");
}
public function getResult() : Product
{
return $this->result;
}
}
class Director
{
public function construct(IBuilder $builder)
{
$builder->buildPartA();
$builder->buildPartB();
$builder->buildPartB();
}
}
$director = new Director();
$b1 = new Builder1();
$b2 = new Builder2();
$director->construct($b1);
$product1 = $b1->getResult();
$product1->display();
$director->construct($b2);
$product2 = $b2->getResult();
$product2->display();
示例4: __autoload
<?php
header('Content-Type: text/html; charset=utf-8');
ini_set('display_errors', '1');
function __autoload($class_name)
{
set_include_path('class');
include $class_name . '.php';
}
$Builder = new Builder();
$Director = new Director($Builder);
$Director->construct();
$Product = $Builder->getResult();
print_r($Product);
writeln('');
writeln('');
$SuperBuilder = new SuperBuilder();
$Director->setBuilder($SuperBuilder);
$Director->construct();
$Product = $SuperBuilder->getResult();
print_r($Product);
function writeln($line_in)
{
echo $line_in . "<br><br>";
}
示例5: TextBuilder
<?php
require_once './Builder.php';
require_once './TextBuilder.php';
require_once './XmlBuilder.php';
require_once './Director.php';
$header = "title->test";
$body = "test builder";
$footer = "end";
$text_builder = new TextBuilder();
$text_director = new Director($text_builder);
$text_director->construct($header, $body, $footer);
$xml_builder = new XmlBuilder();
$xml_director = new Director($xml_builder);
$xml_director->construct($header, $body, $footer);
echo $text_builder->getResult();
echo $xml_builder->getResult();