Is it possible to implement a shared interface in PHP?

I recently asked a question about resolving dependencies between the unit of work and the Mapper of these classes: Dependency Injection and the unit of work of the template - (which answered Gabor de Mooij - thanks)

At PoEAA, Martin Fowler suggests using the Separated Interface to manage these dependencies. My question is simple - is it really possible to implement this template in PHP or is it specific for Java interfaces? I searched high and low, and it's hard to find links to this template anywhere outside of PoEAA.

+3
source share
2 answers

, ( ?). , cookie.

0

Google? :

http://www.ibm.com/developerworks/opensource/library/os-advphpobj/#N101E7

, , , , .

, ,

interface Exportable {
    public function export();
}

class OurNews extends ThirdPartyNews 
              implements Exportable {
    // ...
    function export() {
        print "OurNews export\n";
    }
}

class Dictionary implements Exportable, Iterator {
    function export() {
        //...
    }
}
0

Source: https://habr.com/ru/post/1750015/


All Articles