PageRenderTime 14ms CodeModel.GetById 8ms app.highlight 4ms RepoModel.GetById 0ms app.codeStats 0ms

/zf/library/Zend/Gdata/Exif/Entry.php

http://github.com/eryx/php-framework-benchmark
PHP | 145 lines | 45 code | 12 blank | 88 comment | 3 complexity | ed4c9ef3c5b170f54589d698abc41445 MD5 | raw file
Possible License(s): MIT, BSD-3-Clause, Apache-2.0, LGPL-2.1, LGPL-3.0, BSD-2-Clause
  1<?php
  2
  3/**
  4 * Zend Framework
  5 *
  6 * LICENSE
  7 *
  8 * This source file is subject to the new BSD license that is bundled
  9 * with this package in the file LICENSE.txt.
 10 * It is also available through the world-wide-web at this URL:
 11 * http://framework.zend.com/license/new-bsd
 12 * If you did not receive a copy of the license and are unable to
 13 * obtain it through the world-wide-web, please send an email
 14 * to license@zend.com so we can send you a copy immediately.
 15 *
 16 * @category   Zend
 17 * @package    Zend_Gdata
 18 * @subpackage Exif
 19 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 20 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 21 * @version    $Id: Entry.php 23775 2011-03-01 17:25:24Z ralph $
 22 */
 23
 24/**
 25 * @see Zend_Gdata_Entry
 26 */
 27require_once 'Zend/Gdata/Entry.php';
 28
 29/**
 30 * @see Zend_Gdata_Exif
 31 */
 32require_once 'Zend/Gdata/Exif.php';
 33
 34/**
 35 * @see Zend_Gdata_Exif_Extension_Tags
 36 */
 37require_once 'Zend/Gdata/Exif/Extension/Tags.php';
 38
 39/**
 40 * An Atom entry containing EXIF metadata.
 41 *
 42 * @category   Zend
 43 * @package    Zend_Gdata
 44 * @subpackage Exif
 45 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 46 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 47 */
 48class Zend_Gdata_Exif_Entry extends Zend_Gdata_Entry
 49{
 50    /**
 51     * The classname for individual feed elements.
 52     *
 53     * @var string
 54     */
 55    protected $_entryClassName = 'Zend_Gdata_Exif_Entry';
 56
 57    /**
 58     * The tags that belong to the Exif group.
 59     *
 60     * @var string
 61     */
 62    protected $_tags = null;
 63
 64    /**
 65     * Create a new instance.
 66     *
 67     * @param DOMElement $element (optional) DOMElement from which this
 68     *          object should be constructed.
 69     */
 70    public function __construct($element = null)
 71    {
 72        $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces);
 73        parent::__construct($element);
 74    }
 75
 76    /**
 77     * Retrieves a DOMElement which corresponds to this element and all
 78     * child properties.  This is used to build an entry back into a DOM
 79     * and eventually XML text for sending to the server upon updates, or
 80     * for application storage/persistence.
 81     *
 82     * @param DOMDocument $doc The DOMDocument used to construct DOMElements
 83     * @return DOMElement The DOMElement representing this element and all
 84     * child properties.
 85     */
 86    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
 87    {
 88        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
 89        if ($this->_tags != null) {
 90            $element->appendChild($this->_tags->getDOM($element->ownerDocument));
 91        }
 92        return $element;
 93    }
 94
 95    /**
 96     * Creates individual Entry objects of the appropriate type and
 97     * stores them as members of this entry based upon DOM data.
 98     *
 99     * @param DOMNode $child The DOMNode to process
100     */
101    protected function takeChildFromDOM($child)
102    {
103        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
104        switch ($absoluteNodeName) {
105        case $this->lookupNamespace('exif') . ':' . 'tags':
106            $tags = new Zend_Gdata_Exif_Extension_Tags();
107            $tags->transferFromDOM($child);
108            $this->_tags = $tags;
109            break;
110        default:
111            parent::takeChildFromDOM($child);
112            break;
113        }
114    }
115
116    /**
117     * Retrieve the tags for this entry.
118     *
119     * @see setTags
120     * @return Zend_Gdata_Exif_Extension_Tags The requested object
121     *              or null if not set.
122     */
123    public function getTags()
124    {
125        return $this->_tags;
126    }
127
128    /**
129     * Set the tags property for this entry. This property contains
130     * various Exif data.
131     *
132     * This corresponds to the <exif:tags> property in the Google Data
133     * protocol.
134     *
135     * @param Zend_Gdata_Exif_Extension_Tags $value The desired value
136     *              this element, or null to unset.
137     * @return Zend_Gdata_Exif_Entry Provides a fluent interface
138     */
139    public function setTags($value)
140    {
141        $this->_tags = $value;
142        return $this;
143    }
144
145}