Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Commit

Permalink
Fixes #14
Browse files Browse the repository at this point in the history
  • Loading branch information
hassankhan committed Mar 15, 2016
1 parent 2d9ce70 commit 70826c1
Show file tree
Hide file tree
Showing 18 changed files with 249 additions and 248 deletions.
48 changes: 24 additions & 24 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

use GuzzleHttp\HandlerStack;
use Larabros\Elogram\Container\Builder;
use Larabros\Elogram\Entities\Comment;
use Larabros\Elogram\Entities\LikeRepository;
use Larabros\Elogram\Entities\Location;
use Larabros\Elogram\Entities\Media;
use Larabros\Elogram\Entities\Tag;
use Larabros\Elogram\Entities\User;
use Larabros\Elogram\Repositories\CommentsRepository;
use Larabros\Elogram\Repositories\LikesRepository;
use Larabros\Elogram\Repositories\LocationsRepository;
use Larabros\Elogram\Repositories\MediaRepository;
use Larabros\Elogram\Repositories\TagsRepository;
use Larabros\Elogram\Repositories\UsersRepository;
use Larabros\Elogram\Helpers\RedirectLoginHelper;
use Larabros\Elogram\Http\Clients\AdapterInterface;
use Larabros\Elogram\Http\Response;
Expand Down Expand Up @@ -82,63 +82,63 @@ protected function buildContainer(array $options)
*/

/**
* Returns the current instance of :php:class:`User`.
* Returns the current instance of :php:class:`UsersRepository`.
*
* @return User
* @return UsersRepository
*/
public function users()
{
return $this->container->get('entity.user');
return $this->container->get('repo.user');
}

/**
* Returns the current instance of :php:class:`Media`.
* Returns the current instance of :php:class:`MediaRepository`.
*
* @return Media
* @return MediaRepository
*/
public function media()
{
return $this->container->get('entity.media');
return $this->container->get('repo.media');
}

/**
* Returns the current instance of :php:class:`Comment`.
* Returns the current instance of :php:class:`CommentsRepository`.
*
* @return Comment
* @return CommentsRepository
*/
public function comments()
{
return $this->container->get('entity.comment');
return $this->container->get('repo.comment');
}

/**
* Returns the current instance of :php:class:`LikeRepository`.
* Returns the current instance of :php:class:`LikesRepository`.
*
* @return LikeRepository
* @return LikesRepository
*/
public function likes()
{
return $this->container->get('entity.like');
return $this->container->get('repo.like');
}

/**
* Returns the current instance of :php:class:`Tag`.
* Returns the current instance of :php:class:`TagsRepository`.
*
* @return Tag
* @return TagsRepository
*/
public function tags()
{
return $this->container->get('entity.tag');
return $this->container->get('repo.tag');
}

/**
* Returns the current instance of :php:class:`Location`.
* Returns the current instance of :php:class:`LocationsRepository`.
*
* @return Location
* @return LocationsRepository
*/
public function locations()
{
return $this->container->get('entity.location');
return $this->container->get('repo.location');
}

/**
Expand Down
37 changes: 19 additions & 18 deletions src/Providers/EntityServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Larabros\Elogram\Providers;

use Larabros\Elogram\Entities\Comment;
use Larabros\Elogram\Entities\LikeRepository;
use Larabros\Elogram\Entities\Location;
use Larabros\Elogram\Entities\Media;
use Larabros\Elogram\Entities\Tag;
use Larabros\Elogram\Entities\User;
use Larabros\Elogram\Repositories\CommentsRepository;
use Larabros\Elogram\Repositories\LikesRepository;
use Larabros\Elogram\Repositories\LocationsRepository;
use Larabros\Elogram\Repositories\MediaRepository;
use Larabros\Elogram\Repositories\TagsRepository;
use Larabros\Elogram\Repositories\UsersRepository;
use Larabros\Elogram\Http\Clients\AdapterInterface;
use League\Container\ServiceProvider\AbstractServiceProvider;

Expand All @@ -31,12 +31,12 @@ class EntityServiceProvider extends AbstractServiceProvider
* @var array
*/
protected $provides = [
'entity.user',
'entity.media',
'entity.comment',
'entity.like',
'entity.tag',
'entity.location',
'repo.user',
'repo.media',
'repo.comment',
'repo.like',
'repo.tag',
'repo.location',
];

