Один из разработчиков написал RESTful API для сайта, на котором редакция публикует статьи. Часть кода новой фичи разработчик передал вам на код-ревью. Сайт построен на фреймворке Yii2. Предполагается, что контроллер написан для RESTful-сервиса, а само приложение обладает (или будет впоследствии обладать) большим кол-вом бизнес-логики.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios' | |
class RenderList { | |
constructor( params ) { | |
super(params); | |
window.addEventListener( 'resize' , this.render); | |
} | |
getData() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");?> | |
<?$APPLICATION->IncludeComponent( | |
"bbc:elements", | |
".default", | |
array( | |
"IBLOCK_TYPE" => "news", | |
"IBLOCK_ID" => "6", | |
"SORT_BY_1" => "SHOWS", | |
"SORT_ORDER_1" => "ASC", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bitrix\Main\Application; | |
use Monolog\Handler\StreamHandler; | |
use Monolog\Logger; | |
use Monolog\Registry; | |
use Monolog\Formatter\LogstashFormatter; | |
use Monolog\Processor\WebProcessor; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Console command for Phinx with argument "all" for executed migrations for multiple databases. | |
* | |
* Structure directory for migrations and configs: | |
* ``` | |
* migrations/ | |
* .db1/ | |
* .db2/ | |
* .db3/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Подразумевается, что для каждого админского раздела, пусть и в рамках одного модуля, | |
* будет создаваться свой interface.php | |
*/ | |
namespace Vasya\Supermodule\HeaderFooter; | |
use DigitalWand\AdminHelper\AdminInterface; | |
class HeaderFooterInterface extends AdminInterface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Declination numbers | |
* | |
* @param int $num Number | |
* @param array $words Array with words | |
* @example declension(3, ['попугай', 'попугая', 'попугаев']) | |
* | |
* @return string | |
*/ | |
function declension($num, $words) |