---------------------------
$class=new class;

with($class)
{
    do_something();
    do_more();
    do();
}

What more value does this hold over implementing fluent interfaces which are already possible?

Assuming
class Foo {
   public function doSomething() { /**code**/ return $this; }
   public function doMore() { /**code**/ return $this; }
   public function doDo() { /**code**/ return $this; }
}

You can do this:

$bar = new Foo()
$bar->doSomething()->doMore()->doDo();

or, if you want exceptional fallthrough:

try {
  $bar->doSomething()
      ->doMore()
      ->doDo();
} catch (Exception $e) {
  ...
}

-ralph

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to