Skip to content

Instantly share code, notes, and snippets.

@eS-IT
Last active January 12, 2017 16:51
Show Gist options
  • Save eS-IT/215f57447c67170721d170c392fd5960 to your computer and use it in GitHub Desktop.
Save eS-IT/215f57447c67170721d170c392fd5960 to your computer and use it in GitHub Desktop.
Contao 4: Dependency Injection - AcmeMultiGreeter.php
<?php
# src/Acme/TestBundle/classes/AcmeMultiGreeter.php
namespace Acme\TestBundle\classes;
class AcmeMultiGreeter
{
protected $greeter = null;
protected $count = 0;
public function __construct(Acme\TestBundle\classes\AcmeGreeter $greeter, $count)
{
$this->greeter = $greeter;
$this->count = $count;
}
public function greet()
{
for ($i=0; $i < $this->count; $i++) {
$this->greeter->greet();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment