コード例 #1
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
{% for product in products %}
    <h3>
        <!-- fix this to print the product's name -->
        {{ product }}

        <span class="price">
            <!-- print price here -->
        </span>

        <span class="released-at">
            <!-- extra credit! -->
        </span>
    </h3>
{% endfor %}
EOF
);
        $fileBuilder->setEntryPointFilename('fallCollection.twig');
        // read this over here, get a list of files to send over
        // save the "extra" files on the other side, in the directory
        // -> remap any /../ to avoid leaving the directory
        // set the /../ relative path over here
        // resolve these to real files, by looping over and opening each one
        // send the "extra" files over there as a map: '/../stubs/PantsProduct.php' => 'PantsProduct.php'
        // save the "extra" files on the other side, in the directory, with the "local" filename
        // resolve each in the builder to real files, by looping over and setting the real path
        $fileBuilder->addFile('PantsProduct.php', __DIR__ . '/../stubs/PantsProduct.php');
        return $fileBuilder;
    }
コード例 #2
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
<table>
    <thead>
        <tr>
            <th>Name</th>
            <th>Color</th>
        </tr>
    </thead>
    {% for product in products %}
        <tr>
            <td>{{ product }}</td>
            <td>
                <!-- print black, white or green here randomly -->
                <!-- and make them all capital letters -->
            </td>
        </tr>
    {% endfor %}
</table>
EOF
);
        return $fileBuilder;
    }
コード例 #3
0
    public function getChallengeBuilder()
    {
        $builder = new ChallengeBuilder();
        $builder->addFileContents('index.php', <<<EOF
<?php

require 'DeathStar.php';
require 'DeathStarII.php';

// set your \$deathStar variable here
EOF
)->addFileContents('DeathStarII.php', <<<EOF
EOF
)->addFileContents('DeathStar.php', <<<EOF
<?php

class DeathStar
{
    public function blastPlanet(\$planetName)
    {
        echo 'BOOM '.\$planetName;
    }

    public function getWeakness()
    {
        return 'Thermal Exhaust Port';
    }
}
EOF
)->setEntryPointFilename('index.php');
        return $builder;
    }
コード例 #4
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
{% extends 'layout.twig' %}

{% block body %}
    <h1>{{ fallCollectionTitle }}</h1>
{% endblock %}
EOF
);
        $fileBuilder->setEntryPointFilename('fallCollection.twig');
        $fileBuilder->addFileContents('layout.twig', <<<EOF
<html>
    <head>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <div class="container">
            <div class="row">
                <div class="col-xs-3">
                    {% block sidebar %}{% endblock %}
                </div>
                <div class="col-xs-9">
                    {% block body %}{% endblock %}
                </div>
            </div>
        </div>
    </body>
</html>
EOF
);
        return $fileBuilder;
    }
コード例 #5
0
ファイル: ForLoopCoding.php プロジェクト: rodionrakib/twig
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
EOF
);
        return $fileBuilder;
    }
コード例 #6
0
ファイル: DateFilterCoding.php プロジェクト: rodionrakib/twig
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
<h3>
    The sale starts: <!-- print the date here -->
</h3>
EOF
);
        return $fileBuilder;
    }
コード例 #7
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
<h1>
    <!-- print the variable here -->
</h1>
EOF
);
        return $fileBuilder;
    }
コード例 #8
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('singleItem.twig', <<<EOF
<h1>{{ product.name }}</h1>

<div>
    {{ product.description }}
</div>
EOF
);
        $fileBuilder->setEntryPointFilename('singleItem.twig');
        $fileBuilder->addFile('PantsProduct.php', __DIR__ . '/../stubs/PantsProduct.php');
        return $fileBuilder;
    }
コード例 #9
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
{% for product in products %}
    <h3>
        {{ product.name }}
    </h3>
{% endfor %}
EOF
);
        $fileBuilder->setEntryPointFilename('fallCollection.twig');
        $fileBuilder->addFile('PantsProduct.php', __DIR__ . '/../stubs/PantsProduct.php');
        return $fileBuilder;
    }
コード例 #10
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
<h2 class="featured-product">
    <!-- use randomProductKey to randomly select and print a random product -->
</h2>

{% for product in products %}
    <h3>{{ product }}</h3>
{% endfor %}
EOF
);
        return $fileBuilder;
    }
