Some fixes:
- $gsid's default value cannot sadly be 0, it now must be null to allow some code work - added some more type-hints - documented a bit more
This commit is contained in:
parent
4e53666c70
commit
33768ea1c6
|
@ -111,14 +111,16 @@ class ContactSelector
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Determines network name
|
||||||
|
*
|
||||||
* @param string $network network of the contact
|
* @param string $network network of the contact
|
||||||
* @param string $profile optional, default empty
|
* @param string $profile optional, default empty
|
||||||
* @param string $protocol (Optional) Protocol that is used for the transmission
|
* @param string $protocol (Optional) Protocol that is used for the transmission
|
||||||
* @param int $gsid ??? (@TODO)
|
* @param int $gsid Server id
|
||||||
* @return string
|
* @return string
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public static function networkToName(string $network, string $profile = '', string $protocol = '', int $gsid = 0): string
|
public static function networkToName(string $network, string $profile = '', string $protocol = '', int $gsid = null): string
|
||||||
{
|
{
|
||||||
$nets = [
|
$nets = [
|
||||||
Protocol::DFRN => DI::l10n()->t('DFRN'),
|
Protocol::DFRN => DI::l10n()->t('DFRN'),
|
||||||
|
@ -180,13 +182,15 @@ class ContactSelector
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Determines network's icon name
|
||||||
|
*
|
||||||
* @param string $network network
|
* @param string $network network
|
||||||
* @param string $profile optional, default empty
|
* @param string $profile optional, default empty
|
||||||
* @param int $gsid ??? (@TODO)
|
* @param int $gsid Server id
|
||||||
* @return string
|
* @return string Name for network icon
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function networkToIcon(string $network, string $profile = "", int $gsid = 0): string
|
public static function networkToIcon(string $network, string $profile = "", int $gsid = null): string
|
||||||
{
|
{
|
||||||
$nets = [
|
$nets = [
|
||||||
Protocol::DFRN => 'friendica',
|
Protocol::DFRN => 'friendica',
|
||||||
|
|
|
@ -427,7 +427,7 @@ class DBA
|
||||||
* @return boolean was the update successfull?
|
* @return boolean was the update successfull?
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function update($table, $fields, $condition, $old_fields = [], $params = [])
|
public static function update($table, array $fields, array $condition, $old_fields = [], array $params = [])
|
||||||
{
|
{
|
||||||
return DI::dba()->update($table, $fields, $condition, $old_fields, $params);
|
return DI::dba()->update($table, $fields, $condition, $old_fields, $params);
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,7 @@ class DBA
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @see self::select
|
* @see self::select
|
||||||
*/
|
*/
|
||||||
public static function selectFirst($table, array $fields = [], array $condition = [], $params = [])
|
public static function selectFirst($table, array $fields = [], array $condition = [], array $params = [])
|
||||||
{
|
{
|
||||||
return DI::dba()->selectFirst($table, $fields, $condition, $params);
|
return DI::dba()->selectFirst($table, $fields, $condition, $params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ class Attach
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function exists(array $conditions)
|
public static function exists(array $conditions): bool
|
||||||
{
|
{
|
||||||
return DBA::exists('attach', $conditions);
|
return DBA::exists('attach', $conditions);
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,10 +128,10 @@ class Contact
|
||||||
* @param array $fields Array of selected fields, empty for all
|
* @param array $fields Array of selected fields, empty for all
|
||||||
* @param array $condition Array of fields for condition
|
* @param array $condition Array of fields for condition
|
||||||
* @param array $params Array of several parameters
|
* @param array $params Array of several parameters
|
||||||
* @return array
|
* @return array|bool
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function selectFirst(array $fields = [], array $condition = [], array $params = []): array
|
public static function selectFirst(array $fields = [], array $condition = [], array $params = [])
|
||||||
{
|
{
|
||||||
$contact = DBA::selectFirst('contact', $fields, $condition, $params);
|
$contact = DBA::selectFirst('contact', $fields, $condition, $params);
|
||||||
|
|
||||||
|
|
|
@ -2054,7 +2054,7 @@ class GServer
|
||||||
* @return int
|
* @return int
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function getProtocol(int $gsid)
|
public static function getProtocol(int $gsid): int
|
||||||
{
|
{
|
||||||
if (empty($gsid)) {
|
if (empty($gsid)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -110,7 +110,7 @@ class Photo
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @see \Friendica\Database\DBA::select
|
* @see \Friendica\Database\DBA::select
|
||||||
*/
|
*/
|
||||||
public static function getPhotosForUser($uid, $resourceid, array $conditions = [], array $params = [])
|
public static function getPhotosForUser(int $uid, string $resourceid, array $conditions = [], array $params = [])
|
||||||
{
|
{
|
||||||
$conditions["resource-id"] = $resourceid;
|
$conditions["resource-id"] = $resourceid;
|
||||||
$conditions["uid"] = $uid;
|
$conditions["uid"] = $uid;
|
||||||
|
|
|
@ -1445,7 +1445,7 @@ class Probe
|
||||||
* @return array|bool OStatus data or "false" on error or "true" on short mode
|
* @return array|bool OStatus data or "false" on error or "true" on short mode
|
||||||
* @throws HTTPException\InternalServerErrorException
|
* @throws HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
private static function ostatus($webfinger, $short = false)
|
private static function ostatus(array $webfinger, bool $short = false)
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ class Strings
|
||||||
* @return string Formatted network name
|
* @return string Formatted network name
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public static function formatNetworkName($network, $url = '')
|
public static function formatNetworkName(string $network, string $url = ''): string
|
||||||
{
|
{
|
||||||
if ($network != '') {
|
if ($network != '') {
|
||||||
if ($url != '') {
|
if ($url != '') {
|
||||||
|
@ -176,6 +176,8 @@ class Strings
|
||||||
|
|
||||||
return $network_name;
|
return $network_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,7 +189,7 @@ class Strings
|
||||||
*
|
*
|
||||||
* @return string Transformed string.
|
* @return string Transformed string.
|
||||||
*/
|
*/
|
||||||
public static function deindent($text, $chr = "[\t ]", $count = NULL)
|
public static function deindent(string $text, string $chr = "[\t ]", int $count = null)
|
||||||
{
|
{
|
||||||
$lines = explode("\n", $text);
|
$lines = explode("\n", $text);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue