Esempio n. 1
0
 public function __construct($options = array())
 {
     parent::__construct();
     if (array_key_exists('lineend', $options)) {
         $this->setLineEnd($options['lineend']);
     }
     if (array_key_exists('charset', $options)) {
         $this->setCharset($options['charset']);
     }
     if (array_key_exists('language', $options)) {
         $this->setLanguage($options['language']);
     }
     if (array_key_exists('direction', $options)) {
         $this->setDirection($options['direction']);
     }
     if (array_key_exists('tab', $options)) {
         $this->setTab($options['tab']);
     }
     if (array_key_exists('link', $options)) {
         $this->setLink($options['link']);
     }
     if (array_key_exists('base', $options)) {
         $this->setBase($options['base']);
     }
 }
Esempio n. 2
0
 /**
  * 
  *
  * @return MRange
  */
 public function __construct($location, $length)
 {
     MAssertTypes('int', $location, 'int', $length);
     parent::__construct();
     $this->location = $location;
     $this->length = $length;
 }
 /**
  * Creates a new Persistent Store Coordinator instance
  *
  * @param MManagedObjectMode $mode The model to use for across the
  * different Persistent Stores
  *
  * @return MPersistentStoreCoordinator
  */
 public function __construct(MManagedObjectModel $model)
 {
     parent::__construct();
     $this->model = $model;
     $this->persistentStores = new MMutableSet();
     $this->managedObjectContext = null;
 }
 /**
  * Initializes a new instance of an MEntityDescriptionAttribute class
  *
  * @param MEntityDescription $entity The entity that this attribute belongs to
  * @param MString $name The attribute name
  *
  * @return MEntityDescriptionAttribute A new instance of the MEntityDescriptionAttribute class
  */
 public function __construct(MEntityDescription $entity, MString $name)
 {
     parent::__construct();
     $this->entity = $entity;
     $this->name = $name;
     $this->entity->addAttribute($this);
 }
Esempio n. 5
0
 /**
  * 
  *
  * @return MView
  */
 public function __construct()
 {
     parent::__construct();
     $this->subviews = new MMutableArray();
     $this->superview = null;
     $this->contentType = S("text/plain");
 }
 /**
  * Creates a new MApplicationControllerAcceptedMethod instance with the specified
  * method.
  *
  * @param MString $method A string containing the HTTP method this accepted method
  * represents
  *
  * @return MApplicationControllerAcceptedMethod The newly created acceted method
  * instance
  */
 public function __construct(MString $method)
 {
     parent::__construct();
     $this->method = $method;
     $this->contentTypes = new MMutableArray();
     $this->fields = new MMutableArray();
 }
 /**
  * Constructs a new MPersistentStoreRequest instance. This method should be called
  * by all subclasses of MPersistentStoreRequest
  *
  * @see MPersistentStoreRequest::FetchRequestType
  * @see MPersistentStoreRequest::SaveRequestType
  * @see MPersistentStoreRequest::FaultRequestType
  *
  * @param int $requestType A constant defining the type of the request, possible
  * values are:
  * MPersistentStoreRequest::FetchRequestType
  * MPersistentStoreRequest::SaveRequestType
  * MPersistentStoreRequest::FaultRequestType
  *
  * @param MManagedObjectContext $context The context in which this Persistent Store
  * Request will be performed
  *
  * @return MPersistentStoreRequest The newly created instance of MPersistentStoreRequest
  */
 public function __construct($requestType, MManagedObjectContext $context)
 {
     MAssertTypes('int', $requestType);
     parent::__construct();
     $this->requestType = $requestType;
     $this->context = $context;
 }
 /**
  * 
  * @return MApplicationNode
  */
 public function __construct(MString $name = null)
 {
     parent::__construct();
     $this->name = $name ? $name : S("");
     $this->parentNode = null;
     $this->childNodes = new MMutableArray();
 }
 /**
  * Creates a new MManagedObjectContext object that is connected to a Persistent Store Coordinator
  *
  * @param MPersistentStoreCoordinator $persistentStoreCoordinator The Persistent Store Coordinator
  * this context is connected to
  *
  * @return MManagedObjectContext The new Managed Object Context
  */
 public function __construct(MPersistentStoreCoordinator $persistentStoreCoordinator)
 {
     parent::__construct();
     $this->persistentStoreCoordinator = $persistentStoreCoordinator;
     $this->managedObjects = new MMutableArray();
     $this->deletedObjects = new MMutableArray();
     $this->persistentStoreCoordinator()->setManagedObjectContext($this);
 }
 /**
  * Constructs a new Model by loading data from a model file
  *
  * @param MFile $file The file containing information about this model to be loaded
  * @param MString $version A String used to identify a specific version of the model
  * to use, if null is specified, the default version specified inside the model file
  * is used
  *
  * @return MManagedObjectModel The loaded Model instance
  */
 public function __construct(MFile $modelFile, MString $version = null)
 {
     parent::__construct();
     $this->modelFile = $modelFile;
     $this->version = $version;
     $this->entities = new MMutableArray();
     $this->parse();
 }
 /**
  * This method should be overriden by subclasses of this class to perform
  * extra initialization as necessary
  *
  * This method initializes a new instance of a subclass of MApplicationControllerAttribute
  * with the specified name, type and required parameters
  *
  * @param MString $name The name of this attribute
  * @param int $type A constant representing the type of this attribute
  * Possible values are:
  * 	StringType
  *  IntegerType
  *  FloatType
  *  BooleanType
  *  DateType
  *  BinaryType
  *  ArrayType
  *  DictionaryType
  * @param bool $required Wether or not this attribute is required
  */
 public function __construct(MString $name, $type, $required = true)
 {
     MAssertTypes('int', $type, 'bool', $required);
     parent::__construct();
     $this->name = $name;
     $this->type = $type;
     $this->required = $required;
 }
