Skip to main content
Code Review

Return to Answer

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

This is not OOP.

Observe how your class contains only static functions. There are no class properties. This can be written equivalently:

namespace Router;
function getPath($uri = null){
 // Same implementation (I have just cut it out for readability).
}
function getQuery($uri = null){
 // Same implementation.
}
function follow($uri = null){
 // Same implementation.
}

Usage from anywhere can be compared (First your code):

Router::getPath($uri);
Router::getQuery($uri);
Router::follow($uri);

Then the equivalent:

Router\getPath($uri);
Router\getQuery($uri);
Router\follow($uri);

Note how no object is required to be used (that is a good hint that its not OO).

The following question would be worth reading:

User class design User class design

I have an answer to that question which covers in more detail some of the problems with using static in OOP.

This is not OOP.

Observe how your class contains only static functions. There are no class properties. This can be written equivalently:

namespace Router;
function getPath($uri = null){
 // Same implementation (I have just cut it out for readability).
}
function getQuery($uri = null){
 // Same implementation.
}
function follow($uri = null){
 // Same implementation.
}

Usage from anywhere can be compared (First your code):

Router::getPath($uri);
Router::getQuery($uri);
Router::follow($uri);

Then the equivalent:

Router\getPath($uri);
Router\getQuery($uri);
Router\follow($uri);

Note how no object is required to be used (that is a good hint that its not OO).

The following question would be worth reading:

User class design

I have an answer to that question which covers in more detail some of the problems with using static in OOP.

This is not OOP.

Observe how your class contains only static functions. There are no class properties. This can be written equivalently:

namespace Router;
function getPath($uri = null){
 // Same implementation (I have just cut it out for readability).
}
function getQuery($uri = null){
 // Same implementation.
}
function follow($uri = null){
 // Same implementation.
}

Usage from anywhere can be compared (First your code):

Router::getPath($uri);
Router::getQuery($uri);
Router::follow($uri);

Then the equivalent:

Router\getPath($uri);
Router\getQuery($uri);
Router\follow($uri);

Note how no object is required to be used (that is a good hint that its not OO).

The following question would be worth reading:

User class design

I have an answer to that question which covers in more detail some of the problems with using static in OOP.

Source Link
Paul
  • 4k
  • 2
  • 22
  • 38

This is not OOP.

Observe how your class contains only static functions. There are no class properties. This can be written equivalently:

namespace Router;
function getPath($uri = null){
 // Same implementation (I have just cut it out for readability).
}
function getQuery($uri = null){
 // Same implementation.
}
function follow($uri = null){
 // Same implementation.
}

Usage from anywhere can be compared (First your code):

Router::getPath($uri);
Router::getQuery($uri);
Router::follow($uri);

Then the equivalent:

Router\getPath($uri);
Router\getQuery($uri);
Router\follow($uri);

Note how no object is required to be used (that is a good hint that its not OO).

The following question would be worth reading:

User class design

I have an answer to that question which covers in more detail some of the problems with using static in OOP.

lang-php

AltStyle によって変換されたページ (->オリジナル) /