original_string: public function add()
      {
          if($moduleEvents = $this->module->events())
          {
              $systemEvents = $this->load();
              if(isset($moduleEvents['listen']))
              // for listen event we must check if exists merge if not add it
              foreach ($moduleEvents['listen'] as $event => $listens)
              {
                  if(isset($systemEvents['listen'][$event]))
                      $systemEvents['listen'][$event] = array_merge($systemEvents['listen'][$event],$listens);
                  else
                      $systemEvents['listen'][$event] = $listens;
              }
              // for subscribe
              if(isset($moduleEvents['subscribe']))
                  $systemEvents['subscribe'][] = $moduleEvents['subscribe'];
              return $this->set($systemEvents);
          }
          return true;
      }
code: public function add()
      {
          if($moduleEvents = $this->module->events())
          {
              $systemEvents = $this->load();
              if(isset($moduleEvents['listen']))
              // for listen event we must check if exists merge if not add it
              foreach ($moduleEvents['listen'] as $event => $listens)
              {
                  if(isset($systemEvents['listen'][$event]))
                      $systemEvents['listen'][$event] = array_merge($systemEvents['listen'][$event],$listens);
                  else
                      $systemEvents['listen'][$event] = $listens;
              }
              // for subscribe
              if(isset($moduleEvents['subscribe']))
                  $systemEvents['subscribe'][] = $moduleEvents['subscribe'];
              return $this->set($systemEvents);
          }
          return true;
      }
code_tokens: public function add ( ) { if ( $ moduleEvents = $ this -> module -> events ( ) ) { $ systemEvents = $ this -> load ( ) ; if ( isset ( $ moduleEvents [ 'listen' ] ) ) // for listen event we must check if exists merge if not add it foreach ( $ moduleEvents [ 'listen' ] as $ event => $ listens ) { if ( isset ( $ systemEvents [ 'listen' ] [ $ event ] ) ) $ systemEvents [ 'listen' ] [ $ event ] = array_merge ( $ systemEvents [ 'listen' ] [ $ event ] , $ listens ) ; else $ systemEvents [ 'listen' ] [ $ event ] = $ listens ; } // for subscribe if ( isset ( $ moduleEvents [ 'subscribe' ] ) ) $ systemEvents [ 'subscribe' ] [ ] = $ moduleEvents [ 'subscribe' ] ; return $ this -> set ( $ systemEvents ) ; } return true ; }
docstring: add events to events.php in cache
docstring_tokens: add events to events . php in cache