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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }