Move usage code exaple to single file and correctly include it

This make code more structured and fix code highlighting problem
This commit is contained in:
Nikita Strelkov 2016-10-03 06:25:33 +05:00
parent b98f3436ab
commit f862fba24e
2 changed files with 13 additions and 4 deletions

View File

@ -43,11 +43,11 @@ Bicycle.php
Usage
-----
.. code:: php
Usage/SimpleFactoryUsage.php
$factory = new SimpleFactory();
$bicycle = $factory->createBicycle();
$bicycle->driveTo('Paris');
.. literalinclude:: Usage/SimpleFactoryUsage.php
:language: php
:linenos:
Test
----

View File

@ -0,0 +1,9 @@
<?php
namespace DesignPatterns\Creational\SimpleFactory\Usage;
use DesignPatterns\Creational\SimpleFactory\SimpleFactory;
$factory = new SimpleFactory();
$bicycle = $factory->createBicycle();
$bicycle->driveTo('Paris');