mirror of
https://github.com/friendica/friendica
synced 2024-12-23 12:40:17 +00:00
Coding standards
This commit is contained in:
parent
b56ccbcf2b
commit
4373a66f74
5 changed files with 11 additions and 14 deletions
|
@ -50,7 +50,7 @@ class Activities extends BaseFactory
|
||||||
* @return Array
|
* @return Array
|
||||||
* @throws HTTPException\InternalServerErrorException
|
* @throws HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public function createFromUriId(int $uriId, int $uid): Array
|
public function createFromUriId(int $uriId, int $uid): array
|
||||||
{
|
{
|
||||||
$activities = [
|
$activities = [
|
||||||
'like' => [],
|
'like' => [],
|
||||||
|
@ -60,10 +60,11 @@ class Activities extends BaseFactory
|
||||||
'attendmaybe' => [],
|
'attendmaybe' => [],
|
||||||
'announce' => [],
|
'announce' => [],
|
||||||
];
|
];
|
||||||
|
|
||||||
$condition = ['uid' => $uid, 'thr-parent-id' => $uriId, 'gravity' => GRAVITY_ACTIVITY];
|
$condition = ['uid' => $uid, 'thr-parent-id' => $uriId, 'gravity' => GRAVITY_ACTIVITY];
|
||||||
|
|
||||||
$ret = Post::selectForUser($uid, ['author-id', 'verb'], $condition);
|
$ret = Post::selectForUser($uid, ['author-id', 'verb'], $condition);
|
||||||
|
|
||||||
while ($parent_item = Post::fetch($ret)) {
|
while ($parent_item = Post::fetch($ret)) {
|
||||||
// get user data and add it to the array of the activity
|
// get user data and add it to the array of the activity
|
||||||
$user = $this->twitterUser->createFromContactId($parent_item['author-id'], $uid)->toArray();
|
$user = $this->twitterUser->createFromContactId($parent_item['author-id'], $uid)->toArray();
|
||||||
|
@ -90,9 +91,9 @@ class Activities extends BaseFactory
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DBA::close($ret);
|
DBA::close($ret);
|
||||||
|
|
||||||
return $activities;
|
return $activities;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ namespace Friendica\Factory\Api\Twitter;
|
||||||
|
|
||||||
use Friendica\App\BaseURL;
|
use Friendica\App\BaseURL;
|
||||||
use Friendica\BaseFactory;
|
use Friendica\BaseFactory;
|
||||||
use Friendica\Collection\Api\Mastodon\Mentions;
|
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Tag;
|
use Friendica\Model\Tag;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
|
@ -46,12 +45,12 @@ class Mention extends BaseFactory
|
||||||
* @return Array
|
* @return Array
|
||||||
* @throws HTTPException\InternalServerErrorException
|
* @throws HTTPException\InternalServerErrorException
|
||||||
*/
|
*/
|
||||||
public function createFromUriId(int $uriId): Array
|
public function createFromUriId(int $uriId): array
|
||||||
{
|
{
|
||||||
$mentions = [];
|
$mentions = [];
|
||||||
$tags = Tag::getByURIId($uriId, [Tag::MENTION, Tag::EXCLUSIVE_MENTION, Tag::IMPLICIT_MENTION]);
|
$tags = Tag::getByURIId($uriId, [Tag::MENTION, Tag::EXCLUSIVE_MENTION, Tag::IMPLICIT_MENTION]);
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
$indices = [];
|
$indices = [];
|
||||||
$contact = Contact::getByURL($tag['url'], false);
|
$contact = Contact::getByURL($tag['url'], false);
|
||||||
$object = new \Friendica\Object\Api\Twitter\Mention($tag, $contact, $indices);
|
$object = new \Friendica\Object\Api\Twitter\Mention($tag, $contact, $indices);
|
||||||
$mentions[] = $object->toArray();
|
$mentions[] = $object->toArray();
|
||||||
|
|
|
@ -27,8 +27,6 @@ use Friendica\Content\Text\HTML;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
use Friendica\Factory\Api\Friendica\Activities;
|
use Friendica\Factory\Api\Friendica\Activities;
|
||||||
use Friendica\Factory\Api\Twitter\User as TwitterUser;
|
use Friendica\Factory\Api\Twitter\User as TwitterUser;
|
||||||
use Friendica\Factory\Api\Twitter\Hashtag;
|
|
||||||
use Friendica\Factory\Api\Twitter\Mention;
|
|
||||||
use Friendica\Factory\Api\Twitter\Url;
|
use Friendica\Factory\Api\Twitter\Url;
|
||||||
use Friendica\Model\Post;
|
use Friendica\Model\Post;
|
||||||
use Friendica\Model\Verb;
|
use Friendica\Model\Verb;
|
||||||
|
@ -96,7 +94,7 @@ class Status extends BaseFactory
|
||||||
$coords = explode(' ', $item["coord"]);
|
$coords = explode(' ', $item["coord"]);
|
||||||
if (count($coords) == 2) {
|
if (count($coords) == 2) {
|
||||||
$geo = [
|
$geo = [
|
||||||
'type' => 'Point',
|
'type' => 'Point',
|
||||||
'coordinates' => [(float) $coords[0], (float) $coords[1]]
|
'coordinates' => [(float) $coords[0], (float) $coords[1]]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Hashtag extends BaseDataTransferObject
|
||||||
public function __construct(string $name, array $indices)
|
public function __construct(string $name, array $indices)
|
||||||
{
|
{
|
||||||
$this->indices = $indices;
|
$this->indices = $indices;
|
||||||
$this->text = $name;
|
$this->text = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -79,7 +79,7 @@ class Media extends BaseDataTransferObject
|
||||||
$size = 'large';
|
$size = 'large';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->sizes = [
|
$this->sizes = [
|
||||||
$size => [
|
$size => [
|
||||||
'h' => $media['height'],
|
'h' => $media['height'],
|
||||||
'resize' => 'fit',
|
'resize' => 'fit',
|
||||||
|
@ -87,7 +87,6 @@ class Media extends BaseDataTransferObject
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue