Skip to content
This repository was archived by the owner on Jul 12, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function isMethodStatic(File $file, LineRange $range)
$lastLine = $range->getEnd();

foreach ($file->getNamespaces() as $namespace) {
foreach ($namespace->geTclasses() as $class) {
foreach ($namespace->getClasses() as $class) {
foreach ($class->getMethods() as $method) {
if ($method->getStartLine() < $lastLine && $lastLine < $method->getEndLine()) {
return $method->isStatic();
Expand All @@ -57,7 +57,7 @@ public function getMethodEndLine(File $file, LineRange $range)
$lastLine = $range->getEnd();

foreach ($file->getNamespaces() as $namespace) {
foreach ($namespace->geTclasses() as $class) {
foreach ($namespace->getClasses() as $class) {
foreach ($class->getMethods() as $method) {
if ($method->getStartLine() < $lastLine && $lastLine < $method->getEndLine()) {
return $method->getEndLine();
Expand All @@ -76,7 +76,7 @@ public function getMethodStartLine(File $file, LineRange $range)
$lastLine = $range->getEnd();

foreach ($file->getNamespaces() as $namespace) {
foreach ($namespace->geTclasses() as $class) {
foreach ($namespace->getClasses() as $class) {
foreach ($class->getMethods() as $method) {
if ($method->getStartLine() < $lastLine && $lastLine < $method->getEndLine()) {
return $method->getStartLine();
Expand Down
4 changes: 2 additions & 2 deletions src/main/QafooLabs/Refactoring/Domain/Model/PhpClassName.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace QafooLabs\Refactoring\Domain\Model;

/**
* Abstraction fo php class names based on a file.
* Abstraction for php class names based on a file.
*/
class PhpClassName
{
Expand All @@ -16,7 +16,7 @@ public function __construct(File $file)

public function getNamespace()
{
$parts = explode("/", $this->file->getRelativePath());
$parts = explode(DIRECTORY_SEPARATOR, ltrim($this->file->getRelativePath(), DIRECTORY_SEPARATOR));
$namespace = array();

foreach ($parts as $part) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ public function testNames()

$this->assertEquals("PhpClassNameTest", $className->getShortname());
$this->assertEquals("QafooLabs\Refactoring\Domain\Model", $className->getNamespace());
$this->assertEquals("QafooLabs\Refactoring\Domain\Model\PhpClassNameTest", $className->getName());
}
}