Changes:
- added some type-hints - replaced most double-quotes (only Diaspora.php, later more) with single - added some documentation - normalized indenting in Diaspora.php (I hope I got all?)
This commit is contained in:
parent
51f43278d6
commit
adb4aea6ad
|
@ -45,7 +45,7 @@ class Widget
|
||||||
* @return string
|
* @return string
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public static function follow(string $value = ""): string
|
public static function follow(string $value = ''): string
|
||||||
{
|
{
|
||||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/follow.tpl'), array(
|
return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/follow.tpl'), array(
|
||||||
'$connect' => DI::l10n()->t('Add New Contact'),
|
'$connect' => DI::l10n()->t('Add New Contact'),
|
||||||
|
|
|
@ -1553,11 +1553,11 @@ class Contact
|
||||||
/**
|
/**
|
||||||
* Blocks a contact
|
* Blocks a contact
|
||||||
*
|
*
|
||||||
* @param int $cid
|
* @param int $cid Contact id to block
|
||||||
* @return bool
|
* @param string $reason Block reason
|
||||||
* @throws \Exception
|
* @return bool Whether it was successful
|
||||||
*/
|
*/
|
||||||
public static function block($cid, $reason = null)
|
public static function block(int $cid, string $reason = null): bool
|
||||||
{
|
{
|
||||||
$return = self::update(['blocked' => true, 'block_reason' => $reason], ['id' => $cid]);
|
$return = self::update(['blocked' => true, 'block_reason' => $reason], ['id' => $cid]);
|
||||||
|
|
||||||
|
@ -1567,11 +1567,10 @@ class Contact
|
||||||
/**
|
/**
|
||||||
* Unblocks a contact
|
* Unblocks a contact
|
||||||
*
|
*
|
||||||
* @param int $cid
|
* @param int $cid Contact id to unblock
|
||||||
* @return bool
|
* @return bool Whether it was successfull
|
||||||
* @throws \Exception
|
|
||||||
*/
|
*/
|
||||||
public static function unblock($cid)
|
public static function unblock(int $cid): bool
|
||||||
{
|
{
|
||||||
$return = self::update(['blocked' => false, 'block_reason' => null], ['id' => $cid]);
|
$return = self::update(['blocked' => false, 'block_reason' => null], ['id' => $cid]);
|
||||||
|
|
||||||
|
@ -1581,7 +1580,7 @@ class Contact
|
||||||
/**
|
/**
|
||||||
* Ensure that cached avatar exist
|
* Ensure that cached avatar exist
|
||||||
*
|
*
|
||||||
* @param integer $cid
|
* @param integer $cid Contact id
|
||||||
*/
|
*/
|
||||||
public static function checkAvatarCache(int $cid)
|
public static function checkAvatarCache(int $cid)
|
||||||
{
|
{
|
||||||
|
@ -1621,7 +1620,7 @@ class Contact
|
||||||
* @param bool $no_update Don't perfom an update if no cached avatar was found
|
* @param bool $no_update Don't perfom an update if no cached avatar was found
|
||||||
* @return string photo path
|
* @return string photo path
|
||||||
*/
|
*/
|
||||||
private static function getAvatarPath(array $contact, string $size, $no_update = false)
|
private static function getAvatarPath(array $contact, string $size, bool $no_update = false): string
|
||||||
{
|
{
|
||||||
$contact = self::checkAvatarCacheByArray($contact, $no_update);
|
$contact = self::checkAvatarCacheByArray($contact, $no_update);
|
||||||
|
|
||||||
|
@ -1655,7 +1654,7 @@ class Contact
|
||||||
* @param bool $no_update Don't perfom an update if no cached avatar was found
|
* @param bool $no_update Don't perfom an update if no cached avatar was found
|
||||||
* @return string photo path
|
* @return string photo path
|
||||||
*/
|
*/
|
||||||
public static function getPhoto(array $contact, bool $no_update = false)
|
public static function getPhoto(array $contact, bool $no_update = false): string
|
||||||
{
|
{
|
||||||
return self::getAvatarPath($contact, Proxy::SIZE_SMALL, $no_update);
|
return self::getAvatarPath($contact, Proxy::SIZE_SMALL, $no_update);
|
||||||
}
|
}
|
||||||
|
@ -1667,7 +1666,7 @@ class Contact
|
||||||
* @param bool $no_update Don't perfom an update if no cached avatar was found
|
* @param bool $no_update Don't perfom an update if no cached avatar was found
|
||||||
* @return string photo path
|
* @return string photo path
|
||||||
*/
|
*/
|
||||||
public static function getThumb(array $contact, bool $no_update = false)
|
public static function getThumb(array $contact, bool $no_update = false): string
|
||||||
{
|
{
|
||||||
return self::getAvatarPath($contact, Proxy::SIZE_THUMB, $no_update);
|
return self::getAvatarPath($contact, Proxy::SIZE_THUMB, $no_update);
|
||||||
}
|
}
|
||||||
|
@ -1679,7 +1678,7 @@ class Contact
|
||||||
* @param bool $no_update Don't perfom an update if no cached avatar was found
|
* @param bool $no_update Don't perfom an update if no cached avatar was found
|
||||||
* @return string photo path
|
* @return string photo path
|
||||||
*/
|
*/
|
||||||
public static function getMicro(array $contact, bool $no_update = false)
|
public static function getMicro(array $contact, bool $no_update = false): string
|
||||||
{
|
{
|
||||||
return self::getAvatarPath($contact, Proxy::SIZE_MICRO, $no_update);
|
return self::getAvatarPath($contact, Proxy::SIZE_MICRO, $no_update);
|
||||||
}
|
}
|
||||||
|
@ -1691,7 +1690,7 @@ class Contact
|
||||||
* @param bool $no_update Don't perfom an update if no cached avatar was found
|
* @param bool $no_update Don't perfom an update if no cached avatar was found
|
||||||
* @return array contact array with avatar cache fields
|
* @return array contact array with avatar cache fields
|
||||||
*/
|
*/
|
||||||
private static function checkAvatarCacheByArray(array $contact, bool $no_update = false)
|
private static function checkAvatarCacheByArray(array $contact, bool $no_update = false): array
|
||||||
{
|
{
|
||||||
$update = false;
|
$update = false;
|
||||||
$contact_fields = [];
|
$contact_fields = [];
|
||||||
|
@ -1797,7 +1796,7 @@ class Contact
|
||||||
* @param string $size Size of the avatar picture
|
* @param string $size Size of the avatar picture
|
||||||
* @return string avatar URL
|
* @return string avatar URL
|
||||||
*/
|
*/
|
||||||
public static function getDefaultAvatar(array $contact, string $size)
|
public static function getDefaultAvatar(array $contact, string $size): string
|
||||||
{
|
{
|
||||||
switch ($size) {
|
switch ($size) {
|
||||||
case Proxy::SIZE_MICRO:
|
case Proxy::SIZE_MICRO:
|
||||||
|
|
|
@ -166,7 +166,7 @@ class Directory extends BaseModule
|
||||||
'img_hover' => $contact['name'],
|
'img_hover' => $contact['name'],
|
||||||
'name' => $contact['name'],
|
'name' => $contact['name'],
|
||||||
'details' => $details,
|
'details' => $details,
|
||||||
'account_type' => (!empty($contact['contact-type']) ? Model\Contact::getAccountType($contact['contact-type']) : ''),
|
'account_type' => Model\Contact::getAccountType($contact['contact-type'] ?? ''),
|
||||||
'profile' => $profile,
|
'profile' => $profile,
|
||||||
'location' => $location_e,
|
'location' => $location_e,
|
||||||
'tags' => $contact['pub_keywords'],
|
'tags' => $contact['pub_keywords'],
|
||||||
|
|
|
@ -348,7 +348,7 @@ class DFRN
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
* @todo Find proper type-hint for returned type
|
* @todo Find proper type-hint for returned type
|
||||||
*/
|
*/
|
||||||
private static function addHeader(DOMDocument $doc, array $owner, string $authorelement, string $alternatelink = "", bool $public = false)
|
private static function addHeader(DOMDocument $doc, array $owner, string $authorelement, string $alternatelink = '', bool $public = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($alternatelink == "") {
|
if ($alternatelink == "") {
|
||||||
|
@ -1063,7 +1063,7 @@ class DFRN
|
||||||
* @throws \ImagickException
|
* @throws \ImagickException
|
||||||
* @todo Find good type-hints for all parameter
|
* @todo Find good type-hints for all parameter
|
||||||
*/
|
*/
|
||||||
private static function fetchauthor(\DOMXPath $xpath, \DOMNode $context, array $importer, string $element, bool $onlyfetch, string $xml = ""): array
|
private static function fetchauthor(\DOMXPath $xpath, \DOMNode $context, array $importer, string $element, bool $onlyfetch, string $xml = ''): array
|
||||||
{
|
{
|
||||||
$author = [];
|
$author = [];
|
||||||
$author["name"] = XML::getFirstNodeValue($xpath, $element."/atom:name/text()", $context);
|
$author["name"] = XML::getFirstNodeValue($xpath, $element."/atom:name/text()", $context);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue