本文整理汇总了PHP中Container类的典型用法代码示例。如果您正苦于以下问题:PHP Container类的具体用法?PHP Container怎么用?PHP Container使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Container类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: write
/**
* Write text run
*
* @return string
*/
public function write()
{
$content = '';
$content .= $this->writeOpening();
$writer = new Container($this->parentWriter, $this->element);
$content .= $writer->write();
$content .= $this->writeClosing();
return $content;
}
开发者ID:FabianoFaria,项目名称:ULA_front,代码行数:14,代码来源:TextRun.php
示例14: __construct
public function __construct($app)
{
$this->app = $app;
$this->container = new Container();
$this->defineEnv($this->container);
$this->defineApp();
$this->container->init();
Profile::Checkpoint('Container has been Created');
}
开发者ID:natxet,项目名称:operacore,代码行数:9,代码来源:Bootstrap.php
示例15: write
/**
* Write textrun element
*/
public function write()
{
$xmlWriter = $this->getXmlWriter();
$element = $this->getElement();
$this->writeOpeningWP();
$containerWriter = new Container($xmlWriter, $element);
$containerWriter->write();
$this->writeClosingWP();
}
开发者ID:hcvcastro,项目名称:pxp,代码行数:12,代码来源:TextRun.php
示例16: write
/**
* Write element
*/
public function write()
{
$xmlWriter = $this->getXmlWriter();
$element = $this->getElement();
$xmlWriter->startElement('text:p');
$containerWriter = new Container($xmlWriter, $element);
$containerWriter->write();
$xmlWriter->endElement();
}
开发者ID:doit05,项目名称:relProject,代码行数:12,代码来源:TextRun.php
示例17: __invoke
public function __invoke($object, string $typeName, Container $container)
{
$object = ($this->callback)(...$container->populateArguments($this->ref, [$object], new InjectionPoint($typeName))) ?? $object;
if (!$object instanceof $typeName) {
$type = \is_object($object) ? \get_class($object) : \gettype($object);
throw new ContextLookupException(\sprintf('Decorator must return an instance of %s, returned value is %s', $typeName, $type));
}
return $object;
}
开发者ID:koolkode,项目名称:k1,代码行数:9,代码来源:Decorator.php
示例18: testGettingImageStorage
public function testGettingImageStorage()
{
eval($this->compiler->compile());
/** @var \Nette\DI\Container $container */
$container = new Container();
$this->assertNotNull($class = $container->getByType(\WebChemistry\Images\IImageStorage::class));
$this->assertInstanceOf(\WebChemistry\Images\IImageStorage::class, $class);
$this->assertInstanceOf(\WebChemistry\Images\AbstractStorage::class, $class);
}
开发者ID:webchemistry,项目名称:images,代码行数:9,代码来源:ExtensionTest.php
示例19: testSingletonWithPersistence
public function testSingletonWithPersistence()
{
$container = new Container();
$container->singleton('mySingleton', '\\stdClass');
$stdClass = $container->build('mySingleton');
$stdClass->testVar = 'value';
$stdClass2 = $container->build('mySingleton');
$this->assertEquals('value', $stdClass2->testVar);
}
开发者ID:usmanhalalit,项目名称:viocon,代码行数:9,代码来源:ContainerTest.php
示例20: 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
注:本文中的Container类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论