original_string: public function makeUnique($id, $slug) {
          $repo = $this->getRepository();
          $scope = $this->getConfig('scope');
  
          /** @type \Titon\Db\Query $query */
          foreach ([
              $repo->select()->where($this->getConfig('slug'), $slug),
              $repo->select()->where($this->getConfig('slug'), 'like', $slug . '%')
          ] as $i => $query) {
              if ($scope) {
                  $query->bindCallback($scope);
              }
  
              if ($id) {
                  $query->where($repo->getPrimaryKey(), '!=', $id);
              }
  
              $count = $query->count();
  
              if ($count <= 0) {
                  break;
  
              } else if ($i) {
                  return $slug . '-' . $count;
              }
          }
  
          return $slug;
      }
code: public function makeUnique($id, $slug) {
          $repo = $this->getRepository();
          $scope = $this->getConfig('scope');
  
          /** @type \Titon\Db\Query $query */
          foreach ([
              $repo->select()->where($this->getConfig('slug'), $slug),
              $repo->select()->where($this->getConfig('slug'), 'like', $slug . '%')
          ] as $i => $query) {
              if ($scope) {
                  $query->bindCallback($scope);
              }
  
              if ($id) {
                  $query->where($repo->getPrimaryKey(), '!=', $id);
              }
  
              $count = $query->count();
  
              if ($count <= 0) {
                  break;
  
              } else if ($i) {
                  return $slug . '-' . $count;
              }
          }
  
          return $slug;
      }
code_tokens: public function makeUnique ( $ id , $ slug ) { $ repo = $ this -> getRepository ( ) ; $ scope = $ this -> getConfig ( 'scope' ) ; /** @type \Titon\Db\Query $query */ foreach ( [ $ repo -> select ( ) -> where ( $ this -> getConfig ( 'slug' ) , $ slug ) , $ repo -> select ( ) -> where ( $ this -> getConfig ( 'slug' ) , 'like' , $ slug . '%' ) ] as $ i => $ query ) { if ( $ scope ) { $ query -> bindCallback ( $ scope ) ; } if ( $ id ) { $ query -> where ( $ repo -> getPrimaryKey ( ) , '!=' , $ id ) ; } $ count = $ query -> count ( ) ; if ( $ count <= 0 ) { break ; } else if ( $ i ) { return $ slug . '-' . $ count ; } } return $ slug ; }
docstring: Validate the slug is unique by querying for other slugs.
  If the slug is not unique, append a count to it.
  
  @param int|int[] $id
  @param string $slug
  @return string
docstring_tokens: Validate the slug is unique by querying for other slugs . If the slug is not unique append a count to it .