Total Complexity | 27 |
Total Lines | 174 |
Duplicated Lines | 25.29 % |
Coverage | 0% |
Changes | 0 |
Metric | Value |
---|---|
dl | 44 |
loc | 174 |
rs | 10 |
c | 0 |
b | 0 |
f | 0 |
ccs | 0 |
cts | 133 |
cp | 0 |
wmc | 27 |
lcom | 1 |
cbo | 11 |
Rating | Name | Duplication | Size | Complexity |
---|---|---|---|---|
F | renderHtml() | 44 | 171 | 27 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
2 | class Intraface_modules_debtor_Controller_Send extends k_Component |
||
3 | { |
||
4 | function renderHtml() |
||
5 | { |
||
6 | $module_debtor = $this->context->getKernel()->getModule('debtor'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
7 | |||
8 | $this->context->getKernel()->useModule('contact'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
9 | $this->context->getKernel()->useModule('product'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
10 | $this->context->getKernel()->useModule('filemanager'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
11 | $this->context->getKernel()->useShared('email'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
12 | |||
13 | $translation = $this->translator(); |
||
14 | |||
15 | // find debtoren |
||
16 | $debtor = $this->context->getDebtor(); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getDebtor() does only exist in the following implementations of said interface: Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Show .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
17 | |||
18 | switch ($this->query('send')) { |
||
19 | case 'email': |
||
20 | $contact = $debtor->getContact(); |
||
21 | if (!$contact->address->get('email')) { |
||
22 | throw new Exception('Der er ikke angivet nogen e-mail til kunden'); |
||
23 | } |
||
24 | |||
25 | if ($debtor->contact->get('preferred_invoice') <> 2) { // email |
||
26 | throw new Exception('Kunden foretrækker ikke post på e-mail'); |
||
27 | } |
||
28 | |||
29 | // vi skal lige have oversat den her rigtigt |
||
30 | $subject = $translation->get($debtor->get('type')) . ' #' . $debtor->get('number'); |
||
31 | |||
32 | // hvad skal den skrive her? |
||
33 | if ($debtor->get('type') == 'order') { |
||
34 | $body = $this->context->getKernel()->getSetting()->get('intranet', 'debtor.order.email.text'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
35 | } elseif ($debtor->get('type') == 'invoice') { |
||
36 | $body = $this->context->getKernel()->getSetting()->get('intranet', 'debtor.invoice.email.text'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
37 | } elseif ($debtor->get('type') == 'quotation') { |
||
38 | $body = $this->context->getKernel()->getSetting()->get('intranet', 'debtor.quotation.email.text'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
39 | } else { |
||
40 | $body = ''; |
||
41 | } |
||
42 | break; |
||
43 | |||
44 | case 'electronic_email': |
||
45 | // find ud af hvem der er scan in contact |
||
46 | // måske skal vi lige tjekke om det overhovedet er en faktura |
||
47 | $scan_in_contact_id = $this->context->getKernel()->getSetting()->get('intranet', 'debtor.scan_in_contact'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
48 | |||
49 | $contact = new Contact($this->context->getKernel(), $scan_in_contact_id); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
50 | View Code Duplication | if (!$contact->get('id') > 0) { |
|
51 | throw new Exception('Der er ikke angivet nogen kontakt at sende de elektroniske fakturaer til'); |
||
52 | } elseif (!$contact->address->get('email')) { |
||
53 | throw new Exception('Der er ikke angivet nogen e-mail til Læs-Ind bureauet'); |
||
54 | } |
||
55 | |||
56 | View Code Duplication | if ($debtor->contact->get('preferred_invoice') <> 3) { // elektronisk faktura |
|
57 | throw new Exception('Kunden foretrækker ikke elektronisk faktura!'); |
||
58 | } elseif (!$debtor->contact->address->get('ean')) { |
||
59 | throw new Exception('EAN-nummeret er ikke sat'); |
||
60 | } |
||
61 | |||
62 | $subject = 'Elektronisk faktura'; |
||
63 | $body = 'Hermed faktura #' . $debtor->get('number') . ' til at læse ind'; |
||
64 | |||
65 | break; |
||
66 | } |
||
67 | |||
68 | View Code Duplication | if (($debtor->get("type") == "order" || $debtor->get("type") == "invoice") && $this->context->getKernel()->intranet->hasModuleAccess('onlinepayment')) { |
|
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
69 | $this->context->getKernel()->useModule('onlinepayment'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
70 | $onlinepayment = OnlinePayment::factory($this->context->getKernel()); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
71 | } else { |
||
72 | $onlinepayment = null; |
||
73 | } |
||
74 | |||
75 | if ($this->context->getKernel()->intranet->get("pdf_header_file_id") != 0) { |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
76 | $file = new FileHandler($this->context->getKernel(), $this->context->getKernel()->intranet->get("pdf_header_file_id")); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
77 | } else { |
||
78 | $file = null; |
||
79 | } |
||
80 | |||
81 | // gem debtoren som en fil i filsystemet |
||
82 | $filehandler = new FileHandler($this->context->getKernel()); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
83 | $tmp_file = $filehandler->createTemporaryFile($translation->get($debtor->get("type")).$debtor->get('number').'.pdf'); |
||
84 | |||
85 | // Her gemmes filen |
||
86 | $report = new Intraface_modules_debtor_Visitor_Pdf($translation, $file); |
||
87 | $report->visit($debtor, $onlinepayment); |
||
88 | $report->output('file', $tmp_file->getFilePath()); |
||
89 | |||
90 | // gem filen med filehandleren |
||
91 | $filehandler = new FileHandler($this->context->getKernel()); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
92 | View Code Duplication | if (!$file_id = $filehandler->save($tmp_file->getFilePath(), $tmp_file->getFileName(), 'hidden', 'application/pdf')) { |
|
93 | echo $filehandler->error->view(); |
||
94 | throw new Exception('Filen kunne ikke gemmes'); |
||
95 | } |
||
96 | |||
97 | $input['accessibility'] = 'intranet'; |
||
0 ignored issues
–
show
$input was never initialized. Although not strictly required by PHP, it is generally a good practice to add $input = array(); before regardless.
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code. Let’s take a look at an example: foreach ($collection as $item) {
$myArray['foo'] = $item->getFoo();
if ($item->hasBar()) {
$myArray['bar'] = $item->getBar();
}
// do something with $myArray
}
As you can see in this example, the array This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop. ![]() |
|||
98 | if (!$file_id = $filehandler->update($input)) { |
||
99 | echo $filehandler->error->view(); |
||
100 | throw new Exception('Oplysninger om filen kunne ikke opdateres'); |
||
101 | } |
||
102 | |||
103 | switch ($this->context->getKernel()->getSetting()->get('intranet', 'debtor.sender')) { |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
104 | case 'intranet': |
||
105 | $from_email = ''; |
||
106 | $from_name = ''; |
||
107 | break; |
||
108 | View Code Duplication | case 'user': |
|
109 | $from_email = $this->context->getKernel()->user->getAddress()->get('email'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
110 | $from_name = $this->context->getKernel()->user->getAddress()->get('name'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
111 | break; |
||
112 | View Code Duplication | case 'defined': |
|
113 | $from_email = $this->context->getKernel()->getSetting()->get('intranet', 'debtor.sender.email'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
114 | $from_name = $this->context->getKernel()->getSetting()->get('intranet', 'debtor.sender.name'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
115 | break; |
||
116 | default: |
||
117 | throw new Exception("Invalid sender!"); |
||
118 | exit; |
||
0 ignored issues
–
show
die; does not seem to be reachable.
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed. Unreachable code is most often the result of function fx() {
try {
doSomething();
return true;
}
catch (\Exception $e) {
return false;
}
return false;
}
In the above example, the last ![]() The method
renderHtml() contains an exit expression.
An exit expression should only be used in rare cases. For example, if you write a short command line script. In most cases however, using an ![]() |
|||
119 | } |
||
120 | |||
121 | $signature = new Intraface_shared_email_Signature($this->context->getKernel()->user, $this->context->getKernel()->intranet, $this->context->getKernel()->getSetting()); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
122 | |||
123 | // opret e-mailen |
||
124 | $email = new Email($this->context->getKernel()); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
125 | View Code Duplication | if (!$email->save(array( |
|
0 ignored issues
–
show
array('contact_id' => $c... => $debtor->get('id')) is of type array<string,?,{"contact...eger","belong_to":"?"}> , but the function expects a object<Struct> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
126 | 'contact_id' => $contact->get('id'), |
||
0 ignored issues
–
show
The variable
$contact does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
![]() |
|||
127 | 'subject' => $subject, |
||
0 ignored issues
–
show
The variable
$subject does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
![]() |
|||
128 | 'body' => $body . "\n\n" . $signature->getAsText(), |
||
0 ignored issues
–
show
The variable
$body does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
![]() |
|||
129 | 'from_email' => $from_email, |
||
130 | 'from_name' => $from_name, |
||
131 | 'type_id' => 10, // electronic invoice |
||
132 | 'belong_to' => $debtor->get('id') |
||
133 | ))) { |
||
134 | echo $email->error->view(); |
||
135 | throw new Exception('E-mailen kunne ikke gemmes'); |
||
136 | } |
||
137 | |||
138 | // tilknyt fil |
||
139 | View Code Duplication | if (!$email->attachFile($file_id, $filehandler->get('file_name'))) { |
|
140 | echo $email->error->view(); |
||
141 | throw new Exception('Filen kunne ikke vedhæftes'); |
||
142 | } |
||
143 | |||
144 | switch ($this->query('send')) { |
||
145 | case 'email': |
||
146 | $redirect = Intraface_Redirect::factory($this->context->getKernel(), 'go'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
147 | $shared_email = $this->context->getKernel()->useModule('email'); |
||
0 ignored issues
–
show
It seems like you code against a concrete implementation and not the interface
k_Context as the method getKernel() does only exist in the following implementations of said interface: Intraface_Controller_Index , Intraface_Controller_ModuleGatekeeper , Intraface_Controller_ModulePackage_Process , Intraface_Controller_Restricted , Intraface_Controller_SwitchIntranet , Intraface_Filehandler_Controller_Batchedit , Intraface_Filehandler_Controller_CKEditor , Intraface_Filehandler_Controller_Crop , Intraface_Filehandler_Controller_Index , Intraface_Filehandler_Controller_SelectFile , Intraface_Filehandler_Controller_Show , Intraface_Filehandler_Controller_Size , Intraface_Filehandler_Controller_Sizes , Intraface_Filehandler_Controller_Upload , Intraface_Filehandler_Controller_UploadMultiple , Intraface_Filehandler_Controller_UploadScript , Intraface_Fileimport_Controller_Index , Intraface_Keyword_Controller_Connect , Intraface_Keyword_Controller_Index , Intraface_Keyword_Controller_Show , Intraface_modules_accoun...ontroller_Account_Index , Intraface_modules_accoun...ontroller_Account_Popup , Intraface_modules_accoun...Controller_Account_Show , Intraface_modules_accounting_Controller_Daybook , Intraface_modules_accounting_Controller_Index , Intraface_modules_accounting_Controller_Post_Index , Intraface_modules_accounting_Controller_Post_Show , Intraface_modules_accounting_Controller_Search , Intraface_modules_accounting_Controller_Settings , Intraface_modules_accounting_Controller_State , Intraface_modules_accoun...roller_State_Creditnote , Intraface_modules_accoun...ller_State_Depreciation , Intraface_modules_accoun...ontroller_State_Invoice , Intraface_modules_accoun...ontroller_State_Payment , Intraface_modules_accoun...oller_State_Procurement , Intraface_modules_accoun...ntroller_State_Reminder , Intraface_modules_accoun...roller_State_SelectYear , Intraface_modules_accounting_Controller_Vat_Index , Intraface_modules_accounting_Controller_Vat_Show , Intraface_modules_accoun...ontroller_Voucher_Index , Intraface_modules_accoun...Controller_Voucher_Show , Intraface_modules_accounting_Controller_Year_Edit , Intraface_modules_accounting_Controller_Year_End , Intraface_modules_accounting_Controller_Year_Index , Intraface_modules_accoun...troller_Year_Primosaldo , Intraface_modules_accounting_Controller_Year_Show , Intraface_modules_administration_Controller_Index , Intraface_modules_admini...ion_Controller_Intranet , Intraface_modules_cms_Controller_Element , Intraface_modules_cms_Controller_Elements , Intraface_modules_cms_Controller_Index , Intraface_modules_cms_Controller_Navigation , Intraface_modules_cms_Controller_Page , Intraface_modules_cms_Controller_Pages , Intraface_modules_cms_Controller_Section , Intraface_modules_cms_Controller_Sections , Intraface_modules_cms_Controller_Site , Intraface_modules_cms_Controller_Stylesheet , Intraface_modules_cms_Controller_Template , Intraface_modules_cms_Co...ler_TemplateSectionEdit , Intraface_modules_cms_Controller_TemplateSections , Intraface_modules_cms_Controller_Templates , Intraface_modules_contac...troller_BatchNewsletter , Intraface_modules_contact_Controller_Choosecontact , Intraface_modules_contac...ntroller_Contactpersons , Intraface_modules_contact_Controller_Import , Intraface_modules_contact_Controller_Index , Intraface_modules_contact_Controller_Memos , Intraface_modules_contact_Controller_Merge , Intraface_modules_contact_Controller_Sendemail , Intraface_modules_contact_Controller_Show , Intraface_modules_contro...ntroller_ChangePassword , Intraface_modules_controlpanel_Controller_Index , Intraface_modules_controlpanel_Controller_User , Intraface_modules_contro...troller_UserPreferences , Intraface_modules_curren...ller_ExchangeRate_Index , Intraface_modules_curren...changeRate_ProductPrice , Intraface_modules_currency_Controller_Index , Intraface_modules_currency_Controller_Show , Intraface_modules_debtor_Controller_Collection , Intraface_modules_debtor_Controller_Create , Intraface_modules_debtor_Controller_Depreciation , Intraface_modules_debtor_Controller_Depreciations , Intraface_modules_debtor_Controller_Index , Intraface_modules_debtor_Controller_Item , Intraface_modules_debtor_Controller_Items , Intraface_modules_debtor_Controller_Payment , Intraface_modules_debtor_Controller_Payments , Intraface_modules_debtor_Controller_Reminder , Intraface_modules_debtor_Controller_Reminders , Intraface_modules_debtor_Controller_Settings , Intraface_modules_debtor_Controller_Show , Intraface_modules_debtor_Controller_Typenegotiator , Intraface_modules_email_Controller_Email , Intraface_modules_email_Controller_Index , Intraface_modules_fileimport_Controller_Index , Intraface_modules_filemanager_Controller_Index , Intraface_modules_intran...enance_Controller_Index , Intraface_modules_intran...ntroller_Intranet_Index , Intraface_modules_intran...Controller_Intranet_Key , Intraface_modules_intran...ler_Intranet_Permission , Intraface_modules_intran...ontroller_Intranet_Show , Intraface_modules_intran...ance_Controller_Modules , Intraface_modules_intran...e_Controller_User_Index , Intraface_modules_intran...troller_User_Permission , Intraface_modules_intran...ce_Controller_User_Show , Intraface_modules_module...e_Controller_AddPackage , Intraface_modules_modulepackage_Controller_Index , Intraface_modules_modulepackage_Controller_Package , Intraface_modules_modulepackage_Controller_Payment , Intraface_modules_module...age_Controller_PostForm , Intraface_modules_modulepackage_Controller_Process , Intraface_modules_newsletter_Controller_Index , Intraface_modules_newsletter_Controller_Letter , Intraface_modules_newsletter_Controller_Letters , Intraface_modules_newsletter_Controller_List , Intraface_modules_newsletter_Controller_Lists , Intraface_modules_newsletter_Controller_Log , Intraface_modules_newsletter_Controller_Send , Intraface_modules_newsle..._Controller_Subscribers , Intraface_modules_onlinepayment_Controller_Index , Intraface_modules_online...ent_Controller_Settings , Intraface_modules_payment_Controller_Index , Intraface_modules_payment_Controller_Show , Intraface_modules_procurement_Controller_Index , Intraface_modules_procurement_Controller_Item , Intraface_modules_procurement_Controller_Items , Intraface_modules_procur...ontroller_PurchasePrice , Intraface_modules_procurement_Controller_Show , Intraface_modules_produc...troller_AttributeGroups , Intraface_modules_produc...tributeGroups_Attribute , Intraface_modules_produc...er_AttributeGroups_Show , Intraface_modules_product_Controller_BatchEdit , Intraface_modules_produc...oller_BatchPriceChanger , Intraface_modules_product_Controller_Index , Intraface_modules_produc...r_Productattributegroup , Intraface_modules_product_Controller_Related , Intraface_modules_product_Controller_Selectproduct , Intraface_modules_produc..._Selectproductvariation , Intraface_modules_product_Controller_Show , Intraface_modules_produc...ntroller_Show_PlainText , Intraface_modules_produc...troller_Show_Variations , Intraface_modules_produc...s_SelectAttributeGroups , Intraface_modules_product_Controller_Variation , Intraface_modules_shop_C...r_BasketEvaluation_Edit , Intraface_modules_shop_C..._BasketEvaluation_Index , Intraface_modules_shop_C...r_BasketEvaluation_Show , Intraface_modules_shop_Controller_Categories , Intraface_modules_shop_C...oller_Categories_Create , Intraface_modules_shop_Controller_Categories_Show , Intraface_modules_shop_C...oller_DiscountCampaigns , Intraface_modules_shop_Controller_FeaturedProducts , Intraface_modules_shop_Controller_Index , Intraface_modules_shop_Controller_Show , Intraface_modules_stock_Controller_Index , Intraface_modules_stock_Controller_Product , Intraface_modules_stock_Controller_Variations , Intraface_modules_todo_Controller_Edit , Intraface_modules_todo_Controller_Index , Intraface_modules_todo_Controller_Todo .
Let’s take a look at an example: interface User
{
/** @return string */
public function getPassword();
}
class MyUser implements User
{
public function getPassword()
{
// return something
}
public function getDisplayName()
{
// return some name.
}
}
class AuthSystem
{
public function authenticate(User $user)
{
$this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
// do something.
}
}
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break. Available Fixes
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
![]() |
|||
148 | |||
149 | // First vi set the last, because we need this id to the first. |
||
150 | $url = $redirect->setDestination($shared_email->getPath().$email->get('id') . '?edit', NET_SCHEME . NET_HOST . $this->url('../')); |
||
151 | $redirect->setIdentifier('send_email'); |
||
152 | $redirect->askParameter('send_email_status'); |
||
153 | |||
154 | return new k_SeeOther($url); |
||
155 | break; |
||
0 ignored issues
–
show
break is not strictly necessary here and could be removed.
The break statement is not necessary if it is preceded for example by a return statement: switch ($x) {
case 1:
return 'foo';
break; // This break is not necessary and can be left off.
}
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive. ![]() |
|||
156 | case 'electronic_email': |
||
157 | // Sender e-mailen |
||
158 | if ($email->queue()) { |
||
159 | if ($debtor->get('status') == 'created') { |
||
160 | $debtor->setStatus('sent'); |
||
161 | } |
||
162 | return new k_SeeOther($this->url('../')); |
||
163 | } else { |
||
164 | echo $email->error->view(); |
||
165 | throw new Exception('E-mailen kunne ikke sendes'); |
||
166 | } |
||
167 | |||
168 | break; |
||
0 ignored issues
–
show
break; does not seem to be reachable.
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed. Unreachable code is most often the result of function fx() {
try {
doSomething();
return true;
}
catch (\Exception $e) {
return false;
}
return false;
}
In the above example, the last ![]() |
|||
169 | default: |
||
170 | throw new Exception('not valid send as'); |
||
171 | break; |
||
0 ignored issues
–
show
break; does not seem to be reachable.
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed. Unreachable code is most often the result of function fx() {
try {
doSomething();
return true;
}
catch (\Exception $e) {
return false;
}
return false;
}
In the above example, the last ![]() |
|||
172 | } |
||
173 | throw new Exception('Something went wrong'); |
||
174 | } |
||
175 | } |
||
176 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.