Questions tagged as 'namespace'

2
answers

Differences between syntaxes of namespaces [closed]

I know two ways to declare a namespace: // Comum namespace Example\Class\Method; class ExampleClass {...} // Outro, similar a sintaxe C# (classe dentro do namespace) namespace Example\Class\Method { class ExampleClass {...} } Is there...
asked by 29.06.2016 / 17:10
1
answer

How to organize namespaces?

I have heard that namespaces should be organized by layer, in this case, using some design pattern to make it possible, such as Projeto.Controller , Projeto.UI , Projeto.Model , however, if we look at the namespaces of own .N...
asked by 16.08.2017 / 22:26
1
answer

Is there any way to configure Laravel 4 to use namespaces?

In Laravel 5 , I noticed that they have now added namespaces in the application folder. But things were not like that in the Laravel 4 version. No Laravel 5 , for example Controllers would look like this: namespace...
asked by 13.04.2016 / 14:12
1
answer

Doctrine2 using composer namespace error

Hello, I'm creating a file that serves as base class in Entities \ BaseTable.php as follows: <?php namespace Entidades; use Doctrine\Common\Collections\ArrayCollection; /** * @MappedSuperclass */ class BaseTable { /** * @Id @Col...
asked by 01.09.2014 / 22:19
1
answer

problem with namespace and PDO [duplicate]

asked by 30.10.2017 / 13:02
5
answers

Using unused affect performance?

While developing, I saw that in most of my classes contained a certain amount of using that were not being used and I came to doubt the title. Using unused affects the performance of the application in any way? Do you always need to re...
asked by 21.05.2014 / 16:53
1
answer

How to get the namespace where the function is called?

Is there any way to do this? <?php namespace Bar { class test { public function test($action) { call_user_func($action); // must call \Foo\Action } } } namespace Foo { $test = new \Bar\Test; fu...
asked by 25.08.2015 / 15:16
1
answer

Is it possible to make a Class accessible in all namespaces?

The question is similar to this Instantiate class outside the namespace and has a good answer link However I would like to do this automatically. For example: Is it possible to make a Class accessible in all namespaces? Without using...
asked by 05.08.2015 / 19:33
0
answers

How to parse XML with namespace and prefix in PHP using SimpleXML?

The data.xml file: <?xml version="1.0" encoding="utf-8" ?> <rsp status="ok"> <ArrayOfContact xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Contact> <...
asked by 07.07.2015 / 23:23
2
answers

Namespaces and Use when to use and what are they for? [duplicate]

What are namespaces and use and when is it recommended to use them in an application?     
asked by 07.09.2016 / 00:04