当前位置: 首页>>代码示例>>PHP>>正文


PHP Director::construct方法代码示例

本文整理汇总了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);
 }
开发者ID:AlexanderGrom,项目名称:php-patterns,代码行数:9,代码来源:builder_test.php

示例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;
 }
开发者ID:majchrosoft,项目名称:bars-in-cracow,代码行数:15,代码来源:Facade.php

示例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();
开发者ID:edin,项目名称:php-design-patterns,代码行数:31,代码来源:Builder.php

示例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>";
}
开发者ID:valerij-usachov,项目名称:SandBox,代码行数:25,代码来源:index.php

示例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();
开发者ID:lnmpzkang,项目名称:DesignPattern,代码行数:17,代码来源:test.php


注:本文中的Director::construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。