コード例 #11
0
    public function getChallengeBuilder()
    {
        $builder = new ChallengeBuilder();
        $builder->addFileContents('index.php', <<<EOF
<?php

require 'DeathStar.php';
require 'DeathStarII.php';

\$deathStar = new DeathStarII();

?>

<h2>New DeathStar Specs</h2>
<table>
    <?php foreach (\$deathStar->getSpecs() as \$key => \$val): ?>
    <tr>
        <th><?php echo \$key; ?></th>
        <td><?php echo \$val; ?></td>
    </tr>
    <?php endforeach; ?>
</table>
EOF
)->addFileContents('DeathStarII.php', <<<EOF
<?php

class DeathStarII extends DeathStar
{
    public function getSpecs()
    {
        return array(
            'name' => 'DeathStarII',
            'laser_range' => \$this->planetarySuperLaserRange * 2,
        );
    }
}
EOF
)->addFileContents('DeathStar.php', <<<EOF
<?php

class DeathStar
{
    private \$planetarySuperLaserRange = 2000000;
}
EOF
)->setEntryPointFilename('index.php');
        return $builder;
    }
コード例 #12
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('aboutPenguins.twig', <<<EOF
{{ include('_cannotFly.twig', reason: 'little wings') }}
EOF
);
        $fileBuilder->setEntryPointFilename('aboutPenguins.twig');
        $fileBuilder->addFileContents('_cannotFly.twig', <<<EOF
<div>
    Penguins cannot fly, due to: {{ reason }}
</div>
EOF
);
        return $fileBuilder;
    }
コード例 #13
0
    public function getChallengeBuilder()
    {
        $builder = new ChallengeBuilder();
        $builder->addFileContents('Cache.php', <<<EOF
EOF
)->addFileContents('StringTransformer.php', <<<EOF
<?php

class StringTransformer
{
    public function transformString(\$str)
    {
        \$cacheFile = __DIR__.'/cache/'.md5(\$str);

        if (file_exists(\$cacheFile)) {
            return file_get_contents(\$cacheFile);
        }

        \$newStr = '';
        foreach (str_split(strrev(\$str), 2) as \$twoChars) {
            // capitalize the first of 2 characters
            \$newStr .= ucfirst(\$twoChars);
        }

        if (!file_exists(dirname(\$cacheFile))) {
            mkdir(dirname(\$cacheFile));
        }
        file_put_contents(\$cacheFile, \$newStr);

        return \$newStr;
    }
}
EOF
)->addFileContents('index.php', <<<EOF
<?php

require 'Cache.php';
require 'StringTransformer.php';

\$str = 'Judge me by my size, do you?';

\$transformer = new StringTransformer();
var_dump(\$transformer->transformString(\$str));
EOF
)->setEntryPointFilename('index.php');
        return $builder;
    }
コード例 #14
0
    public function getChallengeBuilder()
    {
        $builder = new ChallengeBuilder();
        $builder->addFileContents('DeathStarIII.php', <<<EOF
EOF
)->addFileContents('index.php', <<<EOF
<?php

require 'AbstractDeathStar.php';
require 'DeathStarIII.php';

\$deathStar3 = new \\DeathStarIII();

?>

<h3>
    The DeathStar 3 -

    <!-- print the description here -->
</h3>
EOF
)->addFileContents('AbstractDeathStar.php', <<<EOF
<?php

abstract class AbstractDeathStar
{
    abstract protected function getLaserRange();

    public function getDescription()
    {
        // replace this with a call to get the correct
        // range based on which DeathStar class is used
        \$range = \$this->getLaserRange();

        return <<<HEREDOC
A fantastic death machine, made to be extra cold and
intimidating. It comes complete with a "super-laser"
capable of destroying planets, with a range of \$range.
HEREDOC;
    }
}
EOF
)->setEntryPointFilename('index.php');
        return $builder;
    }
コード例 #15
0
    public function getChallengeBuilder()
    {
        $builder = new ChallengeBuilder();
        $builder->addFileContents('LaserWeapon.php', <<<EOF
EOF
)->addFileContents('WeaponInterface.php', <<<EOF
<?php

interface WeaponInterface
{
    /**
     * @return integer The weapon's range in kilometers
     */
    public function getWeaponRange();

    /**
     * @return bool Is this weapon effective in space
     */
    public function canBeUsedInSpace();

    /**
     * @return integer The amount of damage the weapon will cause against the given material
     */
    public function getWeaponStrengthAgainstMaterial(\$material);
}
EOF
)->addFileContents('index.php', <<<EOF
<?php

require 'WeaponInterface.php';
require 'LaserWeapon.php';

// instantiate a new LaserWeapon here

?>

<h1>
    Laser weapon range:
    <!-- print your weapon's getWeaponRange() here -->
</h1>
EOF
)->setEntryPointFilename('index.php');
        return $builder;
    }
