1
0
Fork 0
friendica_2020-09-1_sharedH.../src/Object/Profile.php
Hypolite Petovan b92fc24ff0 Add Contact Object
- Add Profile Object
- Add User Model
- Add use statements
2017-11-19 16:55:28 -05:00

46 lines
816 B
PHP

<?php
/**
* @file src/Object/Profile.php
*/
namespace Friendica\Object;
use Friendica\BaseObject;
class Profile extends BaseObject
{
/**
* @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;
}
}