Esempio n. 12
0
 /**
  * 
  *
  * @return MData
  */
 public function __construct($bytes)
 {
     MAssertTypes('string', $bytes);
     parent::__construct();
     if (!is_string($bytes)) {
         throw new MInvalidDataTypeException(S("string"), S(gettype($bytes)));
     }
     $this->bytes = $bytes;
 }
Esempio n. 13
0
 /**
  * 
  *
  * @return MDictionary
  */
 public function __construct($dictionary = array())
 {
     parent::__construct();
     $this->keys = new MMutableArray(A(array_keys($dictionary)));
     $this->values = new MMutableArray(A(array_values($dictionary)));
     $args = func_get_args();
     if (N(count($args))->isEven()) {
         for ($i = 0; $i < count($args); $i++) {
             $key = $args[$i];
             $object = $args[++$i];
             $this->keys->addObject($key);
             $this->values->addObject($object);
         }
     } else {
         throw new MException(S("Uneven number of keys and objects specified"));
     }
 }
 /**
  * 
  *
  * @return MViewController
  */
 public function __construct(MView $view = null)
 {
     parent::__construct();
     $this->view = $view;
     $this->applicationController = null;
     $this->responseCode = MHTTPResponse::RESPONSE_OK;
     $this->responseHeaders = new MMutableDictionary();
     $this->restricted = false;
     $this->realm = S("Restricted Area");
     $this->accessDeniedView = null;
     $this->invalidCredentialsView = null;
     $this->authenticatedUserName = null;
     $this->parameterValues = null;
     $this->fieldValues = null;
     $this->parentViewController = null;
     $this->childViewControllers = new MMutableArray();
 }
Esempio n. 15
0
 /**
  * 
  *
  * @return MDate
  */
 public function __construct($timestamp = null, $timeZone = null)
 {
     MAssertTypes('int', $timestamp, 'string', $timeZone);
     parent::__construct();
     $this->timestamp = is_null($timestamp) ? time() : $timestamp;
     $this->timeZone = empty($timeZone) ? date_default_timezone_get() : $timeZone;
 }