コード例 #16
0
    public function getChallengeBuilder()
    {
        $builder = new ChallengeBuilder();
        $builder->addFileContents('DeathStarII.php', <<<EOF
<?php

class DeathStarII extends DeathStar
{
}
EOF
)->addFileContents('DeathStar.php', <<<EOF
<?php

class DeathStar
{
    public function blastPlanet(\$planetName)
    {
        echo 'BOOM '.\$planetName;
    }

    public function getWeakness()
    {
        return 'Thermal Exhaust Port';
    }
}
EOF
)->addFileContents('index.php', <<<EOF
<?php

require 'DeathStar.php';
require 'DeathStarII.php';

\$original = new DeathStar();
\$new = new DeathStarII();

?>

<h2>Original DeathStar Weakness: <?php echo \$original->getWeakness(); ?></h2>
<h2>New DeathStar Weakness: <?php echo \$new->getWeakness(); ?></h2>
EOF
)->setEntryPointFilename('index.php');
        return $builder;
    }
コード例 #17
0
ファイル: TestIfOddCoding.php プロジェクト: rodionrakib/twig
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
{% for product in products %}
    <h3>
        {{ product.name }}

        <span class="price">{{ product.price }}</span>
    </h3>
{% endfor %}

{# Print your message down here if there are an odd number of pants! #}
EOF
);
        $fileBuilder->setEntryPointFilename('fallCollection.twig');
        $fileBuilder->addFile('PantsProduct.php', __DIR__ . '/../stubs/PantsProduct.php');
        return $fileBuilder;
    }
コード例 #18
0
ファイル: UseIncludeCoding.php プロジェクト: rodionrakib/twig
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
{% extends 'layout.twig' %}

{% block body %}
    <section class="featured-product">
        This week's featured product is a pin-striped full suit, complete
        with cane, monocle and an elegant pocket watch!

        <button class="btn btn-primary">Buy now</button>
    </section>

    <h1>{{ fallCollectionTitle }}</h1>
{% endblock %}
EOF
);
        $fileBuilder->setEntryPointFilename('fallCollection.twig');
        $fileBuilder->addFileContents('mainCollection.twig', <<<EOF
{% extends 'layout.twig' %}

{% block body %}
    <section class="featured-product">
        This week's featured product is a pin-striped full suit, complete
        with cane, monocle and an elegant pocket watch!

        <button class="btn btn-primary">Buy now</button>
    </section>

    <h1>The Main Collection</h1>
{% endblock %}
EOF
);
        $fileBuilder->addFileContents('_featuredProduct.twig', <<<EOF
EOF
);
        $fileBuilder->addFileContents('layout.twig', <<<EOF
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Penguins Pants Plus!</title>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        {% block body %}{% endblock %}

        <footer>
            You're hip, you're cool, you're a penguin!
        </footer>
    </body>
</html>
EOF
);
        return $fileBuilder;
    }
コード例 #19
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
{% extends 'layout.twig' %}

{% block body %}
    <h1>{{ fallCollectionTitle }}</h1>
{% endblock %}
EOF
);
        $fileBuilder->setEntryPointFilename('fallCollection.twig');
        $fileBuilder->addFileContents('mainCollection.twig', <<<EOF
{% extends 'layout.twig' %}

{% block body %}
    <table class="sizing-chart">
        <tr>
            <th>S</th>
            <th>M</th>
            <th>L</th>
            <th>XL</th>
        </tr>
        <tr>
            <td>5-15 lbs</td>
            <td>16-35 lbs</td>
            <td>36-60 lbs</td>
            <td>61-85 lbs</td>
        </tr>
    </table>

    <h1>The Main Collection</h1>
{% endblock %}
EOF
);
        $fileBuilder->addFileContents('macros.twig', <<<EOF
EOF
);
        $fileBuilder->addFileContents('layout.twig', <<<EOF
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Penguins Pants Plus!</title>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <header>Penguins Pants Plus!</header>

        {% block body %}{% endblock %}
    </body>
</html>
EOF
);
        return $fileBuilder;
    }
コード例 #20
0
ファイル: ForElseCoding.php プロジェクト: rodionrakib/twig
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
{% for product in products %}
    <h3>
        {{ product.name }}

        <span class="price">{{ product.price }}</span>
    </h3>
{% endfor %}

{% if products is empty %}
    <div class="alert alert-warning">
        No pants for you!
    </div>
{% endif %}
EOF
);
        $fileBuilder->setEntryPointFilename('fallCollection.twig');
        return $fileBuilder;
    }
