original_string: protected function deleteExtraRecords()
      {
          try {
              $limit = (int)($this->limitMax);
          } catch (\Exception $ex) {
              Yii::error($ex->getMessage(), __METHOD__);
              return 0;
          }
          $host = $this->host;
           /* @var $host \rhosocial\user\User */
          $count = static::find()->createdBy($host)->count();
          Yii::info($host->getReadableGUID() . " has $count login logs.", __METHOD__);
          if ($count > $limit) {
              foreach (static::find()->createdBy($host)->orderByCreatedAt()->limit($count - $limit)->all() as $login) {
                  /* @var $login static */
                  $result = $login->delete();
                  if (YII_ENV_DEV) {
                      Yii::info($host->getReadableGUID() . ": ($result) login record created at (" . $login->getCreatedAt() . ") was just deleted.", __METHOD__);
                  }
              }
          }
          return $count - $limit;
      }
code: protected function deleteExtraRecords()
      {
          try {
              $limit = (int)($this->limitMax);
          } catch (\Exception $ex) {
              Yii::error($ex->getMessage(), __METHOD__);
              return 0;
          }
          $host = $this->host;
           /* @var $host \rhosocial\user\User */
          $count = static::find()->createdBy($host)->count();
          Yii::info($host->getReadableGUID() . " has $count login logs.", __METHOD__);
          if ($count > $limit) {
              foreach (static::find()->createdBy($host)->orderByCreatedAt()->limit($count - $limit)->all() as $login) {
                  /* @var $login static */
                  $result = $login->delete();
                  if (YII_ENV_DEV) {
                      Yii::info($host->getReadableGUID() . ": ($result) login record created at (" . $login->getCreatedAt() . ") was just deleted.", __METHOD__);
                  }
              }
          }
          return $count - $limit;
      }
code_tokens: protected function deleteExtraRecords ( ) { try { $ limit = ( int ) ( $ this -> limitMax ) ; } catch ( \ Exception $ ex ) { Yii :: error ( $ ex -> getMessage ( ) , __METHOD__ ) ; return 0 ; } $ host = $ this -> host ; /* @var $host \rhosocial\user\User */ $ count = static :: find ( ) -> createdBy ( $ host ) -> count ( ) ; Yii :: info ( $ host -> getReadableGUID ( ) . " has $count login logs." , __METHOD__ ) ; if ( $ count > $ limit ) { foreach ( static :: find ( ) -> createdBy ( $ host ) -> orderByCreatedAt ( ) -> limit ( $ count - $ limit ) -> all ( ) as $ login ) { /* @var $login static */ $ result = $ login -> delete ( ) ; if ( YII_ENV_DEV ) { Yii :: info ( $ host -> getReadableGUID ( ) . ": ($result) login record created at (" . $ login -> getCreatedAt ( ) . ") was just deleted." , __METHOD__ ) ; } } } return $ count - $ limit ; }
docstring: Delete extra records.
  @return integer The total of rows deleted.
docstring_tokens: Delete extra records .