Container
[
class tree: Container
] [
index: Container
] [
all elements
]
Packages:
Analyzer
Base
Cache
Config
Container
Creator
Log
Memory
Pattern
Registry
Stat
Word
Source for file Container.php
Documentation is available at
Container.php
<?php
/**
* Mai_Container
*
* Copyright (C) 2009 Mai (Me Artificial Intelligence)
*
* 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, either version 3 of the License, or
* (at your option) any later version.
*
* 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, see <http://www.gnu.org/licenses/>.
*
*
@author
Wouter Bulten (wouterbulten@mai-ai.org)
*
@copyright
Copyright (C) 2009 Mai (Me Artificial Intelligence)
*
@license
http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
*
@link
http://www.launchpad.net/mai
*
*
@category
Mai
*
@package
Container
*
*/
/**
* Mai_Container is a gateway for container classes.
*
*
@author
Wouter Bulten (wouterbulten@mai-ai.org)
*
@copyright
Copyright (C) 2009 Mai (Me Artificial Intelligence)
*
@license
http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
*
@link
http://www.launchpad.net/mai
*
*
@category
Mai
*
@package
Container
*
*/
class
Mai_Container
{
/**
*
@var
Mai_Cache
Singleton instance
*/
protected
static
$_instance
;
/**
* Private constructor to prevent creation of this object.
*
@return
void
*/
private
function
__construct
(
)
{
}
/**
* Retrieve singleton instance
*
*
@return
Mai_Cache
*/
public
static
function
getInstance
(
)
{
if
(
!
Mai
::
isInit
(
))
{
trigger_error
(
'Mai has not been setup yet. Please use Mai::init().'
,
E_USER_ERROR
)
;
}
if
(
null
===
self
::
$_instance
)
{
self
::
$_instance
=
new
self
(
)
;
}
return
self
::
$_instance
;
}
/**
* Create a new word container.
*
@param
$word
The word to store.
*
@return
Mai_Container_Word
*/
public
static
function
newContainerWord
(
$word
)
{
if
(
!
is_string
(
$word
))
{
trigger_error
(
'Word must be set and a string.'
,
E_USER_ERROR
)
;
}
//Require word
if
(
!
Mai
::
getAutoloader
(
))
{
require_once
(
'Mai/Container/Word.php'
)
;
}
return
new
Mai_Container_Word
(
$word
)
;
}
/**
* Create a new sentence container.
*
@return
Mai_Container_Sentnce
*/
public
static
function
newContainerSentence
(
)
{
//Require class
if
(
!
Mai
::
getAutoloader
(
))
{
require_once
(
'Mai/Container/Sentence.php'
)
;
}
return
new
Mai_Container_Sentence
(
)
;
}
/**
* Create a new input container.
*
@return
Mai_Container_Input
*/
public
static
function
newContainerInput
(
)
{
//Require class
if
(
!
Mai
::
getAutoloader
(
))
{
require_once
(
'Mai/Container/Input.php'
)
;
}
return
new
Mai_Container_Input
(
)
;
}
/**
* Cloning of a singleton class is not allowed.
*
@return
void
*/
final
public
function
__clone
(
)
{
trigger_error
(
'Clone is not allowed.'
,
E_USER_ERROR
)
;
}
/**
* Function to prevent deserializing
*
@return
void
*/
public
function
__wakeup
(
)
{
trigger_error
(
'Deserializing is not allowed.'
,
E_USER_ERROR
)
;
}
}
Documentation generated on Mon, 27 Jul 2009 19:55:05 +0200 by
phpDocumentor 1.4.1