This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#MegaDrive.php | |
class MegaDrive | |
{ | |
public function jugar(){ | |
$juego = new Sonic('nivelFacil'); | |
return $juego->play(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#MegaDrive.php | |
$juego = new Sonic('nivelFacil'); | |
class MegaDrive() | |
{ | |
public function jugar(){ | |
global $juego; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#MegaDrive.php | |
class MegaDrive | |
{ | |
protected $juego; | |
public function __construct($juego){ | |
$this->juego = $juego: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#MegaDriveJuegosDI.php | |
$Sonic = new Sonic('nivelFacil'); | |
$Fifa = new Fifa(); | |
$JugarMegaDriveHoy = new MegaDrive($Sonic); | |
$JugarMegaDriveHoy->jugar(); | |
$JugarMegaDriveManana = new MegaDrive($Fifa); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#MegaDriveTiposParametrosDI.php | |
$Fifa = new Fifa(); | |
//Paso mediante Constructor | |
$JugarMegaDrive = new MegaDrive($Fifa); | |
//Paso mediante método | |
$JugarMegaDrive = new MegaDrive(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#OptimizacionMegaDriveDI.php | |
//Objectos juegos disponibles | |
$Fifa = new Fifa(); | |
$Sonic = new Sonic('nivelFacil'); | |
//Una sola instancia de MegaDrive | |
$JugarMegaDrive = new MegaDrive(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace JuanLuis\LabBundle\Form\Type; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | |
class TaskType extends AbstractType | |
{ | |
public function buildForm(FormBuilderInterface $builder, array $options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace JuanLuis\LabBundle\Form\Type; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | |
/* | |
* La Clase FormEvent es una clase que extiende el EventDispatcher | |
* | |
* La Clase FormEvents contiene los diferentes eventos que pueden |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace JuanLuis\LabBundle\Form\EventListener; | |
use Symfony\Component\Form\FormEvent; | |
use Symfony\Component\Form\FormEvents; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
class AddNameFieldOnlyForCreateNewTaskSubscriber implements EventSubscriberInterface | |
{ | |
public static function getSubscribedEvents() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace JuanLuis\LabBundle\Form\Type; | |
use JuanLuis\LabBundle\Form\EventListener\AddNameFieldOnlyForCreateNewTaskSubscriber; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | |
class TaskType extends AbstractType | |
{ |
OlderNewer