Skip to content

Commit

Permalink
[ResourceWatcher] Ran CS Fixer against code + fixed some CS issues by…
Browse files Browse the repository at this point in the history
… myself.
  • Loading branch information
Dattaya committed May 27, 2012
1 parent 0132949 commit 0bec395
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 83 deletions.
18 changes: 9 additions & 9 deletions src/Symfony/Component/ResourceWatcher/Event/FilesystemEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class FilesystemEvent extends Event
/**
* Initializes resource event.
*
* @param TrackedResource $tracked resource, that being tracked
* @param ResourceInterface $resource resource instance
* @param integer $type event type bit
* @param TrackedResource $tracked resource, that being tracked
* @param ResourceInterface $resource resource instance
* @param integer $type event type bit
*/
public function __construct(TrackedResource $tracked, ResourceInterface $resource, $type)
{
Expand All @@ -61,7 +61,7 @@ public function __construct(TrackedResource $tracked, ResourceInterface $resourc
/**
* Returns resource, that being tracked while event occured.
*
* @return integer
* @return integer
*/
public function getTrackedResource()
{
Expand All @@ -71,7 +71,7 @@ public function getTrackedResource()
/**
* Returns changed resource.
*
* @return ResourceInterface
* @return ResourceInterface
*/
public function getResource()
{
Expand All @@ -81,7 +81,7 @@ public function getResource()
/**
* Returns true is resource, that fired event is file.
*
* @return Boolean
* @return Boolean
*/
public function isFileChange()
{
Expand All @@ -91,7 +91,7 @@ public function isFileChange()
/**
* Returns true is resource, that fired event is directory.
*
* @return Boolean
* @return Boolean
*/
public function isDirectoryChange()
{
Expand All @@ -101,7 +101,7 @@ public function isDirectoryChange()
/**
* Returns event type.
*
* @return integer
* @return integer
*/
public function getType()
{
Expand All @@ -111,7 +111,7 @@ public function getType()
/**
* Returns event type string representation.
*
* @return string
* @return string
*/
public function getTypeString()
{
Expand Down
36 changes: 18 additions & 18 deletions src/Symfony/Component/ResourceWatcher/ResourceWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class ResourceWatcher
/**
* Initializes path watcher.
*
* @param TrackerInterface $tracker
* @param EventDispatcherInterface $eventDispatcher
* @param TrackerInterface $tracker
* @param EventDispatcherInterface $eventDispatcher
*/
public function __construct(TrackerInterface $tracker = null, EventDispatcherInterface $eventDispatcher = null)
{
Expand All @@ -61,7 +61,7 @@ public function __construct(TrackerInterface $tracker = null, EventDispatcherInt
/**
* Returns current tracker instance.
*
* @return TrackerInterface
* @return TrackerInterface
*/
public function getTracker()
{
Expand All @@ -71,7 +71,7 @@ public function getTracker()
/**
* Returns event dispatcher mapped to this tracker.
*
* @return EventDispatcherInterface
* @return EventDispatcherInterface
*/
public function getEventDispatcher()
{
Expand All @@ -81,11 +81,11 @@ public function getEventDispatcher()
/**
* Track resource with watcher.
*
* @param string $trackingId id to this track (used for events naming)
* @param ResourceInterface|string $resource resource to track
* @param integer $eventsMask event types bitmask
* @param string $trackingId id to this track (used for events naming)
* @param ResourceInterface|string $resource resource to track
* @param integer $eventsMask event types bitmask
*
* @throws InvalidArgumentException If 'all' is used as a tracking id
* @throws InvalidArgumentException If 'all' is used as a tracking id
*/
public function track($trackingId, $resource, $eventsMask = FilesystemEvent::IN_ALL)
{
Expand Down Expand Up @@ -116,10 +116,10 @@ public function track($trackingId, $resource, $eventsMask = FilesystemEvent::IN_
/**
* Adds callback as specific tracking listener.
*
* @param string $trackingId id to this track (used for events naming)
* @param Callable $callback callback to call on change
* @param string $trackingId id to this track (used for events naming)
* @param callable $callback callback to call on change
*
* @throws InvalidArgumentException If $callback argument isn't callable
* @throws InvalidArgumentException If $callback argument isn't callable
*/
public function addListener($trackingId, $callback)
{
Expand All @@ -135,20 +135,20 @@ public function addListener($trackingId, $callback)
/**
* Tracks specific resource change by provided callback.
*
* @param ResourceInterface|string $resource resource to track
* @param callable $callback callback to call on change
* @param integer $eventsMask event types bitmask
* @param ResourceInterface|string $resource resource to track
* @param callable $callback callback to call on change
* @param integer $eventsMask event types bitmask
*/
public function trackByListener($resource, $callback, $eventsMask = FilesystemEvent::IN_ALL)
{
$this->track($trackingId = md5((string)$resource.$eventsMask), $resource, $eventsMask);
$this->track($trackingId = md5((string) $resource.$eventsMask), $resource, $eventsMask);
$this->addListener($trackingId, $callback);
}

/**
* Returns true if watcher is currently watching on tracked resources (started).
*
* @return Boolean
* @return Boolean
*/
public function isWatching()
{
Expand All @@ -158,8 +158,8 @@ public function isWatching()
/**
* Starts watching on tracked resources.
*
* @param integer $checkInterval check interval in microseconds
* @param integer $timeLimit maximum watching time limit in microseconds
* @param integer $checkInterval check interval in microseconds
* @param integer $timeLimit maximum watching time limit in microseconds
*/
public function start($checkInterval = 1000000, $timeLimit = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class FileStateChecker extends ResourceStateChecker
/**
* Initializes checker.
*
* @param FileResource $resource
* @param integer $eventsMask event types bitmask
* @param FileResource $resource
* @param integer $eventsMask event types bitmask
*/
public function __construct(FileResource $resource, $eventsMask = FilesystemEvent::IN_ALL)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public function add(ResourceStateChecker $watched)
/**
* Returns state checker from the bag
*
* @param int $id Watch descriptor
* @param int $id Watch descriptor
*
* @return \SplObjectStorage|array
*/
public function get($id)
Expand All @@ -67,7 +68,8 @@ public function get($id)
/**
* Checks whether at least one state checker with id $id exists.
*
* @param int $id Watch descriptor
* @param int $id Watch descriptor
*
* @return bool
*/
public function has($id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ class DirectoryStateChecker extends ResourceStateChecker
/**
* Initializes checker.
*
* @param CheckerBag $bag
* @param CheckerBag $bag
* @param DirectoryResource $resource
* @param int $eventsMask
* @param int $eventsMask
*/
public function __construct(CheckerBag $bag, DirectoryResource $resource, $eventsMask = FilesystemEvent::IN_ALL)
{
Expand Down Expand Up @@ -162,6 +162,7 @@ public function getChangeset()

$this->dirEvents = $this->fileEvents = $this->movedResources = array();
$this->event = null;

return $changeset;
}

Expand All @@ -170,7 +171,7 @@ public function getChangeset()
* rename('dir', 'dir_new'); rename('dir_new', 'dir'). As a result no events should be returned.
* This function just keeps track of the move events, and they're analyzed in the getChangeset method.
*
* @param int $mask
* @param int $mask
* @param string $name
*/
protected function trackMoveEvent($mask, $name)
Expand Down Expand Up @@ -242,8 +243,9 @@ protected function reindexChildCheckers()
/**
* Normalizes file event
*
* @param int $event
* @param string $name
* @param int $event
* @param string $name
*
* @return null|int
*/
protected function normalizeFileEvent($event, $name)
Expand All @@ -258,6 +260,7 @@ protected function normalizeFileEvent($event, $name)
}
if (!$this->isDeleted($event)) {
$this->createFileResource($name);

return IN_CREATE;
}

Expand All @@ -267,7 +270,8 @@ protected function normalizeFileEvent($event, $name)
/**
* Normalizes event
*
* @param int $event
* @param int $event
*
* @return int
*/
protected function normalizeEvent($event)
Expand All @@ -285,7 +289,7 @@ protected function normalizeEvent($event)
/**
* Creates new DirectoryStateChecker
*
* @param string $name
* @param string $name
* @param null|DirectoryResource $resource
*/
protected function createNewDirectoryChecker($name, DirectoryResource $resource = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class FileStateChecker extends ResourceStateChecker
/**
* Initializes checker.
*
* @param CheckerBag $bag
* @param CheckerBag $bag
* @param FileResource $resource
* @param int $eventsMask
* @param int $eventsMask
*/
public function __construct(CheckerBag $bag, FileResource $resource, $eventsMask = FilesystemEvent::IN_ALL)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class NewDirectoryStateChecker extends DirectoryStateChecker
/**
* Initializes checker.
*
* @param CheckerBag $bag
* @param CheckerBag $bag
* @param DirectoryResource $resource
* @param int $eventsMask
* @param int $eventsMask
*/
public function __construct(CheckerBag $bag, DirectoryResource $resource, $eventsMask = FilesystemEvent::IN_ALL)
{
Expand Down
Loading

0 comments on commit 0bec395

Please sign in to comment.