fucongcong/framework

View on GitHub

Showing 66 of 1,150 total issues

Function onKernalMiddleware has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

public function onKernalMiddleware(\Event $event)
{
list($request, $config) = $event->getProperty();
 
if (isset($config['csrf']) && $config['csrf'] === false) return;
Severity: Minor
Found in core/Group/Listeners/KernalMiddlewareListener.php - About 1 hr to fix

Function stop has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

public function stop()
{
$pid = $this->getPid();
if (!empty($pid) && $pid) {
if (swoole_process::kill($pid, 0)) {
Severity: Minor
Found in core/Group/Queue/Bear.php - About 1 hr to fix

Function stackedCoroutine has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

private function stackedCoroutine(Generator $coroutine)
{
$stack = new SplStack;
for (;;) {
Severity: Minor
Found in core/Group/Coroutine/Task.php - About 1 hr to fix

Function call has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

public function call($server, $cmd, $data, $getRecv = true)
{
$data = \Group\Async\DataPack::pack($cmd, $data);
 
static $client = null;
Severity: Minor
Found in core/Group/Async/Client/Client.php - About 1 hr to fix

Method call has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function call($server, $cmd, $data, $getRecv = true)
{
$data = \Group\Async\DataPack::pack($cmd, $data);
 
static $client = null;
Severity: Minor
Found in core/Group/Async/Client/Client.php - About 1 hr to fix

    Method pregUrl has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    public function pregUrl($matches, $routeKey, $routing)
    {
    $requestUri = $this->route->getUri();
    if (substr($requestUri, -1) == "/") {
    $requestUri = substr($requestUri, 0, -1);
    Severity: Minor
    Found in core/Group/Routing/Router.php - About 1 hr to fix

      Function setSignal has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      private function setSignal()
      {
      //子进程结束时主进程收到的信号
      swoole_process::signal(SIGCHLD, function ($signo) {
       
       
      Severity: Minor
      Found in core/Group/Cron/Cron.php - About 55 mins to fix

      Function querySql has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      public function querySql($sql, $type, $name = null)
      {
      switch ($type) {
      case 'write':
      return $this->getWrite($name)->query($sql);
      Severity: Minor
      Found in core/Group/Dao/Dao.php - About 55 mins to fix

      Function singleton has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      public function singleton($name, $callable = null)
      {
      if (!isset($this->instances[$name]) && $callable) {
      $obj = call_user_func($callable);
      if (!is_object($obj)) {
      Severity: Minor
      Found in core/Group/App/App.php - About 55 mins to fix

      Function checkStatus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      public function checkStatus()
      {
      $args = getopt('s:');
      if(isset($args['s'])) {
       
       
      Severity: Minor
      Found in core/Group/RpcKernal.php - About 55 mins to fix

      Function getRoutingConfig has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      private function getRoutingConfig()
      {
      $file = 'route/routing.php';
       
      if ($this->container->getEnvironment() == "prod") {
      Severity: Minor
      Found in core/Group/Routing/Router.php - About 55 mins to fix

      Function onFinish has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      public function onFinish(swoole_server $serv, $fd, $data)
      {
      try {
      list($cmd, $one, $info) = \Group\Async\DataPack::unpack($data);
      $config = $this->config;
      Severity: Minor
      Found in core/Group/Async/Server/Server.php - About 55 mins to fix

      Function ListSql has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      private function ListSql($sqlDir)
      {
      $files = [];
      if (is_dir($sqlDir)) {
      $dir = opendir($sqlDir);
      Severity: Minor
      Found in core/Group/Console/Command/SqlMigrateCommand.php - About 45 mins to fix

      Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      public function __construct($serv, $fd, $fromId, $data, $cmd, $table)
      Severity: Minor
      Found in core/Group/Async/Handler/WorkHandler.php - About 45 mins to fix

        Function getShort has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        public static function getShort($str, $length = 40, $ext = '…') {
        $str = strip_tags($str);
        $str = htmlspecialchars($str);
        $strlenth = 0;
        $output = '';
        Severity: Minor
        Found in core/Group/Common/StringToolkit.php - About 45 mins to fix

        Function removeSubscriber has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        public function removeSubscriber(EventSubscriberInterface $subscriber)
        {
        foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
        if (is_array($params) && is_array($params[0])) {
        foreach ($params as $listener) {
        Severity: Minor
        Found in core/Group/EventDispatcher/EventDispatcherService.php - About 45 mins to fix

        Function addSubscriber has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        public function addSubscriber(EventSubscriberInterface $subscriber)
        {
        foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
        if (is_string($params)) {
        $this->addListener($eventName, array($subscriber, $params));
        Severity: Minor
        Found in core/Group/EventDispatcher/EventDispatcherService.php - About 45 mins to fix

        Function setTubes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        public function setTubes()
        {
        foreach ($this->jobs as $tube => $job) {
        $task_worker_num = 0;
        foreach ($job as $key => $value) {
        Severity: Minor
        Found in core/Group/Queue/TubeListener.php - About 45 mins to fix

        Function parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        static public function parse($crontab_string, $timezone = "PRC", $start_time = null)
        {
        date_default_timezone_set($timezone);
         
        if (!preg_match('/^((\*(\/[0-9]+)?)|[0-9\-\,\/]+)\s+((\*(\/[0-9]+)?)|[0-9\-\,\/]+)\s+((\*(\/[0-9]+)?)|[0-9\-\,\/]+)\s+((\*(\/[0-9]+)?)|[0-9\-\,\/]+)\s+((\*(\/[0-9]+)?)|[0-9\-\,\/]+)\s+((\*(\/[0-9]+)?)|[0-9\-\,\/]+)$/i', trim($crontab_string))) {
        Severity: Minor
        Found in core/Group/Cron/ParseCrontab.php - About 45 mins to fix

        Consider simplifying this complex logical expression.
        Open

        if (
        in_array(intval(date('s', $start)), $date['second']) &&
        in_array(intval(date('i', $start)), $date['minutes']) &&
        in_array(intval(date('G', $start)), $date['hours']) &&
        in_array(intval(date('j', $start)), $date['day']) &&
        Severity: Major
        Found in core/Group/Cron/ParseCrontab.php - About 40 mins to fix
          Severity
          Category
          Status
          Source
          Language