瀏覽代碼

Use getters in toArray

Jordi Boggiano 13 年之前
父節點
當前提交
fbb53d894e

+ 3 - 3
src/Packagist/WebBundle/Entity/Author.php

@@ -77,9 +77,9 @@ class Author
     public function toArray()
     {
         return array(
-            'name' => $this->name,
-            'email' => $this->email,
-            'homepage' => $this->homepage,
+            'name' => $this->getName(),
+            'email' => $this->getEmail(),
+            'homepage' => $this->getHomepage(),
         );
     }
 

+ 1 - 1
src/Packagist/WebBundle/Entity/PackageLink.php

@@ -40,7 +40,7 @@ abstract class PackageLink
 
     public function toArray()
     {
-        return array($this->packageName => $this->packageVersion);
+        return array($this->getPackageName() => $this->getPackageVersion());
     }
 
     public function setId($id)

+ 3 - 3
src/Packagist/WebBundle/Entity/User.php

@@ -45,8 +45,8 @@ class User extends BaseUser
     public function toArray()
     {
         return array(
-            'name' => $this->username,
-            'email' => $this->email,
+            'name' => $this->getUsername(),
+            'email' => $this->getEmail(),
         );
     }
 
@@ -103,7 +103,7 @@ class User extends BaseUser
     /**
      * Get createdAt
      *
-     * @return datetime 
+     * @return datetime
      */
     public function getCreatedAt()
     {

+ 7 - 7
src/Packagist/WebBundle/Entity/Version.php

@@ -188,18 +188,18 @@ class Version
         }
 
         $data = array(
-            'name' => $this->name,
-            'description' => $this->description,
+            'name' => $this->getName(),
+            'description' => $this->getDescription(),
             'keywords' => $tags,
-            'homepage' => $this->homepage,
-            'version' => $this->version,
+            'homepage' => $this->getHomepage(),
+            'version' => $this->getVersion(),
             'license' => $this->getLicense(),
             'authors' => $authors,
             'source' => $this->getSource(),
-            'time' => $this->releasedAt ? $this->releasedAt->format('Y-m-d\TH:i:sP') : null,
+            'time' => $this->getReleasedAt() ? $this->getReleasedAt()->format('Y-m-d\TH:i:sP') : null,
             'dist' => $this->getDist(),
-            'type' => $this->type,
-            'extra' => $this->extra,
+            'type' => $this->getType(),
+            'extra' => $this->getExtra(),
         );
 
         $supportedLinkTypes = array(