/** * Validate if you have an access token and it is valid if exists * * @return bool */ public function hasValidToken() { if (empty($this->config->get('fb_token')->long)) { return false; } try { $session = $this->fb()->get('/debug_token?input_token=' . $this->config->get('fb_token')->long)->getGraphSessionInfo(); } catch (FacebookAuthenticationException $e) { return false; } return !(empty($session) || empty($session->getUserId())); }
/** * @param Config $config */ public function __construct(Config $config) { $this->board = new Board(); $this->pins = ['r' => $this->board->getPin($config->get('pins')->r)->mode(Pin::SOFT_PWM_OUT), 'g' => $this->board->getPin($config->get('pins')->g)->mode(Pin::SOFT_PWM_OUT), 'b' => $this->board->getPin($config->get('pins')->b)->mode(Pin::SOFT_PWM_OUT)]; }