/**
Expand All @@ -48,11 +48,12 @@ class EntityServiceProvider extends AbstractServiceProvider
*/
public function register()
{
$this->getContainer()->share('entity.user', new User($this->getContainer()->get(AdapterInterface::class)));
$this->getContainer()->share('entity.media', new Media($this->getContainer()->get(AdapterInterface::class)));
$this->getContainer()->share('entity.comment', new Comment($this->getContainer()->get(AdapterInterface::class)));
$this->getContainer()->share('entity.like', new LikeRepository($this->getContainer()->get(AdapterInterface::class)));
$this->getContainer()->share('entity.tag', new Tag($this->getContainer()->get(AdapterInterface::class)));
$this->getContainer()->share('entity.location', new Location($this->getContainer()->get(AdapterInterface::class)));
$adapter = $this->getContainer()->get(AdapterInterface::class);
$this->getContainer()->share('repo.user', new UsersRepository($adapter));
$this->getContainer()->share('repo.media', new MediaRepository($adapter));
$this->getContainer()->share('repo.comment', new CommentsRepository($adapter));
$this->getContainer()->share('repo.like', new LikesRepository($adapter));
$this->getContainer()->share('repo.tag', new TagsRepository($adapter));
$this->getContainer()->share('repo.location', new LocationsRepository($adapter));
}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<?php

namespace Larabros\Elogram\Entities;
namespace Larabros\Elogram\Repositories;

use Larabros\Elogram\Http\Clients\AdapterInterface;

/**
* An abstract entity class. Any new endpoints should extend this class.
* An abstract repository class. Any new endpoints should extend this class.
*
* @package Elogram
* @author Hassan Khan <[email protected]>
* @link https://github.com/larabros/elogram
* @license MIT
*/
abstract class AbstractEntity
abstract class AbstractRepository
{
/**
* @var AdapterInterface
*/
protected $client;

/**
* Creates a new instance of :php:class:`AbstractEntity`.
* Creates a new instance of :php:class:`AbstractRepository`.
*
* @param AdapterInterface $client
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

namespace Larabros\Elogram\Entities;
namespace Larabros\Elogram\Repositories;

use Larabros\Elogram\Http\Response;

/**
* Comment
* CommentsRepository
*
* @package Elogram
* @author Hassan Khan <[email protected]>
* @link https://github.com/larabros/elogram
* @license MIT
*/
class Comment extends AbstractEntity
class CommentsRepository extends AbstractRepository
{

/**
Expand All @@ -38,7 +38,7 @@ public function get($mediaId)
* - The comment cannot consist of all capital letters.
*
* @param int $mediaId The ID of the media object
* @param string $text Text to post as a comment on the media object as specified by `$mediaId`
* @param string $text Text to post as a comment on the media object
*
* @return Response
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

namespace Larabros\Elogram\Entities;
namespace Larabros\Elogram\Repositories;

use Larabros\Elogram\Http\Response;

/**
* LikeRepository class.
* LikesRepository class.
*
* @package Elogram
* @author Hassan Khan <[email protected]>
* @link https://github.com/larabros/elogram
* @license MIT
*/
class LikeRepository extends AbstractEntity
class LikesRepository extends AbstractRepository
{

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

namespace Larabros\Elogram\Entities;
namespace Larabros\Elogram\Repositories;

use Larabros\Elogram\Http\Response;

/**
* Location
* LocationsRepository
*
* @package Elogram
* @author Hassan Khan <[email protected]>
* @link https://github.com/larabros/elogram
* @license MIT
*/
class Location extends AbstractEntity
class LocationsRepository extends AbstractRepository
{

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

namespace Larabros\Elogram\Entities;
namespace Larabros\Elogram\Repositories;

use Larabros\Elogram\Http\Response;

/**
* Media
* MediaRepository
*
* @package Elogram
* @author Hassan Khan <[email protected]>
* @link https://github.com/larabros/elogram
* @license MIT
*/
class Media extends AbstractEntity
class MediaRepository extends AbstractRepository
{
/**
* Get information about a media object.
Expand All @@ -29,7 +29,7 @@ public function get($id)
}

/**
* This method returns the same response as :php:meth:`Media::get`
* This method returns the same response as :php:meth:`MediaRepository::get`
*
* @param string $shortcode The shortcode of the media object
*
Expand Down
6 changes: 3 additions & 3 deletions src/Entities/Tag.php → src/Repositories/TagsRepository.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

namespace Larabros\Elogram\Entities;
namespace Larabros\Elogram\Repositories;

use Larabros\Elogram\Http\Response;

/**
* Tag
* TagsRepository
*
* @package Elogram
* @author Hassan Khan <[email protected]>
* @link https://github.com/larabros/elogram
* @license MIT
*/
class Tag extends AbstractEntity
class TagsRepository extends AbstractRepository
{
/**
* Get information about a tag object.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

namespace Larabros\Elogram\Entities;
namespace Larabros\Elogram\Repositories;

use Larabros\Elogram\Http\Response;

/**
* User
* UsersRepository
*
* @package Elogram
* @author Hassan Khan <[email protected]>
* @link https://github.com/larabros/elogram
* @license MIT
*/
class User extends AbstractEntity
class UsersRepository extends AbstractRepository
{
/**
* Get information about a user.
Expand Down
Loading

0 comments on commit 70826c1

Please sign in to comment.