PHP Classes

File: strategy.php

Recommend this page to a friend!
  Classes of Nemeth Zoltan   Design patterns   strategy.php   Download  
File: strategy.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Design patterns
Implements several well known design patterns
Author: By
Last change:
Date: 8 years ago
Size: 869 bytes
 

Contents

Class file image Download
<?php
/**
 * Created by PhpStorm.
 * User: nemeth.zoltan
 * Date: 2016. 05. 13.
 * Time: 12:45
 */
include __DIR__ . '/vendor/autoload.php';

$view = new \DP\Strategy\Model\ViewModel(
    array(
       
'title' => 'Stratégia programtervezési minta',
       
'page_title' => 'Stratégia minta',
       
'page_text' => 'A viselkedési minták közé tartozik és arra szolgál, hogy egy algoritmus viselkedését (akár futási id?ben) új m?ködési mechanizmussal ruházzunk fel.',
    )
);

$view->setTemplate('templates/template1.php');

if (
array_key_exists('html', $_GET)) {
   
$phpRenderer = new \DP\Strategy\View\Renderer(new \DP\Strategy\Strategy\PhpRenderingStrategy(), $view);
   
$phpRenderer->render();
} else {
   
$jsonRenderer = new \DP\Strategy\View\Renderer(new \DP\Strategy\Strategy\JsonRenderingStrategy(), $view);
   
$jsonRenderer->render();
}