{"id":215515,"date":"2014-03-12T15:41:03","date_gmt":"2014-03-12T11:41:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=215515"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=215515","title":{"rendered":"<span class=\"post_title\">[PHP] \u041f\u0440\u0438\u043d\u0446\u0438\u043f \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438\/\u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 \u0438 \u043a\u0430\u043a\u0438\u0435 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u0441\u0442\u0430\u0442\u044c \u043d\u0430 \u043f\u0443\u0442\u0438<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u043d\u0435 \u0440\u0430\u0437 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441 \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 SOLID, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438\/\u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 PHP \u0438 \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u0438\u0435 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0439\u0434\u0451\u0442\u0441\u044f \u043f\u0440\u043e\u0439\u0442\u0438.<\/p>\n<h4>\u0427\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435?<\/h4>\n<p>  SOLID \u2014 \u044d\u0442\u043e \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u043f\u044f\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432 \u0434\u0438\u0437\u0430\u0439\u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 \u041e\u041e\u041f. \u041e\u0434\u043d\u0438 \u0438\u0437 \u043d\u0438\u0445 \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438\/\u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430. \u041e\u043d \u0433\u043b\u0430\u0441\u0438\u0442, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f, \u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>  \u0420\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0434\u0432\u0443\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432: \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0438 \u043e\u0431\u0451\u0440\u0442\u043a\u0438. \u041e\u0431\u0451\u0440\u0442\u043a\u0430, \u0431\u0443\u0434\u0443\u0447\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c, \u0441\u0441\u044b\u043b\u0430\u043b\u0441\u044f \u0431\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439, \u043a\u043e\u043f\u0438\u0440\u0443\u044f \u0435\u0433\u043e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0430 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043b\u0435\u0433\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:  <\/p>\n<pre><code class=\"php\">interface iNote { \tpublic function add($text); \tpublic function edit($id); \tpublic function delete($id); }  class _note implements iNote { \tpublic function add($text) { \/* ... *\/ } \t \tpublic function edit($id) { \/* ... *\/ } \t \tpublic function delete($id) { \/* ... *\/ } }  class Note implements iNote { \tprivate $source; \t \tpublic function setSource(iNote $source) \t{ \t\t$this-&gt;source = $source; \t} \t \tpublic function add($text)  \t{  \t\treturn $this-&gt;source-&gt;add($text); \t} \t \tpublic function edit($id)  \t{  \t\treturn $this-&gt;source-&gt;edit($id); \t} \t \tpublic function delete($id)  \t{  \t\treturn $this-&gt;source-&gt;delete($id);  \t} } <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043d\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044f \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<h4>\u0418\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435 \u21161: \u041d\u0435\u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h4>\n<p>  \u041a\u043e\u0434 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430-\u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u043d\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u0435\u043d, \u0438 \u0435\u0433\u043e \u043f\u0440\u0438\u0439\u0434\u0451\u0442\u0441\u044f \u043f\u043e\u0434\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441. \u041d\u043e \u0432\u0435\u0434\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u041e\u041e\u041f \u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u0442\u0430\u043a \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0430\u043c \u043d\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430?  <\/p>\n<pre><code class=\"php\">class Note { \t \tprivate $source; \t \tpublic function __construct() \t{ \t\t$class = '_' . __CLASS__; \t\t$class = new $class(); \t\t \t\t$interface = 'i' . __CLASS__; \t\t \t\tif (!$class instanceof $interface) die(&quot;Default class for '&quot; . __CLASS__ . &quot;' is diened&quot;); \t\telse $this-&gt;source = new $class(); \t} \t \tpublic function setSource($source) \t{ \t\t$interface = 'i' . __CLASS__; \t\tif (!$source instanceof $interface) die(&quot;Changed class for '&quot; . __CLASS__ . &quot;' is diened&quot;); \t\t \t\t$this-&gt;source = $source; \t} \t \tpublic function __get($name) \t{ \t\treturn $this-&gt;source-&gt;$name; \t} \t \tpublic function __set($name, $value)  \t{ \t\t$this-&gt;source-&gt;$name = $value; \t} \t \tpublic function __call($func, $args) \t{ \t\treturn call_user_func_array(array($this-&gt;source, $func), $args); \t} } <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441-\u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u0435\u043d. \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043e\u043d \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441, \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0438\u043c\u0432\u043e\u043b \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u044f \u0438 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430-\u043e\u0431\u0451\u0440\u0442\u043a\u0438, \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Note \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043b\u0435\u0436\u0430\u0449\u0435\u0433\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 $source (\u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u2014 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 _Note, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u043e\u0431\u0440\u0430\u0442\u0438\u0432\u0448\u0438\u0441\u044c \u043a \u043c\u0435\u0442\u043e\u0434\u0443 Note::setSource()).<\/p>\n<h4>\u0418\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435 \u21162: \u041c\u0430\u0441\u0441\u0438\u0432\u044b<\/h4>\n<p>  \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. \u0412\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u044a\u0435\u043a\u0442-\u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0417\u0434\u0435\u0441\u044c \u0432 PHP \u0435\u0441\u0442\u044c \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044c: \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430(-\u043e\u0432) \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u044d\u0442\u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 (\u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 __get()) \u0438 \u0443\u0436\u0435 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0451 \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u043a\u0438 \u0432 \u043a\u043e\u0434\u0435:  <\/p>\n<pre><code class=\"php\">\/\/ public function __get($name) \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430: public function &__get($name) <\/code><\/pre>\n<h4>\u0418\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435 \u21163: \u0410 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430?<\/h4>\n<p>  \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e? \u041d\u0435 \u0443\u0436 \u0442\u043e \u043f\u0440\u0438\u0439\u0434\u0451\u0442\u0441\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430? \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u043e\u0432\u0435\u0441\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0447\u0435\u0440\u0435\u0437 <i>register_tick_function()<\/i>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u043b\u0430 \u0431\u044b \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0432\u0435\u0441\u0438\u043b\u0430 \u0431\u044b \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u044b-\u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u0441\u0432\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441, \u043d\u043e \u044d\u0442\u043e \u043f\u043e-\u0438\u043d\u0434\u0443\u0441\u0441\u043a\u0438. \u0410 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u043b \u0431\u044b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043d\u043e \u044d\u0442\u043e \u0442\u043e\u0440\u0442. \u042f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0443\u0441\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0442\u0438\u043f\u0430 &quot;[\u0418\u041c\u042f_\u041a\u041b\u0410\u0421\u0421\u0410]_DEFAULT&quot; \u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u0431\u044b \u0438\u043c\u0435\u043d\u0430 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u044b \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b-\u043e\u0431\u0451\u0440\u0442\u043a\u0438, \u0447\u044c\u0438\u0445 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 \u0438\u043c\u0435\u043d\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b, \u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0442\u0438\u043f\u0430 &quot;[\u0418\u041c\u042f_\u041a\u041b\u0410\u0421\u0421\u0410]_CHANGED&quot; \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u0431\u044b \u0438\u043c\u0435\u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0412\u043e\u0442 \u0442\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c Note::__construct():  <\/p>\n<pre><code class=\"php\">public function __construct() { \t$interface = 'i' . __CLASS__; \t \tif (!defined(strtoupper(__CLASS__) . '_DEFAULT')) die('Default class not set (' . __LINE__ . ' line in ' . __FILE__ . ')'); \t \tif (!defined(strtoupper(__CLASS__) . '_CHANGED') or constant(strtoupper(__CLASS__) . '_CHANGED') == null) { \t\t$class = constant(strtoupper(__CLASS__) . '_DEFAULT'); \t\t$class = new $class(); \t\t \t\tif (!$class instanceof $interface) die(&quot;Default class for '&quot; . __CLASS__ . &quot;' is diened (&quot; . __LINE__ . &quot; line in &quot; . __FILE__ . &quot;)&quot;); \t\telse $this-&gt;source = new $class(); \t} \telse { \t\t$class = constant(strtoupper(__CLASS__) . '_CHANGED'); \t\t$class = new $class(); \t\t \t\tif (!$class instanceof $interface) { \t\t\tdie(&quot;Changed class for '&quot; . __CLASS__ . &quot;' is diened (&quot; . __LINE__ . &quot; line in &quot; . __FILE__ . &quot;)&quot;); \t\t} \t\telse $this-&gt;source = new $class; \t} \t }  <\/code><\/pre>\n<h4>\u0418\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435 \u21164: \u041a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 \u043c\u043e\u0434\u0443\u043b\u0435\u0439<\/h4>\n<p>  \u0412\u0435\u0441\u044c\u043c\u0430 \u0437\u0430\u0431\u0430\u0432\u043d\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u043a\u043b\u0430\u0441\u0441\u0430. \u041a\u0430\u043a \u0431\u044b\u0442\u044c \u0442\u043e\u0433\u0434\u0430? \u0417\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0437\u0430\u0431\u043b\u0430\u0433\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0434\u043e\u0433\u043e\u0432\u0430\u0440\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u00ab\u043a\u0442\u043e \u043a\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u0437\u0430\u0431\u0438\u043b\u00bb? \u0417\u0434\u0435\u0441\u044c \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043f\u043e\u043c\u043e\u0447\u044c, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u043c\u0435\u0440\u044b. \u042f \u043d\u0435 \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0441\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u041c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e? \u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u2014 \u0433\u0440\u043e\u043c\u043a\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0443 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430-\u043e\u0431\u0451\u0440\u0442\u043a\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c 2-\u0439 \u0442\u0438\u043f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442: &quot;[\u0418\u041c\u042f_\u041a\u041b\u0410\u0421\u0421\u0410]_FUNCTION_[\u0418\u041c\u042f_\u041c\u0415\u0422\u041e\u0414\u0410]&quot;, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442-\u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043c\u0435\u0442\u043e\u0434\u0443, \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0438\u043c\u0435\u043d\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b, \u043a\u043b\u0430\u0441\u0441\u0430, \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0438\u043c\u0435\u043d\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442-\u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u043f\u0435\u0440\u0432\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0441\u044f \u043c\u0435\u0442\u043e\u0434, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e. \u0412\u0435\u0441\u044c\u043c\u0430 \u0437\u0430\u043c\u044b\u0441\u043b\u043e\u0432\u0430\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043a\u043e\u0434 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u044f\u0441\u043d\u0438\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0435:  <\/p>\n<pre><code class=\"php\">\tpublic function __call($func, $args) { \t\tif (defined(strtoupper(__CLASS__) . '_CHANGED')) return call_user_func_array(array(&$this-&gt;source, $func), $args); # \u0415\u0441\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438\u0437\u043c\u0435\u043d\u0451\u043d, \u0442\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0438\u0434\u0451\u0442 \u043a \u043d\u0435\u043c\u0443 \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \t\t \t\tif (defined(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func))) { \t\t\treturn call_user_func_array(constant(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func)), array(&$this) + $args); \t\t} \t\t \t\telse  \t\t\treturn call_user_func_array(array(&$this-&gt;source, $func), $args); \t} <\/code><\/pre>\n<h4>\u0418\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435 \u21165: \u0410 \u0433\u0434\u0435 \u0434\u043e\u0441\u0442\u0443\u043f \u043a private?<\/h4>\n<p>  \u0412 \u0442\u0443 \u0441\u0430\u043c\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0435 \u0442\u0438\u043f\u0430 &quot;[\u0418\u041c\u042f_\u041a\u041b\u0410\u0421\u0421\u0410]_FUNCTION_[\u0418\u041c\u042f_\u041c\u0415\u0422\u041e\u0414\u0410]&quot; \u043f\u0435\u0440\u0432\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442-\u043e\u0431\u0451\u0440\u0442\u043a\u0443, \u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a private- \u0438 protected- \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c, \u0447\u0442\u043e \u0432\u0435\u0441\u044c\u043c\u0430 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441-\u043e\u0431\u0451\u0440\u0442\u043a\u0443, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041f\u0443\u0441\u0442\u044c \u0435\u0433\u043e \u0438\u043c\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u0432\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u044f \u0438 \u0438\u043c\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430-\u043e\u0431\u0451\u0440\u0442\u043a\u0438. \u0421\u0430\u043c\u0430 \u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 ReflectionProperty \u0438 ReflectionMethod:  <\/p>\n<pre><code class=\"php\">class __Note extends Note { \tprivate $source; \t \tprivate function &reader ($object, $property) { \t\t$sweetsThief = new ReflectionProperty(&$object, $property);  \t\treturn $sweetsThief; \t} \t \tpublic function __construct(&$source) { \t\t$interface = 'i' . substr(__CLASS__, 2); \t\tif (!$source instanceof $interface) die('Die construct ' . __CLASS__ . ' on ' . __LINE__ . ' line in ' . __FILE__ . '.'); \t\t$this-&gt;source = $source; \t} \t \tpublic function &__get($name) { \t\ttry { \t\t\t$sweetsThief = new ReflectionProperty(get_class($this-&gt;source), $name); \t\t\t$sweetsThief-&gt;setAccessible(true); \t\t\t$return = $sweetsThief-&gt;getValue(&$this-&gt;source); \t\t\treturn $return; \t\t} \t\tcatch (ReflectionException $e) { \t\t\treturn ''; \t\t} \t} \t \tpublic function __set($name, $value) { \t\ttry { \t\t\t$sweetsThief = new ReflectionProperty(get_class($this-&gt;source), $name); \t\t\t$sweetsThief-&gt;setAccessible(true); \t\t\t$sweetsThief-&gt;setValue(&$this-&gt;source, $value); \t\t} \t\tcatch (ReflectionException $e) { } \t} \t \tpublic function __isset($name) { \t\ttry { \t\t\t$sweetsThief = new ReflectionProperty(get_class($this-&gt;source), $name); \t\t\treturn true; \t\t} \t\tcatch (ReflectionException $e) { \t\t\treturn false; \t\t} \t} \t \tpublic function __call($func, $args) { \t\t$sweetsThief = new ReflectionMethod(get_class($this-&gt;source), $func); \t\t$sweetsThief-&gt;setAccessible(true); \t\treturn $sweetsThief-&gt;invokeArgs(&$this-&gt;source, $args); \t} } <\/code><\/pre>\n<p>  \u0418 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e __call():  <\/p>\n<pre><code class=\"php\">public function __call($func, $args) { \tif (defined(strtoupper(__CLASS__) . '_CHANGED')) return call_user_func_array(array(&$this-&gt;source, $func), $args); \t \tif (defined(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func))) { \t\t$obj = '__' . __CLASS__; \t\t$obj = new $obj(&$this-&gt;source); \t\treturn call_user_func_array(constant(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func)), array(&$obj) + $args); \t} \t \telse  \t\treturn call_user_func_array(array(&$this-&gt;source, $func), $args); } <\/code><\/pre>\n<h4>\u0418\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435 \u21166: \u0427\u0442\u043e? \u041e\u043f\u044f\u0442\u044c \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 \u043c\u043e\u0434\u0443\u043b\u0435\u0439?!<\/h4>\n<p>  \u0418 \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u0441\u0442\u0430\u0440\u043e\u043c\u0443. \u0415\u0441\u0442\u044c \u0435\u0449\u0451 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u0434\u0432\u0430 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f \u0437\u0430\u0445\u043e\u0442\u044f\u0442 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043c\u0435\u0442\u043e\u0434 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u043a\u043b\u0430\u0441\u0441\u0430. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u0430 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0441\u043d\u0438\u0437\u0438\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442 \u043c\u0435\u0442\u043e\u0434\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043c \u0435\u0449\u0451 2 \u0442\u0438\u043f\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442: &quot;[\u0418\u041c\u042f_\u041a\u041b\u0410\u0421\u0421\u0410]_[\u0418\u041c\u042f_\u0424\u0423\u041d\u041a\u0426\u0418\u0418]_EVENT_CALL_[ID]&quot; \u0438 &quot;[\u0418\u041c\u042f_\u041a\u041b\u0410\u0421\u0421\u0410]_[\u0418\u041c\u042f_\u0424\u0423\u041d\u041a\u0426\u0418\u0418]_EVENT_RETURN_[ID]&quot;. \u042f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0438 \u0442\u0430\u043a \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a \u0432\u0441\u0451 \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e<s>, \u0430 \u0435\u0441\u043b\u0438 \u044f \u0432\u043e\u0437\u044c\u043c\u0443\u0441\u044c \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c, \u0442\u043e \u0412\u0430\u043c \u0441\u0442\u0430\u043d\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435<\/s>. \u042f \u043b\u0438\u0448\u044c \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0447\u044c\u0451 \u0438\u043c\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0435, \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430: \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442-\u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a \u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0430 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0443\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u0443. \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0447\u044c\u0451 \u0438\u043c\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0435, \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e 3 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430: \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442-\u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a \u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c, \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438 return \u043c\u0435\u0442\u043e\u0434\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e return \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0443.  <\/p>\n<pre><code class=\"php\">public function __call($func, $args) { \tif (defined(strtoupper(__CLASS__) . '_CHANGED')) return call_user_func_array(array(&$this-&gt;source, $func), $args); \t \tif (defined(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func))) { \t\t$obj = '__' . __CLASS__; \t\t$obj = new $obj(&$this-&gt;source); \t\treturn call_user_func_array(constant(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func)), array(&$obj) + $args); \t} \t \telse { \t\t$obj = '__' . __CLASS__; \t\t$obj = new $obj(&$this-&gt;source); \t\tfor ($i = 0; defined(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func) . &quot;_EVENT_CALL_&quot; . $i); $i++)  \t\t\t$args = call_user_func(constant(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func) . &quot;_EVENT_CALL_&quot; . $i), $obj, $args); \t\t \t\t$return = call_user_func_array(array(&$this-&gt;source, $func), $args); \t\t \t\tfor ($i = 0; defined(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func) . &quot;_EVENT_RETURN_&quot; . $i); $i++)  \t\t\t$return = call_user_func(constant(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func) . &quot;_EVENT_RETURN_&quot; . $i), $obj, $args, $return); \t\t \t\treturn $return; \t} } <\/code><\/pre>\n<h4>\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u0430<\/h4>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u0432\u0430 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430-\u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438\/\u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430. \u041f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u0434 \u0441\u043f\u043e\u0438\u043b\u0435\u0440\u043e\u043c.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">interface iAbc { \tpublic function test1(); \tpublic function test3($echo); }  define(&quot;ABC_DEFAULT&quot;, &quot;_abc&quot;);  class _abc implements iAbc { \tpublic function test1() { \t\techo 'test1'; \t} \tprivate function test2() { \t\techo 'test2'; \t} \t \tpublic function test3($echo) { \t\treturn ':' . $echo . ':'; \t} \t \tprivate $_test = '_test'; }  class Abc { \t \tprivate $source; \t \tpublic function __construct() { \t\t$interface = 'i' . __CLASS__; \t\t \t\tif (!defined(strtoupper(__CLASS__) . '_DEFAULT')) die('Default class not set (' . __LINE__ . ' line in ' . __FILE__ . ')'); \t\t \t\tif (!defined(strtoupper(__CLASS__) . '_CHANGED') or constant(strtoupper(__CLASS__) . '_CHANGED') == null) { \t\t\t$class = constant(strtoupper(__CLASS__) . '_DEFAULT'); \t\t\t$class = new $class(); \t\t\t \t\t\tif (!$class instanceof $interface) die(&quot;Default class for '&quot; . __CLASS__ . &quot;' is diened (&quot; . __LINE__ . &quot; line in &quot; . __FILE__ . &quot;)&quot;); \t\t\telse $this-&gt;source = new $class(); \t\t} \t\telse { \t\t\t$class = constant(strtoupper(__CLASS__) . '_CHANGED'); \t\t\t$class = new $class(); \t\t\t \t\t\tif (!$class instanceof $interface) { \t\t\t\tdie(&quot;Changed class for '&quot; . __CLASS__ . &quot;' is diened (&quot; . __LINE__ . &quot; line in &quot; . __FILE__ . &quot;)&quot;); \t\t\t} \t\t\telse $this-&gt;source = new $class; \t\t} \t\t \t} \t \tpublic function setSource($source) { \t\t$interface = 'i' . __CLASS__; \t\tif (!$source instanceof $interface) die('Die argument for ' . __CLASS__ . '::setSource() on ' . __LINE__ . ' line in ' . __FILE__ . '.'); \t\t$this-&gt;source = $source; \t} \t \tpublic function &__get($name) { \t\treturn $this-&gt;source-&gt;$name; \t} \t \tpublic function __set($name, $value) { \t\t$this-&gt;source-&gt;$name = $value; \t} \t \tpublic function __isset($name) { \t\treturn isset($this-&gt;source-&gt;$name); \t} \t \tpublic function __call($func, $args) { \t\tif (defined(strtoupper(__CLASS__) . '_CHANGED')) return call_user_func_array(array(&$this-&gt;source, $func), $args); \t\t \t\tif (defined(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func))) { \t\t\t$obj = '__' . __CLASS__; \t\t\t$obj = new $obj(&$this-&gt;source); \t\t\treturn call_user_func_array(constant(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func)), array(&$obj) + $args); \t\t} \t\t \t\telse { \t\t\t$obj = '__' . __CLASS__; \t\t\t$obj = new $obj(&$this-&gt;source); \t\t\tfor ($i = 0; defined(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func) . &quot;_EVENT_CALL_&quot; . $i); $i++)  \t\t\t\t$args = call_user_func(constant(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func) . &quot;_EVENT_CALL_&quot; . $i), $obj, $args); \t\t\t \t\t\t$return = call_user_func_array(array(&$this-&gt;source, $func), $args); \t\t\t \t\t\tfor ($i = 0; defined(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func) . &quot;_EVENT_RETURN_&quot; . $i); $i++)  \t\t\t\t$return = call_user_func(constant(strtoupper(__CLASS__) . '_FUNCTION_' . strtoupper($func) . &quot;_EVENT_RETURN_&quot; . $i), $obj, $args, $return); \t\t\t \t\t\treturn $return; \t\t} \t} } class __Abc extends Abc { \tprivate $source; \t \tprivate function &reader ($object, $property) { \t\t$sweetsThief = new ReflectionProperty(&$object, $property);  \t\treturn $sweetsThief; \t} \t \tpublic function __construct(&$source) { \t\t$interface = 'i' . substr(__CLASS__, 2); \t\tif (!$source instanceof $interface) die('Die construct ' . __CLASS__ . ' on ' . __LINE__ . ' line in ' . __FILE__ . '.'); \t\t$this-&gt;source = $source; \t} \t \tpublic function &__get($name) { \t\ttry { \t\t\t$sweetsThief = new ReflectionProperty(get_class($this-&gt;source), $name); \t\t\t$sweetsThief-&gt;setAccessible(true); \t\t\t$return = $sweetsThief-&gt;getValue(&$this-&gt;source); \t\t\treturn $return; \t\t} \t\tcatch (ReflectionException $e) { \t\t\treturn ''; \t\t} \t} \t \tpublic function __set($name, $value) { \t\ttry { \t\t\t$sweetsThief = new ReflectionProperty(get_class($this-&gt;source), $name); \t\t\t$sweetsThief-&gt;setAccessible(true); \t\t\t$sweetsThief-&gt;setValue(&$this-&gt;source, $value); \t\t} \t\tcatch (ReflectionException $e) { } \t} \t \tpublic function __isset($name) { \t\ttry { \t\t\t$sweetsThief = new ReflectionProperty(get_class($this-&gt;source), $name); \t\t\treturn true; \t\t} \t\tcatch (ReflectionException $e) { \t\t\treturn false; \t\t} \t} \t \tpublic function __call($func, $args) { \t\t$sweetsThief = new ReflectionMethod(get_class($this-&gt;source), $func); \t\t$sweetsThief-&gt;setAccessible(true); \t\treturn $sweetsThief-&gt;invokeArgs(&$this-&gt;source, $args); \t} }  function rewrite_test1($obj) { \t$obj-&gt;test2(); \t\/\/echo (isset($obj-&gt;_test)) ? '1' : '0'; }  function event_call_1($obj, $args) { \t$args[0] = 'it not argument, lol'; \treturn $args; }  function event_call_2($obj, $args) { \t$args[0] = 'nice try, it\\'s argument.'; \treturn $args; }  function event_return_1($obj, $args, $return) { \t$return .= '1'; \treturn $return; }  function event_return_2($obj, $args, $return) { \t$return .= '2'; \treturn $return; } $abc = new Abc(); $abc-&gt;test1(); echo '&lt;br \/&gt;';  \/\/\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e Abc::test1() define(&quot;ABC_FUNCTION_TEST1&quot;, &quot;rewrite_test1&quot;); $abc-&gt;test1(); echo '&lt;br \/&gt;';  \/\/\u041f\u043e\u0441\u0442\u0430\u0432\u0438\u043c event \u043d\u0430 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Abc::test3() define(&quot;ABC_FUNCTION_TEST3_EVENT_CALL_0&quot;, &quot;event_call_1&quot;); echo $abc-&gt;test3('ZzZz'); echo '&lt;br \/&gt;';  \/\/\u041f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0432\u0442\u043e\u0440\u043e\u0439 event \u043d\u0430 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Abc::test3() define(&quot;ABC_FUNCTION_TEST3_EVENT_CALL_1&quot;, &quot;event_call_2&quot;); echo $abc-&gt;test3('ZzZz'); echo '&lt;br \/&gt;';  \/\/\u041f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0432\u0442\u043e\u0440\u043e\u0439 event \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Abc::test3() define(&quot;ABC_FUNCTION_TEST3_EVENT_RETURN_0&quot;, &quot;event_return_1&quot;); echo $abc-&gt;test3('ZzZz'); echo '&lt;br \/&gt;';  \/\/\u041f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0432\u0442\u043e\u0440\u043e\u0439 event \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Abc::test3() define(&quot;ABC_FUNCTION_TEST3_EVENT_RETURN_1&quot;, &quot;event_return_2&quot;); echo $abc-&gt;test3('ZzZz'); echo '&lt;br \/&gt;';  \/** * \u0412\u044b\u0432\u043e\u0434: * test1 * test2 * :it not argument, lol: * :nice try, it's argument.: * :nice try, it's argument.:1 * :nice try, it's argument.:12 *\/ ?&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/215515\/\"> http:\/\/habrahabr.ru\/post\/215515\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u043d\u0435 \u0440\u0430\u0437 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441 \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u0438 SOLID, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438\/\u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 PHP \u0438 \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u0438\u0435 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0439\u0434\u0451\u0442\u0441\u044f \u043f\u0440\u043e\u0439\u0442\u0438.<\/p>\n<h4>\u0427\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435?<\/h4>\n<p>  SOLID \u2014 \u044d\u0442\u043e \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u043f\u044f\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432 \u0434\u0438\u0437\u0430\u0439\u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 \u041e\u041e\u041f. \u041e\u0434\u043d\u0438 \u0438\u0437 \u043d\u0438\u0445 \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438\/\u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430. \u041e\u043d \u0433\u043b\u0430\u0441\u0438\u0442, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f, \u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044b \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-215515","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/215515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=215515"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/215515\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=215515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=215515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=215515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}