original_string: public static function findByKeyfield($keyfield, $status = self::STATUS_ACTIVE)
      {
          if ($status === null) {
              return static::find()->where(['or', ['email' => $keyfield], ['username' => $keyfield]])->limit(1)->one();
          }
          return static::find()->where(['and', ['status' => $status], ['or', ['email' => $keyfield], ['username' => $keyfield]]])->limit(1)->one();
      }
code: public static function findByKeyfield($keyfield, $status = self::STATUS_ACTIVE)
      {
          if ($status === null) {
              return static::find()->where(['or', ['email' => $keyfield], ['username' => $keyfield]])->limit(1)->one();
          }
          return static::find()->where(['and', ['status' => $status], ['or', ['email' => $keyfield], ['username' => $keyfield]]])->limit(1)->one();
      }
code_tokens: public static function findByKeyfield ( $ keyfield , $ status = self :: STATUS_ACTIVE ) { if ( $ status === null ) { return static :: find ( ) -> where ( [ 'or' , [ 'email' => $ keyfield ] , [ 'username' => $ keyfield ] ] ) -> limit ( 1 ) -> one ( ) ; } return static :: find ( ) -> where ( [ 'and' , [ 'status' => $ status ] , [ 'or' , [ 'email' => $ keyfield ] , [ 'username' => $ keyfield ] ] ] ) -> limit ( 1 ) -> one ( ) ; }
docstring: Finds user of given status by username or email.
  @param string $keyfield value to compare
  @param int $status
  @return static|null
docstring_tokens: Finds user of given status by username or email .