PHP Classes

File: src/Creational/AbstractFactory/init.php

Recommend this page to a friend!
  Classes of Niko Peikrishvili   PHP Design Patterns with Real World Examples   src/Creational/AbstractFactory/init.php   Download  
File: src/Creational/AbstractFactory/init.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Design Patterns with Real World Examples
Implementation of design patterns with examples
Author: By
Last change:
Date: 1 year ago
Size: 433 bytes
 

Contents

Class file image Download
<?php
require __DIR__ . '/../../vendor/autoload.php';

$windowsWriterFactory = new \DesignPatterns\Creational\AbstractFactory\WinWriterFactory();
$unixWriterFactory = new \DesignPatterns\Creational\AbstractFactory\UnixWriterFactory();

$csvWriter = $windowsWriterFactory->createCSVWriter();
$csvWriterUnix = $unixWriterFactory->createCSVWriter();

var_dump($csvWriter->write(["A", "V"]));
var_dump($csvWriterUnix->write(["A", "V"]));