/** * Constructor * * @param ConfigurationInterface $configuration */ public function __construct(ConfigurationInterface $configuration = null) { if ($configuration === null) { $configuration = new DotEnvConfiguration('.'); } $this->configuration = $configuration; $this->json_mapper = new \JsonMapper(); // create logger $this->log = new Logger('JiraClient'); $this->log->pushHandler(new StreamHandler($configuration->getJiraLogFile(), $this->convertLogLevel($configuration->getJiraLogLevel()))); $this->http_response = 200; }
/** * Constructor * * @param ConfigurationInterface $configuration */ public function __construct(ConfigurationInterface $configuration = null) { if ($configuration === null) { $path = "./"; if (!file_exists(".env")) { // If calling the getcwd() on laravel it will returning the 'public' directory. $path = "../"; } $configuration = new DotEnvConfiguration($path); } $this->configuration = $configuration; $this->json_mapper = new \JsonMapper(); // create logger $this->log = new Logger('JiraClient'); $this->log->pushHandler(new StreamHandler($configuration->getJiraLogFile(), $this->convertLogLevel($configuration->getJiraLogLevel()))); $this->http_response = 200; }
/** * Constructor. * * @param ConfigurationInterface $configuration * @param Logger $logger */ public function __construct(ConfigurationInterface $configuration = null, Logger $logger = null) { if ($configuration === null) { $path = './'; if (!file_exists('.env')) { // If calling the getcwd() on laravel it will returning the 'public' directory. $path = '../'; } $configuration = new DotEnvConfiguration($path); } $this->configuration = $configuration; $this->json_mapper = new \JsonMapper(); $this->json_mapper->undefinedPropertyHandler = [\JiraRestApi\JsonMapperHelper::class, 'setUndefinedProperty']; // create logger if ($logger) { $this->log = $logger; } else { $this->log = new Logger('JiraClient'); $this->log->pushHandler(new StreamHandler($configuration->getJiraLogFile(), $this->convertLogLevel($configuration->getJiraLogLevel()))); } $this->http_response = 200; }