]> git.mxchange.org Git - friendica.git/blob - src/Object/Profile.php
Revert "Move Objects to Model"
[friendica.git] / src / Object / Profile.php
1 <?php
2
3 /**
4  * @file src/Object/Profile.php
5  */
6
7 namespace Friendica\Object;
8
9 use Friendica\BaseObject;
10
11 class Profile extends BaseObject
12 {
13         /**
14          * @brief Returns a formatted location string from the given profile array
15          *
16          * @param array $profile Profile array (Generated from the "profile" table)
17          *
18          * @return string Location string
19          */
20         public static function formatLocation(array $profile)
21         {
22                 $location = '';
23
24                 if ($profile['locality']) {
25                         $location .= $profile['locality'];
26                 }
27
28                 if ($profile['region'] && ($profile['locality'] != $profile['region'])) {
29                         if ($location) {
30                                 $location .= ', ';
31                         }
32
33                         $location .= $profile['region'];
34                 }
35
36                 if ($profile['country-name']) {
37                         if ($location) {
38                                 $location .= ', ';
39                         }
40
41                         $location .= $profile['country-name'];
42                 }
43
44                 return $location;
45         }
46 }