예제 #1
0
 /**
  * @param string $outputFilePath
  * @return type
  */
 public function create($outputFilePath = '')
 {
     $this->initImage();
     $width = $this->getImageHandler()->getImageWidth();
     $height = $this->getImageHandler()->getImageHeight();
     $Builder = new Builder();
     $Builder->setBackgroundCharacter('-');
     $Builder->setCanvasSize($width, $height);
     for ($y = 0; $y <= $height - 1; $y++) {
         for ($x = 0; $x <= $width - 1; $x++) {
             $Builder->setPoint(new Point(new Coordinate($x, $y), $this->getImageHandler()->getCharByCoordinate($x, $y)));
         }
     }
     if (trim($outputFilePath) == '') {
         return $Builder->render(true);
     }
     file_put_contents($outputFilePath, $Builder->render(true));
 }
예제 #2
0
 /**
  * Add your code below.
  */
 public function slash()
 {
     $builder = new Builder();
     $builder->config(file_get_contents(base_path('composer.json')));
     $builder->set('name', 'phalconslayer/slayer');
     $builder->merge('require', ['phalconslayer/framework' => '1.4.*']);
     $validation = $builder->validate();
     if (!$validation['valid']) {
         if (isset($validation['publish_error'])) {
             throw new \Exception('Publish Error found ' . json_encode($validation['publish_error']));
         }
         if (isset($validation['error'])) {
             throw new \Exception('Error found ' . json_encode($validation['error']));
         }
     }
     file_put_contents(base_path('composer.json'), $builder->render());
 }
 public function build()
 {
     $builder = new Builder();
     $this->output = $builder->render($this->settings);
 }
<?php

require_once __DIR__ . '/lib/Builder.php';
require_once __DIR__ . '/lib/ContactUsController.php';
// Instantiate a Builder object to use below.
$builder = new Builder();
// Create an array for the contact form.
$contact_form = array('name' => array('title' => 'Name', 'type' => 'text', 'validations' => array('not_empty')), 'email' => array('title' => 'Email', 'type' => 'email', 'validations' => array('not_empty', 'is_valid_email')), 'comment' => array('title' => 'Comments', 'type' => 'textarea', 'validations' => array('not_empty')), 'submit' => array('title' => 'Submit me!', 'type' => 'submit'));
// Create an array for the footer content and render it.
$footer_content = array('divider' => array('type' => 'html', 'value' => '<hr />'), 'content' => array('type' => 'html', 'value' => '<div style="text-align:center">&copy; ' . date('Y') . ' BuildAModule</div>'));
$footer = $builder->render($footer_content);
// Create an array for the page.
$page_elements = array('header' => array('type' => 'html', 'value' => '<p>Please submit this form. You will make my day if you do.</p>'), 'contact_form' => array('type' => 'form', 'value' => $contact_form), 'footer' => array('type' => 'html', 'value' => $footer));
print ContactUsController::ContactUsPage($page_elements);