{"id":310699,"date":"2020-09-30T03:00:15","date_gmt":"2020-09-30T03:00:15","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=310699"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=310699","title":{"rendered":"\u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0432 PHP. \u041a\u0440\u0430\u0441\u043e\u0442\u0430 \u0438\u043b\u0438 \u043b\u0430\u043f\u0448\u0430?"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/521292\/\">\u0412\u044b\u0431\u0438\u0440\u0430\u044f \u043b\u0443\u0447\u0448\u0438\u0439 PHP-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0438\u0437 \u0434\u0435\u0441\u044f\u0442\u043a\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445, \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0434\u0438\u043b\u0435\u043c\u043c\u043e\u0439. \u0427\u0442\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0432\u0430\u0436\u043d\u0435\u0435? \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u043c SOLID \/ \u041e\u041e\u041f-\u043a\u0430\u043d\u043e\u043d\u0430\u043c \u0438\u043b\u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430? \u0427\u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0443\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/github.com\/gotzmann\/comet\" rel=\"nofollow\">Comet<\/a>? \u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u0432\u043e\u043f\u0440\u043e\u0441 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442 \u2014 \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442 \u0432 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u043c \u043a\u043e\u0434\u0430 \ud83d\ude42<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wc\/4y\/kd\/wc4ykdlos2zj8fbut4bdxuz12lq.jpeg\"><br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u043e\u043c\u0438\u043c\u043e \u043e\u0437\u0430\u0431\u043e\u0447\u0435\u043d\u043d\u043e\u0441\u0442\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/501722\/\">\u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/a> \u0434\u043b\u044f REST API \u0438 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u044f \u043e\u0447\u0435\u043d\u044c \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u044e \u0437\u0430 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e \u043d\u0430\u0431\u0438\u0432\u0430\u0435\u043c \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0437\u0430\u0434\u0430\u0447, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u2014 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u0425\u043e\u0447\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430 \u0438\u0437 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0448\u0438\u0440\u043e\u0442\u0443 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043a \u043d\u0430\u043c \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"php\">$form = [     'name'           =&gt; 'Elon Mask',      'name_wrong'     =&gt; 'Mask',     'login'          =&gt; 'mask',      'login_wrong'    =&gt; 'm@sk',      'email'          =&gt; 'elon@tesla.com',      'email_wrong'    =&gt; 'elon@tesla_com',      'password'       =&gt; '1q!~|w2o&lt;z',      'password_wrong' =&gt; '123456',     'date'           =&gt; '2020-06-05 15:52:00',     'date_wrong'     =&gt; '2020:06:05 15-52-00',     'ipv4'           =&gt; '192.168.1.1',     'ipv4_wrong'     =&gt; '402.28.6.12',     'uuid'           =&gt; '70fcf623-6c4e-453b-826d-072c4862d133',     'uuid_wrong'     =&gt; 'abcd-xyz-6c4e-453b-826d-072c4862d133',     'extra'          =&gt; 'that field out of scope of validation',     'empty'          =&gt; '' ]; <\/code><\/pre>\n<p>  \u041d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c \u2014 \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u0430\u0432\u0438\u043b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/p>\n<h4>\u041e\u0442\u0440\u0430\u0441\u043b\u0435\u0432\u043e\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0438 \u0438\u043a\u043e\u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u0433\u043e \u041e\u041e\u041f \u2014 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 <a href=\"https:\/\/github.com\/symfony\/validator\" rel=\"nofollow\">Symfony<\/a><\/h4>\n<pre><code class=\"php\">use Symfony\\Component\\Validator\\Constraints\\Length; use Symfony\\Component\\Validator\\Constraints\\NotBlank; use Symfony\\Component\\Validator\\Validation; use Symfony\\Component\\Validator\\Constraints as Assert; use Symfony\\Component\\Translation\\MessageSelector;  $validator = Validation::createValidator();  $constraint = new Assert\\Collection([         'name' =&gt; new Assert\\Regex('\/^[A-Za-z]+\\s[A-Za-z]+$\/u'),   \t     'login' =&gt; new Assert\\Regex('\/^[a-zA-Z0-9]-_+$\/'),     'email' =&gt; new Assert\\Email(),     'password' =&gt; [         new Assert\\NotBlank(),         new Assert\\Length(['max' =&gt; 64]),         new Assert\\Type(['type' =&gt; 'string'])     ],     'agreed' =&gt; new Assert\\Type(['type' =&gt; 'boolean']) ]);  $violations = $validator-&gt;validate($form, $constraint);  $errors = []; if (0 !== count($violations)) {     foreach ($violations as $violation) {         $errors[] = $violation-&gt;getPropertyPath() . ' : ' . $violation-&gt;getMessage();     } }   return $errors; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0412\u044b\u0440\u0432\u0438\u0433\u043b\u0430\u0437\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c PHP<\/h4>\n<p>  <\/p>\n<pre><code class=\"php\">$errors = [];  if (!preg_match('\/^[A-Za-z]+\\s[A-Za-z]+$\/u', $form['name']))     $errors['name'] = 'should consist of two words!'; if (!preg_match('\/^[A-Za-z]+\\s[A-Za-z]+$\/u', $form['name_wrong']))     $errors['name_wrong'] = 'should consist of two words!'; if (!preg_match('\/^[a-zA-Z0-9-_]+$\/', $form['login']))     $errors['login'] = 'should contain only alphanumeric!'; if (!preg_match('\/^[a-zA-Z0-9]-_+$\/', $form['login_wrong']))     $errors['login_wrong'] = 'should contain only alphanumeric!';  if (filter_var($form['email'], FILTER_VALIDATE_EMAIL) != $form['email'])     $errors['email'] = 'provide correct email!'; if (filter_var($form['email_wrong'], FILTER_VALIDATE_EMAIL) != $form['email_wrong'])     $errors['email_wrong'] = 'provide correct email!';  if (!is_string($form['password']) ||     $form['password'] == '' ||     strlen($form['password']) &lt; 8 ||     strlen($form['password']) &gt; 64  )     $errors['password'] = 'provide correct password!';  if (!is_string($form['password_wrong']) ||     $form['password_wrong'] == '' ||     strlen($form['password_wrong']) &lt; 8 ||     strlen($form['password_wrong']) &gt; 64  )     $errors['password_wrong'] = 'provide correct password!';  if (!preg_match('\/^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$\/', $form['date']))     $errors['date'] = 'provide correct date!'; if (!preg_match('\/^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$\/', $form['date_wrong']))     $errors['date_wrong'] = 'provide correct date!';  if (filter_var($form['ipv4'], FILTER_VALIDATE_IP) != $form['ipv4'])     $errors['ipv4'] = 'provide correct ip4!'; if (filter_var($form['ipv4_wrong'], FILTER_VALIDATE_IP) != $form['ipv4_wrong'])     $errors['ipv4_wrong'] = 'provide correct ip4!';  if (!preg_match('\/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$\/i', $form['uuid']))     $errors['uuid'] = 'provide correct uuid!'; if (!preg_match('\/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$\/i', $form['uuid_wrong']))     $errors['uuid_wrong'] = 'provide correct uuid!';  if (!isset($form['agreed']) || !is_bool($form['agreed']) || $form['agreed'] != true)     $errors['agreed'] = 'you should agree with terms!';  return $errors; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0431\u0430\u0437\u0435 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u0442\u0435\u043a <a href=\"https:\/\/github.com\/Respect\/Validation\" rel=\"nofollow\">Respect Validation<\/a><\/h4>\n<p>  <\/p>\n<pre><code class=\"php\">use Respect\\Validation\\Validator as v; use Respect\\Validation\\Factory;  Factory::setDefaultInstance(     (new Factory())         -&gt;withRuleNamespace('Validation')         -&gt;withExceptionNamespace('Validation') );  $messages = [];  try {     v::attribute('name', v::RespectRule())         -&gt;attribute('name_wrong', v::RespectRule())         -&gt;attribute('login', v::alnum('-_'))         -&gt;attribute('login_wrong', v::alnum('-_'))         -&gt;attribute('email', v::email())         -&gt;attribute('email_wrong', v::email())         -&gt;attribute('password', v::notEmpty()-&gt;stringType()-&gt;length(null, 64))         -&gt;attribute('password_wrong', v::notEmpty()-&gt;stringType()-&gt;length(null, 64))         -&gt;attribute('date', v::date())         -&gt;attribute('date_wrong', v::date())         -&gt;attribute('ipv4', v::ipv4())         -&gt;attribute('ipv4_wrong', v::ipv4())         -&gt;attribute('uuid', v::uuid())         -&gt;attribute('uuid_wrong', v::uuid())         -&gt;attribute('agreed', v::trueVal())         -&gt;assert((object) $form); } catch (\\Exception $ex) {     $messages = $ex-&gt;getMessages(); }  return $messages; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0415\u0449\u0435 \u043e\u0434\u043d\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0435 \u0438\u043c\u044f: <a href=\"https:\/\/github.com\/vlucas\/valitron\" rel=\"nofollow\">Valitron<\/a><\/h4>\n<p>  <\/p>\n<pre><code class=\"php\">use Valitron\\Validator;  Validator::addRule('uuid', function($field, $value) {     return (bool) preg_match('\/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$\/i', $value); }, 'UUID should confirm RFC style!');  $rules = [     'required'  =&gt; [ 'login', 'agreed' ],     'regex'     =&gt; [ ['name', '\/^[A-Za-z]+\\s[A-Za-z]+$\/'] ],     'lengthMin' =&gt; [ [ 'password', '8'], [ 'password_wrong', '8'] ],     'lengthMax' =&gt; [ [ 'password', '64'], [ 'password_wrong', '64'] ],     'slug'      =&gt; [ 'login', 'login_wrong' ],     'email'     =&gt; [ 'email', 'email_wrong' ],     'date'      =&gt; [ 'date', 'date_wrong' ],     'ipv4'      =&gt; [ 'ipv4', 'ipv4_wrong' ],     'uuid'      =&gt; [ 'uuid', 'uuid_wrong' ],     'accepted'  =&gt; 'agreed' ];  $validator = new Validator($form); $validator-&gt;rules($rules); $validator-&gt;rule('accepted', 'agreed')-&gt;message('You should set {field} value!'); $validator-&gt;validate();  return $validator-&gt;errors()); <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 <a href=\"https:\/\/github.com\/siriusphp\/validation\" rel=\"nofollow\">Sirius<\/a><\/h4>\n<p>  <\/p>\n<pre><code class=\"php\"> $validator = new \\Sirius\\Validation\\Validator;  $validator     -&gt;add('name', 'required | \\Validation\\SiriusRule')     -&gt;add('login', 'required | alphanumhyphen', null, 'Only latin chars, underscores and dashes please.')     -&gt;add('email', 'required | email', null, 'Give correct email please.')     -&gt;add('password', 'required | maxlength(64)', null, 'Wrong password.')     -&gt;add('agreed', 'required | equal(true)', null, 'Where is your agreement?');  $validator-&gt;validate($form);  $errors = []; foreach ($validator-&gt;getMessages() as $attribute =&gt; $messages) {     foreach ($messages as $message) {         $errors[] = $attribute . ' : '. $message-&gt;getTemplate();     } }  return $errors; <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u044e\u0442 \u0432 Laravel<\/h4>\n<p>  <\/p>\n<pre><code class=\"php\">use Illuminate\\Validation\\Factory as ValidatorFactory; use Illuminate\\Translation\\Translator; use Illuminate\\Translation\\ArrayLoader; use Symfony\\Component\\Translation\\MessageSelector; use Illuminate\\Support\\Facades\\Validator as FacadeValidator;  $rules = array(     'name' =&gt; ['regex:\/^[A-Za-z]+\\s[A-Za-z]+$\/u'],     'name_wrong' =&gt; ['regex:\/^[A-Za-z]+\\s[A-Za-z]+$\/u'],     'login' =&gt; ['required', 'alpha_num'],     'login_wrong' =&gt; ['required', 'alpha_num'],     'email' =&gt; ['email'],     'email_wrong' =&gt; ['email'],     'password' =&gt; ['required', 'min:8', 'max:64'],     'password_wrong' =&gt; ['required', 'min:8', 'max:64'],     'date' =&gt; ['date'],     'date_wrong' =&gt; ['date'],     'ipv4' =&gt; ['ipv4'],     'ipv4_wrong' =&gt; ['ipv4'],     'uuid' =&gt; ['uuid'],     'uuid_wrong' =&gt; ['uuid'],     'agreed' =&gt; ['required', 'boolean'] );  $messages = [     'name_wrong.regex' =&gt; 'Username is required.',     'password_wrong.required' =&gt; 'Password is required.',     'password_wrong.max' =&gt; 'Password must be no more than :max characters.',     'email_wrong.email' =&gt; 'Email is required.',     'login_wrong.required' =&gt; 'Login is required.',     'login_wrong.alpha_num' =&gt; 'Login must consist of alfa numeric chars.',     'agreed.required' =&gt; 'Confirm radio box required.', );  $loader = new ArrayLoader(); $translator = new Translator($loader, 'en'); $validatorFactory = new ValidatorFactory($translator);  $validator = $validatorFactory-&gt;make($form, $rules, $messages);  return $validator-&gt;messages(); <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0439 \u0431\u0440\u0438\u043b\u043b\u0438\u0430\u043d\u0442 <a href=\"https:\/\/github.com\/rakit\/validation\" rel=\"nofollow\">Rakit Validation<\/a><\/h4>\n<p>  <\/p>\n<pre><code class=\"php\">$validator = new \\Rakit\\Validation\\Validator; $validator-&gt;addValidator('uuid', new \\Validation\\RakitRule);  $validation = $validator-&gt;make($form, [     'name'           =&gt; 'regex:\/^[A-Za-z]+\\s[A-Za-z]+$\/u',     'name_wrong'     =&gt; 'regex:\/^[A-Za-z]+\\s[A-Za-z]+$\/u',     'email'          =&gt; 'email',     'email_wrong'    =&gt; 'email',     'password'       =&gt; 'required|min:8|max:64',     'password_wrong' =&gt; 'required|min:8|max:64',     'login'          =&gt; 'alpha_dash',     'login_wrong'    =&gt; 'alpha_dash',     'date'           =&gt; 'date:Y-m-d H:i:s',     'date_wrong'     =&gt; 'date:Y-m-d H:i:s',     'ipv4'           =&gt; 'ipv4',     'ipv4_wrong'     =&gt; 'ipv4',     'uuid'           =&gt; 'uuid',     'uuid_wrong'     =&gt; 'uuid',     'agreed'         =&gt; 'required|accepted' ]); \t  $validation-&gt;setMessages([     'uuid'     =&gt; 'UUID should confirm RFC rules!',     'required' =&gt; ':attribute is required!',     \/\/ etc ]);  $validation-&gt;validate();  return $validation-&gt;errors()-&gt;toArray(); <\/code><\/pre>\n<p>  \u041d\u0443 \u0442\u0430\u043a \u0447\u0442\u043e? \u041a\u0430\u043a\u043e\u0439 \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043a\u043e\u0434\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0439, \u0438\u0434\u0438\u043e\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u0439, \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u00ab\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439\u00bb? \u041c\u043e\u0439 \u043b\u0438\u0447\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u2014 \u0432 \u0434\u043e\u043a\u0430\u0445 \u043d\u0430 Comet: <a href=\"https:\/\/github.com\/gotzmann\/comet\" rel=\"nofollow\">github.com\/gotzmann\/comet<\/a> <\/p>\n<p>  \u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u2014 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432.<\/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=\"https:\/\/habr.com\/ru\/post\/521292\/\"> https:\/\/habr.com\/ru\/post\/521292\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/521292\/\">\u0412\u044b\u0431\u0438\u0440\u0430\u044f \u043b\u0443\u0447\u0448\u0438\u0439 PHP-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0438\u0437 \u0434\u0435\u0441\u044f\u0442\u043a\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445, \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0434\u0438\u043b\u0435\u043c\u043c\u043e\u0439. \u0427\u0442\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0432\u0430\u0436\u043d\u0435\u0435? \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u043c SOLID \/ \u041e\u041e\u041f-\u043a\u0430\u043d\u043e\u043d\u0430\u043c \u0438\u043b\u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430? \u0427\u0442\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0443\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/github.com\/gotzmann\/comet\" rel=\"nofollow\">Comet<\/a>? \u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u0432\u043e\u043f\u0440\u043e\u0441 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442 \u2014 \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442 \u0432 \u0434\u043b\u0438\u043d\u043d\u043e\u0435 \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u043c \u043a\u043e\u0434\u0430 \ud83d\ude42<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wc\/4y\/kd\/wc4ykdlos2zj8fbut4bdxuz12lq.jpeg\">  <\/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-310699","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/310699","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=310699"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/310699\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=310699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=310699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=310699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}