Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Navigation / Page / Uri.php
blob338e937be53c2b12143be7ce5bf92439401d8bb5
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Navigation\Page;
12 use Zend\Navigation\Exception;
14 /**
15 * Represents a page that is defined by specifying a URI
17 class Uri extends AbstractPage
19 /**
20 * Page URI
22 * @var string|null
24 protected $uri = null;
26 /**
27 * Sets page URI
29 * @param string $uri page URI, must a string or null
31 * @return Uri fluent interface, returns self
32 * @throws Exception\InvalidArgumentException if $uri is invalid
34 public function setUri($uri)
36 if (null !== $uri && !is_string($uri)) {
37 throw new Exception\InvalidArgumentException(
38 'Invalid argument: $uri must be a string or null'
42 $this->uri = $uri;
43 return $this;
46 /**
47 * Returns URI
49 * @return string
51 public function getUri()
53 return $this->uri;
56 /**
57 * Returns href for this page
59 * Includes the fragment identifier if it is set.
61 * @return string
63 public function getHref()
65 $uri = $this->getUri();
67 $fragment = $this->getFragment();
68 if (null !== $fragment) {
69 if ('#' == substr($uri, -1)) {
70 return $uri . $fragment;
71 } else {
72 return $uri . '#' . $fragment;
76 return $uri;
79 /**
80 * Returns an array representation of the page
82 * @return array
84 public function toArray()
86 return array_merge(
87 parent::toArray(),
88 array(
89 'uri' => $this->getUri(),