コード例 #1
0
    /**
     * @return  void
     */
    public function testCanEncodeObjectWithoutToArray()
    {
        $object = new stdClass;
        $object->string = 'foo';
        $object->integer = 42;

        $this->assertEquals(
            'd7:integeri42e6:string3:fooe',
            Rych_Bencode_Encoder::encode($object)
        );
    }
コード例 #2
0
 /**
  * Proxy method to {@link Rych_Bencode_Encoder::encode()}.
  *
  * @uses    Rych_Bencode_Encoder::encode()
  * @param   mixed   $valueToEncode
  * @return  string
  */
 public static function encode($valueToEncode)
 {
     return Rych_Bencode_Encoder::encode($valueToEncode);
 }