Jump to content

PHP comments - make function block documentation private to file


phpJoeMo

Recommended Posts

Hi all,  I have a function that is only used in the file it is declared in :

 

/index.php

/**
* This function is used to display form messages.
* 
* @param string $msg This explains login and session status .
* 
* @access private
* 
* @return string
*/
function pred($msg)
{
    return 
        "<p class='content' style='color:red;'>
             $msg</p>";
}

 

I'm using netbeans 7.0 (which by the way rocks !!!!! 8);):shy::D:-*;D::)), and I don't want to be able to see the documentation in other files when I start typing something similar.

 

I read at pear.net coding standards that the '@param private' can be used on class methods.  Is there a way to make the documentation private to the file that the function is declared in?

 

I'm simply trying not to flood other files in the project with needless function suggestions.

 

Thanks in advance.

Link to comment
Share on other sites

the "@access private" is for the documentation only,

however you can't make the global function private, your need to put it into a class first,

 

if your having problems where you including that function too may times and are getting an error then you could do this

if (!function_exists('pred')) {
  function pred($msg) {
    return "<p class='content' style='color:red;'>
             $msg</p>";
  }
}

 

 

Link to comment
Share on other sites

The issue isn't with re-declaration.  I have a main file that includes the page content.  Inside the individual page is where I declare this page - specific function.  I simply don't want to see fund pred every time I start to type a function in my project IE preg_match.

 

Maybe I'm just being picky, but check out the following tips I've uncovered on my quest to learn how to do this:

 

ctrl + hover on any constant, class, method, function to see documentation click on it and you will be directed to the line of declaration, definition, or instantiation.

 

ctrl + p on parameters to see full list for that function.

 

:D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.