Refactoring the code
git-svn-id: http://php-reader.googlecode.com/svn/trunk@140 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -55,7 +56,7 @@ require_once("ID3/Timing.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -115,26 +116,26 @@ final class ID3_Frame_SYLT extends ID3_Frame
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
list($this->_description, $this->_data) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16($this->_description), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
list($this->_description, $this->_data) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16BE($this->_description), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
list($this->_description, $this->_data) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString8($this->_description), "utf-8");
|
||||
break;
|
||||
default:
|
||||
list($this->_description, $this->_data) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString8($this->_description), "iso-8859-1");
|
||||
}
|
||||
|
||||
@@ -142,26 +143,26 @@ final class ID3_Frame_SYLT extends ID3_Frame
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
list($syllable, $this->_data) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$syllable = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$syllable = $this->_convertString
|
||||
(Transform::fromString16($syllable), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
list($syllable, $this->_data) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$syllable = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$syllable = $this->_convertString
|
||||
(Transform::fromString16BE($syllable), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
list($syllable, $this->_data) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$syllable = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$syllable = $this->_convertString
|
||||
(Transform::fromString8($syllable), "utf-8");
|
||||
break;
|
||||
default:
|
||||
list($syllable, $this->_data) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$syllable = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$syllable = $this->_convertString
|
||||
(Transform::fromString8($syllable), "iso-8859-1");
|
||||
}
|
||||
$this->_events[Transform::fromUInt32BE(substr($this->_data, 0, 4))] =
|
||||
@@ -299,11 +300,11 @@ final class ID3_Frame_SYLT extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding) . $this->_language .
|
||||
Transform::toUInt8($this->_format) . Transform::toUInt8($this->_type);
|
||||
@@ -338,7 +339,6 @@ final class ID3_Frame_SYLT extends ID3_Frame
|
||||
}
|
||||
$data .= Transform::toUInt32BE($timestamp);
|
||||
}
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user