Is it possible in PHP 5 to have an interface that has private / protected methods?
Right now I have:
interface iService
{
private method1();
}
interfaces are type declarations. a type is set of values, plus a set of operations that can be carried upon them from outside. a private method doesn't fit into this picture.
interface T {
public /*int*/ function f(array $a);
}
interface U {
public /*T*/ function g(T $t);
}
class C implements U {
public function g(T $t) {
...
$x = $t->f();
...
}
}
interfaces are useful because they state, well, objects' interfaces. how the objects communicate with their environment.
now let's say T::f
could be declared private. how would that be useful to other objects? it would not callable from outside, it would not be part of its interface.