Permalink
Browse files

Cleaning up the lins

  • Loading branch information...
1 parent 575e60f commit e22ca7671a5a279f5b06093a31fb9f8d69079223 Paul Matthews committed Oct 6, 2010
Showing with 16 additions and 8 deletions.
  1. +16 −8 Link.php
View
@@ -38,7 +38,8 @@ public function __construct()
* @access public
* @return string the url
*/
- public function getUrl() {
+ public function getUrl()
+ {
return $this->url;
}
@@ -48,7 +49,8 @@ public function getUrl() {
* @access public
* @return array of tags
*/
- public function getTags() {
+ public function getTags()
+ {
return $this->tags;
}
@@ -59,7 +61,8 @@ public function getTags() {
* @access public
* @return void
*/
- public function setUrl($url) {
+ public function setUrl($url)
+ {
$this->url = (string) $url;
}
@@ -70,7 +73,8 @@ public function setUrl($url) {
* @access public
* @return void
*/
- public function addTag($tag) {
+ public function addTag($tag)
+ {
$this->tags[] = (string) $tag;
}
@@ -82,7 +86,8 @@ public function addTag($tag) {
* @return boolean true if the tag was found and removed false if
* the tag didn't exist
*/
- public function removeTag($tag) {
+ public function removeTag($tag)
+ {
$success = false;
// look through the current tags for the specified tag
foreach ($this->tags as $key => $tagName) {
@@ -101,7 +106,8 @@ public function removeTag($tag) {
* @access public
* @return string the string description of the link
*/
- public function __toString() {
+ public function __toString()
+ {
// example: http://www.google.com/ [usa, search]
return sprintf('%s [%s]', $this->url, implode(', ', $this->tags));
}
@@ -112,7 +118,8 @@ public function __toString() {
* @access public
* @return array the link representation
*/
- public function toArray() {
+ public function toArray()
+ {
return array(
// _id is the name of the url in this case as it makes it easier
// for interoperability with the Database
@@ -131,7 +138,8 @@ public function toArray() {
* @throws Exception
* @return this object
*/
- public function fromArray($link) {
+ public function fromArray($link)
+ {
// Ensure the url is set
if (empty($link['url']) || !is_string($link['url'])) {
throw new Exception('Incorrect data supplied');

0 comments on commit e22ca76

Please sign in to comment.