コード例 #21
0
    public function getChallengeBuilder()
    {
        $builder = new ChallengeBuilder();
        $builder->addFileContents('DeathStarII.php', <<<EOF
<?php

class DeathStarII extends DeathStar
{
}
EOF
)->addFileContents('DeathStar.php', <<<EOF
<?php

class DeathStar
{
    public function getLaserRange()
    {
        return 2000000;
    }
}
EOF
)->addFileContents('index.php', <<<EOF
<?php

require 'DeathStar.php';
require 'DeathStarII.php';

\$deathStar = new DeathStarII();

?>

<h3>
    Laser Range <?php echo \$deathStar->getLaserRange(); ?>
</h3>
EOF
)->setEntryPointFilename('index.php');
        return $builder;
    }
コード例 #22
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
{% for product in products %}
    <h3>
        {{ product.name }}

        <div class="stock-status">
            {% if product.quantity > 0 %}
                {{ product.quantity }}
            {% else %}
                Out of stock
            {% endif %}
        </div>
    </h3>
{% endfor %}
EOF
);
        $fileBuilder->setEntryPointFilename('fallCollection.twig');
        $fileBuilder->addFile('PantsProduct.php', __DIR__ . '/../stubs/PantsProduct.php');
        return $fileBuilder;
    }
コード例 #23
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
{{ include('_featuredProduct.twig') }}
EOF
);
        $fileBuilder->addFileContents('_featuredProduct.twig', <<<EOF
    <section class="featured-product">
        This week's featured product is a pin-striped full suit, complete
        with cane, monocle and an elegant pocket watch!

        <div class="featured-quantity">
            {{ quantityRemaining }}
        </div>

        <button class="btn btn-primary">Buy now</button>
    </section>
EOF
);
        $fileBuilder->setEntryPointFilename('fallCollection.twig');
        return $fileBuilder;
    }
コード例 #24
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
{% extends 'layout.twig' %}

<h1>
    {{ fallCollectionTitle }}
</h1>

<div>
    The fall products are coming soon!
</div>
EOF
);
        $fileBuilder->setEntryPointFilename('fallCollection.twig');
        $fileBuilder->addFileContents('layout.twig', <<<EOF
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Penguins Pants Plus!</title>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <header>
            <div class="logo">Penguins Pants Plus!</div>
        </header>

        {% block body %}{% endblock %}

    </body>
</html>
EOF
);
        return $fileBuilder;
    }
コード例 #25
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
{% extends 'layout.twig' %}

{#
    make some change so that the footer says:
    Winter is coming! Get your pants!
#}

{% block body %}
    <h1>{{ fallCollectionTitle }}</h1>
{% endblock %}
EOF
);
        $fileBuilder->setEntryPointFilename('fallCollection.twig');
        $fileBuilder->addFileContents('layout.twig', <<<EOF
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Penguins Pants Plus!</title>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        {% block body %}{% endblock %}

        <footer>
            You're hip, you're cool, you're a penguin!
        </footer>
    </body>
</html>
EOF
);
        return $fileBuilder;
    }
コード例 #26
0
    public function getChallengeBuilder()
    {
        $fileBuilder = new ChallengeBuilder();
        $fileBuilder->addFileContents('fallCollection.twig', <<<EOF
<html>
    <head>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <header>Penguins Pants Plus!</header>

        <h1>{{ fallCollectionTitle }}</h1>

        <div>The fall products are coming soon!</div>
    </body>
</html>
EOF
);
        $fileBuilder->setEntryPointFilename('fallCollection.twig');
        $fileBuilder->addFileContents('mainCollection.twig', <<<EOF
<html>
    <head>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <header>Penguins Pants Plus!</header>

        <h1>Welcome to our main collection or products</h1>

        <div>The main products are being updated!</div>
    </body>
</html>
EOF
);
        $fileBuilder->addFileContents('layout.twig', '');
        return $fileBuilder;
    }
