PHP Classes

File: vendor/pimple/pimple/ext/pimple/tests/016.phpt

Recommend this page to a friend!
  Classes of Gavin Gordon Markowski  >  Helphp PHP Class Generator  >  vendor/pimple/pimple/ext/pimple/tests/016.phpt  >  Download  
File: vendor/pimple/pimple/ext/pimple/tests/016.phpt
Role: Example script
Content type: text/plain
Description: Example script
Class: Helphp PHP Class Generator
Generate classes from configuration parameters
Author: By
Last change:
Date: 4 months ago
Size: 577 bytes
 

Contents

Class file image Download
--TEST--
Test extend()
--SKIPIF--
<?php if (!extension_loaded("pimple")) print "skip"; ?>
--FILE--
<?php
/*
 This is part of Pimple::extend() code :

          $extended = function ($c) use ($callable, $factory) {
             return $callable($factory($c), $c);
          };
*/

$p = new Pimple\Container();
$p[12] = function ($v) { var_dump($v); return 'foo';}; /* $factory in code above */

$c = $p->extend(12, function ($w) { var_dump($w); return 'bar'; }); /* $callable in code above */

var_dump($c('param'));
--
EXPECTF--
string(5) "param"
string(3) "foo"
string(3) "bar"

For more information send a message to info at phpclasses dot org.