_board_name; } final protected function setBoardName(string $board_name): void { $this->_board_name = $board_name; } final protected function getUserEntity(): UserEntity { return $this->_user_entity; } final protected function setUserEntity(UserEntity $user_entity): void { $this->_user_entity = $user_entity; } //-----------------------필수항목-------------------// final protected function getMySocket() { if ($this->_mySocket === null) { $this->_mySocket = new WebSocket($this->getHost()); } return $this->_mySocket; } final protected function createMyStorage(): MangboardStorage { return new MangboardStorage($this->getBoardName(), $this->getUserEntity()); } final protected function getBoardsEntity(): BoardsEntity { if ($this->_boards_entity === null) { $boardsModel = new BoardsModel(); $this->_boards_entity = $boardsModel->getEntityByID($this->getBoardName()); if ($this->_boards_entity === null) { throw new \Exception(__FUNCTION__ . "=> {$this->getBoardName()}에 해당 Board 정보가 존재하지 않습니다."); } } return $this->_boards_entity; } final protected function getBoardModel(): BoardModel { if ($this->_board_model === null) { $this->_board_model = new BoardModel("mb_" . $this->getBoardName()); } return $this->_board_model; } final protected function getUserModel(): UserModel { if ($this->_user_model === null) { return $this->_user_model = new UserModel(); } return $this->_user_model; } final protected function login_process(string $user_id = null): void { $user_id = $user_id ?? getenv("mangboard.login.default.id"); $password = getenv("mangboard.login.default.password"); $this->setUserEntity($this->getUserModel()->getEntityByID($user_id)); // $response = $this->getWebLibrary($host)->getResponse( // getenv("mangboard.host.url") . getenv("mangboard.login.url"), // "post", // [ // 'form_params' => [ // 'user_id' => $id, // 'password' => $password, // ], // ] // ); // if ($response->getStatusCode() == 200) { // $entity = $this->getUserModel()->getEntityByLoginCheck($id, $password); // if ($entity === null) { // throw new \Exception("{$id}는 회원이 아니거나 암호가 맞지 않습니다."); // } // } else { // throw new \Exception("연결실패:" . $response->getStatusCode()); // } log_message("notice", "{$user_id}로 로그인 성공"); } final protected function getSelector(string $content, string $tag): Crawler { $crawler = new Crawler($content); if ($this->isDebug) { log_message("debug", __FUNCTION__ . "=> " . $tag); } $crawler->filter($tag); if ($this->isDebug) { log_message("debug", sprintf( "\n------------%s HTML-------------\n%s\n-----------------------------------------------------\n", __FUNCTION__, $crawler->filter($tag)->html() )); } return $crawler->filter($tag); } protected function changeURLByCrawler(string $url): string { return preg_match('/^[^?]+/', $url, $matches) ? $matches[0] : null; } protected function getUrlByMediaType(Crawler $node, string $media_tag, string $attr): null|string { switch ($media_tag) { case 'video': $url = $node->attr($attr); // 또는 if ($url === null) { $url = $node->children()->attr("src"); //