original_string: protected function saveProperty( $id, $name, $value )
      {
          $rows   = 0;
          $sql    = $this->sql( $this->getTableInSchema(
              static::$propertyTableName
          ) );
  
          $like = strtr( $name, array(
              '\\' => '\\\\',
              '%' => '\%',
              '_' => '\_',
          ) ) . '.%';
  
          if ( is_array( $value ) )
          {
              $nameLikeOrEq = new Sql\Predicate\PredicateSet( array(
                  new Sql\Predicate\Like( 'name', $like ),
                  new Sql\Predicate\Operator( 'name', Sql\Predicate\Operator::OP_EQ, $name )
              ), Sql\Predicate\PredicateSet::OP_OR );
  
              if ( empty( $value ) )
              {
                  $delete = $sql->delete()
                                ->where( array(
                                    'menuId'  => $id,
                                    $nameLikeOrEq,
                                ) );
  
                  $rows += $sql->prepareStatementForSqlObject( $delete )
                               ->execute()
                               ->getAffectedRows();
              }
              else
              {
                  $keys = array();
  
                  foreach ( $value as $idx => $val )
                  {
                      $keys[] = $key = $name . '.' . $idx;
                      $rows += $this->saveSingleProperty( $id, $key, $val );
                  }
  
                  $delete = $sql->delete()
                                ->where( array(
                                    'menuId'  => $id,
                                    $nameLikeOrEq,
                                    new NotIn( 'name', $keys ),
                                ) );
  
                  $rows += $sql->prepareStatementForSqlObject( $delete )
                               ->execute()
                               ->getAffectedRows();
              }
          }
          else
          {
              $rows += $this->saveSingleProperty( $id, $name, $value );
  
              $delete = $sql->delete()
                            ->where( array(
                                'menuId'  => $id,
                                new Sql\Predicate\Like( 'name', $like ),
                            ) );
  
              $rows += $sql->prepareStatementForSqlObject( $delete )
                           ->execute()
                           ->getAffectedRows();
          }
  
          return $rows;
      }
code: protected function saveProperty( $id, $name, $value )
      {
          $rows   = 0;
          $sql    = $this->sql( $this->getTableInSchema(
              static::$propertyTableName
          ) );
  
          $like = strtr( $name, array(
              '\\' => '\\\\',
              '%' => '\%',
              '_' => '\_',
          ) ) . '.%';
  
          if ( is_array( $value ) )
          {
              $nameLikeOrEq = new Sql\Predicate\PredicateSet( array(
                  new Sql\Predicate\Like( 'name', $like ),
                  new Sql\Predicate\Operator( 'name', Sql\Predicate\Operator::OP_EQ, $name )
              ), Sql\Predicate\PredicateSet::OP_OR );
  
              if ( empty( $value ) )
              {
                  $delete = $sql->delete()
                                ->where( array(
                                    'menuId'  => $id,
                                    $nameLikeOrEq,
                                ) );
  
                  $rows += $sql->prepareStatementForSqlObject( $delete )
                               ->execute()
                               ->getAffectedRows();
              }
              else
              {
                  $keys = array();
  
                  foreach ( $value as $idx => $val )
                  {
                      $keys[] = $key = $name . '.' . $idx;
                      $rows += $this->saveSingleProperty( $id, $key, $val );
                  }
  
                  $delete = $sql->delete()
                                ->where( array(
                                    'menuId'  => $id,
                                    $nameLikeOrEq,
                                    new NotIn( 'name', $keys ),
                                ) );
  
                  $rows += $sql->prepareStatementForSqlObject( $delete )
                               ->execute()
                               ->getAffectedRows();
              }
          }
          else
          {
              $rows += $this->saveSingleProperty( $id, $name, $value );
  
              $delete = $sql->delete()
                            ->where( array(
                                'menuId'  => $id,
                                new Sql\Predicate\Like( 'name', $like ),
                            ) );
  
              $rows += $sql->prepareStatementForSqlObject( $delete )
                           ->execute()
                           ->getAffectedRows();
          }
  
          return $rows;
      }
code_tokens: protected function saveProperty ( $ id , $ name , $ value ) { $ rows = 0 ; $ sql = $ this -> sql ( $ this -> getTableInSchema ( static :: $ propertyTableName ) ) ; $ like = strtr ( $ name , array ( '\\' => '\\\\' , '%' => '\%' , '_' => '\_' , ) ) . '.%' ; if ( is_array ( $ value ) ) { $ nameLikeOrEq = new Sql \ Predicate \ PredicateSet ( array ( new Sql \ Predicate \ Like ( 'name' , $ like ) , new Sql \ Predicate \ Operator ( 'name' , Sql \ Predicate \ Operator :: OP_EQ , $ name ) ) , Sql \ Predicate \ PredicateSet :: OP_OR ) ; if ( empty ( $ value ) ) { $ delete = $ sql -> delete ( ) -> where ( array ( 'menuId' => $ id , $ nameLikeOrEq , ) ) ; $ rows += $ sql -> prepareStatementForSqlObject ( $ delete ) -> execute ( ) -> getAffectedRows ( ) ; } else { $ keys = array ( ) ; foreach ( $ value as $ idx => $ val ) { $ keys [ ] = $ key = $ name . '.' . $ idx ; $ rows += $ this -> saveSingleProperty ( $ id , $ key , $ val ) ; } $ delete = $ sql -> delete ( ) -> where ( array ( 'menuId' => $ id , $ nameLikeOrEq , new NotIn ( 'name' , $ keys ) , ) ) ; $ rows += $ sql -> prepareStatementForSqlObject ( $ delete ) -> execute ( ) -> getAffectedRows ( ) ; } } else { $ rows += $ this -> saveSingleProperty ( $ id , $ name , $ value ) ; $ delete = $ sql -> delete ( ) -> where ( array ( 'menuId' => $ id , new Sql \ Predicate \ Like ( 'name' , $ like ) , ) ) ; $ rows += $ sql -> prepareStatementForSqlObject ( $ delete ) -> execute ( ) -> getAffectedRows ( ) ; } return $ rows ; }
docstring: Save a property
  
  @param int $id
  @param string $name
  @param mixed $value
  @return int
docstring_tokens: Save a property