{"id":281553,"date":"2016-11-25T14:10:04","date_gmt":"2016-11-25T11:10:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=281553"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=281553","title":{"rendered":"\u041a\u0430\u043a \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u043e \u0431\u0435\u0437 \u0431\u043e\u043b\u0438 \u0438 \u0441\u0442\u0440\u0430\u0445\u0430"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/blog.adacore.com\/uploads\/_2400x1200_crop_center-center\/punch_cards.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0438\u043b\u0438 \u043f\u0440\u0438\u0448\u043b\u0438 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 <i>d+<\/i>\u0434\u0446\u0430\u0442\u044c \u043b\u0435\u0442? PHP \u043a\u043e\u0434 \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u043f\u0435\u0440\u0435\u0440\u044b\u0432\u0430\u0445 \u043c\u0435\u0436\u0434\u0443 \u043e\u0445\u043e\u0442\u043e\u0439 \u043d\u0430 \u043c\u0430\u043c\u043e\u043d\u0442\u043e\u0432 \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043b\u0435\u0433\u043a\u0430 \u043d\u0435 \u0447\u0438\u0442\u0430\u0435\u043c? \u0412\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u044d\u0442\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0441\u0430\u043f\u043e\u0440\u0442\u0438\u0442\u044c, \u043a\u0430\u043a \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u2014 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0442\u044c \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c?<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0438\u043b\u043e\u0441\u044c \u0434\u044b\u0445\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u0443\u043b\u044c\u0441 \u2014 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u0435 \u043c\u0438\u043c\u043e, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0443\u0436\u0435 \u0431\u044b\u0432\u0430\u043b \u0436\u0435\u0440\u0442\u0432\u043e\u0439 \u0442\u0430\u043a\u0438\u0445 \u0438\u0437\u0434\u0435\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432 \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u0447\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u0441\u0443\u0434\u044c\u0431\u044b.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0420\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e\u0431 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435, \u0442\u0438\u043f\u0438\u0447\u043d\u043e\u0439 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u2014 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0438 \u044e\u043d\u0438\u0442 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 legacy-\u043a\u043e\u0434\u0430 \u043f\u0435\u0440\u0435\u0434 \u0435\u0433\u043e \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u043e\u043c \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u0433\u043b\u0443\u0448\u0435\u043a (\u043c\u043e\u043a\u0430\u043d\u044c\u0435, \u0441\u0438\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, etc) \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\/\u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u00ab\u043d\u0430 \u043b\u0435\u0442\u0443\u00bb.<\/p>\n<p>  \u0425\u043e\u0447\u0443 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0434\u0432\u0443\u0445, \u043a\u0430\u043a \u043f\u043e \u043c\u043d\u0435 \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445, \u043f\u0440\u043e\u0431\u043b\u0435\u043c:<\/p>\n<h3>1. \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 return \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0438<\/h3>\n<p>  <\/p>\n<pre><code class=\"php\">public function getSomething($param1, $param2) {     $result1 = mysql_query('SELECT * FROM table1');     \/\/ ...     if ($result1['field'] == $param1) {         $result2 = mysql_query('SELECT * FROM table2');     }     \/\/ ...     if ($result2['field'] == $param2) {         $result3 = mysql_query('SELECT * FROM table3');     }     \/\/ ...     return isset($result3) ? $result3 : $result2; }<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u043c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u2014 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\u0420\u0435\u0444\u0430\u043a\u0442\u043e\u0440, \u0432\u044b\u043d\u043e\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, <i>PDO<\/i> \u0438 \u0442\u0434. \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b, \u043d\u043e \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u043d\u0443\u0436\u043d\u043e <b>\u0434\u043e<\/b> \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u0441\u044f, \u0447\u0442\u043e <b>\u043f\u043e\u0441\u043b\u0435<\/b> \u2014 \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u0430\u043a \u0436\u0435;<\/li>\n<li>Mock \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043f\u0438\u044e \u0431\u0430\u0437\u044b, \u00ab\u043f\u043e\u0434\u0441\u0443\u043d\u0443\u0442\u044c\u00bb \u043d\u0443\u0436\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438. \u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u043f\u043e\u043b\u0435\u0439 \u0432 \u043d\u0438\u0445 \u0434\u0435\u0441\u044f\u0442\u043a\u0438, \u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435, \u0447\u0435\u043c 2-3 join-\u0430? \u0414\u0435\u0431\u0430\u0433 \u0438 \u0444\u0430\u0431\u0440\u0438\u043a\u0430\u0446\u0438\u044f \u043d\u0443\u0436\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u0434\u043d\u0438;<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <i>runkit<\/i> \u0438\u043b\u0438 <i>uopz<\/i>. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438. \u041d\u043e \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430?<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>2. \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430, \u043d\u0435 \u0432\u043b\u0438\u044f\u044e\u0449\u0435\u0433\u043e \u043d\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/h3>\n<p>  <\/p>\n<pre><code class=\"php\">public function sendSomething(array $data) {     $ch = curl_init();     $result = mysql_query('SELECT url FROM info WHERE id = ' . $data['someId']);     curl_setopt($ch, CURLOPT_URL, $result['url']);     curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $data);     \/\/ ...     curl_exec($ch); } public function myMethod() {     $data = SomeCLass::getSomeData();     \/\/ ...     $data = OtherClass::modifyData($data);     \/\/ ...     \/\/ \u0435\u0449\u0435 \u0441\u043e\u0442\u043d\u044f-\u0434\u0440\u0443\u0433\u0430\u044f \u043a\u043e\u0434\u0430, \u0432\u043b\u0438\u044f\u044e\u0449\u0435\u0433\u043e \u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 $data     \/\/ ...     $this-&gt;sendSomething($data);     \/\/ ...     return $completelyOtherVariable; }<\/code><\/pre>\n<p>  \u0412\u0430\u0440\u0438\u0430\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\u0424\u0438\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 url? \u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u00ab\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c\u00bb \u0432 \u0431\u0430\u0437\u0443, \u0434\u0430 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u0447\u043b\u0435\u043d\u0430\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0445\u043e\u0441\u0442 \u0438\u043b\u0438 \u043a\u043e\u043c\u043c\u0438\u0442\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u00ab\u043c\u0438\u0440\u0443\u00bb \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0445\u043e\u0441\u0442\u0430\u2026 \u041d\u0435 \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, imho;<\/li>\n<li>\u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c <i>mysql_query<\/i> \u0438 <i>curl_exec<\/i> \u0447\u0435\u0440\u0435\u0437 <i>runkit<\/i> \u0438\u043b\u0438 <i>uopz<\/i>. \u0414\u0430, \u043d\u043e \u043a\u0430\u043a \u0436\u0435 \u0443\u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u043f\u0430\u043b\u043e \u0432 <i>$data<\/i>?<\/li>\n<li>\u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u043c\u0435\u0442\u043e\u0434 <i>sendSomething<\/i>, \u0430\u043d\u043e\u043d\u0438\u043c\u043a\u0443 \u00ab\u0437\u0430-<i>bind<\/i>-\u0438\u0442\u044c\u00bb \u0432 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043c<\/li>\n<\/ul>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u00ab\u043f\u0440\u0438\u0442\u044f\u043d\u0443\u0442\u044b \u0437\u0430 \u0443\u0448\u0438\u00bb, \u043d\u043e \u0432 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0441\u0445\u043e\u0436\u0435\u0441\u0442\u0438, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0432 \u043c\u043e\u0435\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0442\u0430\u043a\u0438\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f. \u0414\u0430 \u0438 \u0442\u0430\u043a \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u0435\u0435.<\/p>\n<p>  \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e \u0432\u0441\u0435 \u044d\u0442\u043e \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0435\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 #3 \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445. \u041d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, <i>runkit<\/i> \u0438\u043b\u0438 <i>uopz<\/i>? \u0414\u043b\u044f \u043c\u0435\u043d\u044f \u043e\u0442\u0432\u0435\u0442 \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c php-\u043a\u043e\u0434 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2014 \u0438\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c, \u043d\u043e \u043d\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e:<\/p>\n<pre><code class=\"php\">void uopz_function ( string $class , string $function , Closure $handler [, int $modifiers ] )<\/code><\/pre>\n<p>  \u041e\u043d\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430. \u041c\u044b \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439. \u0422\u0430\u043a \u0436\u0435 \u0442\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u00ab\u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u00bb \u0441 \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c.<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0439 middle+ \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0443\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435, \u0430 junior-\u0443 \u0432\u0440\u044f\u0434 \u043b\u0438 \u043f\u043e\u0440\u0443\u0447\u0430\u0442 \u0442\u0430\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432\u0432\u0438\u0434\u0443 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0441\u0443\u0438\u0446\u0438\u0434\u0430.<br \/>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u0448\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043a\u0430\u0442\u043e\u0440\u0436\u043d\u0438\u043a\u0430 \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u043e\u0434 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c \u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0445\u043e\u0447\u0443 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0432\u0430\u043c 2 \u0432\u0435\u0449\u0438:<\/p>\n<ol>\n<li>\u0421\u0432\u044f\u0442\u0430\u044f \u0432\u043e\u0439\u043d\u0430 \u043d\u0430 \u0442\u0435\u043c\u0443: \u00ab\u0433\u0434\u0435, \u043a\u0430\u043a \u0438 \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c trait-\u044b\u00bb;<\/li>\n<li>Trait-\u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u0434\u043b\u044f <i>uopz<\/i>, \u0433\u0434\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/li>\n<\/ol>\n<p>  \u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443, \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0441\u0442\u0430\u0432\u043b\u044e <a href=\"https:\/\/gist.github.com\/jced-artem\/b38f861b0912885e14001acf78c33847\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 gist. \u0418 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043a\u0440\u0430\u0442\u043a\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044e \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<pre><code class=\"php\">uopzFlags($function, $flags); \/\/ \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0444\u043b\u0430\u0433\u0438 uopzRedefine($constant, $value); \/\/ \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 uopzFunction($function, Closure $closure, $backup = false); \/\/ \u0430\u043d\u0430\u043b\u043e\u0433 &quot;\u0447\u0438\u0441\u0442\u043e\u0439&quot; uopz_function \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0443\u043c\u0435\u0435\u0442 backup-\u0438\u0442\u044c \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0438\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u0430: 'mysql_query' \u0438\u043b\u0438 ['ClassName', 'methodName'] uopzMuteFunction($function, $backup = false); \/\/ \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0447\u0435\u0433\u043e-\u043b\u0438\u0431\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b \u043f\u0438\u0441\u044c\u043c\u043e \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435, \u0438\u043b\u0438 curl \u043d\u0435 &quot;\u0434\u0435\u0440\u0433\u0430\u043b&quot; url, etc uopzRestore($function); \/\/ \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 backup-\u0430 uopzBackup($function); \/\/ backup \u0444\u0443\u043d\u043a\u0446\u0438\u0438\/\u043c\u0435\u0442\u043e\u0434\u0430 (\u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438) uopzFunctionSimpleReturn($function, $return, $backup = false); \/\/ \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043f\u043e\u0434\u043c\u0435\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. return \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043a\u0430\u043b\u044f\u0440\u043e\u043c, \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c (\u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d \u043a\u043b\u043e\u043d) \u0438\u043b\u0438 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439. uopzFunctionReplace($function, $replace, $backup = false); \/\/ \u0437\u0430\u043c\u0435\u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u0440\u0443\u0433\u043e\u0439. uopzFunctionConsistentReturn($function, array $return, $backup = false); \/\/ \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u043c\u0435\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041d\u0443\u0436\u043d\u0430 \u0432 \u0442\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u0442\u043e\u0447\u043d\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0446\u0438\u043a\u043b\u0435. uopzFunctionConditionReturn($function, array $conditionList, $default = null, $backup = false); \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e. \u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. uopzFunctionHook($function, Closure $closure, &$return, $backup = false); \/\/ \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435.<\/code><\/pre>\n<p>  \u041d\u0443, \u0438, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0435\u0445 \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u00ab\u044d\u0442\u043e\u0433\u043e\u00bb:<\/p>\n<h4>1. \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 <i>return<\/i><\/h4>\n<p>  <\/p>\n<pre><code class=\"php\">$this-&gt;uopzFunctionConsistentReturn('mysql_query', [     ['id' =&gt; 12, 'data' =&gt; 'dummy'],     ['id' =&gt; 31, 'data' =&gt; 'dummy'],     ['id' =&gt; 45, 'data' =&gt; 'dummy'], ]); \/\/ \u0418\u043b\u0438, \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0441\u043b\u043e\u0432\u0438\u0439 (\u0437\u0434\u0435\u0441\u044c \u043e\u043d \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u0435\u043d, \u043a\u043e\u043d\u0435\u0447\u043d\u043e): $this-&gt;uopzFunctionConditionReturn('mysql_query', [     ['query', 'SELECT * FROM table1', ['id' =&gt; 12, 'data' =&gt; 'dummy']],     ['query', 'SELECT * FROM table2', ['id' =&gt; 31, 'data' =&gt; 'dummy']],     ['query', 'SELECT * FROM table3', ['id' =&gt; 45, 'data' =&gt; 'dummy']], ]);<\/code><\/pre>\n<p>  <\/p>\n<h4>2. \u041f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/h4>\n<p>  <\/p>\n<pre><code class=\"php\">$this-&gt;uopzFunctionHook(     ['ClassName', 'sendSomething'],     function() { return $data; }, \/\/ \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440     $data \/\/ \u0441\u044e\u0434\u0430 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u043e, \u0447\u0442\u043e \u0438\u0437 myMethod \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 sendSomething \u043a\u0430\u043a $data );<\/code><\/pre>\n<p>  \u041c\u043d\u0435 \u044d\u0442\u043e \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043b\u043e \u043e\u0433\u0440\u043e\u043c\u043d\u0443\u044e \u043a\u0443\u0447\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u2014 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043a\u043e\u043c\u0443-\u0442\u043e \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c. \u0418 \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0432 \u043c\u0438\u0440\u0435 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0434\u043d\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0433\u0434\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \ud83d\ude42<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/316140\/\"> https:\/\/habrahabr.ru\/post\/316140\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/blog.adacore.com\/uploads\/_2400x1200_crop_center-center\/punch_cards.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0438\u043b\u0438 \u043f\u0440\u0438\u0448\u043b\u0438 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 <i>d+<\/i>\u0434\u0446\u0430\u0442\u044c \u043b\u0435\u0442? PHP \u043a\u043e\u0434 \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u043f\u0435\u0440\u0435\u0440\u044b\u0432\u0430\u0445 \u043c\u0435\u0436\u0434\u0443 \u043e\u0445\u043e\u0442\u043e\u0439 \u043d\u0430 \u043c\u0430\u043c\u043e\u043d\u0442\u043e\u0432 \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043b\u0435\u0433\u043a\u0430 \u043d\u0435 \u0447\u0438\u0442\u0430\u0435\u043c? \u0412\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u044d\u0442\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0441\u0430\u043f\u043e\u0440\u0442\u0438\u0442\u044c, \u043a\u0430\u043a \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u2014 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0442\u044c \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c?<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0438\u043b\u043e\u0441\u044c \u0434\u044b\u0445\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u0443\u043b\u044c\u0441 \u2014 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u0435 \u043c\u0438\u043c\u043e, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0443\u0436\u0435 \u0431\u044b\u0432\u0430\u043b \u0436\u0435\u0440\u0442\u0432\u043e\u0439 \u0442\u0430\u043a\u0438\u0445 \u0438\u0437\u0434\u0435\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432 \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u0447\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u0441\u0443\u0434\u044c\u0431\u044b.  <\/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-281553","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/281553","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=281553"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/281553\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=281553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=281553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=281553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}