Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constants defined in kohana/index.php (application) #568

Closed
WinterSilence opened this issue Nov 17, 2014 · 18 comments
Closed

Constants defined in kohana/index.php (application) #568

WinterSilence opened this issue Nov 17, 2014 · 18 comments

Comments

@WinterSilence
Copy link

  1. SYSPATH, APPPATH, MODPATH (EXT, KOHANA_START_TIME, KOHANA_START_MEMORY) not defined in system library. They should not be used directly in the classes (only as arguments), permissible use only in config\view\init files.
  2. Does not make sense to use protection defined('SYSPATH') OR die('No direct script access.'); in class, i18n, message files.
    Why not use Kohana::VERSION instead SYSPATH?
<?php defined('Kohana::VERSION') OR die('No direct script access.');
@WinterSilence WinterSilence changed the title Changing the use of constants with paths Changing for constants of paths Nov 17, 2014
@WinterSilence WinterSilence changed the title Changing for constants of paths Constants defined in kohana/index.php (application) Nov 17, 2014
@kemo
Copy link
Member

kemo commented Nov 17, 2014

  1. I agree these should be injected into the Filesystem object (if we ever get to having one)
  2. Neither is going to be used for 'security' anymore

@WinterSilence
Copy link
Author

@kemo

  1. Filesystem or Kohana_Core (easy way) or Autoload (classes) object + contained EXT (best way).
  2. Planned to complete remove 'security'?

@enov
Copy link
Contributor

enov commented Nov 18, 2014

  1. There is a feature branch @zombor has started regarding a Filesystem class.
  2. Direct access check for security was proposed & accepted in Remove Direct Access Checks #508 and was implemented in Remove direct access checks #529.

@WinterSilence
Copy link
Author

@enov

  1. are you seriously? ugly solution - just few first strings:
protected $_include_paths = array();

public function __construct(array $paths)
{
    $this->_paths = $paths;
}

Class must be static (to be available everywhere) and may include the methods for autoloading classes, constant with file extension.

  1. great! have not seen it before (( @lenton 👍

@kemo
Copy link
Member

kemo commented Nov 18, 2014

We're trying to move away from static classes. What you see there is just a mock @zombor did, it's not the final solution. Having it as an object provides infinite benefits over having it static and IMHO should stay that way.

Passing / injecting the Filesystem object should be something the developer takes care of.

@enov
Copy link
Contributor

enov commented Nov 18, 2014

@kemo 👍

@WinterSilence you should follow the fashion 💅 ... static is a bad word nowadays 😄

@enov
Copy link
Contributor

enov commented Nov 18, 2014

a huge milestone...

@WinterSilence
Copy link
Author

@kemo

We're trying to move away static classes.

What are the advantages of such an option?

For example, I want to display in the template(view) list of paths, how to get this object?

@WinterSilence
Copy link
Author

@cyrgit

Most of the time, if you're using static methods or variables then there is almost certainly a better way.
That said, there are a few instances where static methods and variables are useful.
However, all of these are accessed solely by methods in the class that also contains the statics, and do not have dependencies on anything outside them.

@WinterSilence
Copy link
Author

@cyrgit You're right, I made a mistake in translation. But then I do not understand how you plan to dynamically use the helpers (Arr, HTML, etc) - I do not see in the project implementation of pattern "service locator" or something similar.

For example, I want to display in the template(view) list of paths, how to get this object? Describe at least schematically.

@kemo
Copy link
Member

kemo commented Nov 18, 2014

@WinterSilence think of it as static == global == procedural == something is wrong

If there is no way to get the object to another object that needs it, something else is wrong - in that case you'd probably be doing it via a DI container / service manager.

Filesystem (object) -> App\Kohana\Whatever (object) -> wherever else you need it. And you'll be able to have multiple "filesystems", it doesn't have to always be the "main one" current app is relying on

@kemo
Copy link
Member

kemo commented Nov 18, 2014

And yes, those 'helpers' are in essence procedural function containers (which is ok as long as they have no external dependencies - which they usually don't).

@WinterSilence
Copy link
Author

@kemo

If there is no way to get the object to another object that needs it, something else is wrong - in that case you'd probably be doing it via a DI container / service manager.

Then at the beginning to create an environment in which your solution can work, and after that start to create them. If the new environment is absent, then need use the old environment and delay global changes until the next release.

And yes, those 'helpers' are in essence procedural function containers (which is ok as long as they have no external dependencies - which they usually don't).

Filesystem have external dependencies?

@WinterSilence
Copy link
Author

@WinterSilence
Copy link
Author

@cyrgit Why you think that I don't know DI?)) I'm trying to say: each project has its own "face" (style).
Abstraction is nice, but there is Zend and as a result of these changes get his clone. I think that this project should strive for an optimal solution, not the ideal solution.

@WinterSilence
Copy link
Author

@cyrgit

It appeared that way from your comments insisting on a static Filesystem class

If your opponent has a different point of view, it does not mean that he is not familiar with your.

questioning how could a view ever be built without a static factory.

Answer this question, by the way, I did not see. I did not say anything about the factory.
By the way the factory should be a separate class, not static crutch as in your.

P.s. Builder must use the "lazy" loading and cascade system, once you make a module for Kohana.

@WinterSilence
Copy link
Author

@cyrgit

This in reference to your request on how a view object should be created, which is currently done by a static factory in the code. It's a bit hard to understand your English sometimes so perhaps that is not what you were asking?

Write abstract http application that execute a Request, launched Controller, returned View displayed paths of Filesystem.

What I'm building deprecates the use of modules all together and relies on Composer, so there is no need for that with proper namespaces and PSR4 autoloading.

Also cascading filesystem used in config.

@lenton
Copy link
Contributor

lenton commented Feb 2, 2015

Closing this since point 1 already exists as an issue and point 2 has already been addressed by removal.

@lenton lenton closed this as completed Feb 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants