fucongcong/framework

View on GitHub
core/Group/Async/Handler/FinishHandler.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
 
namespace Group\Async\Handler;
 
Whitespace found at end of line
abstract class FinishHandler
Opening class brace must be on a line by itself
Expected 0 spaces before opening brace; 1 found
Whitespace found at end of line
{
protected $serv;
 
Avoid variables with short names like $fd. Configured minimum length is 3.
protected $fd;
 
protected $data;
 
protected $cache;
 
protected $database;
 
protected $table;
 
Avoid variables with short names like $fd. Configured minimum length is 3.
public function __construct($serv, $fd, $data, $table)
{
$this->serv = $serv;
$this->fd = $fd;
$this->data = $data;
$this->table = $table;
}
 
abstract public function handle();
 
public function task($cmd, $data)
Whitespace found at end of line
{
//update count
$count = $this->table->get($this->fd);
$count['count'] = $count['count'] + 1;
$this->table->set($this->fd, $count);
 
//投递task
$data = \Group\Async\DataPack::pack($cmd, $data, ['fd' => $this->fd]);
$this->serv->task($data);
}
 
public function getData()
{
return $this->data;
}
 
public function getServ()
{
return $this->serv;
}
 
public function getFd()
{
return $this->fd;
}
 
public function setCache(obj $cache)
{
$this->cache = $cache;
}
 
public function getCache()
{
return $this->cache;
}
 
public function setDatabase(obj $database)
{
$this->database = $database;
}
 
public function getDatabase()
{
return $this->database;
}
 
public function createService($serviceName)
{
return \App::getInstance()->singleton('service')->createService($serviceName);
}
}