PhpStorm and expanded php method definitions on same project - php

Using code navigation, PHPStorm can not show me quick function definitions; can it be configured to show me more detailed examples of the function's use? I have used ALT + F7 but its not helping.

as from this question
You can place the cursor (text-cursor, not mouse-cursor) on any PHP function and press Shift + F1 (Menu: View -> External Documentation).
That will open the detailed description incl. examples and user-comments (read: the PHP manual).

Related

What is the "Use Trait Body" setting for?

Recently I've started using PHP (worked for MS shops since graduating, and that was mostly what I used in college too). To help with this, I'm using Netbeans and am in the process of configuring it so that it's more similar to Visual Studio.
Under Options -> Editor -> Formatting, I've found this setting highlighted in the red box:
Any setting I pick for that value makes no difference in the sample file on the right. I copied the text from when I use the "Same Line" value and did a diff on it against the text when using "New Line" and they're identical.
So, what is this setting?
In the example to the right of the options, I thought this would impact the (new Example())->alignParamsExample(... and push anything after the -> onto a New Line, but that's not the case.
I've also read the documentation about traits but I'm still unclear exactly as to what the "trait body" would be. I typed out the code they provided in "Example #2 Precedence Order Example" but noticed no behavioral difference in the IDE.
I've tagged this question with both Netbeans and php tags; if I select other languages this option isn't present (but I only have HTML, JSON, Javascript, and PHP to chose from) so I wasn't sure if this is a "PHP thing" or a "Netbeans thing." If it's explicitly one or the other, let me know and I'll remove the tag.
I think this is about that block in class:
class ExampleClass
{
/** Start of Use Trait Body **/
use TraitOne;
use TraitTwo;
use TraitThree;
/** End of Use Trait Body **/
}

Check if Google Map Point is in polygon from PHP

I've been looking for a way to check if a point is part of a polygon; this polygon is loaded from a file.
All the answers related to this question are solved with javascript, but I require to do this on server-side; this because the result does not need to be shown to the user as a webclient, it needs to be stored and later be used as a parameter to select a group of users (that use the system) inside that area (polygon).
I looked for a Google Maps API for PHP but it looks like it does not exists at all. I found this one, but it is not related to Google and also focuses on the front end.
I also looked for a REST API; it would have been relatively easy to load the content to my php and parse it, but looks like Google put all its efforts on the JS API.
Is there any workaround for this?
Edit 1: As #Spacedman requested, the file format is a KML
Clarification 1: I expected that Google provide a tool for this (as it exists with JS); parsing the file to check via an algorithm is a posibility and I'll have to check if it works properly.
Did you try searching for "php point in polygon" in your favourite search engine? Top hit:
http://assemblysys.com/php-point-in-polygon-algorithm/
It uses a scanline algorithm, and there's some examples. All you need to do is read your polygon file into the right format (you neglected to say what format you have) and call the function.
You can try somthing like this (in php should be similar):
int iCheck=0;
for (i = 0, v = HowManyVecotrsHasThePolygon - 1; i < HowManyVecotrsHasThePolygon; v = i++)
{
if (((vectorPointLatitud[i] > ptoLatitud) != (vectorPointLatitud[v] > ptoLatitud)) && (ptoLongitud < (vectorPointLongitud[v] - vectorPointLongitud[i]) * (ptoLatitud - vectorPointLatitud[i]) / (vectorPointLatitud[v] - vectorPointLatitud[i]) + vectorPointLongitud[i]))
iCheck++;
}
if iCheck is pair the point is outside, even inside
Checkout Polygons Eric Haines. I got the idea from him.
The idea is you've to create a Ray from your point, and check how many intersections between this ray and the Polygons vectors
The algorithm is just a bit of algebra, that you can check in any book.
You could use the PHP V8 PECL extension to execute javascript within PHP. Alternatively, you could call a node.js script using a shell command (which essentially does the same thing).
http://php.net/manual/en/book.v8js.php
http://php.net/manual/en/function.shell-exec.php

PhpStorm and expanded php definitions

Using code hinting, PHPStorm can show me quick function definitions; can it be configured to show me more detailed examples of the function's use?
You can place the cursor (text-cursor, not mouse-cursor) on any PHP function and press Shift + F1 (Menu: View -> External Documentation).
That will open the detailed description incl. examples and user-comments (read: the PHP manual).
With an OSX specific keyboard, you may need to trigger the F1 key by pressing fn + F1. So here are two use cases that work for me:
Open php.net documentation: fn + shift + F1
Quick view php.net documentation: fn + F1
You may also find it useful that you can enable Quick documentation on hover. Open up File > Preferences, navigate to the Editor section, and at the bottom check the box for Show quick doc on mouse move.

PHP function descriptions as I type in Notepad++

Is there a plugin for Notepad++ which would allow me to see functions including parameters/returns as I type?
For example, if i type "implode(", I'd see:
string implode ( string $glue , array $pieces )
Update: Wow, I'm surprised so many other people were as interested in this as me. The take-home lesson for me was to always explore all the Settings options!
You don't need a plugin! 5.0 and above have this already.
Go to Settings -> Preferences, then go to the Backup/Auto-Completion tab, and you'll find it at the bottom! Check the box for function parameters hint as well.
You'll get exactly what you've asked for, as long as it knows the file is PHP.
maybe, plugin Auto completion for custom PHP classes (ACCPC) is what you're mean.
basic info:
Show an overview over your classes' attributes & methods in a nice popup!
A popup window appears after typing the "->" or "::" behind a class or an instantiated object variable which displays all attributes and methods of it's class.
more information:
http://sourceforge.net/projects/accpc/
maybe this answer can helpful too:
Get parameter hints from Editing the API XML file
https://stackoverflow.com/a/12609240/2427906
You can read about it in Notepad++'s documentation site found here
http://npp-community.tuxfamily.org/
The auto complete section can be found here
http://npp-community.tuxfamily.org/documentation/notepad-user-manual//editing/auto-completion

any open source IDE with the possibility to go the declaration of a function, a variable..?

any open source IDE with the possibility to go the declaration of a function, a variable, a class... presing a key(s)??
Apart from Netbeans and Eclipse.
Regards
Javi
Take a look at ctags, and e.g. vim. In reality, "ctags" is a gross understatement, as you can generate an index of function and variable "tags" for almost any language.
emacs or vim would allow you to do this for most languages. Not really an IDE though.
I prefer to use PHPDesigner which does have a free edition. What you appear to be asking about is called "code completition" which this editor does, along with the ability to right click a custom function and "Go to definition" or hit F1 to view the PHP Manual on that function.
May be Komodo edit ? It's close to Eclipse and Netbeans, but much more simpler. You can go to declaration of function or variable by a custom shortcut key or just CTRL + Click on the desired var/func.

Categories