{"id":431254,"date":"2024-09-04T21:00:03","date_gmt":"2024-09-04T21:00:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=431254"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=431254","title":{"rendered":"<span>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u0442 \u041e\u0431\u043e\u0440\u043e\u0442.\u0440\u0443: \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0432 \u0441\u0430\u0434\u0443 \u043d\u0430 PHP<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p> \u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u041d\u0438\u043a, \u043c\u043d\u0435 25, \u0438 \u044f \u0443\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0432 \u0441\u0444\u0435\u0440\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u0441 \u0432\u0430\u043c\u0438. \u042f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0435\u0451 \u043a\u0430\u043a \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u2014 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u041e\u0431\u043e\u0440\u043e\u0442.\u0440\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432. \u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0430\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0432 \u0441\u0430\u0434\u0443, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0435\u0433\u043e \u0432 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u041e\u041e\u041f) \u043d\u0430 PHP. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u044f \u043f\u043e\u0434\u043e\u0448\u0435\u043b \u043a \u0435\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u044e.  <\/p>\n<h3>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0431\u0435 \u0444\u0440\u0443\u043a\u0442\u043e\u0432\u044b\u0439 \u0441\u0430\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0441\u0442\u0443\u0442 \u044f\u0431\u043b\u043e\u043d\u0438 \u0438 \u0433\u0440\u0443\u0448\u0438. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 10 \u044f\u0431\u043b\u043e\u043d\u044c \u0438 15 \u0433\u0440\u0443\u0448, \u0441 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043b\u043e\u0434\u043e\u0432. \u0421\u0431\u043e\u0440\u0449\u0438\u043a \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0435\u0445\u0430\u0442\u044c \u043f\u043e \u0441\u0430\u0434\u0443, \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u043b\u043e\u0434\u044b, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043f\u043e \u0442\u0438\u043f\u0443 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0435\u0441. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<ul>\n<li>\n<p>\u0421 \u043e\u0434\u043d\u043e\u0439 \u044f\u0431\u043b\u043e\u043d\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u0442 40 \u0434\u043e 50 \u044f\u0431\u043b\u043e\u043a, \u043a\u0430\u0436\u0434\u043e\u0435 \u0432\u0435\u0441\u0438\u0442 \u043e\u0442 150 \u0434\u043e 180 \u0433\u0440\u0430\u043c\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0421 \u043e\u0434\u043d\u043e\u0439 \u0433\u0440\u0443\u0448\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u0442 0 \u0434\u043e 20 \u0433\u0440\u0443\u0448, \u043a\u0430\u0436\u0434\u0430\u044f \u0432\u0435\u0441\u0438\u0442 \u043e\u0442 130 \u0434\u043e 170 \u0433\u0440\u0430\u043c\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u0435\u0441\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430:<\/p>\n<ol>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u0432 \u0441\u0430\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u043b\u043e\u0434\u044b \u0441\u043e \u0432\u0441\u0435\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u043f\u043b\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u0432\u0435\u0441 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0438\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0435 \u0442\u044f\u0436\u0435\u043b\u043e\u0435 \u044f\u0431\u043b\u043e\u043a\u043e \u0438 ID \u0434\u0435\u0440\u0435\u0432\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043e.<\/p>\n<\/li>\n<\/ol>\n<h3>\u041c\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434<\/h3>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u041e\u041e\u041f \u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c. \u0417\u0430\u0434\u0430\u0447\u0430 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043b\u043e\u0436\u0438\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b. \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043a\u043e\u0434\u0443, \u044f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438: \u0434\u0435\u0440\u0435\u0432\u043e, \u0444\u0440\u0443\u043a\u0442, \u0441\u0430\u0434 \u0438 \u0441\u0431\u043e\u0440\u0449\u0438\u043a.<\/p>\n<p><strong>1. \u041a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0438 \u0444\u0440\u0443\u043a\u0442\u043e\u0432<\/strong><br \/>\u041a\u043b\u0430\u0441\u0441 <code>Tree<\/code> \u0431\u0443\u0434\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u044f\u0431\u043b\u043e\u043d\u0438 \u0438 \u0433\u0440\u0443\u0448\u0438 \u0438\u043c\u0435\u044e\u0442 \u0441\u0432\u043e\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043b\u043e\u0434\u043e\u0432 \u0438 \u0438\u0445 \u0432\u0435\u0441. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u0432\u0430 \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u0430 \u2014 <code>AppleTree<\/code> \u0438 <code>PearTree<\/code>. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>harvestFruits()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043b\u043e\u0434\u043e\u0432.<\/p>\n<p>\u0414\u043b\u044f \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u044f \u0442\u0430\u043a\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043b \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Fruit<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 <code>Apple<\/code> \u0438 <code>Pear<\/code>. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0440\u0443\u043a\u0442\u0430 \u0435\u0441\u0442\u044c \u0432\u0435\u0441 \u0438 \u043d\u043e\u043c\u0435\u0440 \u0434\u0435\u0440\u0435\u0432\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d \u0431\u044b\u043b \u0441\u043e\u0440\u0432\u0430\u043d.<\/p>\n<p><strong>2. \u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0441\u0430\u0434\u0430<\/strong><br \/>\u041a\u043b\u0430\u0441\u0441 <code>Garden<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0445 \u0441\u043f\u0438\u0441\u043a\u0430. \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432.<\/p>\n<p><strong>3. \u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430 \u0444\u0440\u0443\u043a\u0442\u043e\u0432<\/strong><br \/>\u0421\u0431\u043e\u0440\u0449\u0438\u043a, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Harvester<\/code>, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043f\u043b\u043e\u0434\u043e\u0432 \u0441 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0438 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u043e\u0431\u0449\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0438 \u0432\u0435\u0441\u0430 \u0444\u0440\u0443\u043a\u0442\u043e\u0432. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0430\u043c\u043e\u0435 \u0442\u044f\u0436\u0435\u043b\u043e\u0435 \u044f\u0431\u043b\u043e\u043a\u043e \u0438 \u0434\u0435\u0440\u0435\u0432\u043e, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0440\u0432\u0430\u043d\u043e.<\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b:<\/p>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 <\/strong><code>Tree<\/code> \u0438 \u0435\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u044b:<\/p>\n<pre><code class=\"php\">&lt;?php abstract class Tree {     protected $id;      public function __construct($id) {         $this-&gt;id = $id;     }      abstract public function harvestFruits();      public function getId() {         return $this-&gt;id;     } }  class AppleTree extends Tree {     public function harvestFruits() {         $apples = [];         $count = rand(40, 50);         for ($i = 0; $i &lt; $count; $i++) {             $apples[] = new Apple($this-&gt;id, rand(150, 180));         }         return $apples;     } }  class PearTree extends Tree {     public function harvestFruits() {         $pears = [];         $count = rand(0, 20);         for ($i = 0; $i &lt; $count; $i++) {             $pears[] = new Pear($this-&gt;id, rand(130, 170));         }         return $pears;     } } ?&gt;<\/code><\/pre>\n<h2>\u0420\u0430\u0437\u0436\u0443\u0451\u043c \u042f\u0431\u043b\u043e\u043a\u0438 \u043e\u0442 \u0410 \u0434\u043e \u042f<\/h2>\n<ul>\n<li>\n<p><strong>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441<\/strong>: <code>Tree<\/code> \u2014 \u044d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e; \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e <\/strong><code>$id<\/code>: \u042d\u0442\u043e \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0440\u0435\u0432\u0430. \u041e\u043d\u043e \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <\/strong><code>__construct<\/code>: \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443 \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <\/strong><code>harvestFruits<\/code>: \u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0435. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0441\u0431\u043e\u0440 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0441 \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 <\/strong><code>getId<\/code>: \u041e\u0431\u044b\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0434\u0435\u0440\u0435\u0432\u0430. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f ID \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 <\/strong><code>AppleTree<\/code>: \u042d\u0442\u043e \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Tree<\/code>. \u041e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u0435\u0440\u0435\u0432\u0430 \u2014 \u044f\u0431\u043b\u043e\u043d\u044e.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 <\/strong><code>harvestFruits<\/code>: \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Tree<\/code>. \u041e\u043d \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u044f\u0431\u043b\u043e\u043a\u0438 \u0441 \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<ul>\n<li>\n<p><code>$apples = []<\/code>: \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u044f\u0431\u043b\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p><code>$count = rand(40, 50)<\/code>: \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0431\u043b\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0441 \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 (\u043e\u0442 40 \u0434\u043e 50).<\/p>\n<\/li>\n<li>\n<p><strong>\u0426\u0438\u043a\u043b <\/strong><code>for<\/code>: \u0412 \u0446\u0438\u043a\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <code>Apple<\/code>, \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f ID \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0432\u0435\u0441 (\u043e\u0442 150 \u0434\u043e 180 \u0433\u0440\u0430\u043c\u043c). \u042d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <code>$apples<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>return $apples<\/code>: \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u044f\u0431\u043b\u043e\u043a.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 <\/strong><code>PearTree<\/code>: \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Tree<\/code> \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u0435\u0440\u0435\u0432\u0430 \u2014 \u0433\u0440\u0443\u0448\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 <\/strong><code>harvestFruits<\/code>: \u041c\u0435\u0442\u043e\u0434, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434\u0443 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <code>AppleTree<\/code>, \u043d\u043e \u0434\u043b\u044f \u0433\u0440\u0443\u0448.<\/p>\n<ul>\n<li>\n<p><code>$pears = []<\/code>: \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u0448.<\/p>\n<\/li>\n<li>\n<p><code>$count = rand(0, 20)<\/code>: \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0440\u0443\u0448, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0441 \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 (\u043e\u0442 0 \u0434\u043e 20).<\/p>\n<\/li>\n<li>\n<p><strong>\u0426\u0438\u043a\u043b <\/strong><code>for<\/code>: \u0412 \u0446\u0438\u043a\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <code>Pear<\/code>, \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f ID \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0432\u0435\u0441 (\u043e\u0442 130 \u0434\u043e 170 \u0433\u0440\u0430\u043c\u043c). \u042d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <code>$pears<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>return $pears<\/code>: \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u0448.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u041a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u0444\u0440\u0443\u043a\u0442\u043e\u0432: <\/p>\n<pre><code class=\"php\">&lt;?php abstract class Fruit {     protected $treeId;     protected $weight;      public function __construct($treeId, $weight) {         $this-&gt;treeId = $treeId;         $this-&gt;weight = $weight;     }      public function getWeight() {         return $this-&gt;weight;     }      public function getTreeId() {         return $this-&gt;treeId;     } }  class Apple extends Fruit { }  class Pear extends Fruit { }  ?&gt;<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <\/strong><code>Fruit<\/code>:<br \/>\u042d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0444\u0440\u0443\u043a\u0442\u043e\u0432. \u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0435\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <\/strong><code>treeId<\/code> \u0438 <code>weight<\/code>:<\/p>\n<ul>\n<li>\n<p><code>$treeId<\/code>: \u0417\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0440\u0435\u0432\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b \u0441\u043e\u0431\u0440\u0430\u043d \u0444\u0440\u0443\u043a\u0442. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0444\u0440\u0443\u043a\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><code>$weight<\/code>: \u0417\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0435\u0441 \u0444\u0440\u0443\u043a\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <\/strong><code>__construct<\/code>:<br \/>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u041e\u043d \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <code>$treeId<\/code> \u0438 <code>$weight<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0440\u0443\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0442\u044c, \u0441 \u043a\u0430\u043a\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u043e\u043d \u0431\u044b\u043b \u0441\u043e\u0431\u0440\u0430\u043d, \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043d \u0432\u0435\u0441\u0438\u0442.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0442\u043e\u0434\u044b <\/strong><code>getWeight()<\/code> \u0438 <code>getTreeId()<\/code>:<\/p>\n<ul>\n<li>\n<p><code>getWeight()<\/code>: \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <code>$weight<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0435\u0441 \u0444\u0440\u0443\u043a\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><code>getTreeId()<\/code>: \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <code>$treeId<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0440\u0435\u0432\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0440\u0443\u043a\u0442 \u0431\u044b\u043b \u0441\u043e\u0431\u0440\u0430\u043d.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 <\/strong><code>Apple<\/code>:<br \/>\u042d\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044f\u0431\u043b\u043e\u043a\u043e. \u041e\u043d \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <code>Fruit<\/code>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Apple<\/code> \u0438\u043c\u0435\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u0432\u0435\u0441, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b <code>getWeight()<\/code> \u0438 <code>getTreeId()<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 <\/strong><code>Pear<\/code>:<br \/>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043a\u043b\u0430\u0441\u0441\u0443 <code>Apple<\/code>, \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0433\u0440\u0443\u0448\u0443 \u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <code>Fruit<\/code>. \u041e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Pear<\/code> \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u0432\u0435\u0441, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c <code>getWeight()<\/code> \u0438 <code>getTreeId()<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p> \u041a\u043b\u0430\u0441\u0441 <code>Garden<\/code>:  <\/p>\n<pre><code class=\"php\">&lt;?php class Garden {     private $trees = [];      public function addTree(Tree $tree) {         $this-&gt;trees[] = $tree;     }      public function getTrees() {         return $this-&gt;trees;     } }  ?&gt;<\/code><\/pre>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 <\/strong><code>Harvester<\/code>:<\/p>\n<pre><code class=\"php\">&lt;?php class Harvester {     public function harvest(Garden $garden) {         $apples = [];         $pears = [];          foreach ($garden-&gt;getTrees() as $tree) {             $fruits = $tree-&gt;harvestFruits();             foreach ($fruits as $fruit) {                 if ($fruit instanceof Apple) {                     $apples[] = $fruit;                 } elseif ($fruit instanceof Pear) {                     $pears[] = $fruit;                 }             }         }          return ['apples' =&gt; $apples, 'pears' =&gt; $pears];     }      public function getTotalWeight($fruits) {         return array_sum(array_map(function($fruit) {             return $fruit-&gt;getWeight();         }, $fruits));     }      public function getHeaviestApple($apples) {         usort($apples, function($a, $b) {             return $b-&gt;getWeight() &lt;=&gt; $a-&gt;getWeight();         });          return $apples[0];     } }  ?&gt;<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430 \u043c\u0435\u0442\u043e\u0434\u0430<\/strong>:<br \/>\u041c\u0435\u0442\u043e\u0434 <code>harvest()<\/code> \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0441\u0431\u043e\u0440 \u0432\u0441\u0435\u0445 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0441 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0432 \u0441\u0430\u0434\u0443. \u041e\u043d \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0432\u0441\u0435\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043b\u043e\u0434\u044b \u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0438\u0445 \u043f\u043e \u0442\u0438\u043f\u0443 (\u044f\u0431\u043b\u043e\u043a\u0438 \u0438 \u0433\u0440\u0443\u0448\u0438).<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <\/strong><code>Garden $garden<\/code>:<br \/>\u041c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Garden<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u0430 \u0444\u0440\u0443\u043a\u0442\u043e\u0432<\/strong>:<\/p>\n<ul>\n<li>\n<p><code>foreach ($garden-&gt;getTrees() as $tree)<\/code>: \u041f\u0440\u043e\u0445\u043e\u0434 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0434\u0435\u0440\u0435\u0432\u0443 \u0432 \u0441\u0430\u0434\u0443.<\/p>\n<\/li>\n<li>\n<p><code>$fruits = $tree-&gt;harvestFruits()<\/code>: \u0421\u0431\u043e\u0440 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0435\u0442\u043e\u0434 <code>harvestFruits()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 (<code>AppleTree<\/code>, <code>PearTree<\/code>).<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 <\/strong><code>foreach<\/code>: \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0443\u043a\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u0442\u0438\u043f:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0444\u0440\u0443\u043a\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0430 <code>Apple<\/code>, \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <code>$apples<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0444\u0440\u0443\u043a\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0430 <code>Pear<\/code>, \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <code>$pears<\/code>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong>:<br \/>\u041c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u0434\u0432\u0443\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438: <code>apples<\/code> (\u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u044f\u0431\u043b\u043e\u043a) \u0438 <code>pears<\/code> (\u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u0448) <\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430 \u043c\u0435\u0442\u043e\u0434\u0430<\/strong>:<br \/>\u041c\u0435\u0442\u043e\u0434 <code>getTotalWeight()<\/code> \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043e\u0431\u0449\u0438\u0439 \u0432\u0435\u0441 \u0444\u0440\u0443\u043a\u0442\u043e\u0432, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0435\u043c\u0443 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <\/strong><code>$fruits<\/code>:<br \/>\u041c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 (<code>Apple<\/code> \u0438\u043b\u0438 <code>Pear<\/code>).<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0432\u0435\u0441\u0430<\/strong>:<\/p>\n<ul>\n<li>\n<p><code>array_map()<\/code>: \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>array_map()<\/code> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>$fruits<\/code>. \u041e\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0440\u0443\u043a\u0442\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <code>getWeight()<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u0432\u0435\u0441.<\/p>\n<\/li>\n<li>\n<p><code>array_sum()<\/code>: \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0435\u0441\u043e\u0432 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u043d, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>array_sum()<\/code> \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0435 \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u0449\u0438\u0439 \u0432\u0435\u0441.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430 \u043c\u0435\u0442\u043e\u0434\u0430<\/strong>:<br \/>\u041c\u0435\u0442\u043e\u0434 <code>getHeaviestApple()<\/code> \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u043e\u0435 \u0442\u044f\u0436\u0435\u043b\u043e\u0435 \u044f\u0431\u043b\u043e\u043a\u043e \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u044f\u0431\u043b\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <\/strong><code>$apples<\/code>:<br \/>\u041c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 <code>Apple<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u044f\u0436\u0435\u043b\u043e\u0433\u043e \u044f\u0431\u043b\u043e\u043a\u0430<\/strong>:<\/p>\n<ul>\n<li>\n<p><code>usort()<\/code>: \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>usort()<\/code> \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u044f\u0431\u043b\u043e\u043a \u043f\u043e \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044e \u0432\u0435\u0441\u0430. \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>&lt;=&gt;<\/code> (\u043a\u043e\u0441\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u0440\u0430\u0431\u043b\u044c) \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432\u0435\u0441\u043e\u0432 \u0434\u0432\u0443\u0445 \u044f\u0431\u043b\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong>:\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u0430\u043c\u043e\u0435 \u0442\u044f\u0436\u0435\u043b\u043e\u0435 \u044f\u0431\u043b\u043e\u043a\u043e \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0438 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442 <code>main.php<\/code>:  <\/p>\n<pre><code class=\"php\">&lt;?php $garden = new Garden();  for ($i = 1; $i &lt;= 10; $i++) {     $garden-&gt;addTree(new AppleTree($i)); }  for ($i = 11; $i &lt;= 25; $i++) {     $garden-&gt;addTree(new PearTree($i)); }  $harvester = new Harvester(); $fruits = $harvester-&gt;harvest($garden);  $totalApples = count($fruits['apples']); $totalPears = count($fruits['pears']); $totalAppleWeight = $harvester-&gt;getTotalWeight($fruits['apples']); $totalPearWeight = $harvester-&gt;getTotalWeight($fruits['pears']); $heaviestApple = $harvester-&gt;getHeaviestApple($fruits['apples']);  echo \"Total apples: $totalApples\\n\"; echo \"Total pears: $totalPears\\n\"; echo \"Total apple weight: $totalAppleWeight g\\n\"; echo \"Total pear weight: $totalPearWeight g\\n\"; echo \"Heaviest apple weight: \" . $heaviestApple-&gt;getWeight() . \" g from tree ID: \" . $heaviestApple-&gt;getTreeId() . \"\\n\";  ?&gt;<\/code><\/pre>\n<h3>\u0427\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u0438\u0442\u043e\u0433\u0435<\/h3>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0444\u0440\u0443\u043a\u0442\u0430\u0445 \u0432 \u0441\u0430\u0434\u0443:<\/p>\n<ol>\n<li>\n<p><strong>\u041e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0440\u0443\u043a\u0442\u043e\u0432:<\/strong> \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f\u0431\u043b\u043e\u043a \u0438 \u0433\u0440\u0443\u0448 \u0431\u044b\u043b\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043e \u0441\u043e \u0432\u0441\u0435\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0431\u0449\u0438\u0439 \u0432\u0435\u0441 \u0444\u0440\u0443\u043a\u0442\u043e\u0432:<\/strong> \u0441\u0443\u043c\u043c\u0430 \u0432\u0435\u0441\u0430 \u0432\u0441\u0435\u0445 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u044f\u0431\u043b\u043e\u043a \u0438 \u0433\u0440\u0443\u0448.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0430\u043c\u043e\u0435 \u0442\u044f\u0436\u0435\u043b\u043e\u0435 \u044f\u0431\u043b\u043e\u043a\u043e:<\/strong> \u0435\u0433\u043e \u0432\u0435\u0441 \u0438 ID \u0434\u0435\u0440\u0435\u0432\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0440\u0432\u0430\u043d\u043e.<\/p>\n<\/li>\n<\/ol>\n<h3>\u042e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b<\/h3>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u044f \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u043e\u0432. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0435\u0441\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u0431\u043e\u0440 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430:<\/p>\n<pre><code class=\"php\">&lt;?php use PHPUnit\\Framework\\TestCase;  class GardenTest extends TestCase {     public function testHarvesting() {         $tree = new AppleTree(1);         $fruits = $tree-&gt;harvestFruits();          $this-&gt;assertGreaterThanOrEqual(40, count($fruits));         $this-&gt;assertLessThanOrEqual(50, count($fruits));          foreach ($fruits as $fruit) {             $this-&gt;assertInstanceOf(Apple::class, $fruit);             $this-&gt;assertGreaterThanOrEqual(150, $fruit-&gt;getWeight());             $this-&gt;assertLessThanOrEqual(180, $fruit-&gt;getWeight());         }     } }  ?&gt;<\/code><\/pre>\n<p>\u0422\u0435\u0441\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u044f\u0431\u043b\u043e\u043a \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043e\u0442 40 \u0434\u043e 50 \u0448\u0442\u0443\u043a, \u0438 \u0447\u0442\u043e \u0432\u0435\u0441 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044f\u0431\u043b\u043e\u043a\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c.<\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u043e\u0442 \u041e\u0431\u043e\u0440\u043e\u0442.\u0440\u0443 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439, \u043d\u043e \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u0432\u044b\u043a\u043e\u0432 \u041e\u041e\u041f \u0432 PHP. \u041f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432.<\/p>\n<p>\u041e\u041e\u041f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0438\u043b\u0438 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432, \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0435\u0437 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0438 \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0443\u0442 \u043a \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u043c \u043e\u0448\u0438\u0431\u043a\u0430\u043c.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u0442 \u0432\u0430\u0441 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u041e\u041e\u041f. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u0438, \u043a\u0430\u043a \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f, \u0438\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u2014 \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0441 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435\u043c \u043e\u0431\u0441\u0443\u0436\u0443!<\/p>\n<p>\u0414\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0438 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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:\/\/habr.com\/ru\/articles\/840898\/\"> https:\/\/habr.com\/ru\/articles\/840898\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p> \u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u041d\u0438\u043a, \u043c\u043d\u0435 25, \u0438 \u044f \u0443\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0432 \u0441\u0444\u0435\u0440\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u0441 \u0432\u0430\u043c\u0438. \u042f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0435\u0451 \u043a\u0430\u043a \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u2014 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u041e\u0431\u043e\u0440\u043e\u0442.\u0440\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432. \u0417\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u0430\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0432 \u0441\u0430\u0434\u0443, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u0435\u0433\u043e \u0432 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u041e\u041e\u041f) \u043d\u0430 PHP. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u044f \u043f\u043e\u0434\u043e\u0448\u0435\u043b \u043a \u0435\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u044e.  <\/p>\n<h3>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0431\u0435 \u0444\u0440\u0443\u043a\u0442\u043e\u0432\u044b\u0439 \u0441\u0430\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0441\u0442\u0443\u0442 \u044f\u0431\u043b\u043e\u043d\u0438 \u0438 \u0433\u0440\u0443\u0448\u0438. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 10 \u044f\u0431\u043b\u043e\u043d\u044c \u0438 15 \u0433\u0440\u0443\u0448, \u0441 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043b\u043e\u0434\u043e\u0432. \u0421\u0431\u043e\u0440\u0449\u0438\u043a \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0435\u0445\u0430\u0442\u044c \u043f\u043e \u0441\u0430\u0434\u0443, \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u043b\u043e\u0434\u044b, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043f\u043e \u0442\u0438\u043f\u0443 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0435\u0441. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<ul>\n<li>\n<p>\u0421 \u043e\u0434\u043d\u043e\u0439 \u044f\u0431\u043b\u043e\u043d\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u0442 40 \u0434\u043e 50 \u044f\u0431\u043b\u043e\u043a, \u043a\u0430\u0436\u0434\u043e\u0435 \u0432\u0435\u0441\u0438\u0442 \u043e\u0442 150 \u0434\u043e 180 \u0433\u0440\u0430\u043c\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0421 \u043e\u0434\u043d\u043e\u0439 \u0433\u0440\u0443\u0448\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u0442 0 \u0434\u043e 20 \u0433\u0440\u0443\u0448, \u043a\u0430\u0436\u0434\u0430\u044f \u0432\u0435\u0441\u0438\u0442 \u043e\u0442 130 \u0434\u043e 170 \u0433\u0440\u0430\u043c\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u0435\u0441\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430:<\/p>\n<ol>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u0432 \u0441\u0430\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u043b\u043e\u0434\u044b \u0441\u043e \u0432\u0441\u0435\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u043f\u043b\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u0432\u0435\u0441 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0438\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0435 \u0442\u044f\u0436\u0435\u043b\u043e\u0435 \u044f\u0431\u043b\u043e\u043a\u043e \u0438 ID \u0434\u0435\u0440\u0435\u0432\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043e.<\/p>\n<\/li>\n<\/ol>\n<h3>\u041c\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434<\/h3>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u041e\u041e\u041f \u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c. \u0417\u0430\u0434\u0430\u0447\u0430 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043b\u043e\u0436\u0438\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b. \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043a\u043e\u0434\u0443, \u044f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438: \u0434\u0435\u0440\u0435\u0432\u043e, \u0444\u0440\u0443\u043a\u0442, \u0441\u0430\u0434 \u0438 \u0441\u0431\u043e\u0440\u0449\u0438\u043a.<\/p>\n<p><strong>1. \u041a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0438 \u0444\u0440\u0443\u043a\u0442\u043e\u0432<\/strong><br \/>\u041a\u043b\u0430\u0441\u0441 <code>Tree<\/code> \u0431\u0443\u0434\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u044f\u0431\u043b\u043e\u043d\u0438 \u0438 \u0433\u0440\u0443\u0448\u0438 \u0438\u043c\u0435\u044e\u0442 \u0441\u0432\u043e\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043b\u043e\u0434\u043e\u0432 \u0438 \u0438\u0445 \u0432\u0435\u0441. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u0432\u0430 \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u0430 \u2014 <code>AppleTree<\/code> \u0438 <code>PearTree<\/code>. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>harvestFruits()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043b\u043e\u0434\u043e\u0432.<\/p>\n<p>\u0414\u043b\u044f \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u044f \u0442\u0430\u043a\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043b \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Fruit<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 <code>Apple<\/code> \u0438 <code>Pear<\/code>. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0440\u0443\u043a\u0442\u0430 \u0435\u0441\u0442\u044c \u0432\u0435\u0441 \u0438 \u043d\u043e\u043c\u0435\u0440 \u0434\u0435\u0440\u0435\u0432\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d \u0431\u044b\u043b \u0441\u043e\u0440\u0432\u0430\u043d.<\/p>\n<p><strong>2. \u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0441\u0430\u0434\u0430<\/strong><br \/>\u041a\u043b\u0430\u0441\u0441 <code>Garden<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u0445 \u0441\u043f\u0438\u0441\u043a\u0430. \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432.<\/p>\n<p><strong>3. \u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430 \u0444\u0440\u0443\u043a\u0442\u043e\u0432<\/strong><br \/>\u0421\u0431\u043e\u0440\u0449\u0438\u043a, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Harvester<\/code>, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043f\u043b\u043e\u0434\u043e\u0432 \u0441 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0438 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u043e\u0431\u0449\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0438 \u0432\u0435\u0441\u0430 \u0444\u0440\u0443\u043a\u0442\u043e\u0432. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0430\u043c\u043e\u0435 \u0442\u044f\u0436\u0435\u043b\u043e\u0435 \u044f\u0431\u043b\u043e\u043a\u043e \u0438 \u0434\u0435\u0440\u0435\u0432\u043e, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0440\u0432\u0430\u043d\u043e.<\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b:<\/p>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 <\/strong><code>Tree<\/code> \u0438 \u0435\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u044b:<\/p>\n<pre><code class=\"php\">&lt;?php abstract class Tree {     protected $id;      public function __construct($id) {         $this-&gt;id = $id;     }      abstract public function harvestFruits();      public function getId() {         return $this-&gt;id;     } }  class AppleTree extends Tree {     public function harvestFruits() {         $apples = [];         $count = rand(40, 50);         for ($i = 0; $i &lt; $count; $i++) {             $apples[] = new Apple($this-&gt;id, rand(150, 180));         }         return $apples;     } }  class PearTree extends Tree {     public function harvestFruits() {         $pears = [];         $count = rand(0, 20);         for ($i = 0; $i &lt; $count; $i++) {             $pears[] = new Pear($this-&gt;id, rand(130, 170));         }         return $pears;     } } ?&gt;<\/code><\/pre>\n<h2>\u0420\u0430\u0437\u0436\u0443\u0451\u043c \u042f\u0431\u043b\u043e\u043a\u0438 \u043e\u0442 \u0410 \u0434\u043e \u042f<\/h2>\n<ul>\n<li>\n<p><strong>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441<\/strong>: <code>Tree<\/code> \u2014 \u044d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e; \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e <\/strong><code>$id<\/code>: \u042d\u0442\u043e \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0440\u0435\u0432\u0430. \u041e\u043d\u043e \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <\/strong><code>__construct<\/code>: \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443 \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <\/strong><code>harvestFruits<\/code>: \u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0435. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0441\u0431\u043e\u0440 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0441 \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 <\/strong><code>getId<\/code>: \u041e\u0431\u044b\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0434\u0435\u0440\u0435\u0432\u0430. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f ID \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 <\/strong><code>AppleTree<\/code>: \u042d\u0442\u043e \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Tree<\/code>. \u041e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u0435\u0440\u0435\u0432\u0430 \u2014 \u044f\u0431\u043b\u043e\u043d\u044e.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 <\/strong><code>harvestFruits<\/code>: \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Tree<\/code>. \u041e\u043d \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u044f\u0431\u043b\u043e\u043a\u0438 \u0441 \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<ul>\n<li>\n<p><code>$apples = []<\/code>: \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u044f\u0431\u043b\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p><code>$count = rand(40, 50)<\/code>: \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044f\u0431\u043b\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0441 \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 (\u043e\u0442 40 \u0434\u043e 50).<\/p>\n<\/li>\n<li>\n<p><strong>\u0426\u0438\u043a\u043b <\/strong><code>for<\/code>: \u0412 \u0446\u0438\u043a\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <code>Apple<\/code>, \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f ID \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0432\u0435\u0441 (\u043e\u0442 150 \u0434\u043e 180 \u0433\u0440\u0430\u043c\u043c). \u042d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <code>$apples<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>return $apples<\/code>: \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u044f\u0431\u043b\u043e\u043a.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 <\/strong><code>PearTree<\/code>: \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>Tree<\/code> \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0438\u043f \u0434\u0435\u0440\u0435\u0432\u0430 \u2014 \u0433\u0440\u0443\u0448\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 <\/strong><code>harvestFruits<\/code>: \u041c\u0435\u0442\u043e\u0434, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434\u0443 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <code>AppleTree<\/code>, \u043d\u043e \u0434\u043b\u044f \u0433\u0440\u0443\u0448.<\/p>\n<ul>\n<li>\n<p><code>$pears = []<\/code>: \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u0448.<\/p>\n<\/li>\n<li>\n<p><code>$count = rand(0, 20)<\/code>: \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0440\u0443\u0448, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0441 \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 (\u043e\u0442 0 \u0434\u043e 20).<\/p>\n<\/li>\n<li>\n<p><strong>\u0426\u0438\u043a\u043b <\/strong><code>for<\/code>: \u0412 \u0446\u0438\u043a\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <code>Pear<\/code>, \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f ID \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u0432\u0435\u0441 (\u043e\u0442 130 \u0434\u043e 170 \u0433\u0440\u0430\u043c\u043c). \u042d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <code>$pears<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>return $pears<\/code>: \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u0448.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u041a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u0444\u0440\u0443\u043a\u0442\u043e\u0432: <\/p>\n<pre><code class=\"php\">&lt;?php abstract class Fruit {     protected $treeId;     protected $weight;      public function __construct($treeId, $weight) {         $this-&gt;treeId = $treeId;         $this-&gt;weight = $weight;     }      public function getWeight() {         return $this-&gt;weight;     }      public function getTreeId() {         return $this-&gt;treeId;     } }  class Apple extends Fruit { }  class Pear extends Fruit { }  ?&gt;<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <\/strong><code>Fruit<\/code>:<br \/>\u042d\u0442\u043e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0444\u0440\u0443\u043a\u0442\u043e\u0432. \u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0435\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <\/strong><code>treeId<\/code> \u0438 <code>weight<\/code>:<\/p>\n<ul>\n<li>\n<p><code>$treeId<\/code>: \u0417\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0440\u0435\u0432\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b \u0441\u043e\u0431\u0440\u0430\u043d \u0444\u0440\u0443\u043a\u0442. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0444\u0440\u0443\u043a\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><code>$weight<\/code>: \u0417\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0435\u0441 \u0444\u0440\u0443\u043a\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <\/strong><code>__construct<\/code>:<br \/>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u041e\u043d \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <code>$treeId<\/code> \u0438 <code>$weight<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0440\u0443\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0442\u044c, \u0441 \u043a\u0430\u043a\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430 \u043e\u043d \u0431\u044b\u043b \u0441\u043e\u0431\u0440\u0430\u043d, \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043d \u0432\u0435\u0441\u0438\u0442.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0442\u043e\u0434\u044b <\/strong><code>getWeight()<\/code> \u0438 <code>getTreeId()<\/code>:<\/p>\n<ul>\n<li>\n<p><code>getWeight()<\/code>: \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <code>$weight<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0435\u0441 \u0444\u0440\u0443\u043a\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><code>getTreeId()<\/code>: \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <code>$treeId<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0440\u0435\u0432\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0440\u0443\u043a\u0442 \u0431\u044b\u043b \u0441\u043e\u0431\u0440\u0430\u043d.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 <\/strong><code>Apple<\/code>:<br \/>\u042d\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044f\u0431\u043b\u043e\u043a\u043e. \u041e\u043d \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <code>Fruit<\/code>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Apple<\/code> \u0438\u043c\u0435\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u0432\u0435\u0441, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b <code>getWeight()<\/code> \u0438 <code>getTreeId()<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 <\/strong><code>Pear<\/code>:<br \/>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043a\u043b\u0430\u0441\u0441\u0443 <code>Apple<\/code>, \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0433\u0440\u0443\u0448\u0443 \u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <code>Fruit<\/code>. \u041e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Pear<\/code> \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u0432\u0435\u0441, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c <code>getWeight()<\/code> \u0438 <code>getTreeId()<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p> \u041a\u043b\u0430\u0441\u0441 <code>Garden<\/code>:  <\/p>\n<pre><code class=\"php\">&lt;?php class Garden {     private $trees = [];      public function addTree(Tree $tree) {         $this-&gt;trees[] = $tree;     }      public function getTrees() {         return $this-&gt;trees;     } }  ?&gt;<\/code><\/pre>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 <\/strong><code>Harvester<\/code>:<\/p>\n<pre><code class=\"php\">&lt;?php class Harvester {     public function harvest(Garden $garden) {         $apples = [];         $pears = [];          foreach ($garden-&gt;getTrees() as $tree) {             $fruits = $tree-&gt;harvestFruits();             foreach ($fruits as $fruit) {                 if ($fruit instanceof Apple) {                     $apples[] = $fruit;                 } elseif ($fruit instanceof Pear) {                     $pears[] = $fruit;                 }             }         }          return ['apples' =&gt; $apples, 'pears' =&gt; $pears];     }      public function getTotalWeight($fruits) {         return array_sum(array_map(function($fruit) {             return $fruit-&gt;getWeight();         }, $fruits));     }      public function getHeaviestApple($apples) {         usort($apples, function($a, $b) {             return $b-&gt;getWeight() &lt;=&gt; $a-&gt;getWeight();         });          return $apples[0];     } }  ?&gt;<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430 \u043c\u0435\u0442\u043e\u0434\u0430<\/strong>:<br \/>\u041c\u0435\u0442\u043e\u0434 <code>harvest()<\/code> \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0441\u0431\u043e\u0440 \u0432\u0441\u0435\u0445 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0441 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u0432 \u0441\u0430\u0434\u0443. \u041e\u043d \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0432\u0441\u0435\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043b\u043e\u0434\u044b \u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0438\u0445 \u043f\u043e \u0442\u0438\u043f\u0443 (\u044f\u0431\u043b\u043e\u043a\u0438 \u0438 \u0433\u0440\u0443\u0448\u0438).<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <\/strong><code>Garden $garden<\/code>:<br \/>\u041c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Garden<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u0430 \u0444\u0440\u0443\u043a\u0442\u043e\u0432<\/strong>:<\/p>\n<ul>\n<li>\n<p><code>foreach ($garden-&gt;getTrees() as $tree)<\/code>: \u041f\u0440\u043e\u0445\u043e\u0434 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0434\u0435\u0440\u0435\u0432\u0443 \u0432 \u0441\u0430\u0434\u0443.<\/p>\n<\/li>\n<li>\n<p><code>$fruits = $tree-&gt;harvestFruits()<\/code>: \u0421\u0431\u043e\u0440 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0435\u0442\u043e\u0434 <code>harvestFruits()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 (<code>AppleTree<\/code>, <code>PearTree<\/code>).<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 <\/strong><code>foreach<\/code>: \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0443\u043a\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u0442\u0438\u043f:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0444\u0440\u0443\u043a\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0430 <code>Apple<\/code>, \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <code>$apples<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0444\u0440\u0443\u043a\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0430 <code>Pear<\/code>, \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <code>$pears<\/code>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong>:<br \/>\u041c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u0434\u0432\u0443\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438: <code>apples<\/code> (\u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u044f\u0431\u043b\u043e\u043a) \u0438 <code>pears<\/code> (\u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0433\u0440\u0443\u0448) <\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430 \u043c\u0435\u0442\u043e\u0434\u0430<\/strong>:<br \/>\u041c\u0435\u0442\u043e\u0434 <code>getTotalWeight()<\/code> \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043e\u0431\u0449\u0438\u0439 \u0432\u0435\u0441 \u0444\u0440\u0443\u043a\u0442\u043e\u0432, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0435\u043c\u0443 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <\/strong><code>$fruits<\/code>:<br \/>\u041c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 (<code>Apple<\/code> \u0438\u043b\u0438 <code>Pear<\/code>).<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0432\u0435\u0441\u0430<\/strong>:<\/p>\n<ul>\n<li>\n<p><code>array_map()<\/code>: \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>array_map()<\/code> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>$fruits<\/code>. \u041e\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0440\u0443\u043a\u0442\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <code>getWeight()<\/code> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u0432\u0435\u0441.<\/p>\n<\/li>\n<li>\n<p><code>array_sum()<\/code>: \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0435\u0441\u043e\u0432 \u0444\u0440\u0443\u043a\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u043d, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>array_sum()<\/code> \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0435 \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u0449\u0438\u0439 \u0432\u0435\u0441.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430 \u043c\u0435\u0442\u043e\u0434\u0430<\/strong>:<br \/>\u041c\u0435\u0442\u043e\u0434 <code>getHeaviestApple()<\/code> \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u043e\u0435 \u0442\u044f\u0436\u0435\u043b\u043e\u0435 \u044f\u0431\u043b\u043e\u043a\u043e \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u044f\u0431\u043b\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0430\u0440\u0430<\/strong><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-431254","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/431254","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=431254"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/431254\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=431254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=431254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=431254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}