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


PHP Container类代码示例

本文整理汇总了PHP中Container的典型用法代码示例。如果您正苦于以下问题:PHP Container类的具体用法?PHP Container怎么用?PHP Container使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Container类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderFormFieldContent

 private function renderFormFieldContent($renderApi, $unit)
 {
     $this->formSubmit = new \FormSubmit();
     $fieldId = 'field' . $unit->getId();
     $properties = $unit->getFormValues();
     $labelText = $properties["fieldLabel"];
     $listType = $properties["listType"];
     //select, checkbox, radio
     $postRequest = $this->getPostValue($unit);
     $choiceBox = new \ChoiceBox();
     if ($listType === \ListType::RADIO || $listType === \ListType::CHECKBOX) {
         $required = $renderApi->getFormValue($unit, 'enableRequired');
         $formField = $choiceBox->getRadioCheckbox($renderApi, $unit, $fieldId, $postRequest, $required);
     } elseif ($listType === \ListType::DROP_DOWN) {
         $formField = $choiceBox->getSelectField($renderApi, $unit, $fieldId, $postRequest);
     }
     $label = new \Label();
     $labelProperties = $label->getElementProperties();
     $labelProperties->addAttribute("for", $fieldId);
     $label->add(new \Span($labelText));
     if ($formField) {
         $elementProperties = $formField->getElementProperties();
         $wrapper = new \Container();
         $wrapper->add($label);
         $wrapper->add($formField);
         echo $wrapper->renderElement();
     }
     $renderApi->renderChildren($unit);
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:29,代码来源:rz_form_field_select.php

示例2: BuildTemplate

 public function BuildTemplate($a_template)
 {
     // Load template
     $doc = new Template_Document($a_template);
     // Load all static modules
     $modules = $doc->getElementsByTag('CMS_MODULE');
     foreach ($modules as $module) {
         // Build Module
         $c_module = new StaticModule($module, $this->m_pageid);
         $module_doc = $c_module->Build();
         $module->replaceWith($module_doc);
     }
     // Load all modules
     $containers = $doc->getElementsByTag('CMS_CONTAINER');
     foreach ($containers as $container) {
         $c_container = new Container($container, $this->m_pageid);
         $c_container->Build();
     }
     // Plugin Hook
     $data_object = new stdClass();
     $data_object->pageid = $this->m_pageid;
     $data_object->doc = $doc;
     ObjMgr::GetPluginMgr()->ExecuteHook("On_Compiler_BuiltTemplate", $data_object);
     return $doc;
 }
开发者ID:transformersprimeabcxyz,项目名称:cms-intel-fake,代码行数:25,代码来源:class_compiler.php

示例3: getHtml

 public function getHtml()
 {
     $trace = $this->trace->addChild("HodnoteniaCallback");
     $hodnotenia = $this->app->getHodnotenia($trace);
     $hodnoteniaTable = new Table(TableDefinitions::hodnotenia());
     $priemeryCalculator = new PriemeryCalculator();
     foreach (Sorter::sort($hodnotenia->getData(), array("semester" => -1, "nazov" => 1)) as $row) {
         if ($row['semester'] == 'L') {
             $class = 'leto';
             $priemeryCalculator->add(PriemeryCalculator::SEMESTER_LETNY, $row['znamka'], $row['kredit']);
         } else {
             $class = 'zima';
             $priemeryCalculator->add(PriemeryCalculator::SEMESTER_ZIMNY, $row['znamka'], $row['kredit']);
         }
         $hodnoteniaTable->addRow($row, array('class' => $class));
     }
     $hodnoteniaCollapsible = new Collapsible(new HtmlHeader('Hodnotenia'), $hodnoteniaTable);
     $priemery = $this->app->getPriemery($trace);
     $priemeryTable = new Table(TableDefinitions::priemery());
     $priemeryTable->addRows($priemery->getData());
     $priemeryContainer = new Container();
     $priemeryContainer->addChild(new Label('Nasledovné priemery sú prebraté z AISu, čiže to (ne)funguje presne rovnako:'));
     $priemeryContainer->addChild($priemeryTable);
     if ($priemeryCalculator->hasPriemer()) {
         $priemeryFajrText = '<p><br />Nasledovné vážené študijné priemery sú počítané Fajrom priebežne z tabuľky Hodnotenia, <strong>preto nemôžu byť považované ako oficiálne</strong>:<br /><br />';
         $priemeryFajrText .= $priemeryCalculator->getHtml();
         $priemeryFajrText .= '</p>';
         $priemeryContainer->addChild(new Label($priemeryFajrText));
     }
     $priemeryCollapsible = new Collapsible(new HtmlHeader('Priemery'), $priemeryContainer);
     return $hodnoteniaCollapsible->getHtml() . $priemeryCollapsible->getHtml();
 }
开发者ID:BGCX067,项目名称:fajr-svn-to-git,代码行数:32,代码来源:HodnoteniaCallback.php

示例4: testCanBindInterfaceUsingWhenNeedsGive

 public function testCanBindInterfaceUsingWhenNeedsGive()
 {
     $this->container->when('NetRivet\\Container\\Test\\Foo')->needs('NetRivet\\Container\\Test\\BarInterface')->give('NetRivet\\Container\\Test\\Bar2');
     $foo = $this->container->make('NetRivet\\Container\\Test\\Foo');
     $bar = $foo->getBar();
     $this->assertInstanceOf('NetRivet\\Container\\Test\\Bar2', $bar);
 }
开发者ID:netrivet,项目名称:container,代码行数:7,代码来源:ContainerTest.php

示例5: write

 /**
  * Write table
  *
  * @return string
  */
 public function write()
 {
     if (!$this->element instanceof \PhpOffice\PhpWord\Element\Table) {
         return '';
     }
     $content = '';
     $rows = $this->element->getRows();
     $rowCount = count($rows);
     if ($rowCount > 0) {
         $content .= '<table>' . PHP_EOL;
         foreach ($rows as $row) {
             /** @var $row \PhpOffice\PhpWord\Element\Row Type hint */
             $rowStyle = $row->getStyle();
             // $height = $row->getHeight();
             $tblHeader = $rowStyle->isTblHeader();
             $content .= '<tr>' . PHP_EOL;
             foreach ($row->getCells() as $cell) {
                 $writer = new Container($this->parentWriter, $cell);
                 $cellTag = $tblHeader ? 'th' : 'td';
                 $content .= "<{$cellTag}>" . PHP_EOL;
                 $content .= $writer->write();
                 $content .= "</{$cellTag}>" . PHP_EOL;
             }
             $content .= '</tr>' . PHP_EOL;
         }
         $content .= '</table>' . PHP_EOL;
     }
     return $content;
 }
开发者ID:Senasum,项目名称:PHPWord,代码行数:34,代码来源:Table.php

示例6: inject

 private function inject(Container $model, $arg)
 {
     $sitemap = '';
     foreach ($model->getModels() as $key => $value) {
         $sitemap .= $this->visit($value, $arg . '/' . $key, false);
     }
     return '<div class="sitemap-sub-level"><ul>' . $sitemap . '</ul>';
 }
开发者ID:phgamper,项目名称:markdown_blog,代码行数:8,代码来源:SitemapView.php

示例7: container

 public function container(Container $model, $arg, $bool)
 {
     $string = '';
     foreach ($model->getModels() as $m) {
         $string .= $this->visit($m, $arg, $bool);
     }
     return $string;
 }
开发者ID:phgamper,项目名称:markdown_blog,代码行数:8,代码来源:OnePager.php

示例8: container

 /**
  *
  * @param Collection|Container $model
  * @param int $arg
  * @return string
  */
 public function container(Container $model, $arg)
 {
     $sitemap = '';
     foreach ($model->getModels() as $key => $value) {
         $sitemap .= $this->visit($value, $arg . '/' . $key);
     }
     return '<li><p><a href="' . $arg . '">' . $model->config['name'] . '</a></p><div class="sitemap-sub-level"><ul>' . $sitemap . '</ul></div></li>';
 }
开发者ID:Stephan123,项目名称:markdown_blog,代码行数:14,代码来源:SitemapView.php

示例9: testContainerToCallback

 public function testContainerToCallback()
 {
     $c = new Container();
     $c->share('service', function (Container $container) {
         return $container;
     });
     $this->assertInstanceOf(Container::class, $c->get('service'));
 }
开发者ID:nicklasos,项目名称:BoringDI,代码行数:8,代码来源:ContainerTest.php

示例10: __construct

 /**
  * Initialize the router object.
  *
  * @param Container $container
  */
 public function __construct($container)
 {
     $this->container = $container;
     $this->request = new Request($container->get('request'));
     $this->response = new Response($this->request->getCallType(), $this->request->isUpload());
     $this->defaultAccess = $container->getParameter('direct.api.default_access');
     $this->session = $this->container->get('session')->get($container->getParameter('direct.api.session_attribute'));
 }
开发者ID:modera,项目名称:foundation,代码行数:13,代码来源:Router.php

示例11: testGetObjectConstructorArguments

 public function testGetObjectConstructorArguments()
 {
     $container = new Container();
     $container->set('foo', new \stdClass());
     $container->set('foo_bar', new \stdClass());
     $builder = new ObjectBuilder($container);
     $object = $builder->getObject('PSX\\Dependency\\FooService', array('foo'), 'PSX\\Dependency\\FooService');
     $this->assertEquals('foo', $object->getProperty());
 }
开发者ID:seytar,项目名称:psx,代码行数:9,代码来源:ObjectBuilderTest.php

示例12: executeCron

 public function executeCron(Container $cron, $unqueue = true)
 {
     $date = $cron->getDate();
     if ($date <= time()) {
         $_REQUEST = unserialize($cron->getData());
         context()->dispatch($cron);
         return true === $unqueue ? $this->unqueueCron($cron) : $this;
     }
 }
开发者ID:noikiy,项目名称:inovi,代码行数:9,代码来源:Cron.php

示例13: run

 public function run()
 {
     $entityManager = null;
     if (is_array($_SERVER['argv'])) {
         foreach ($_SERVER['argv'] as $key => $value) {
             if (substr($value, 0, 5) === '--em=') {
                 $entityManager = substr($value, 5);
                 unset($_SERVER['argv'][$key]);
                 if (is_int($_SERVER['argc'])) {
                     $_SERVER['argc']--;
                 }
                 break;
             }
         }
     }
     $commands = $this->container->getDoctrine()->getCommands();
     $helperSet = $this->container->getDoctrine()->getHelperSet($entityManager);
     if (!$helperSet instanceof HelperSet) {
         foreach ($GLOBALS as $helperSetCandidate) {
             if ($helperSetCandidate instanceof HelperSet) {
                 $helperSet = $helperSetCandidate;
                 break;
             }
         }
     }
     ConsoleRunner::run($helperSet, $commands);
 }
开发者ID:sinergi,项目名称:core,代码行数:27,代码来源:DoctrineRuntime.php

示例14: testFactoryExists

 public function testFactoryExists()
 {
     $this->assertFalse($this->container->factoryExists('foo'));
     $this->container->factory('foo', function () {
     });
     $this->assertTrue($this->container->factoryExists('foo'));
 }
开发者ID:nick-jones,项目名称:simpleconfig,代码行数:7,代码来源:ContainerTest.php

示例15: _resolveArgs

 /**
 * Getting required arguments with given parameters
 *
 * @param \ReflectionParameter[] $required Arguments
 * @param array                  $params   Parameters
 *
 *@return array
 */
 private function _resolveArgs($required, $params = array())
 {
     $args = array();
     foreach ($required as $param) {
         $name = $param->getName();
         $type = $param->getClass();
         if (isset($type)) {
             $type = $type->getName();
         }
         if (isset($params[$name])) {
             $args[] = $params[$name];
         } elseif (is_string($type) && isset($params[$type])) {
             $args[] = $params[$type];
         } else {
             $content = $this->_container->get($name);
             if (isset($content)) {
                 $args[] = $content;
             } elseif (is_string($type)) {
                 $args[] = $this->_container->get($type);
             } else {
                 $args[] = null;
             }
         }
     }
     return $args;
 }
开发者ID:TheBlackBloodyUnicorn,项目名称:pico_wanderblog,代码行数:34,代码来源:ReflectorItem.class.php


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