Esempio n. 16
0
 /**
  * 
  *
  * @return MStreamWriter
  */
 public function __construct(MOutputStream $stream)
 {
     parent::__construct();
     $this->stream = $stream;
 }
 /**
  * Creates a new instance of the MPersistentStore class which represents a 
  * Persistent Store identified by the Persistent Store url
  *
  * At the moment only MySQL is supported as a Persistent Store. In the future
  * support for other database mechanisms will be added
  *
  * The $url parameter currently uses the same format as PHP's PDO.
  *
  * @see http://php.net/manual/en/book.pdo.php
  *
  * @param MString $url A url which identifies your Persistent Store's location
  * This URL uses the same format used by PHP's PDO to connect to a database
  * @param MDictionary $options A Dictionary of options used to connect to the
  * Persistent Store
  *
  * @return MPersistentStore The newly created Persistent Store instance
  */
 public function __construct(MString $url, MDictionary $options = null)
 {
     parent::__construct();
     $this->url = $url;
     $this->options = $options;
     $this->username = S("");
     $this->password = S("");
     $this->delegate = null;
     $this->persistentStoreCoordinator = null;
     $this->connection = null;
 }
Esempio n. 18
0
 /**
  * 
  *
  * @return MEnumerator
  */
 public function __construct()
 {
     parent::__construct();
     $this->reset();
 }
Esempio n. 19
0
 /**
  * Creates a new MApplication instance with the specified delegate class
  * If no delegate class is specified the system looks for the 'manifest.xml'
  * file inside the 'resources' folder and parses it
  *
  * @param MString $delegateClass A string containing the fully qualified class
  * name for this application's delegate, or null.
  *
  * @return MApplication The MApplication instance which has just been created
  */
 public function __construct(MString $delegateClass = null)
 {
     parent::__construct();
     $this->_delegate = null;
     $this->_errorViewControllerClass = null;
     $this->_defaultNamespace = null;
     $this->_rootViewController = null;
     $this->_commandName = null;
     $this->_commandLineArguments = null;
     if (!$this->isRoutingEnabled()) {
         $this->enableRouting();
         $redirect = new MHTTPResponse(MHTTPResponse::RESPONSE_FOUND);
         $redirect->addHeader(S("Location"), MHTTPRequest()->url());
         MDie($redirect);
     }
     if ($delegateClass) {
         $this->_delegate = MObject::newInstanceOfClass($delegateClass);
     } else {
         if (MFile::fileExists("resources/manifest.xml")) {
             $xmlManifest = simplexml_load_file("resources/manifest.xml");
             $this->_delegate = MObject::newInstanceOfClassWithParameters(S($xmlManifest['delegate']), A($this));
             $this->_errorViewControllerClass = S($xmlManifest['errorClass']);
             try {
                 $this->_defaultNamespace = MApplicationNamespace::parseFromXMLElement($xmlManifest, S("application"));
             } catch (Exception $e) {
                 throw new MParseErrorException(S("resources/manifest.xml"), null, null, $e);
             }
         } else {
             $this->_delegate = new MApplicationDelegate($this);
         }
     }
     MApplication::$_application = $this;
 }
Esempio n. 20
0
 /**
  * 
  *
  * @return MArray
  */
 public function __construct($array = array())
 {
     parent::__construct();
     $this->array = $array;
 }
Esempio n. 21
0
 /**
  * 
  *
  * @return MString
  */
 public function __construct($string = "")
 {
     MAssertTypes('string', $string);
     parent::__construct();
     $this->string = $string;
 }
Esempio n. 22
0
 /**
  * 
  *
  * @return MSet
  */
 public function __construct(MArray $array = null)
 {
     parent::__construct();
     $this->set = $array ? $array->toArray() : array();
 }
Esempio n. 23
0
 /**
  * 
  *
  * @return MHTTPResponse
  */
 public function __construct($code = MHTTPResponse::RESPONSE_OK, MString $body = null)
 {
     MAssertTypes('int', $code);
     parent::__construct();
     $this->code = $code;
     $this->body = $body;
     $this->headers = new MMutableDictionary();
 }
