Move Object\Profile to Model\Profile

This commit is contained in:
Hypolite Petovan 2017-12-07 08:57:35 -05:00
parent 3fc3e67b70
commit 6b60b89385
5 changed files with 7 additions and 9 deletions

44
src/Model/Profile.php Normal file
View file

@ -0,0 +1,44 @@
<?php
/**
* @file src/Model/Profile.php
*/
namespace Friendica\Model;
class Profile
{
/**
* @brief Returns a formatted location string from the given profile array
*
* @param array $profile Profile array (Generated from the "profile" table)
*
* @return string Location string
*/
public static function formatLocation(array $profile)
{
$location = '';
if ($profile['locality']) {
$location .= $profile['locality'];
}
if ($profile['region'] && ($profile['locality'] != $profile['region'])) {
if ($location) {
$location .= ', ';
}
$location .= $profile['region'];
}
if ($profile['country-name']) {
if ($location) {
$location .= ', ';
}
$location .= $profile['country-name'];
}
return $location;
}
}