コード例 #27
0
    public function getChallengeBuilder()
    {
        $builder = new ChallengeBuilder();
        $builder->addFileContents('PlanetInterface.php', <<<EOF
<?php

interface PlanetInterface
{
    /**
     * Return the radius if the planet, in thousands of kilometers.
     *
     * @return integer
     */
    public function getRadius();

    /**
     * Return the hex color (without the #) for the planet.
     *
     * @return string
     */
    public function getHexColor();
}
EOF
)->addFileContents('SolidPlanet.php', <<<EOF
<?php

class SolidPlanet extends AbstractPlanet
{
    private \$radius;

    private \$hexColor;

    public function __construct(\$radius, \$hexColor)
    {
        \$this->radius = \$radius;
        \$this->hexColor = \$hexColor;
    }

    public function getRadius()
    {
        return \$this->radius;
    }

    public function getHexColor()
    {
        return \$this->hexColor;
    }
}
EOF
)->addFileContents('GasPlanet.php', <<<EOF
<?php

class GasPlanet extends AbstractPlanet
{
    private \$diameter;

    private \$mainElement;

    public function __construct(\$mainElement, \$diameter)
    {
        \$this->diameter = \$diameter;
        \$this->mainElement = \$mainElement;
    }

    public function getRadius()
    {
        return \$this->diameter / 2;
    }

    public function getHexColor()
    {
        // a "fake" map of elements to colors
        switch (\$this->mainElement) {
            case 'ammonia':
                return '663300';
            case 'hydrogen':
            case 'helium':
                return 'FFFF66';
            case 'methane':
                return '0066FF';
            default:
                return '464646';
        }
    }
}
EOF
)->addFileContents('PlanetRenderer.php', <<<EOF
<?php

class PlanetRenderer
{
    public function render(AbstractPlanet \$planet)
    {
        return sprintf(
            '<div style="width: %spx; height: %spx; border-radius: %spx; background-color: #%s;"></div>',
            \$planet->getRadius() * 2,
            \$planet->getRadius() * 2,
            \$planet->getRadius(),
            \$planet->getHexColor()
        );
    }
}
EOF
)->addFileContents('index.php', <<<EOF
<?php

require 'PlanetInterface.php';
require 'SolidPlanet.php';
require 'GasPlanet.php';
require 'PlanetRenderer.php';

\$planets = array(
    new SolidPlanet(10, 'CC66FF'),
    new SolidPlanet(50, '00FF99'),
    new GasPlanet('ammonia', 100),
    new GasPlanet('methane', 150),
);

\$renderer = new PlanetRenderer();

foreach (\$planets as \$planet) {
    echo \$renderer->render(\$planet);
}
EOF
)->setEntryPointFilename('index.php');
        return $builder;
    }
コード例 #28
0
    public function getChallengeBuilder()
    {
        $builder = new ChallengeBuilder();
        $builder->addFileContents('AbstractDeathStar.php', <<<EOF
EOF
)->addFileContents('DeathStar.php', <<<EOF
<?php

class DeathStar
{
    private \$crewSize;

    private \$weaponPower;

    public function setCrewSize(\$numberOfPeople)
    {
        \$this->crewSize = \$numberOfPeople;
    }

    public function getCrewSize()
    {
        return \$this->crewSize;
    }

    public function setWeaponPower(\$power)
    {
        \$this->weaponPower = \$power;
    }

    public function getWeaponPower()
    {
        return \$this->weaponPower;
    }

    public function makeFiringNoise()
    {
        echo 'BOOM x '.\$this->weaponPower;
    }
}
EOF
)->addFileContents('DeathStarII.php', <<<EOF
<?php

class DeathStarII extends DeathStar
{
    // this DeathStar must *always* have 5000 people on it
    public function getCrewSize()
    {
        return 5000;
    }

    public function makeFiringNoise()
    {
        echo 'SUPER BOOM';
    }
}
EOF
)->addFileContents('index.php', <<<EOF
<?php

require 'AbstractDeathStar.php';
require 'DeathStar.php';
require 'DeathStarII.php';

\$deathStar1 = new DeathStar();
\$deathStar1->setCrewSize(3000);
\$deathStar1->setWeaponPower(500);

\$deathStar2 = new DeathStarII();
\$deathStar2->setWeaponPower(999);

?>

<table>
    <tr>
        <td>&nbsp;</td>
        <th>DeathStar 1</th>
        <th>DeathStar 2</th>
    </tr>
    <tr>
        <th>Crew Size</th>
        <td><?php echo \$deathStar1->getCrewSize(); ?></td>
        <td><?php echo \$deathStar2->getCrewSize(); ?></td>
    </tr>
    <tr>
        <th>Weapon Power</th>
        <td><?php echo \$deathStar1->getWeaponPower(); ?></td>
        <td><?php echo \$deathStar2->getWeaponPower(); ?></td>
    </tr>
    <tr>
        <th>Fire!</th>
        <td><?php echo \$deathStar1->makeFiringNoise(); ?></td>
        <td><?php echo \$deathStar2->makeFiringNoise(); ?></td>
    </tr>
</table>
EOF
)->setEntryPointFilename('index.php');
        return $builder;
    }