Esempio n. 24
0
 /**
  * @internal
  *
  * @return MHTTPRequest
  */
 public function __construct($simulatedRequestFile = null, $simulatedRequestName = null)
 {
     parent::__construct();
     $this->method = null;
     $this->contentType = null;
     $this->contents = null;
     $this->inputParameters = null;
     $this->inputFields = null;
     $this->arguments = null;
     $this->baseAddress = null;
     $this->relativeAddress = null;
     $this->baseUrl = null;
     $this->url = null;
     if ($simulatedRequestFile) {
         if (file_exists($simulatedRequestFile)) {
             $json = json_decode(file_get_contents($simulatedRequestFile), true);
             if (!empty($simulatedRequestName)) {
                 $request = $json[$simulatedRequestName];
                 if (!empty($request)) {
                     $this->server = array_merge($_SERVER, $json[$simulatedRequestName]['server']);
                     $this->get = array_merge($_GET, $json[$simulatedRequestName]['get']);
                     $this->post = array_merge($_POST, $json[$simulatedRequestName]['post']);
                     $this->contentsFile = $json[$simulatedRequestName]['contents-file'];
                 } else {
                     throw new Exception(Sf("Could not find request named '%s' inside '%s'", $simulatedRequestName, $simulatedRequestFile));
                 }
             } else {
                 throw new MException(S("You must specify a 'request_name'. Usage: hhvm -m index.php --simulated-request [json_request_file] [request_name]"));
             }
         } else {
             throw new MFileNotFoundException(S($simulatedRequestFile));
         }
     } else {
         $this->server = $_SERVER;
         $this->get = $_GET;
         $this->post = $_POST;
         $this->contentsFile = "php://input";
     }
 }
Esempio n. 25
0
 /**
  * 
  *
  * @return MNumber
  */
 public function __construct($number = 0)
 {
     parent::__construct();
     if (!is_numeric($number)) {
         throw new MNaNException($number);
     }
     $this->number = $number;
 }
Esempio n. 26
0
 /**
  * 
  *
  * @return MFile
  */
 public function __construct(MString $path)
 {
     parent::__construct();
     $this->path = $path;
 }
 /**
  * Creates a new instance of an MEntityDescription object
  *
  * @example new MEntityDescription(S("Customer"), S("Customers"), S("com.myapp.Customer"));
  *
  * @see S()
  *
  * @param MString $name The entity name
  * @param MString $plural The entity's pluralised name
  * @param MString $entityClassName The fully qualified class name for the entity
  *
  * @return MEntityDescription The newly created instance of MEntityDescription
  */
 public function __construct(MString $name, MString $plural, MString $entityClassName)
 {
     parent::__construct();
     $this->name = $name;
     $this->plural = $plural;
     $this->entityClassName = $entityClassName;
     $this->attributes = new MMutableArray();
 }
Esempio n. 28
0
 /**
  * Creates a new instance of the MManagedObject class and inserts it into the context
  *
  * @param MEntityDescription $entity The entity that represents this Managed Object
  * @param MManagedObjectContext $context The context to insert this new Managed Object into
  *
  * @return MManagedObject The newly created Managed Object
  */
 public function __construct(MEntityDescription $entity, MManagedObjectContext $context, $objectID = MManagedObject::UNKNOWN_ID)
 {
     MAssertTypes('int', $objectID);
     parent::__construct();
     $this->entity = $entity;
     $this->context = $context;
     $this->objectID = $objectID;
     $this->data = new MMutableDictionary();
     $this->updatedData = new MMutableDictionary();
     $this->relationships = new MMutableDictionary();
     $this->insertedRelationships = new MMutableDictionary();
     $this->removedRelationships = new MMutableDictionary();
     $this->isSaving = false;
     $this->savingInsertedRelationships = new MMutableArray();
     $this->savingRemovedRelationships = new MMutableArray();
     $this->initDefaultValues();
     $this->context()->insertObject($this);
     $this->didCreateObject();
 }
Esempio n. 29
0
 /**
  * 
  *
  * @return MStreamReader
  */
 public function __construct(MInputStream $stream)
 {
     parent::__construct();
     $this->stream = $stream;
     $this->buffer = new MMutableData();
 }
Esempio n. 30
0
 /**
  * 
  *
  * @return MStream
  */
 public function __construct()
 {
     parent::__construct();
 }