예제 #1
0
파일: listing3.php 프로젝트: jabouzi/projet
 function register(Lesson $lesson)
 {
     // do something with this Lesson
     // now tell someone
     $notifier = Notifier::getNotifier();
     $notifier->inform("new lesson: cost ({$lesson->cost()})");
 }
예제 #2
0
파일: reg.php 프로젝트: Codealist/patterns
 public function register(Lesson $lesson)
 {
     // marking registration
     // ...
     // notify
     $notifier = Notifier::getNotifier();
     $notifier->inform("new lesson. cost = {$lesson->cost()}");
 }
예제 #3
0
<?php

declare (strict_types=1);
namespace blog\factory;

require 'autoload.php';
try {
    $data = array(1, 2, 3, 4, 5);
    $typeNotifications = array(Notifier::EMAIL, Notifier::SFTP, Notifier::EMAIL);
    foreach ($typeNotifications as $type) {
        $notifier = Notifier::getNotifier($type, $data);
        echo $notifier->notify() . PHP_EOL;
    }
} catch (\Exception $e) {
    echo $e->getMessage() . PHP_EOL;
}