mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 19:41:55 +02:00
Add Stream_URL class for passing them around
This commit is contained in:
parent
bc6d3d1e43
commit
a1594882c7
2 changed files with 85 additions and 0 deletions
55
lib/class/memory_object.class.php
Normal file
55
lib/class/memory_object.class.php
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
|
||||
/**
|
||||
*
|
||||
* LICENSE: GNU General Public License, version 2 (GPLv2)
|
||||
* Copyright (c) 2001 - 2011 Ampache.org All Rights Reserved
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
// A magical class filled with ponies
|
||||
|
||||
class memory_object {
|
||||
|
||||
private $_data = array();
|
||||
public $properties;
|
||||
|
||||
public function __construct($data) {
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if (in_array($key, $this->properties)) {
|
||||
$this->_data[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function __set($name, $value) {
|
||||
if (!in_array($name, $this->properties)) {
|
||||
return false;
|
||||
}
|
||||
$this->_data[$name] = $value;
|
||||
}
|
||||
|
||||
public function __get($name) {
|
||||
if (!in_array($name, $this->properties)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset($this->_data[$name]) ? $this->_data[$name] : null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue