PHP chatgpt-video-generator > 365ok IT뉴스

365ok IT뉴스

PHP chatgpt-video-generator 정보

PHP chatgpt-video-generator

본문

https://github.com/bghira/chatgpt-video-generator

 

declare(strict_types=1);
  use Psr\Log\LoggerInterface;
   
  class AppConfig
  {
  private LoggerInterface $logger;
  private array $config;
   
  public function __construct(LoggerInterface $logger)
  {
  $this->logger = $logger;
  $this->loadConfig();
  }
   
  private function loadConfig(): void
  {
  try {
  $configFile = new SplFileObject(__DIR__ . '/../config/config.json', 'r');
  $configContents = $configFile->fread($configFile->getSize());
  $this->config = json_decode($configContents, true);
  } catch (\Exception $exception) {
  $this->logger->error('Failed to load the configuration file.', [
  'exception' => $exception
  ]);
  throw $exception;
  }
  }
   
  public function getApiKey(string $className): string
  {
  if (!isset($this->config[$className])) {
  $errorMessage = "API key not found for class {$className}.";
  $this->logger->error($errorMessage);
  throw new \InvalidArgumentException($errorMessage);
  }
   
  return $this->config[$className];
  }
  }

 

그누보드강좌/영카트강좌 - 기초부터 적용까지 체계적인 영상강좌

프로그래밍 실력 확인하기

심심할 때 게임하자
PHP메뉴얼

By 웹학교

추천
0

댓글 0개

전체 1,660 |RSS
365ok IT뉴스 내용 검색

회원로그인

진행중 포인트경매

  1. 참여71 회 시작24.04.19 15:40 종료24.04.26 15:40
(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT