public static function receiver($output) { foreach ($output as $line) { Yii::info('$line: ' . $line, 'task-receiver'); } $return = Task::sscanfOutput($output); if ($return) { Yii::info('sscanfOutput, return', 'task-receiver'); $from = 0; $to = 0; $action = 0; $message = ''; list($from, $to, $action, $message) = $return; Yii::info('$message: ' . $message, 'task-receiver'); $modelTask = new Task(); $modelTask->from_device_id = $from; $modelTask->to_device_id = $to; $modelTask->action_id = $action; $modelTask->data = $message; if (!$modelTask->insert()) { print_r($modelTask->errors); Yii::error($modelTask->errors, 'task-receiver'); Yii::error('return 0 (false)', 'task-receiver'); return 0; } Yii::info('return 1 (true)', 'task-receiver'); return 1; } Yii::info('sscanfOutput, !return', 'task-receiver'); Yii::error('return 0 (false)', 'task-receiver'); return 0; }