composer.phar 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <naderman@naderman.de>
  7. * Jordi Boggiano <j.boggiano@seld.be>
  8. *
  9. * For the full copyright and license information, please view
  10. * the license that is located at the bottom of this file.
  11. */
  12. // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
  13. if (extension_loaded('apc') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN)) {
  14. if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
  15. ini_set('apc.cache_by_default', 0);
  16. } else {
  17. fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
  18. fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
  19. }
  20. }
  21. Phar::mapPhar('composer.phar');
  22. require 'phar://composer.phar/bin/composer';
  23. __HALT_COMPILER(); ?>
  24. 4•��ö������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.phpµe��h¾¬\µe��ª}¶������+���src/Composer/Autoload/ClassMapGenerator.php–��h¾¬\–��¤>Pz¶���������src/Composer/Cache.php’��h¾¬\’��­bš0¶������%���src/Composer/Command/AboutCommand.phpÍ��h¾¬\Í��ÿÌŒ4¶������'���src/Composer/Command/ArchiveCommand.phpž��h¾¬\ž��lG¶������$���src/Composer/Command/BaseCommand.phpÜ ��h¾¬\Ü ��gô1¶������.���src/Composer/Command/BaseDependencyCommand.phpñ��h¾¬\ñ��XgFð¶������1���src/Composer/Command/CheckPlatformReqsCommand.phpë ��h¾¬\ë ��kâ¶������*���src/Composer/Command/ClearCacheCommand.phpª��h¾¬\ª��Ȩ J¶������&���src/Composer/Command/ConfigCommand.php/J��h¾¬\/J��r>¶������-���src/Composer/Command/CreateProjectCommand.phpg5��h¾¬\g5��æÊ�†¶������'���src/Composer/Command/DependsCommand.phpø��h¾¬\ø��ªeá¶������(���src/Composer/Command/DiagnoseCommand.phpåM��h¾¬\åM��hÇÔ¶������,���src/Composer/Command/DumpAutoloadCommand.phpA ��h¾¬\A ��Ò)šN¶������$���src/Composer/Command/ExecCommand.phpï��h¾¬\ï��Xrœ¾¶������&���src/Composer/Command/GlobalCommand.phpz ��h¾¬\z ��³çå?¶������$���src/Composer/Command/HomeCommand.php��h¾¬\��qLB޶������$���src/Composer/Command/InitCommand.php%P��h¾¬\%P��‘ç*[¶������'���src/Composer/Command/InstallCommand.phpT��h¾¬\T��Þùõ›¶������(���src/Composer/Command/LicensesCommand.phpw��h¾¬\w��š˜V¶������(���src/Composer/Command/OutdatedCommand.php ��h¾¬\ ��Uý@]¶������)���src/Composer/Command/ProhibitsCommand.php��h¾¬\��_¤éS¶������&���src/Composer/Command/RemoveCommand.phpá��h¾¬\á��½í�)¶������'���src/Composer/Command/RequireCommand.phpÌ$��h¾¬\Ì$��Ø
  25.  ¶������)���src/Composer/Command/RunScriptCommand.php"��h¾¬\"��‰$ŒÔ¶������+���src/Composer/Command/ScriptAliasCommand.php¯��h¾¬\¯��?=Ѷ������&���src/Composer/Command/SearchCommand.phpJ ��h¾¬\J ��lºo¶������*���src/Composer/Command/SelfUpdateCommand.php03��h¾¬\03��j.­ ¶������$���src/Composer/Command/ShowCommand.phphq��h¾¬\hq��+a_¶������&���src/Composer/Command/StatusCommand.php–��h¾¬\–��ùjض������(���src/Composer/Command/SuggestsCommand.phpå ��h¾¬\å ��Þ=¶������&���src/Composer/Command/UpdateCommand.phpñ#��h¾¬\ñ#��p\F¶������(���src/Composer/Command/ValidateCommand.php€��h¾¬\€��ÍÃ�î¶���������src/Composer/Composer.phpN ��h¾¬\N ��P֡Ƕ���������src/Composer/Config.phpp#��h¾¬\p#��¸’·š¶������-���src/Composer/Config/ConfigSourceInterface.php��h¾¬\��³ [/¶������(���src/Composer/Config/JsonConfigSource.phpu��h¾¬\u��=¤ƒ¶������$���src/Composer/Console/Application.php²4��h¾¬\²4��ŒŽæ¶������,���src/Composer/Console/HtmlOutputFormatter.php3��h¾¬\3��Ú�Eu¶������-���src/Composer/DependencyResolver/Decisions.php'��h¾¬\'��¹Ô޼¶������1���src/Composer/DependencyResolver/DefaultPolicy.php��h¾¬\��õÝv¶������/���src/Composer/DependencyResolver/GenericRule.phpµ��h¾¬\µ��᫤¶������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��h¾¬\C��´\õ*¶������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��h¾¬\÷��ïÎà÷¶������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��h¾¬\ý��3#†¶������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���h¾¬\Ó���Ùâ&ä¶������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��h¾¬\¹��&¢e
  26. ¶������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��h¾¬\I��FûÂɶ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phph��h¾¬\h��öSÕ]¶������3���src/Composer/DependencyResolver/PolicyInterface.php­��h¾¬\­��Ÿ‹R¶������(���src/Composer/DependencyResolver/Pool.php¯"��h¾¬\¯"��m½ ¶������+���src/Composer/DependencyResolver/Problem.php¹��h¾¬\¹��Rájl¶������+���src/Composer/DependencyResolver/Request.phpƒ��h¾¬\ƒ��åVP„¶������(���src/Composer/DependencyResolver/Rule.php?��h¾¬\?��¬‘œü¶������1���src/Composer/DependencyResolver/Rule2Literals.php��h¾¬\��tZÅɶ������+���src/Composer/DependencyResolver/RuleSet.phpª
  27. ��h¾¬\ª
  28. ��_΂¶������4���src/Composer/DependencyResolver/RuleSetGenerator.php&��h¾¬\&��gÇF£¶������3���src/Composer/DependencyResolver/RuleSetIterator.php��h¾¬\��›Cü$¶������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��h¾¬\i��hïš,¶������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��h¾¬\á��‰rôv¶������1���src/Composer/DependencyResolver/RuleWatchNode.php��h¾¬\���Gd7¶������*���src/Composer/DependencyResolver/Solver.php�:��h¾¬\�:��æ¯Ép¶������6���src/Composer/DependencyResolver/SolverBugException.php™��h¾¬\™��Xg6¶������;���src/Composer/DependencyResolver/SolverProblemsException.phpô��h¾¬\ô��×|Ŧ¶������/���src/Composer/DependencyResolver/Transaction.php×��h¾¬\×��Vm쟶������-���src/Composer/Downloader/ArchiveDownloader.phpÆ ��h¾¬\Æ ��G s0¶������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���h¾¬\Ì���¯à¨¿¶������+���src/Composer/Downloader/DownloadManager.php`��h¾¬\`��#ÏX¶������/���src/Composer/Downloader/DownloaderInterface.phpÊ��h¾¬\Ê��gs!l¶������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���h¾¬\Ñ���&Áœ¿¶������*���src/Composer/Downloader/FileDownloader.phpG��h¾¬\G��…�Ä÷¶������/���src/Composer/Downloader/FilesystemException.php
  29. ��h¾¬\
  30. ��.-‹¶������,���src/Composer/Downloader/FossilDownloader.php‚ ��h¾¬\‚ ��Ü�Ii¶������)���src/Composer/Downloader/GitDownloader.phpq4��h¾¬\q4��ZÎÇ×¶������*���src/Composer/Downloader/GzipDownloader.phpó��h¾¬\ó��}Úo¶������(���src/Composer/Downloader/HgDownloader.php”��h¾¬\”��ßis̶������*���src/Composer/Downloader/PathDownloader.phpÞ��h¾¬\Þ��¨Mí~¶������0���src/Composer/Downloader/PearPackageExtractor.phpu��h¾¬\u��z„‡¶������.���src/Composer/Downloader/PerforceDownloader.php§��h¾¬\§��⃨¶������*���src/Composer/Downloader/PharDownloader.phpå���h¾¬\å���ÞÉç¶������)���src/Composer/Downloader/RarDownloader.phpž��h¾¬\ž��6 3U¶������)���src/Composer/Downloader/SvnDownloader.phpG��h¾¬\G��M#j¶������)���src/Composer/Downloader/TarDownloader.phpã���h¾¬\ã���Í’X?¶������.���src/Composer/Downloader/TransportException.php=��h¾¬\=��ZÎÈÞ¶������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���h¾¬\Ô���`§ôö¶������)���src/Composer/Downloader/VcsDownloader.php¡��h¾¬\¡��( à>¶������(���src/Composer/Downloader/XzDownloader.php§��h¾¬\§��W$;á¶������)���src/Composer/Downloader/ZipDownloader.phpk��h¾¬\k��Òo”ζ������&���src/Composer/EventDispatcher/Event.php ��h¾¬\ ��±™jï¶������0���src/Composer/EventDispatcher/EventDispatcher.phpY3��h¾¬\Y3��ã&=q¶������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���h¾¬\©���h·0¶������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���h¾¬\v���wZ8S¶������)���src/Composer/Exception/NoSslException.phpf���h¾¬\f���ËíM�¶���������src/Composer/Factory.php_=��h¾¬\_=��x"Ŷ���������src/Composer/IO/BaseIO.phpŒ��h¾¬\Œ��(‚l‘¶���������src/Composer/IO/BufferIO.php*��h¾¬\*��¢®hT¶���������src/Composer/IO/ConsoleIO.php7��h¾¬\7��¥<ȶ���������src/Composer/IO/IOInterface.phpì��h¾¬\ì���Õ�¶���������src/Composer/IO/NullIO.phpÀ��h¾¬\À��F`sʶ���������src/Composer/Installer.phpÄ���h¾¬\Ä���ÍMlI¶������*���src/Composer/Installer/BinaryInstaller.php
  31. ��h¾¬\
  32. ��t¤{ø¶������2���src/Composer/Installer/BinaryPresenceInterface.phpË���h¾¬\Ë���À5š¨¶������.���src/Composer/Installer/InstallationManager.php-��h¾¬\-��¾}Œ7¶������)���src/Composer/Installer/InstallerEvent.php��h¾¬\��lÔzi¶������*���src/Composer/Installer/InstallerEvents.phpÞ���h¾¬\Þ���ìŸ@G¶������-���src/Composer/Installer/InstallerInterface.phpã��h¾¬\ã��^ƒ“ʶ������+���src/Composer/Installer/LibraryInstaller.php%��h¾¬\%�� »�̶������/���src/Composer/Installer/MetapackageInstaller.phpÊ��h¾¬\Ê��Ùti·¶������(���src/Composer/Installer/NoopInstaller.php+��h¾¬\+��À·M}¶������'���src/Composer/Installer/PackageEvent.phpe��h¾¬\e��;° ¶������(���src/Composer/Installer/PackageEvents.php¸��h¾¬\¸��dbØs¶������.���src/Composer/Installer/PearBinaryInstaller.phpø ��h¾¬\ø ��*ë•k¶������(���src/Composer/Installer/PearInstaller.php¢��h¾¬\¢��È‚¶Ñ¶������*���src/Composer/Installer/PluginInstaller.php‹��h¾¬\‹��ÒX8¶������+���src/Composer/Installer/ProjectInstaller.php��h¾¬\��*0@P¶������4���src/Composer/Installer/SuggestedPackagesReporter.php:��h¾¬\:��‚´UV¶���������src/Composer/Json/JsonFile.phpî��h¾¬\î��b-~¶������#���src/Composer/Json/JsonFormatter.phpb��h¾¬\b��ÝNš¶������%���src/Composer/Json/JsonManipulator.php’3��h¾¬\’3��é7¶������-���src/Composer/Json/JsonValidationException.php\��h¾¬\\��.Xóܶ������%���src/Composer/Package/AliasPackage.php��h¾¬\��¹—~š¶������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��h¾¬\ ��yY+¦¶������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��h¾¬\Þ�� ²²¹¶������0���src/Composer/Package/Archiver/ArchiveManager.phpÝ ��h¾¬\Ý ��í<´B¶������3���src/Composer/Package/Archiver/ArchiverInterface.php��h¾¬\��ñ´> ¶������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��h¾¬\–��y¶=ƶ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��h¾¬\��‹SZ0¶������2���src/Composer/Package/Archiver/GitExcludeFilter.phpr��h¾¬\r��3‘Mh¶������1���src/Composer/Package/Archiver/HgExcludeFilter.php ��h¾¬\ �� •¦S¶������.���src/Composer/Package/Archiver/PharArchiver.php?��h¾¬\?��®— u¶������-���src/Composer/Package/Archiver/ZipArchiver.php½��h¾¬\½��VÀ‚¨¶������$���src/Composer/Package/BasePackage.php��h¾¬\��D|ŸÈ¶������*���src/Composer/Package/Comparer/Comparer.phpR��h¾¬\R��ÏØ³î¶������(���src/Composer/Package/CompletePackage.phpü��h¾¬\ü��þM˶¶������1���src/Composer/Package/CompletePackageInterface.phpõ��h¾¬\õ��¦Ê�ò¶������+���src/Composer/Package/Dumper/ArrayDumper.phpW ��h¾¬\W ��¿éÁ¦¶���������src/Composer/Package/Link.phpˆ��h¾¬\ˆ��å¶Y«¶������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��h¾¬\‚��é~‹¶������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��h¾¬\d��¤ôLn¶������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��h¾¬\‚��ób`ý¶������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��h¾¬\i��Þ”š%¶������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��h¾¬\X��}`y¶������+���src/Composer/Package/Loader/ArrayLoader.phpN��h¾¬\N��âQ¬¶������7���src/Composer/Package/Loader/InvalidPackageException.phpE��h¾¬\E��xb¾¶������*���src/Composer/Package/Loader/JsonLoader.phpù��h¾¬\ù��!~ˆ{¶������/���src/Composer/Package/Loader/LoaderInterface.php²���h¾¬\²���¦}úζ������1���src/Composer/Package/Loader/RootPackageLoader.phpó��h¾¬\ó��l”.ض������5���src/Composer/Package/Loader/ValidatingArrayLoader.phpº<��h¾¬\º<��°-à@¶���������src/Composer/Package/Locker.php¥!��h¾¬\¥!��/=xö¶������ ���src/Composer/Package/Package.phpÉ��h¾¬\É��cÃ�h¶������)���src/Composer/Package/PackageInterface.php ��h¾¬\ ��ûÇ^ƶ������)���src/Composer/Package/RootAliasPackage.php ��h¾¬\ �� _€ø¶������$���src/Composer/Package/RootPackage.php��h¾¬\��ŽÎ_¶������-���src/Composer/Package/RootPackageInterface.php¹��h¾¬\¹��"maV¶������/���src/Composer/Package/Version/VersionGuesser.phpÏ��h¾¬\Ï��ÌÂß¶������.���src/Composer/Package/Version/VersionParser.php¥��h¾¬\¥��ô´à¶������0���src/Composer/Package/Version/VersionSelector.phpK ��h¾¬\K ��²<ȶ������-���src/Composer/Plugin/Capability/Capability.phpW���h¾¬\W���æ_¨1¶������2���src/Composer/Plugin/Capability/CommandProvider.php—���h¾¬\—���ûOâ>¶���������src/Composer/Plugin/Capable.php���h¾¬\���Æq+¶������$���src/Composer/Plugin/CommandEvent.phpâ��h¾¬\â��³ÆÇW¶������$���src/Composer/Plugin/PluginEvents.phpö���h¾¬\ö���á1=z¶������'���src/Composer/Plugin/PluginInterface.phpô���h¾¬\ô���)'*ض������%���src/Composer/Plugin/PluginManager.php$��h¾¬\$��‹K©¶������*���src/Composer/Plugin/PreCommandRunEvent.phpõ��h¾¬\õ��:ðd¶������,���src/Composer/Plugin/PreFileDownloadEvent.php`��h¾¬\`���9-ζ������4���src/Composer/Question/StrictConfirmationQuestion.php��h¾¬\��'.³è¶������+���src/Composer/Repository/ArrayRepository.php��h¾¬\��éÌt�¶������.���src/Composer/Repository/ArtifactRepository.php ��h¾¬\ ��Fœâò¶������*���src/Composer/Repository/BaseRepository.phpv ��h¾¬\v ��„ÜL¶������.���src/Composer/Repository/ComposerRepository.php�T��h¾¬\�T��©‘^¶������/���src/Composer/Repository/CompositeRepository.php;��h¾¬\;��¤¯S¶������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���h¾¬\…���±Ÿ_¶������0���src/Composer/Repository/FilesystemRepository.phpp��h¾¬\p��#ù¶������4���src/Composer/Repository/InstalledArrayRepository.php£���h¾¬\£���/ö~>¶������9���src/Composer/Repository/InstalledFilesystemRepository.php£���h¾¬\£���V
  33. •_¶������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���h¾¬\‡���£9p¶������6���src/Composer/Repository/InvalidRepositoryException.phpn���h¾¬\n���à“똶������-���src/Composer/Repository/PackageRepository.phpj��h¾¬\j��¥ôò̶������*���src/Composer/Repository/PathRepository.php– ��h¾¬\– ��WÛ¶������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��h¾¬\I��c6³¶������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��h¾¬\Ä��:T*ɶ������.���src/Composer/Repository/Pear/ChannelReader.phpí��h¾¬\í��?ÈYT¶������4���src/Composer/Repository/Pear/ChannelRest10Reader.php® ��h¾¬\® ��™ÖÛú¶������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��h¾¬\& ��òUb¶������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��h¾¬\q��9=¶������/���src/Composer/Repository/Pear/DependencyInfo.phpq��h¾¬\q��fºTò¶������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��h¾¬\…��÷$Li¶������,���src/Composer/Repository/Pear/PackageInfo.php°��h¾¬\°��Ÿ ¸ ¶������,���src/Composer/Repository/Pear/ReleaseInfo.php’��h¾¬\’��o“ŠÃ¶������*���src/Composer/Repository/PearRepository.phpª��h¾¬\ª��)Ÿƒ}¶������.���src/Composer/Repository/PlatformRepository.phpå��h¾¬\å��»G÷å¶������-���src/Composer/Repository/RepositoryFactory.php`��h¾¬\`��K¾du¶������/���src/Composer/Repository/RepositoryInterface.phpÛ��h¾¬\Û��’âÁ¶������-���src/Composer/Repository/RepositoryManager.php2
  34. ��h¾¬\2
  35. ��á…5#¶������7���src/Composer/Repository/RepositorySecurityException.phpo���h¾¬\o���pÕ«ª¶������/���src/Composer/Repository/Vcs/BitbucketDriver.phpø��h¾¬\ø��Æo¢±¶������,���src/Composer/Repository/Vcs/FossilDriver.php©��h¾¬\©��t1Ú®¶������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpê��h¾¬\ê��ÃŽ»¶������)���src/Composer/Repository/Vcs/GitDriver.php¼��h¾¬\¼��Š©Ðê¶������,���src/Composer/Repository/Vcs/GitHubDriver.php¡(��h¾¬\¡(��s›S;¶������,���src/Composer/Repository/Vcs/GitLabDriver.phpÍ#��h¾¬\Í#��ßNìʶ������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpä��h¾¬\ä��i›üà¶������(���src/Composer/Repository/Vcs/HgDriver.php\��h¾¬\\��sàØ¶������.���src/Composer/Repository/Vcs/PerforceDriver.php' ��h¾¬\' ��ÙóH¶������)���src/Composer/Repository/Vcs/SvnDriver.php¤��h¾¬\¤�� ¶������)���src/Composer/Repository/Vcs/VcsDriver.phpæ
  36. ��h¾¬\æ
  37. ��eׯ-¶������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��h¾¬\÷��ÇX[‰¶������)���src/Composer/Repository/VcsRepository.phpŒ)��h¾¬\Œ)��òž|9¶������1���src/Composer/Repository/VersionCacheInterface.php”���h¾¬\”���A?Rï¶������3���src/Composer/Repository/WritableArrayRepository.php��h¾¬\��¾G*¶������7���src/Composer/Repository/WritableRepositoryInterface.php‰��h¾¬\‰��‘/sï¶������$���src/Composer/Script/CommandEvent.phpW���h¾¬\W���£VZt¶���������src/Composer/Script/Event.phpµ��h¾¬\µ��lt¦M¶������$���src/Composer/Script/PackageEvent.phpœ���h¾¬\œ���§ÿÉ ¶������$���src/Composer/Script/ScriptEvents.phpP��h¾¬\P��‡�¶¶������ ���src/Composer/SelfUpdate/Keys.php���h¾¬\��� îÊN¶������$���src/Composer/SelfUpdate/Versions.phpì��h¾¬\ì��͵‘ƒ¶������ ���src/Composer/Util/AuthHelper.phpË��h¾¬\Ë��>zx–¶���������src/Composer/Util/Bitbucket.php*��h¾¬\*��,Lšk¶������$���src/Composer/Util/ComposerMirror.php±��h¾¬\±��­½øØ¶������%���src/Composer/Util/ConfigValidator.php÷��h¾¬\÷��v•Ͷ������"���src/Composer/Util/ErrorHandler.php¬��h¾¬\¬��š^`ƶ������ ���src/Composer/Util/Filesystem.phpN/��h¾¬\N/��זּ���������src/Composer/Util/Git.php2+��h¾¬\2+��}rð¦¶���������src/Composer/Util/GitHub.php| ��h¾¬\| ��`0tü¶���������src/Composer/Util/GitLab.phpœ ��h¾¬\œ �� `YÖ¶���������src/Composer/Util/Hg.php¾��h¾¬\¾��LÓ �¶���������src/Composer/Util/IniHelper.phph��h¾¬\h��;FP¶������$���src/Composer/Util/NoProxyPattern.php¾��h¾¬\¾��Z+°m¶���������src/Composer/Util/Perforce.phpÁ2��h¾¬\Á2��ñ÷‹¶���������src/Composer/Util/Platform.phpü��h¾¬\ü��s­fç¶������%���src/Composer/Util/ProcessExecutor.php ��h¾¬\ ��›Éº¶������&���src/Composer/Util/RemoteFilesystem.phpçl��h¾¬\çl��¾ â¶���������src/Composer/Util/Silencer.phpé��h¾¬\é��“Vjf¶������!���src/Composer/Util/SpdxLicense.php��h¾¬\��¾7
  38. ñ¶������*���src/Composer/Util/StreamContextFactory.php��h¾¬\��CÉ…ù¶���������src/Composer/Util/Svn.php,��h¾¬\,��Ì žÄ¶���������src/Composer/Util/TlsHelper.phpn
  39. ��h¾¬\n
  40. ��S¯Í:¶���������src/Composer/Util/Url.php£��h¾¬\£��3œÉܶ���������src/Composer/XdebugHandler.phpð��h¾¬\ð��zÓf~¶���������src/bootstrap.php¹��h¾¬\¹��I}œ¶������%���src/Composer/Autoload/ClassLoader.php“4��h¾¬\“4��²z�–¶������#���res/composer-repository-schema.jsonð��h¾¬\ð���GÐà¶���������res/composer-schema.json…–��h¾¬\…–�� º,˜¶������6���vendor/composer/spdx-licenses/res/spdx-exceptions.jsonJ ��h¾¬\J ��ñR�¶������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonÞ”��h¾¬\Þ”��YŒs¤¶������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$��h¾¬\�$��•�¥v¶������&���vendor/symfony/console/Application.php=X��h¾¬\=X��� S’¶������*���vendor/symfony/console/Command/Command.phpî"��h¾¬\î"��x°jÕ¶������.���vendor/symfony/console/Command/HelpCommand.phpØ��h¾¬\Ø��¦Ú-:¶������.���vendor/symfony/console/Command/ListCommand.phpZ��h¾¬\Z��»w`¶������(���vendor/symfony/console/ConsoleEvents.phpé���h¾¬\é���RÛÔe¶������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÐ��h¾¬\Ð��™Ž5°¶������0���vendor/symfony/console/Descriptor/Descriptor.php���h¾¬\���¿N•¶������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���h¾¬\ü���±Qµ¶������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpÜ ��h¾¬\Ü ��*û�ɶ������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¶��h¾¬\¶��·Ô;ݶ������4���vendor/symfony/console/Descriptor/TextDescriptor.php¼��h¾¬\¼��òç$¶������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��h¾¬\��b{<¶������4���vendor/symfony/console/Event/ConsoleCommandEvent.php°��h¾¬\°��!�ȶ������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��h¾¬\Å��ÒxÛ\¶������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��h¾¬\��á2é¶������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��h¾¬\z��³,îL¶������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��h¾¬\Ô��È÷ L¶������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���h¾¬\f���¡ABª¶������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���h¾¬\¦���Ö̽Z¶������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���h¾¬\¦���Ë×H¶������3���vendor/symfony/console/Exception/LogicException.php’���h¾¬\’���ÍO\e¶������5���vendor/symfony/console/Exception/RuntimeException.php–���h¾¬\–���Ùí,6¶������4���vendor/symfony/console/Formatter/OutputFormatter.php6��h¾¬\6��?=¨¶������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒ��h¾¬\Œ��òññÀ¶������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpF��h¾¬\F��𦴶������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„��h¾¬\„��÷½G¶������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php@��h¾¬\@��G¨ýU¶������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpy��h¾¬\y��Ì8ÆÐ¶������2���vendor/symfony/console/Helper/DescriptorHelper.phpw��h¾¬\w��|¦C¶������.���vendor/symfony/console/Helper/DialogHelper.php��h¾¬\��¹ÜÃ_¶������1���vendor/symfony/console/Helper/FormatterHelper.phpd��h¾¬\d��§×,¸¶������(���vendor/symfony/console/Helper/Helper.php«��h¾¬\«��!�§—¶������1���vendor/symfony/console/Helper/HelperInterface.phpå���h¾¬\å���Š ¶������+���vendor/symfony/console/Helper/HelperSet.phpÊ��h¾¬\Ê��áÏW"¶������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��h¾¬\c��Ìøƒ¶������/���vendor/symfony/console/Helper/ProcessHelper.phpÓ ��h¾¬\Ó ��©w‚R¶������-���vendor/symfony/console/Helper/ProgressBar.phpl%��h¾¬\l%�� díÛ¶������0���vendor/symfony/console/Helper/ProgressHelper.php]��h¾¬\]��ù»‰X¶������3���vendor/symfony/console/Helper/ProgressIndicator.phpN��h¾¬\N��ÿ§³l¶������0���vendor/symfony/console/Helper/QuestionHelper.phpl��h¾¬\l��Ntó¶������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php–
  41. ��h¾¬\–
  42. ��- ض������'���vendor/symfony/console/Helper/Table.phpÄ*��h¾¬\Ä*��¾™ØT¶������+���vendor/symfony/console/Helper/TableCell.php���h¾¬\���åV^¶������-���vendor/symfony/console/Helper/TableHelper.php ��h¾¬\ ��›uô™¶������0���vendor/symfony/console/Helper/TableSeparator.phpÊ���h¾¬\Ê���az¶������,���vendor/symfony/console/Helper/TableStyle.php
  43. ��h¾¬\
  44. ��_ÍI"¶������*���vendor/symfony/console/Input/ArgvInput.php��h¾¬\��×ö†›¶������+���vendor/symfony/console/Input/ArrayInput.php) ��h¾¬\) ��¥ÑC¶������&���vendor/symfony/console/Input/Input.php£ ��h¾¬\£ ��f¡?¶������.���vendor/symfony/console/Input/InputArgument.php��h¾¬\��D £¶������4���vendor/symfony/console/Input/InputAwareInterface.php˜���h¾¬\˜���­O°¶������0���vendor/symfony/console/Input/InputDefinition.php†��h¾¬\†��¤U)¤¶������/���vendor/symfony/console/Input/InputInterface.php£��h¾¬\£��ÆBŒ'¶������,���vendor/symfony/console/Input/InputOption.php ��h¾¬\ ��\¢Ü=¶������,���vendor/symfony/console/Input/StringInput.phpš��h¾¬\š��žµ è¶���������vendor/symfony/console/LICENSE)��h¾¬\)��NUN½¶������/���vendor/symfony/console/Logger/ConsoleLogger.php0 ��h¾¬\0 ��…� ¸¶������0���vendor/symfony/console/Output/BufferedOutput.php_��h¾¬\_��‹ >P¶������/���vendor/symfony/console/Output/ConsoleOutput.php±��h¾¬\±��nì!f¶������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpà���h¾¬\à���‡†ÆÊ¶������,���vendor/symfony/console/Output/NullOutput.phpÏ��h¾¬\Ï��®˜‹Z¶������(���vendor/symfony/console/Output/Output.php˜ ��h¾¬\˜ ��0p¶������1���vendor/symfony/console/Output/OutputInterface.php��h¾¬\���ì&¶������.���vendor/symfony/console/Output/StreamOutput.php���h¾¬\���Ä’Oç¶������2���vendor/symfony/console/Question/ChoiceQuestion.phpx
  45. ��h¾¬\x
  46. ��W€!¶������8���vendor/symfony/console/Question/ConfirmationQuestion.phpè��h¾¬\è��/Ô�¶������,���vendor/symfony/console/Question/Question.phpÎ ��h¾¬\Î ��lF¶������ ���vendor/symfony/console/Shell.phpæ��h¾¬\æ��¼XÒA¶������,���vendor/symfony/console/Style/OutputStyle.php\��h¾¬\\��wפ¶������/���vendor/symfony/console/Style/StyleInterface.phpÏ��h¾¬\Ï��&nÅѶ������-���vendor/symfony/console/Style/SymfonyStyle.phpä��h¾¬\ä��­å (¶������3���vendor/symfony/console/Tester/ApplicationTester.phpÏ��h¾¬\Ï��sž9i¶������/���vendor/symfony/console/Tester/CommandTester.phpª��h¾¬\ª��¬K z¶������(���vendor/symfony/debug/BufferingLogger.phpt��h¾¬\t��=�hܶ���������vendor/symfony/debug/Debug.php,��h¾¬\,��Ë~Ž.¶������)���vendor/symfony/debug/DebugClassLoader.phpµ��h¾¬\µ��1rEÓ¶������%���vendor/symfony/debug/ErrorHandler.phpH��h¾¬\H��¹:D#¶������9���vendor/symfony/debug/Exception/ClassNotFoundException.php–��h¾¬\–��i‰æô¶������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��h¾¬\˜��-
  47. d2¶������1���vendor/symfony/debug/Exception/DummyException.php��h¾¬\��®+Ãê¶������6���vendor/symfony/debug/Exception/FatalErrorException.php��h¾¬\��™Ä¶������6���vendor/symfony/debug/Exception/FatalThrowableError.phpW��h¾¬\W��?àèK¶������3���vendor/symfony/debug/Exception/FlattenException.php¼��h¾¬\¼�� ×¶������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���h¾¬\~���ë¨oâ¶������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpš��h¾¬\š���ñJÀ¶������;���vendor/symfony/debug/Exception/UndefinedMethodException.php˜��h¾¬\˜��nöêØ¶������)���vendor/symfony/debug/ExceptionHandler.php)3��h¾¬\)3���h5=¶������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.phpA��h¾¬\A��Ϥ¹l¶������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��h¾¬\��ĹBV¶������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpx��h¾¬\x��~ò"¶������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpO��h¾¬\O���ž¦*¶���������vendor/symfony/debug/LICENSE)��h¾¬\)��NUN½¶������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���h¾¬\i���$ ÿ›¶������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��h¾¬\¼��pí\¶¶������3���vendor/symfony/filesystem/Exception/IOException.php‡��h¾¬\‡��€ü#Ѷ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���h¾¬\¦���jÙwM¶������(���vendor/symfony/filesystem/Filesystem.phpc4��h¾¬\c4��‹×@þ¶������!���vendor/symfony/filesystem/LICENSE)��h¾¬\)��NUN½¶������)���vendor/symfony/filesystem/LockHandler.phpö��h¾¬\ö��ŸZµ1¶������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��h¾¬\\ ��hˆB¶������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php���h¾¬\���HC€/¶������2���vendor/symfony/finder/Adapter/AdapterInterface.php›��h¾¬\›��Mþ¶������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php3��h¾¬\3��75$·¶������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��h¾¬\��Ÿ`]¶������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��h¾¬\ô��Þdè;¶������/���vendor/symfony/finder/Comparator/Comparator.php���h¾¬\���¾üœµ¶������3���vendor/symfony/finder/Comparator/DateComparator.php#��h¾¬\#��°ζ������5���vendor/symfony/finder/Comparator/NumberComparator.php|��h¾¬\|��ITÇͶ������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���h¾¬\„���½¾sœ¶������;���vendor/symfony/finder/Exception/AdapterFailureException.php¬��h¾¬\¬��wR¶������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���h¾¬\„���Gz-¶������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��h¾¬\)��x§e¶������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpº��h¾¬\º��˜þ˜¶������/���vendor/symfony/finder/Expression/Expression.php��h¾¬\��i¥:Ŷ������)���vendor/symfony/finder/Expression/Glob.phpf��h¾¬\f��DÞcj¶������*���vendor/symfony/finder/Expression/Regex.php��h¾¬\��ü(Ã϶������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��h¾¬\Í��\p4†¶������ ���vendor/symfony/finder/Finder.phpc.��h¾¬\c.��:ˆ5g¶���������vendor/symfony/finder/Glob.phpL��h¾¬\L��jÍ9×¶������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��h¾¬\]��ÎoÅÆ¶������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpx��h¾¬\x��ôP¶������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpî��h¾¬\î��üÍ�q¶������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpí��h¾¬\í��nõH¶������4���vendor/symfony/finder/Iterator/FilePathsIterator.php#��h¾¬\#��G?T½¶������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZ��h¾¬\Z��(&ø¶������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��h¾¬\5��ší¶������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��h¾¬\r��tu¶������1���vendor/symfony/finder/Iterator/FilterIterator.phpÃ��h¾¬\Ã��š+µÞ¶������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-��h¾¬\-��ºÎÒ_¶������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÐ��h¾¬\Ð��‚c¶������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��h¾¬\ ��ë]í»¶������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpe��h¾¬\e��Ÿ’áé¶������3���vendor/symfony/finder/Iterator/SortableIterator.php+��h¾¬\+��õÝË ¶���������vendor/symfony/finder/LICENSE)��h¾¬\)��NUN½¶������'���vendor/symfony/finder/Shell/Command.php> ��h¾¬\> ��_~u ¶������%���vendor/symfony/finder/Shell/Shell.phpr��h¾¬\r��þpN¶������%���vendor/symfony/finder/SplFileInfo.php��h¾¬\��þ�íù¶������'���vendor/symfony/polyfill-ctype/Ctype.phpH ��h¾¬\H ��³�Õݶ������%���vendor/symfony/polyfill-ctype/LICENSE$��h¾¬\$��?‡s:¶������+���vendor/symfony/polyfill-ctype/bootstrap.phpI��h¾¬\I���D!e¶������(���vendor/symfony/polyfill-mbstring/LICENSE)��h¾¬\)��±íж������-���vendor/symfony/polyfill-mbstring/Mbstring.phpC��h¾¬\C��ãZ?¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php÷@��h¾¬\÷@��õžØ¶������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã��h¾¬\ã��öy_•¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.phpfA��h¾¬\fA��Úf”ß¶������.���vendor/symfony/polyfill-mbstring/bootstrap.phpË��h¾¬\Ë��ó<Ë¢¶������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���h¾¬\f���]ö>T¶������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���h¾¬\¨���ÐÀ+_¶������3���vendor/symfony/process/Exception/LogicException.php”���h¾¬\”��� ³ãñ¶������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��h¾¬\x��¨Ìzy¶������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��h¾¬\��ï«¶������5���vendor/symfony/process/Exception/RuntimeException.php˜���h¾¬\˜���¢Ø:¶������+���vendor/symfony/process/ExecutableFinder.php���h¾¬\���ûus€¶���������vendor/symfony/process/LICENSE)��h¾¬\)��NUN½¶������.���vendor/symfony/process/PhpExecutableFinder.phpÏ��h¾¬\Ï��Î%h¶������%���vendor/symfony/process/PhpProcess.phpü��h¾¬\ü��‡jûü¶������.���vendor/symfony/process/Pipes/AbstractPipes.php½��h¾¬\½��憶������/���vendor/symfony/process/Pipes/PipesInterface.phpD��h¾¬\D��vØî¡¶������*���vendor/symfony/process/Pipes/UnixPipes.php>��h¾¬\>��ª•ir¶������-���vendor/symfony/process/Pipes/WindowsPipes.phpp ��h¾¬\p ��âU~ɶ������"���vendor/symfony/process/Process.php·R��h¾¬\·R��Š`Õ¶������)���vendor/symfony/process/ProcessBuilder.phpâ
  48. ��h¾¬\â
  49. ��†M¶¶������'���vendor/symfony/process/ProcessUtils.phpQ��h¾¬\Q��b-$m¶���������vendor/seld/jsonlint/LICENSE"��h¾¬\"��aƒsy¶������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��h¾¬\*��•pñ¶������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php/2��h¾¬\/2��­ß˜ö¶������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php��h¾¬\��%ÿ3N¶������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��h¾¬\��‰²ñ¶������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���h¾¬\>���ÿqŸŸ¶������(���vendor/justinrainbow/json-schema/LICENSE ��h¾¬\ ��ºç©¶������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��h¾¬\ñ��fC¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��h¾¬\¡ ��†wÌl¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php) ��h¾¬\) ��#©¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ ��h¾¬\§ ��›Vض������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��h¾¬\¼��ÿ Qœ¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��h¾¬\]��VŽU<¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã ��h¾¬\ã ��á0;¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…��h¾¬\…��“TœÚ¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpš
  50. ��h¾¬\š
  51. ��z&¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃ��h¾¬\Ã��©Å¼x¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 ��h¾¬\0 ��×j´˜¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php��h¾¬\��¥wš‡¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��h¾¬\a�� qö������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.phpp��h¾¬\p��rë¶������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��h¾¬\‰��“µ+j¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��h¾¬\&��4˜©T¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php,"��h¾¬\,"��ulÙ·¶������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��h¾¬\è��{N–¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���h¾¬\I���%|°¶������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���h¾¬\•���‹àG¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���h¾¬\l���A!L×¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���h¾¬\l���è2÷þ¶������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���h¾¬\u���=hç¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���h¾¬\w���N-ò[¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��h¾¬\Þ��\¸
  52. ¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���h¾¬\o���píÛù¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���h¾¬\…���%…—¶������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���h¾¬\€���u-#1¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���h¾¬\j���å>�¶������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���h¾¬\f���¬¤„þ¶������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��h¾¬\þ��M�„õ¶������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��h¾¬\ ��f4÷³¶������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ��h¾¬\œ ��åfO¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��h¾¬\��oŠ+}¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���h¾¬\á���[þA�¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥��h¾¬\¥��Ô§Lb¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%��h¾¬\%��5" ¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��h¾¬\,��1•5þ¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���h¾¬\®���ÿ‹Áå¶������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��h¾¬\ ��£Ÿ)à¶������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php&��h¾¬\&��¼î‚¢¶������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���h¾¬\ƒ���J€¶������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���h¾¬\…���íæe¶������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpx��h¾¬\x��eÃþ¶������%���vendor/composer/spdx-licenses/LICENSE��h¾¬\��Bhí¶������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpH��h¾¬\H��͉T¶���������vendor/composer/semver/LICENSE��h¾¬\��Bhí¶������)���vendor/composer/semver/src/Comparator.php��h¾¬\��wlƒï¶������<���vendor/composer/semver/src/Constraint/AbstractConstraint.phpî��h¾¬\î��Õ­w-¶������4���vendor/composer/semver/src/Constraint/Constraint.phpª ��h¾¬\ª ��ÇO7²¶������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���h¾¬\ß���0C,‡¶������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpé��h¾¬\é��!-Ø™¶������9���vendor/composer/semver/src/Constraint/MultiConstraint.php1��h¾¬\1��í xU¶������%���vendor/composer/semver/src/Semver.phpv��h¾¬\v��‹×È›¶������,���vendor/composer/semver/src/VersionParser.php¯*��h¾¬\¯*��ZÒ“¶������!���vendor/composer/ca-bundle/LICENSE��h¾¬\��*!^`¶������*���vendor/composer/ca-bundle/src/CaBundle.php��h¾¬\��Ê ~Ķ������&���vendor/composer/xdebug-handler/LICENSE)��h¾¬\)��#Ô;^¶������0���vendor/composer/xdebug-handler/src/PhpConfig.php´��h¾¬\´��*D’�¶������.���vendor/composer/xdebug-handler/src/Process.phpt��h¾¬\t��ÛŒú&¶������-���vendor/composer/xdebug-handler/src/Status.php
  53. ��h¾¬\
  54. ��²‚²¶������4���vendor/composer/xdebug-handler/src/XdebugHandler.php!��h¾¬\!��2|¿C¶���������vendor/psr/log/LICENSE=��h¾¬\=��p±ŽO¶������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��h¾¬\;��ñ>3[¶������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���h¾¬\`��� ˆX1¶������#���vendor/psr/log/Psr/Log/LogLevel.phpû���h¾¬\û���jðñ8¶������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���h¾¬\|���$£ˆ¶������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���h¾¬\§���T½úB¶������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÆ��h¾¬\Æ��»sg¶������&���vendor/psr/log/Psr/Log/LoggerTrait.phpi��h¾¬\i��35§Þ¶������%���vendor/psr/log/Psr/Log/NullLogger.phpž���h¾¬\ž���Çö������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpI ��h¾¬\I ��õÇAs¶������*���vendor/psr/log/Psr/Log/Test/TestLogger.php ��h¾¬\ ��ôc�›¶���������vendor/autoload.php‚���h¾¬\‚���³Ah¥¶������'���vendor/composer/autoload_namespaces.phpd���h¾¬\d���Z¡¦H¶������!���vendor/composer/autoload_psr4.php÷��h¾¬\÷��Å*š¶������%���vendor/composer/autoload_classmap.phpd���h¾¬\d���Z¡¦H¶������"���vendor/composer/autoload_files.php��h¾¬\��¥� ®¶������!���vendor/composer/autoload_real.phpI��h¾¬\I��¤¬_¶������#���vendor/composer/autoload_static.php§
  55. ��h¾¬\§
  56. ��¤±¯¶���������vendor/composer/ClassLoader.php¨��h¾¬\¨��xää`¶������(���vendor/composer/ca-bundle/res/cacert.pemÌY�h¾¬\ÌY�R.£¶������ ���bin/composerÊ��h¾¬\Ê��ÿêP¶���������LICENSE.��h¾¬\.�� Õ¶������<?php
  57. namespace Composer\Autoload;
  58. use Composer\Config;
  59. use Composer\EventDispatcher\EventDispatcher;
  60. use Composer\Installer\InstallationManager;
  61. use Composer\IO\IOInterface;
  62. use Composer\Package\AliasPackage;
  63. use Composer\Package\PackageInterface;
  64. use Composer\Repository\InstalledRepositoryInterface;
  65. use Composer\Util\Filesystem;
  66. use Composer\Script\ScriptEvents;
  67. class AutoloadGenerator
  68. {
  69. private $eventDispatcher;
  70. private $io;
  71. private $devMode = false;
  72. private $classMapAuthoritative = false;
  73. private $apcu = false;
  74. private $runScripts = false;
  75. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  76. {
  77. $this->eventDispatcher = $eventDispatcher;
  78. $this->io = $io;
  79. }
  80. public function setDevMode($devMode = true)
  81. {
  82. $this->devMode = (bool) $devMode;
  83. }
  84. public function setClassMapAuthoritative($classMapAuthoritative)
  85. {
  86. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  87. }
  88. public function setApcu($apcu)
  89. {
  90. $this->apcu = (bool) $apcu;
  91. }
  92. public function setRunScripts($runScripts = true)
  93. {
  94. $this->runScripts = (bool) $runScripts;
  95. }
  96. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  97. {
  98. if ($this->classMapAuthoritative) {
  99. $scanPsr0Packages = true;
  100. }
  101. if ($this->runScripts) {
  102. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  103. 'optimize' => (bool) $scanPsr0Packages,
  104. ));
  105. }
  106. $filesystem = new Filesystem();
  107. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  108. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  109. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  110. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  111. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  112. $targetDir = $vendorPath.'/'.$targetDir;
  113. $filesystem->ensureDirectoryExists($targetDir);
  114. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  115. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  116. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  117. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  118. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  119. $namespacesFile = <<<EOF
  120. <?php
  121. // autoload_namespaces.php @generated by Composer
  122. \$vendorDir = $vendorPathCode52;
  123. \$baseDir = $appBaseDirCode;
  124. return array(
  125. EOF;
  126. $psr4File = <<<EOF
  127. <?php
  128. // autoload_psr4.php @generated by Composer
  129. \$vendorDir = $vendorPathCode52;
  130. \$baseDir = $appBaseDirCode;
  131. return array(
  132. EOF;
  133. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  134. $autoloads = $this->parseAutoloads($packageMap, $mainPackage, $this->devMode === false);
  135. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  136. $exportedPaths = array();
  137. foreach ($paths as $path) {
  138. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  139. }
  140. $exportedPrefix = var_export($namespace, true);
  141. $namespacesFile .= " $exportedPrefix => ";
  142. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  143. }
  144. $namespacesFile .= ");\n";
  145. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  146. $exportedPaths = array();
  147. foreach ($paths as $path) {
  148. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  149. }
  150. $exportedPrefix = var_export($namespace, true);
  151. $psr4File .= " $exportedPrefix => ";
  152. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  153. }
  154. $psr4File .= ");\n";
  155. $classmapFile = <<<EOF
  156. <?php
  157. // autoload_classmap.php @generated by Composer
  158. \$vendorDir = $vendorPathCode52;
  159. \$baseDir = $appBaseDirCode;
  160. return array(
  161. EOF;
  162. $targetDirLoader = null;
  163. $mainAutoload = $mainPackage->getAutoload();
  164. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  165. $levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
  166. $prefixes = implode(', ', array_map(function ($prefix) {
  167. return var_export($prefix, true);
  168. }, array_keys($mainAutoload['psr-0'])));
  169. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  170. $targetDirLoader = <<<EOF
  171. public static function autoload(\$class)
  172. {
  173. \$dir = $baseDirFromTargetDirCode . '/';
  174. \$prefixes = array($prefixes);
  175. foreach (\$prefixes as \$prefix) {
  176. if (0 !== strpos(\$class, \$prefix)) {
  177. continue;
  178. }
  179. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  180. if (!\$path = stream_resolve_include_path(\$path)) {
  181. return false;
  182. }
  183. require \$path;
  184. return true;
  185. }
  186. }
  187. EOF;
  188. }
  189. $blacklist = null;
  190. if (!empty($autoloads['exclude-from-classmap'])) {
  191. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  192. }
  193. $classMap = array();
  194. if ($scanPsr0Packages) {
  195. $namespacesToScan = array();
  196. foreach (array('psr-0', 'psr-4') as $psrType) {
  197. foreach ($autoloads[$psrType] as $namespace => $paths) {
  198. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  199. }
  200. }
  201. krsort($namespacesToScan);
  202. foreach ($namespacesToScan as $namespace => $groups) {
  203. foreach ($groups as $group) {
  204. foreach ($group['paths'] as $dir) {
  205. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  206. if (!is_dir($dir)) {
  207. continue;
  208. }
  209. $namespaceFilter = $namespace === '' ? null : $namespace;
  210. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  211. }
  212. }
  213. }
  214. }
  215. foreach ($autoloads['classmap'] as $dir) {
  216. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  217. }
  218. ksort($classMap);
  219. foreach ($classMap as $class => $code) {
  220. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  221. }
  222. $classmapFile .= ");\n";
  223. if (!$suffix) {
  224. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  225. $content = file_get_contents($vendorPath.'/autoload.php');
  226. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  227. $suffix = $match[1];
  228. }
  229. }
  230. if (!$suffix) {
  231. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  232. }
  233. }
  234. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  235. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  236. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  237. $includePathFilePath = $targetDir.'/include_paths.php';
  238. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  239. file_put_contents($includePathFilePath, $includePathFileContents);
  240. } elseif (file_exists($includePathFilePath)) {
  241. unlink($includePathFilePath);
  242. }
  243. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  244. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  245. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  246. } elseif (file_exists($includeFilesFilePath)) {
  247. unlink($includeFilesFilePath);
  248. }
  249. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  250. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  251. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  252. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  253. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  254. if ($this->runScripts) {
  255. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  256. 'optimize' => (bool) $scanPsr0Packages,
  257. ));
  258. }
  259. return count($classMap);
  260. }
  261. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
  262. {
  263. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
  264. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  265. if (!isset($classMap[$class])) {
  266. $classMap[$class] = $pathCode;
  267. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  268. $this->io->writeError(
  269. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  270. ' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
  271. );
  272. }
  273. }
  274. return $classMap;
  275. }
  276. private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
  277. {
  278. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
  279. }
  280. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  281. {
  282. $packageMap = array(array($mainPackage, ''));
  283. foreach ($packages as $package) {
  284. if ($package instanceof AliasPackage) {
  285. continue;
  286. }
  287. $this->validatePackage($package);
  288. $packageMap[] = array(
  289. $package,
  290. $installationManager->getInstallPath($package),
  291. );
  292. }
  293. return $packageMap;
  294. }
  295. protected function validatePackage(PackageInterface $package)
  296. {
  297. $autoload = $package->getAutoload();
  298. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  299. $name = $package->getName();
  300. $package->getTargetDir();
  301. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  302. }
  303. if (!empty($autoload['psr-4'])) {
  304. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  305. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  306. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  307. }
  308. }
  309. }
  310. }
  311. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage, $filterOutRequireDevPackages = false)
  312. {
  313. $mainPackageMap = array_shift($packageMap);
  314. if ($filterOutRequireDevPackages) {
  315. $packageMap = $this->filterPackageMap($packageMap, $mainPackage);
  316. }
  317. $sortedPackageMap = $this->sortPackageMap($packageMap);
  318. $sortedPackageMap[] = $mainPackageMap;
  319. array_unshift($packageMap, $mainPackageMap);
  320. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  321. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  322. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  323. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  324. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  325. krsort($psr0);
  326. krsort($psr4);
  327. return array(
  328. 'psr-0' => $psr0,
  329. 'psr-4' => $psr4,
  330. 'classmap' => $classmap,
  331. 'files' => $files,
  332. 'exclude-from-classmap' => $exclude,
  333. );
  334. }
  335. public function createLoader(array $autoloads)
  336. {
  337. $loader = new ClassLoader();
  338. if (isset($autoloads['psr-0'])) {
  339. foreach ($autoloads['psr-0'] as $namespace => $path) {
  340. $loader->add($namespace, $path);
  341. }
  342. }
  343. if (isset($autoloads['psr-4'])) {
  344. foreach ($autoloads['psr-4'] as $namespace => $path) {
  345. $loader->addPsr4($namespace, $path);
  346. }
  347. }
  348. if (isset($autoloads['classmap'])) {
  349. $blacklist = null;
  350. if (!empty($autoloads['exclude-from-classmap'])) {
  351. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  352. }
  353. foreach ($autoloads['classmap'] as $dir) {
  354. try {
  355. $loader->addClassMap($this->generateClassMap($dir, $blacklist, null, false));
  356. } catch (\RuntimeException $e) {
  357. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  358. }
  359. }
  360. }
  361. return $loader;
  362. }
  363. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  364. {
  365. $includePaths = array();
  366. foreach ($packageMap as $item) {
  367. list($package, $installPath) = $item;
  368. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  369. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  370. }
  371. foreach ($package->getIncludePaths() as $includePath) {
  372. $includePath = trim($includePath, '/');
  373. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  374. }
  375. }
  376. if (!$includePaths) {
  377. return;
  378. }
  379. $includePathsCode = '';
  380. foreach ($includePaths as $path) {
  381. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  382. }
  383. return <<<EOF
  384. <?php
  385. // include_paths.php @generated by Composer
  386. \$vendorDir = $vendorPathCode;
  387. \$baseDir = $appBaseDirCode;
  388. return array(
  389. $includePathsCode);
  390. EOF;
  391. }
  392. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  393. {
  394. $filesCode = '';
  395. foreach ($files as $fileIdentifier => $functionFile) {
  396. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  397. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  398. }
  399. if (!$filesCode) {
  400. return false;
  401. }
  402. return <<<EOF
  403. <?php
  404. // autoload_files.php @generated by Composer
  405. \$vendorDir = $vendorPathCode;
  406. \$baseDir = $appBaseDirCode;
  407. return array(
  408. $filesCode);
  409. EOF;
  410. }
  411. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  412. {
  413. if (!$filesystem->isAbsolutePath($path)) {
  414. $path = $basePath . '/' . $path;
  415. }
  416. $path = $filesystem->normalizePath($path);
  417. $baseDir = '';
  418. if (strpos($path.'/', $vendorPath.'/') === 0) {
  419. $path = substr($path, strlen($vendorPath));
  420. $baseDir = '$vendorDir';
  421. if ($path !== false) {
  422. $baseDir .= " . ";
  423. }
  424. } else {
  425. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  426. if (!$filesystem->isAbsolutePath($path)) {
  427. $baseDir = '$baseDir . ';
  428. $path = '/' . $path;
  429. }
  430. }
  431. if (preg_match('/\.phar.+$/', $path)) {
  432. $baseDir = "'phar://' . " . $baseDir;
  433. }
  434. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  435. }
  436. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  437. {
  438. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  439. if ("'" === $lastChar || '"' === $lastChar) {
  440. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  441. } else {
  442. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  443. }
  444. return <<<AUTOLOAD
  445. <?php
  446. // autoload.php @generated by Composer
  447. require_once $vendorPathToTargetDirCode;
  448. return ComposerAutoloaderInit$suffix::getLoader();
  449. AUTOLOAD;
  450. }
  451. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  452. {
  453. $file = <<<HEADER
  454. <?php
  455. // autoload_real.php @generated by Composer
  456. class ComposerAutoloaderInit$suffix
  457. {
  458. private static \$loader;
  459. public static function loadClassLoader(\$class)
  460. {
  461. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  462. require __DIR__ . '/ClassLoader.php';
  463. }
  464. }
  465. public static function getLoader()
  466. {
  467. if (null !== self::\$loader) {
  468. return self::\$loader;
  469. }
  470. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  471. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  472. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  473. HEADER;
  474. if ($useIncludePath) {
  475. $file .= <<<'INCLUDE_PATH'
  476. $includePaths = require __DIR__ . '/include_paths.php';
  477. $includePaths[] = get_include_path();
  478. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  479. INCLUDE_PATH;
  480. }
  481. $file .= <<<STATIC_INIT
  482. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  483. if (\$useStaticLoader) {
  484. require_once __DIR__ . '/autoload_static.php';
  485. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  486. } else {
  487. STATIC_INIT;
  488. if (!$this->classMapAuthoritative) {
  489. $file .= <<<'PSR04'
  490. $map = require __DIR__ . '/autoload_namespaces.php';
  491. foreach ($map as $namespace => $path) {
  492. $loader->set($namespace, $path);
  493. }
  494. $map = require __DIR__ . '/autoload_psr4.php';
  495. foreach ($map as $namespace => $path) {
  496. $loader->setPsr4($namespace, $path);
  497. }
  498. PSR04;
  499. }
  500. if ($useClassMap) {
  501. $file .= <<<'CLASSMAP'
  502. $classMap = require __DIR__ . '/autoload_classmap.php';
  503. if ($classMap) {
  504. $loader->addClassMap($classMap);
  505. }
  506. CLASSMAP;
  507. }
  508. $file .= " }\n\n";
  509. if ($this->classMapAuthoritative) {
  510. $file .= <<<'CLASSMAPAUTHORITATIVE'
  511. $loader->setClassMapAuthoritative(true);
  512. CLASSMAPAUTHORITATIVE;
  513. }
  514. if ($this->apcu) {
  515. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  516. $file .= <<<APCU
  517. \$loader->setApcuPrefix('$apcuPrefix');
  518. APCU;
  519. }
  520. if ($useGlobalIncludePath) {
  521. $file .= <<<'INCLUDEPATH'
  522. $loader->setUseIncludePath(true);
  523. INCLUDEPATH;
  524. }
  525. if ($targetDirLoader) {
  526. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  527. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  528. REGISTER_TARGET_DIR_AUTOLOAD;
  529. }
  530. $file .= <<<REGISTER_LOADER
  531. \$loader->register($prependAutoloader);
  532. REGISTER_LOADER;
  533. if ($useIncludeFiles) {
  534. $file .= <<<INCLUDE_FILES
  535. if (\$useStaticLoader) {
  536. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  537. } else {
  538. \$includeFiles = require __DIR__ . '/autoload_files.php';
  539. }
  540. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  541. composerRequire$suffix(\$fileIdentifier, \$file);
  542. }
  543. INCLUDE_FILES;
  544. }
  545. $file .= <<<METHOD_FOOTER
  546. return \$loader;
  547. }
  548. METHOD_FOOTER;
  549. $file .= $targetDirLoader;
  550. if ($useIncludeFiles) {
  551. return $file . <<<FOOTER
  552. }
  553. function composerRequire$suffix(\$fileIdentifier, \$file)
  554. {
  555. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  556. require \$file;
  557. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  558. }
  559. }
  560. FOOTER;
  561. }
  562. return $file . <<<FOOTER
  563. }
  564. FOOTER;
  565. }
  566. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  567. {
  568. $staticPhpVersion = 50600;
  569. $file = <<<HEADER
  570. <?php
  571. // autoload_static.php @generated by Composer
  572. namespace Composer\Autoload;
  573. class ComposerStaticInit$suffix
  574. {
  575. HEADER;
  576. $loader = new ClassLoader();
  577. $map = require $targetDir . '/autoload_namespaces.php';
  578. foreach ($map as $namespace => $path) {
  579. $loader->set($namespace, $path);
  580. }
  581. $map = require $targetDir . '/autoload_psr4.php';
  582. foreach ($map as $namespace => $path) {
  583. $loader->setPsr4($namespace, $path);
  584. }
  585. $classMap = require $targetDir . '/autoload_classmap.php';
  586. if ($classMap) {
  587. $loader->addClassMap($classMap);
  588. }
  589. $filesystem = new Filesystem();
  590. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  591. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  592. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  593. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  594. $initializer = '';
  595. $prefix = "\0Composer\Autoload\ClassLoader\0";
  596. $prefixLen = strlen($prefix);
  597. if (file_exists($targetDir . '/autoload_files.php')) {
  598. $maps = array('files' => require $targetDir . '/autoload_files.php');
  599. } else {
  600. $maps = array();
  601. }
  602. foreach ((array) $loader as $prop => $value) {
  603. if ($value && 0 === strpos($prop, $prefix)) {
  604. $maps[substr($prop, $prefixLen)] = $value;
  605. }
  606. }
  607. foreach ($maps as $prop => $value) {
  608. if (count($value) > 32767) {
  609. $staticPhpVersion = 70000;
  610. }
  611. $value = var_export($value, true);
  612. $value = str_replace($absoluteVendorPathCode, $vendorPathCode, $value);
  613. $value = str_replace($absoluteAppBaseDirCode, $appBaseDirCode, $value);
  614. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  615. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  616. if ('files' !== $prop) {
  617. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  618. }
  619. }
  620. return $file . <<<INITIALIZER
  621. public static function getInitializer(ClassLoader \$loader)
  622. {
  623. return \Closure::bind(function () use (\$loader) {
  624. $initializer
  625. }, null, ClassLoader::class);
  626. }
  627. }
  628. INITIALIZER;
  629. }
  630. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  631. {
  632. $autoloads = array();
  633. foreach ($packageMap as $item) {
  634. list($package, $installPath) = $item;
  635. $autoload = $package->getAutoload();
  636. if ($this->devMode && $package === $mainPackage) {
  637. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  638. }
  639. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  640. continue;
  641. }
  642. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  643. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  644. }
  645. foreach ($autoload[$type] as $namespace => $paths) {
  646. foreach ((array) $paths as $path) {
  647. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  648. if ($package === $mainPackage) {
  649. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  650. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  651. } else {
  652. $path = $package->getTargetDir() . '/' . $path;
  653. }
  654. }
  655. if ($type === 'exclude-from-classmap') {
  656. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  657. $path = str_replace('\\*\\*', '.+?', $path);
  658. $path = str_replace('\\*', '[^/]+?', $path);
  659. $updir = null;
  660. $path = preg_replace_callback(
  661. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  662. function ($matches) use (&$updir) {
  663. if (isset($matches[1])) {
  664. $updir = str_replace('\\.', '.', $matches[1]);
  665. }
  666. return '';
  667. },
  668. $path
  669. );
  670. if (empty($installPath)) {
  671. $installPath = strtr(getcwd(), '\\', '/');
  672. }
  673. $resolvedPath = realpath($installPath . '/' . $updir);
  674. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  675. continue;
  676. }
  677. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  678. if ($type === 'files') {
  679. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  680. continue;
  681. } elseif ($type === 'classmap') {
  682. $autoloads[] = $relativePath;
  683. continue;
  684. }
  685. $autoloads[$namespace][] = $relativePath;
  686. }
  687. }
  688. }
  689. return $autoloads;
  690. }
  691. protected function getFileIdentifier(PackageInterface $package, $path)
  692. {
  693. return md5($package->getName() . ':' . $path);
  694. }
  695. protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
  696. {
  697. $packages = array();
  698. $include = array();
  699. foreach ($packageMap as $item) {
  700. $package = $item[0];
  701. $name = $package->getName();
  702. $packages[$name] = $package;
  703. }
  704. $add = function (PackageInterface $package) use (&$add, $packages, &$include) {
  705. foreach ($package->getRequires() as $link) {
  706. $target = $link->getTarget();
  707. if (!isset($include[$target])) {
  708. $include[$target] = true;
  709. if (isset($packages[$target])) {
  710. $add($packages[$target]);
  711. }
  712. }
  713. }
  714. };
  715. $add($mainPackage);
  716. return array_filter(
  717. $packageMap,
  718. function ($item) use ($include) {
  719. $package = $item[0];
  720. foreach ($package->getNames() as $name) {
  721. if (isset($include[$name])) {
  722. return true;
  723. }
  724. }
  725. return false;
  726. }
  727. );
  728. }
  729. protected function sortPackageMap(array $packageMap)
  730. {
  731. $packages = array();
  732. $paths = array();
  733. $usageList = array();
  734. foreach ($packageMap as $item) {
  735. list($package, $path) = $item;
  736. $name = $package->getName();
  737. $packages[$name] = $package;
  738. $paths[$name] = $path;
  739. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  740. $target = $link->getTarget();
  741. $usageList[$target][] = $name;
  742. }
  743. }
  744. $computing = array();
  745. $computed = array();
  746. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  747. if (isset($computed[$name])) {
  748. return $computed[$name];
  749. }
  750. if (isset($computing[$name])) {
  751. return 0;
  752. }
  753. $computing[$name] = true;
  754. $weight = 0;
  755. if (isset($usageList[$name])) {
  756. foreach ($usageList[$name] as $user) {
  757. $weight -= 1 - $computeImportance($user);
  758. }
  759. }
  760. unset($computing[$name]);
  761. $computed[$name] = $weight;
  762. return $weight;
  763. };
  764. $weightList = array();
  765. foreach ($packages as $name => $package) {
  766. $weight = $computeImportance($name);
  767. $weightList[$name] = $weight;
  768. }
  769. $stable_sort = function (&$array) {
  770. static $transform, $restore;
  771. $i = 0;
  772. if (!$transform) {
  773. $transform = function (&$v, $k) use (&$i) {
  774. $v = array($v, ++$i, $k, $v);
  775. };
  776. $restore = function (&$v, $k) {
  777. $v = $v[3];
  778. };
  779. }
  780. array_walk($array, $transform);
  781. asort($array);
  782. array_walk($array, $restore);
  783. };
  784. $stable_sort($weightList);
  785. $sortedPackageMap = array();
  786. foreach (array_keys($weightList) as $name) {
  787. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  788. }
  789. return $sortedPackageMap;
  790. }
  791. protected function safeCopy($source, $target)
  792. {
  793. $source = fopen($source, 'r');
  794. $target = fopen($target, 'w+');
  795. stream_copy_to_stream($source, $target);
  796. fclose($source);
  797. fclose($target);
  798. }
  799. }
  800. <?php
  801. namespace Composer\Autoload;
  802. use Symfony\Component\Finder\Finder;
  803. use Composer\IO\IOInterface;
  804. use Composer\Util\Filesystem;
  805. class ClassMapGenerator
  806. {
  807. public static function dump($dirs, $file)
  808. {
  809. $maps = array();
  810. foreach ($dirs as $dir) {
  811. $maps = array_merge($maps, static::createMap($dir));
  812. }
  813. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  814. }
  815. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  816. {
  817. if (is_string($path)) {
  818. if (is_file($path)) {
  819. $path = array(new \SplFileInfo($path));
  820. } elseif (is_dir($path)) {
  821. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  822. } else {
  823. throw new \RuntimeException(
  824. 'Could not scan for classes inside "'.$path.
  825. '" which does not appear to be a file nor a folder'
  826. );
  827. }
  828. }
  829. $map = array();
  830. $filesystem = new Filesystem();
  831. $cwd = realpath(getcwd());
  832. foreach ($path as $file) {
  833. $filePath = $file->getPathname();
  834. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  835. continue;
  836. }
  837. if (!$filesystem->isAbsolutePath($filePath)) {
  838. $filePath = $cwd . '/' . $filePath;
  839. $filePath = $filesystem->normalizePath($filePath);
  840. } else {
  841. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  842. }
  843. if ($blacklist && preg_match($blacklist, strtr(realpath($filePath), '\\', '/'))) {
  844. continue;
  845. }
  846. if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
  847. continue;
  848. }
  849. $classes = self::findClasses($filePath);
  850. foreach ($classes as $class) {
  851. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  852. continue;
  853. }
  854. if (!isset($map[$class])) {
  855. $map[$class] = $filePath;
  856. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  857. $io->writeError(
  858. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  859. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  860. );
  861. }
  862. }
  863. }
  864. return $map;
  865. }
  866. private static function findClasses($path)
  867. {
  868. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  869. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  870. $extraTypes .= '|enum';
  871. }
  872. $contents = @php_strip_whitespace($path);
  873. if (!$contents) {
  874. if (!file_exists($path)) {
  875. $message = 'File at "%s" does not exist, check your classmap definitions';
  876. } elseif (!is_readable($path)) {
  877. $message = 'File at "%s" is not readable, check its permissions';
  878. } elseif ('' === trim(file_get_contents($path))) {
  879. return array();
  880. } else {
  881. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  882. }
  883. $error = error_get_last();
  884. if (isset($error['message'])) {
  885. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  886. }
  887. throw new \RuntimeException(sprintf($message, $path));
  888. }
  889. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  890. return array();
  891. }
  892. $contents = preg_replace('{<<<[ \t]*([\'"]?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)(?:\s*)\\2(?=\s+|[;,.)])}s', 'null', $contents);
  893. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  894. if (substr($contents, 0, 2) !== '<?') {
  895. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  896. if ($replacements === 0) {
  897. return array();
  898. }
  899. }
  900. $contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
  901. $pos = strrpos($contents, '?>');
  902. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  903. $contents = substr($contents, 0, $pos);
  904. }
  905. if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
  906. $contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
  907. }
  908. preg_match_all('{
  909. (?:
  910. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  911. | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
  912. )
  913. }ix', $contents, $matches);
  914. $classes = array();
  915. $namespace = '';
  916. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  917. if (!empty($matches['ns'][$i])) {
  918. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  919. } else {
  920. $name = $matches['name'][$i];
  921. if ($name === 'extends' || $name === 'implements') {
  922. continue;
  923. }
  924. if ($name[0] === ':') {
  925. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  926. } elseif ($matches['type'][$i] === 'enum') {
  927. $name = rtrim($name, ':');
  928. }
  929. $classes[] = ltrim($namespace . $name, '\\');
  930. }
  931. }
  932. return $classes;
  933. }
  934. }
  935. <?php
  936. namespace Composer;
  937. use Composer\IO\IOInterface;
  938. use Composer\Util\Filesystem;
  939. use Composer\Util\Silencer;
  940. use Symfony\Component\Finder\Finder;
  941. class Cache
  942. {
  943. private static $cacheCollected = false;
  944. private $io;
  945. private $root;
  946. private $enabled = true;
  947. private $whitelist;
  948. private $filesystem;
  949. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  950. {
  951. $this->io = $io;
  952. $this->root = rtrim($cacheDir, '/\\') . '/';
  953. $this->whitelist = $whitelist;
  954. $this->filesystem = $filesystem ?: new Filesystem();
  955. if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
  956. $this->enabled = false;
  957. return;
  958. }
  959. if (
  960. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  961. || !is_writable($this->root)
  962. ) {
  963. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  964. $this->enabled = false;
  965. }
  966. }
  967. public function isEnabled()
  968. {
  969. return $this->enabled;
  970. }
  971. public function getRoot()
  972. {
  973. return $this->root;
  974. }
  975. public function read($file)
  976. {
  977. if ($this->enabled) {
  978. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  979. if (file_exists($this->root . $file)) {
  980. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  981. return file_get_contents($this->root . $file);
  982. }
  983. }
  984. return false;
  985. }
  986. public function write($file, $contents)
  987. {
  988. if ($this->enabled) {
  989. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  990. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  991. try {
  992. return file_put_contents($this->root . $file, $contents);
  993. } catch (\ErrorException $e) {
  994. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  995. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  996. unlink($this->root . $file);
  997. $message = sprintf(
  998. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  999. $this->root . $file,
  1000. $m[1],
  1001. $m[2],
  1002. @disk_free_space($this->root . dirname($file))
  1003. );
  1004. $this->io->writeError($message);
  1005. return false;
  1006. }
  1007. throw $e;
  1008. }
  1009. }
  1010. return false;
  1011. }
  1012. public function copyFrom($file, $source)
  1013. {
  1014. if ($this->enabled) {
  1015. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1016. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1017. if (!file_exists($source)) {
  1018. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1019. } elseif ($this->io->isDebug()) {
  1020. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1021. }
  1022. return copy($source, $this->root . $file);
  1023. }
  1024. return false;
  1025. }
  1026. public function copyTo($file, $target)
  1027. {
  1028. if ($this->enabled) {
  1029. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1030. if (file_exists($this->root . $file)) {
  1031. try {
  1032. touch($this->root . $file, filemtime($this->root . $file), time());
  1033. } catch (\ErrorException $e) {
  1034. Silencer::call('touch', $this->root . $file);
  1035. }
  1036. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1037. return copy($this->root . $file, $target);
  1038. }
  1039. }
  1040. return false;
  1041. }
  1042. public function gcIsNecessary()
  1043. {
  1044. return (!self::$cacheCollected && !mt_rand(0, 50));
  1045. }
  1046. public function remove($file)
  1047. {
  1048. if ($this->enabled) {
  1049. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1050. if (file_exists($this->root . $file)) {
  1051. return $this->filesystem->unlink($this->root . $file);
  1052. }
  1053. }
  1054. return false;
  1055. }
  1056. public function clear()
  1057. {
  1058. if ($this->enabled) {
  1059. return $this->filesystem->removeDirectory($this->root);
  1060. }
  1061. return false;
  1062. }
  1063. public function gc($ttl, $maxSize)
  1064. {
  1065. if ($this->enabled) {
  1066. $expire = new \DateTime();
  1067. $expire->modify('-'.$ttl.' seconds');
  1068. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1069. foreach ($finder as $file) {
  1070. $this->filesystem->unlink($file->getPathname());
  1071. }
  1072. $totalSize = $this->filesystem->size($this->root);
  1073. if ($totalSize > $maxSize) {
  1074. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1075. while ($totalSize > $maxSize && $iterator->valid()) {
  1076. $filepath = $iterator->current()->getPathname();
  1077. $totalSize -= $this->filesystem->size($filepath);
  1078. $this->filesystem->unlink($filepath);
  1079. $iterator->next();
  1080. }
  1081. }
  1082. self::$cacheCollected = true;
  1083. return true;
  1084. }
  1085. return false;
  1086. }
  1087. public function sha1($file)
  1088. {
  1089. if ($this->enabled) {
  1090. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1091. if (file_exists($this->root . $file)) {
  1092. return sha1_file($this->root . $file);
  1093. }
  1094. }
  1095. return false;
  1096. }
  1097. public function sha256($file)
  1098. {
  1099. if ($this->enabled) {
  1100. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1101. if (file_exists($this->root . $file)) {
  1102. return hash_file('sha256', $this->root . $file);
  1103. }
  1104. }
  1105. return false;
  1106. }
  1107. protected function getFinder()
  1108. {
  1109. return Finder::create()->in($this->root)->files();
  1110. }
  1111. }
  1112. <?php
  1113. namespace Composer\Command;
  1114. use Symfony\Component\Console\Input\InputInterface;
  1115. use Symfony\Component\Console\Output\OutputInterface;
  1116. class AboutCommand extends BaseCommand
  1117. {
  1118. protected function configure()
  1119. {
  1120. $this
  1121. ->setName('about')
  1122. ->setDescription('Shows the short information about Composer.')
  1123. ->setHelp(
  1124. <<<EOT
  1125. <info>php composer.phar about</info>
  1126. EOT
  1127. )
  1128. ;
  1129. }
  1130. protected function execute(InputInterface $input, OutputInterface $output)
  1131. {
  1132. $this->getIO()->write(
  1133. <<<EOT
  1134. <info>Composer - Dependency Manager for PHP</info>
  1135. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1136. See https://getcomposer.org/ for more information.</comment>
  1137. EOT
  1138. );
  1139. }
  1140. }
  1141. <?php
  1142. namespace Composer\Command;
  1143. use Composer\Factory;
  1144. use Composer\IO\IOInterface;
  1145. use Composer\Config;
  1146. use Composer\Composer;
  1147. use Composer\Repository\CompositeRepository;
  1148. use Composer\Repository\RepositoryFactory;
  1149. use Composer\Script\ScriptEvents;
  1150. use Composer\Plugin\CommandEvent;
  1151. use Composer\Plugin\PluginEvents;
  1152. use Composer\Util\Filesystem;
  1153. use Symfony\Component\Console\Input\InputArgument;
  1154. use Symfony\Component\Console\Input\InputInterface;
  1155. use Symfony\Component\Console\Input\InputOption;
  1156. use Symfony\Component\Console\Output\OutputInterface;
  1157. class ArchiveCommand extends BaseCommand
  1158. {
  1159. protected function configure()
  1160. {
  1161. $this
  1162. ->setName('archive')
  1163. ->setDescription('Creates an archive of this composer package.')
  1164. ->setDefinition(array(
  1165. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1166. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1167. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1168. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1169. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1170. .' Note that the format will be appended.'),
  1171. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1172. ))
  1173. ->setHelp(
  1174. <<<EOT
  1175. The <info>archive</info> command creates an archive of the specified format
  1176. containing the files and directories of the Composer project or the specified
  1177. package in the specified version and writes it to the specified directory.
  1178. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1179. Read more at https://getcomposer.org/doc/03-cli.md#archive
  1180. EOT
  1181. )
  1182. ;
  1183. }
  1184. protected function execute(InputInterface $input, OutputInterface $output)
  1185. {
  1186. $config = Factory::createConfig();
  1187. $composer = $this->getComposer(false);
  1188. if ($composer) {
  1189. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1190. $eventDispatcher = $composer->getEventDispatcher();
  1191. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1192. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1193. }
  1194. if (null === $input->getOption('format')) {
  1195. $input->setOption('format', $config->get('archive-format'));
  1196. }
  1197. if (null === $input->getOption('dir')) {
  1198. $input->setOption('dir', $config->get('archive-dir'));
  1199. }
  1200. $returnCode = $this->archive(
  1201. $this->getIO(),
  1202. $config,
  1203. $input->getArgument('package'),
  1204. $input->getArgument('version'),
  1205. $input->getOption('format'),
  1206. $input->getOption('dir'),
  1207. $input->getOption('file'),
  1208. $input->getOption('ignore-filters'),
  1209. $composer
  1210. );
  1211. if (0 === $returnCode && $composer) {
  1212. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1213. }
  1214. return $returnCode;
  1215. }
  1216. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1217. {
  1218. if ($composer) {
  1219. $archiveManager = $composer->getArchiveManager();
  1220. } else {
  1221. $factory = new Factory;
  1222. $downloadManager = $factory->createDownloadManager($io, $config);
  1223. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1224. }
  1225. if ($packageName) {
  1226. $package = $this->selectPackage($io, $packageName, $version);
  1227. if (!$package) {
  1228. return 1;
  1229. }
  1230. } else {
  1231. $package = $this->getComposer()->getPackage();
  1232. }
  1233. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1234. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1235. $fs = new Filesystem;
  1236. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1237. $io->writeError('Created: ', false);
  1238. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1239. return 0;
  1240. }
  1241. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1242. {
  1243. $io->writeError('<info>Searching for the specified package.</info>');
  1244. if ($composer = $this->getComposer(false)) {
  1245. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1246. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1247. } else {
  1248. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1249. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1250. $repo = new CompositeRepository($defaultRepos);
  1251. }
  1252. $packages = $repo->findPackages($packageName, $version);
  1253. if (count($packages) > 1) {
  1254. $package = reset($packages);
  1255. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1256. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1257. return $p->getPrettyString();
  1258. }, $packages)).'.');
  1259. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1260. } elseif ($packages) {
  1261. $package = reset($packages);
  1262. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1263. } else {
  1264. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1265. return false;
  1266. }
  1267. return $package;
  1268. }
  1269. }
  1270. <?php
  1271. namespace Composer\Command;
  1272. use Composer\Composer;
  1273. use Composer\Config;
  1274. use Composer\Console\Application;
  1275. use Composer\Factory;
  1276. use Composer\IO\IOInterface;
  1277. use Composer\IO\NullIO;
  1278. use Composer\Plugin\PreCommandRunEvent;
  1279. use Composer\Plugin\PluginEvents;
  1280. use Symfony\Component\Console\Input\InputInterface;
  1281. use Symfony\Component\Console\Output\OutputInterface;
  1282. use Symfony\Component\Console\Command\Command;
  1283. abstract class BaseCommand extends Command
  1284. {
  1285. private $composer;
  1286. private $io;
  1287. public function getComposer($required = true, $disablePlugins = null)
  1288. {
  1289. if (null === $this->composer) {
  1290. $application = $this->getApplication();
  1291. if ($application instanceof Application) {
  1292. $this->composer = $application->getComposer($required, $disablePlugins);
  1293. } elseif ($required) {
  1294. throw new \RuntimeException(
  1295. 'Could not create a Composer\Composer instance, you must inject '.
  1296. 'one if this command is not used with a Composer\Console\Application instance'
  1297. );
  1298. }
  1299. }
  1300. return $this->composer;
  1301. }
  1302. public function setComposer(Composer $composer)
  1303. {
  1304. $this->composer = $composer;
  1305. }
  1306. public function resetComposer()
  1307. {
  1308. $this->composer = null;
  1309. $this->getApplication()->resetComposer();
  1310. }
  1311. public function isProxyCommand()
  1312. {
  1313. return false;
  1314. }
  1315. public function getIO()
  1316. {
  1317. if (null === $this->io) {
  1318. $application = $this->getApplication();
  1319. if ($application instanceof Application) {
  1320. $this->io = $application->getIO();
  1321. } else {
  1322. $this->io = new NullIO();
  1323. }
  1324. }
  1325. return $this->io;
  1326. }
  1327. public function setIO(IOInterface $io)
  1328. {
  1329. $this->io = $io;
  1330. }
  1331. protected function initialize(InputInterface $input, OutputInterface $output)
  1332. {
  1333. $disablePlugins = $input->hasParameterOption('--no-plugins');
  1334. $composer = $this->getComposer(false, $disablePlugins);
  1335. if (null === $composer) {
  1336. $composer = Factory::createGlobal($this->getIO(), $disablePlugins);
  1337. }
  1338. if ($composer) {
  1339. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1340. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1341. }
  1342. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1343. $input->setOption('no-progress', true);
  1344. }
  1345. parent::initialize($input, $output);
  1346. }
  1347. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1348. {
  1349. $preferSource = false;
  1350. $preferDist = false;
  1351. switch ($config->get('preferred-install')) {
  1352. case 'source':
  1353. $preferSource = true;
  1354. break;
  1355. case 'dist':
  1356. $preferDist = true;
  1357. break;
  1358. case 'auto':
  1359. default:
  1360. break;
  1361. }
  1362. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1363. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1364. $preferDist = $input->getOption('prefer-dist');
  1365. }
  1366. return array($preferSource, $preferDist);
  1367. }
  1368. }
  1369. <?php
  1370. namespace Composer\Command;
  1371. use Composer\DependencyResolver\Pool;
  1372. use Composer\Package\Link;
  1373. use Composer\Package\PackageInterface;
  1374. use Composer\Repository\ArrayRepository;
  1375. use Composer\Repository\CompositeRepository;
  1376. use Composer\Repository\PlatformRepository;
  1377. use Composer\Repository\RepositoryFactory;
  1378. use Composer\Plugin\CommandEvent;
  1379. use Composer\Plugin\PluginEvents;
  1380. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1381. use Composer\Package\Version\VersionParser;
  1382. use Symfony\Component\Console\Helper\Table;
  1383. use Symfony\Component\Console\Input\InputArgument;
  1384. use Symfony\Component\Console\Input\InputInterface;
  1385. use Symfony\Component\Console\Input\InputOption;
  1386. use Symfony\Component\Console\Output\OutputInterface;
  1387. class BaseDependencyCommand extends BaseCommand
  1388. {
  1389. const ARGUMENT_PACKAGE = 'package';
  1390. const ARGUMENT_CONSTRAINT = 'constraint';
  1391. const OPTION_RECURSIVE = 'recursive';
  1392. const OPTION_TREE = 'tree';
  1393. protected $colors;
  1394. protected function configure()
  1395. {
  1396. $this->setDefinition(array(
  1397. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1398. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1399. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1400. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1401. ));
  1402. }
  1403. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1404. {
  1405. $composer = $this->getComposer();
  1406. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1407. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1408. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1409. $repository = new CompositeRepository(array(
  1410. new ArrayRepository(array($composer->getPackage())),
  1411. $composer->getRepositoryManager()->getLocalRepository(),
  1412. new PlatformRepository(array(), $platformOverrides),
  1413. ));
  1414. $pool = new Pool();
  1415. $pool->addRepository($repository);
  1416. list($needle, $textConstraint) = array_pad(
  1417. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1418. 2,
  1419. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1420. );
  1421. $packages = $pool->whatProvides(strtolower($needle));
  1422. if (empty($packages)) {
  1423. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1424. }
  1425. if (!$repository->findPackage($needle, $textConstraint)) {
  1426. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1427. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1428. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1429. }
  1430. }
  1431. $needles = array($needle);
  1432. if ($inverted) {
  1433. foreach ($packages as $package) {
  1434. $needles = array_merge($needles, array_map(function (Link $link) {
  1435. return $link->getTarget();
  1436. }, $package->getReplaces()));
  1437. }
  1438. }
  1439. if ('*' !== $textConstraint) {
  1440. $versionParser = new VersionParser();
  1441. $constraint = $versionParser->parseConstraints($textConstraint);
  1442. } else {
  1443. $constraint = null;
  1444. }
  1445. $renderTree = $input->getOption(self::OPTION_TREE);
  1446. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1447. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1448. if (empty($results)) {
  1449. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1450. $this->getIO()->writeError(sprintf(
  1451. '<info>There is no installed package depending on "%s"%s</info>',
  1452. $needle,
  1453. $extra
  1454. ));
  1455. } elseif ($renderTree) {
  1456. $this->initStyles($output);
  1457. $root = $packages[0];
  1458. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1459. $this->printTree($results);
  1460. } else {
  1461. $this->printTable($output, $results);
  1462. }
  1463. return 0;
  1464. }
  1465. protected function printTable(OutputInterface $output, $results)
  1466. {
  1467. $table = array();
  1468. $doubles = array();
  1469. do {
  1470. $queue = array();
  1471. $rows = array();
  1472. foreach ($results as $result) {
  1473. list($package, $link, $children) = $result;
  1474. $unique = (string) $link;
  1475. if (isset($doubles[$unique])) {
  1476. continue;
  1477. }
  1478. $doubles[$unique] = true;
  1479. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1480. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1481. if ($children) {
  1482. $queue = array_merge($queue, $children);
  1483. }
  1484. }
  1485. $results = $queue;
  1486. $table = array_merge($rows, $table);
  1487. } while (!empty($results));
  1488. $renderer = new Table($output);
  1489. $renderer->setStyle('compact');
  1490. $rendererStyle = $renderer->getStyle();
  1491. $rendererStyle->setVerticalBorderChar('');
  1492. $rendererStyle->setCellRowContentFormat('%s ');
  1493. $renderer->setRows($table)->render();
  1494. }
  1495. protected function initStyles(OutputInterface $output)
  1496. {
  1497. $this->colors = array(
  1498. 'green',
  1499. 'yellow',
  1500. 'cyan',
  1501. 'magenta',
  1502. 'blue',
  1503. );
  1504. foreach ($this->colors as $color) {
  1505. $style = new OutputFormatterStyle($color);
  1506. $output->getFormatter()->setStyle($color, $style);
  1507. }
  1508. }
  1509. protected function printTree($results, $prefix = '', $level = 1)
  1510. {
  1511. $count = count($results);
  1512. $idx = 0;
  1513. foreach ($results as $result) {
  1514. list($package, $link, $children) = $result;
  1515. $color = $this->colors[$level % count($this->colors)];
  1516. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1517. $isLast = (++$idx == $count);
  1518. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1519. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1520. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1521. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1522. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1523. if ($children) {
  1524. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1525. }
  1526. }
  1527. }
  1528. private function writeTreeLine($line)
  1529. {
  1530. $io = $this->getIO();
  1531. if (!$io->isDecorated()) {
  1532. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1533. }
  1534. $io->write($line);
  1535. }
  1536. }
  1537. <?php
  1538. namespace Composer\Command;
  1539. use Composer\Package\Link;
  1540. use Composer\Package\PackageInterface;
  1541. use Composer\Semver\Constraint\Constraint;
  1542. use Symfony\Component\Console\Helper\Table;
  1543. use Symfony\Component\Console\Input\InputInterface;
  1544. use Symfony\Component\Console\Input\InputOption;
  1545. use Symfony\Component\Console\Output\OutputInterface;
  1546. use Composer\Repository\PlatformRepository;
  1547. class CheckPlatformReqsCommand extends BaseCommand
  1548. {
  1549. protected function configure()
  1550. {
  1551. $this->setName('check-platform-reqs')
  1552. ->setDescription('Check that platform requirements are satisfied.')
  1553. ->setDefinition(array(
  1554. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
  1555. ))
  1556. ->setHelp(
  1557. <<<EOT
  1558. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1559. <info>php composer.phar check-platform-reqs</info>
  1560. EOT
  1561. );
  1562. }
  1563. protected function execute(InputInterface $input, OutputInterface $output)
  1564. {
  1565. $composer = $this->getComposer();
  1566. $requires = $composer->getPackage()->getRequires();
  1567. if ($input->getOption('no-dev')) {
  1568. $dependencies = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'))->getPackages();
  1569. } else {
  1570. $dependencies = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  1571. $requires += $composer->getPackage()->getDevRequires();
  1572. }
  1573. foreach ($requires as $require => $link) {
  1574. $requires[$require] = array($link);
  1575. }
  1576. foreach ($dependencies as $package) {
  1577. foreach ($package->getRequires() as $require => $link) {
  1578. $requires[$require][] = $link;
  1579. }
  1580. }
  1581. ksort($requires);
  1582. $platformRepo = new PlatformRepository(array(), array());
  1583. $currentPlatformPackages = $platformRepo->getPackages();
  1584. $currentPlatformPackageMap = array();
  1585. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1586. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1587. }
  1588. $results = array();
  1589. $exitCode = 0;
  1590. foreach ($requires as $require => $links) {
  1591. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1592. if (isset($currentPlatformPackageMap[$require])) {
  1593. $pass = true;
  1594. $version = $currentPlatformPackageMap[$require]->getVersion();
  1595. foreach ($links as $link) {
  1596. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1597. $results[] = array(
  1598. $currentPlatformPackageMap[$require]->getPrettyName(),
  1599. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1600. $link,
  1601. '<error>failed</error>',
  1602. );
  1603. $pass = false;
  1604. $exitCode = max($exitCode, 1);
  1605. }
  1606. }
  1607. if ($pass) {
  1608. $results[] = array(
  1609. $currentPlatformPackageMap[$require]->getPrettyName(),
  1610. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1611. null,
  1612. '<info>success</info>',
  1613. );
  1614. }
  1615. } else {
  1616. $results[] = array(
  1617. $require,
  1618. 'n/a',
  1619. $links[0],
  1620. '<error>missing</error>',
  1621. );
  1622. $exitCode = max($exitCode, 2);
  1623. }
  1624. }
  1625. }
  1626. $this->printTable($output, $results);
  1627. return $exitCode;
  1628. }
  1629. protected function printTable(OutputInterface $output, $results)
  1630. {
  1631. $table = array();
  1632. $rows = array();
  1633. foreach ($results as $result) {
  1634. list($platformPackage, $version, $link, $status) = $result;
  1635. $rows[] = array(
  1636. $platformPackage,
  1637. $version,
  1638. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1639. $status,
  1640. );
  1641. }
  1642. $table = array_merge($rows, $table);
  1643. $renderer = new Table($output);
  1644. $renderer->setStyle('compact');
  1645. $rendererStyle = $renderer->getStyle();
  1646. $rendererStyle->setVerticalBorderChar('');
  1647. $rendererStyle->setCellRowContentFormat('%s ');
  1648. $renderer->setRows($table)->render();
  1649. }
  1650. }
  1651. <?php
  1652. namespace Composer\Command;
  1653. use Composer\Cache;
  1654. use Composer\Factory;
  1655. use Symfony\Component\Console\Input\InputInterface;
  1656. use Symfony\Component\Console\Output\OutputInterface;
  1657. class ClearCacheCommand extends BaseCommand
  1658. {
  1659. protected function configure()
  1660. {
  1661. $this
  1662. ->setName('clear-cache')
  1663. ->setAliases(array('clearcache'))
  1664. ->setDescription('Clears composer\'s internal package cache.')
  1665. ->setHelp(
  1666. <<<EOT
  1667. The <info>clear-cache</info> deletes all cached packages from composer's
  1668. cache directory.
  1669. Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-
  1670. EOT
  1671. )
  1672. ;
  1673. }
  1674. protected function execute(InputInterface $input, OutputInterface $output)
  1675. {
  1676. $config = Factory::createConfig();
  1677. $io = $this->getIO();
  1678. $cachePaths = array(
  1679. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1680. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1681. 'cache-files-dir' => $config->get('cache-files-dir'),
  1682. 'cache-dir' => $config->get('cache-dir'),
  1683. );
  1684. foreach ($cachePaths as $key => $cachePath) {
  1685. $cachePath = realpath($cachePath);
  1686. if (!$cachePath) {
  1687. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1688. continue;
  1689. }
  1690. $cache = new Cache($io, $cachePath);
  1691. if (!$cache->isEnabled()) {
  1692. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1693. continue;
  1694. }
  1695. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1696. $cache->clear();
  1697. }
  1698. $io->writeError('<info>All caches cleared.</info>');
  1699. }
  1700. }
  1701. <?php
  1702. namespace Composer\Command;
  1703. use Composer\Util\Platform;
  1704. use Composer\Util\Silencer;
  1705. use Symfony\Component\Console\Input\InputInterface;
  1706. use Symfony\Component\Console\Input\InputArgument;
  1707. use Symfony\Component\Console\Input\InputOption;
  1708. use Symfony\Component\Console\Output\OutputInterface;
  1709. use Composer\Config;
  1710. use Composer\Config\JsonConfigSource;
  1711. use Composer\Factory;
  1712. use Composer\IO\IOInterface;
  1713. use Composer\Json\JsonFile;
  1714. use Composer\Semver\VersionParser;
  1715. use Composer\Package\BasePackage;
  1716. class ConfigCommand extends BaseCommand
  1717. {
  1718. protected $config;
  1719. protected $configFile;
  1720. protected $configSource;
  1721. protected $authConfigFile;
  1722. protected $authConfigSource;
  1723. protected function configure()
  1724. {
  1725. $this
  1726. ->setName('config')
  1727. ->setDescription('Sets config options.')
  1728. ->setDefinition(array(
  1729. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1730. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1731. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1732. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1733. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1734. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1735. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1736. new InputArgument('setting-key', null, 'Setting key'),
  1737. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1738. ))
  1739. ->setHelp(
  1740. <<<EOT
  1741. This command allows you to edit composer config settings and repositories
  1742. in either the local composer.json file or the global config.json file.
  1743. Additionally it lets you edit most properties in the local composer.json.
  1744. To set a config setting:
  1745. <comment>%command.full_name% bin-dir bin/</comment>
  1746. To read a config setting:
  1747. <comment>%command.full_name% bin-dir</comment>
  1748. Outputs: <info>bin</info>
  1749. To edit the global config.json file:
  1750. <comment>%command.full_name% --global</comment>
  1751. To add a repository:
  1752. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1753. To remove a repository (repo is a short alias for repositories):
  1754. <comment>%command.full_name% --unset repo.foo</comment>
  1755. To disable packagist:
  1756. <comment>%command.full_name% repo.packagist false</comment>
  1757. You can alter repositories in the global config.json file by passing in the
  1758. <info>--global</info> option.
  1759. To edit the file in an external editor:
  1760. <comment>%command.full_name% --editor</comment>
  1761. To choose your editor you can set the "EDITOR" env variable.
  1762. To get a list of configuration values in the file:
  1763. <comment>%command.full_name% --list</comment>
  1764. You can always pass more than one option. As an example, if you want to edit the
  1765. global config.json file.
  1766. <comment>%command.full_name% --editor --global</comment>
  1767. Read more at https://getcomposer.org/doc/03-cli.md#config
  1768. EOT
  1769. )
  1770. ;
  1771. }
  1772. protected function initialize(InputInterface $input, OutputInterface $output)
  1773. {
  1774. parent::initialize($input, $output);
  1775. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1776. throw new \RuntimeException('--file and --global can not be combined');
  1777. }
  1778. $io = $this->getIO();
  1779. $this->config = Factory::createConfig($io);
  1780. $configFile = $input->getOption('global')
  1781. ? ($this->config->get('home') . '/config.json')
  1782. : ($input->getOption('file') ?: Factory::getComposerFile());
  1783. if (
  1784. ($configFile === 'composer.json' || $configFile === './composer.json')
  1785. && !file_exists($configFile)
  1786. && realpath(getcwd()) === realpath($this->config->get('home'))
  1787. ) {
  1788. file_put_contents($configFile, "{\n}\n");
  1789. }
  1790. $this->configFile = new JsonFile($configFile, null, $io);
  1791. $this->configSource = new JsonConfigSource($this->configFile);
  1792. $authConfigFile = $input->getOption('global')
  1793. ? ($this->config->get('home') . '/auth.json')
  1794. : dirname(realpath($configFile)) . '/auth.json';
  1795. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1796. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1797. if ($input->getOption('global') && !$this->configFile->exists()) {
  1798. touch($this->configFile->getPath());
  1799. $this->configFile->write(array('config' => new \ArrayObject));
  1800. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1801. }
  1802. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1803. touch($this->authConfigFile->getPath());
  1804. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1805. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1806. }
  1807. if (!$this->configFile->exists()) {
  1808. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1809. }
  1810. }
  1811. protected function execute(InputInterface $input, OutputInterface $output)
  1812. {
  1813. if ($input->getOption('editor')) {
  1814. $editor = escapeshellcmd(getenv('EDITOR'));
  1815. if (!$editor) {
  1816. if (Platform::isWindows()) {
  1817. $editor = 'notepad';
  1818. } else {
  1819. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1820. if (exec('which '.$candidate)) {
  1821. $editor = $candidate;
  1822. break;
  1823. }
  1824. }
  1825. }
  1826. }
  1827. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1828. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1829. return 0;
  1830. }
  1831. if (!$input->getOption('global')) {
  1832. $this->config->merge($this->configFile->read());
  1833. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1834. }
  1835. if ($input->getOption('list')) {
  1836. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1837. return 0;
  1838. }
  1839. $settingKey = $input->getArgument('setting-key');
  1840. if (!$settingKey) {
  1841. return 0;
  1842. }
  1843. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1844. throw new \RuntimeException('You can not combine a setting value with --unset');
  1845. }
  1846. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1847. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1848. $rawData = $this->configFile->read();
  1849. $data = $this->config->all();
  1850. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1851. if (!isset($matches[1]) || $matches[1] === '') {
  1852. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1853. } else {
  1854. if (!isset($data['repositories'][$matches[1]])) {
  1855. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1856. }
  1857. $value = $data['repositories'][$matches[1]];
  1858. }
  1859. } elseif (strpos($settingKey, '.')) {
  1860. $bits = explode('.', $settingKey);
  1861. if ($bits[0] === 'extra') {
  1862. $data = $rawData;
  1863. } else {
  1864. $data = $data['config'];
  1865. }
  1866. $match = false;
  1867. foreach ($bits as $bit) {
  1868. $key = isset($key) ? $key.'.'.$bit : $bit;
  1869. $match = false;
  1870. if (isset($data[$key])) {
  1871. $match = true;
  1872. $data = $data[$key];
  1873. unset($key);
  1874. }
  1875. }
  1876. if (!$match) {
  1877. throw new \RuntimeException($settingKey.' is not defined.');
  1878. }
  1879. $value = $data;
  1880. } elseif (isset($data['config'][$settingKey])) {
  1881. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1882. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1883. $value = $rawData[$settingKey];
  1884. } else {
  1885. throw new \RuntimeException($settingKey.' is not defined');
  1886. }
  1887. if (is_array($value)) {
  1888. $value = json_encode($value);
  1889. }
  1890. $this->getIO()->write($value, true, IOInterface::QUIET);
  1891. return 0;
  1892. }
  1893. $values = $input->getArgument('setting-value');
  1894. $booleanValidator = function ($val) {
  1895. return in_array($val, array('true', 'false', '1', '0'), true);
  1896. };
  1897. $booleanNormalizer = function ($val) {
  1898. return $val !== 'false' && (bool) $val;
  1899. };
  1900. $uniqueConfigValues = array(
  1901. 'process-timeout' => array('is_numeric', 'intval'),
  1902. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1903. 'preferred-install' => array(
  1904. function ($val) {
  1905. return in_array($val, array('auto', 'source', 'dist'), true);
  1906. },
  1907. function ($val) {
  1908. return $val;
  1909. },
  1910. ),
  1911. 'store-auths' => array(
  1912. function ($val) {
  1913. return in_array($val, array('true', 'false', 'prompt'), true);
  1914. },
  1915. function ($val) {
  1916. if ('prompt' === $val) {
  1917. return 'prompt';
  1918. }
  1919. return $val !== 'false' && (bool) $val;
  1920. },
  1921. ),
  1922. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1923. 'vendor-dir' => array('is_string', function ($val) {
  1924. return $val;
  1925. }),
  1926. 'bin-dir' => array('is_string', function ($val) {
  1927. return $val;
  1928. }),
  1929. 'archive-dir' => array('is_string', function ($val) {
  1930. return $val;
  1931. }),
  1932. 'archive-format' => array('is_string', function ($val) {
  1933. return $val;
  1934. }),
  1935. 'data-dir' => array('is_string', function ($val) {
  1936. return $val;
  1937. }),
  1938. 'cache-dir' => array('is_string', function ($val) {
  1939. return $val;
  1940. }),
  1941. 'cache-files-dir' => array('is_string', function ($val) {
  1942. return $val;
  1943. }),
  1944. 'cache-repo-dir' => array('is_string', function ($val) {
  1945. return $val;
  1946. }),
  1947. 'cache-vcs-dir' => array('is_string', function ($val) {
  1948. return $val;
  1949. }),
  1950. 'cache-ttl' => array('is_numeric', 'intval'),
  1951. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1952. 'cache-files-maxsize' => array(
  1953. function ($val) {
  1954. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  1955. },
  1956. function ($val) {
  1957. return $val;
  1958. },
  1959. ),
  1960. 'bin-compat' => array(
  1961. function ($val) {
  1962. return in_array($val, array('auto', 'full'));
  1963. },
  1964. function ($val) {
  1965. return $val;
  1966. },
  1967. ),
  1968. 'discard-changes' => array(
  1969. function ($val) {
  1970. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  1971. },
  1972. function ($val) {
  1973. if ('stash' === $val) {
  1974. return 'stash';
  1975. }
  1976. return $val !== 'false' && (bool) $val;
  1977. },
  1978. ),
  1979. 'autoloader-suffix' => array('is_string', function ($val) {
  1980. return $val === 'null' ? null : $val;
  1981. }),
  1982. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1983. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1984. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1985. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  1986. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1987. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1988. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  1989. 'cafile' => array(
  1990. function ($val) {
  1991. return file_exists($val) && is_readable($val);
  1992. },
  1993. function ($val) {
  1994. return $val === 'null' ? null : $val;
  1995. },
  1996. ),
  1997. 'capath' => array(
  1998. function ($val) {
  1999. return is_dir($val) && is_readable($val);
  2000. },
  2001. function ($val) {
  2002. return $val === 'null' ? null : $val;
  2003. },
  2004. ),
  2005. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  2006. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  2007. );
  2008. $multiConfigValues = array(
  2009. 'github-protocols' => array(
  2010. function ($vals) {
  2011. if (!is_array($vals)) {
  2012. return 'array expected';
  2013. }
  2014. foreach ($vals as $val) {
  2015. if (!in_array($val, array('git', 'https', 'ssh'))) {
  2016. return 'valid protocols include: git, https, ssh';
  2017. }
  2018. }
  2019. return true;
  2020. },
  2021. function ($vals) {
  2022. return $vals;
  2023. },
  2024. ),
  2025. 'github-domains' => array(
  2026. function ($vals) {
  2027. if (!is_array($vals)) {
  2028. return 'array expected';
  2029. }
  2030. return true;
  2031. },
  2032. function ($vals) {
  2033. return $vals;
  2034. },
  2035. ),
  2036. 'gitlab-domains' => array(
  2037. function ($vals) {
  2038. if (!is_array($vals)) {
  2039. return 'array expected';
  2040. }
  2041. return true;
  2042. },
  2043. function ($vals) {
  2044. return $vals;
  2045. },
  2046. ),
  2047. );
  2048. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  2049. return $this->configSource->removeConfigSetting($settingKey);
  2050. }
  2051. if (isset($uniqueConfigValues[$settingKey])) {
  2052. return $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  2053. }
  2054. if (isset($multiConfigValues[$settingKey])) {
  2055. return $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  2056. }
  2057. $uniqueProps = array(
  2058. 'name' => array('is_string', function ($val) {
  2059. return $val;
  2060. }),
  2061. 'type' => array('is_string', function ($val) {
  2062. return $val;
  2063. }),
  2064. 'description' => array('is_string', function ($val) {
  2065. return $val;
  2066. }),
  2067. 'homepage' => array('is_string', function ($val) {
  2068. return $val;
  2069. }),
  2070. 'version' => array('is_string', function ($val) {
  2071. return $val;
  2072. }),
  2073. 'minimum-stability' => array(
  2074. function ($val) {
  2075. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2076. },
  2077. function ($val) {
  2078. return VersionParser::normalizeStability($val);
  2079. },
  2080. ),
  2081. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2082. );
  2083. $multiProps = array(
  2084. 'keywords' => array(
  2085. function ($vals) {
  2086. if (!is_array($vals)) {
  2087. return 'array expected';
  2088. }
  2089. return true;
  2090. },
  2091. function ($vals) {
  2092. return $vals;
  2093. },
  2094. ),
  2095. 'license' => array(
  2096. function ($vals) {
  2097. if (!is_array($vals)) {
  2098. return 'array expected';
  2099. }
  2100. return true;
  2101. },
  2102. function ($vals) {
  2103. return $vals;
  2104. },
  2105. ),
  2106. );
  2107. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2108. throw new \InvalidArgumentException('The '.$settingKey.' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
  2109. }
  2110. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2111. return $this->configSource->removeProperty($settingKey);
  2112. }
  2113. if (isset($uniqueProps[$settingKey])) {
  2114. return $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2115. }
  2116. if (isset($multiProps[$settingKey])) {
  2117. return $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2118. }
  2119. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2120. if ($input->getOption('unset')) {
  2121. return $this->configSource->removeRepository($matches[1]);
  2122. }
  2123. if (2 === count($values)) {
  2124. return $this->configSource->addRepository($matches[1], array(
  2125. 'type' => $values[0],
  2126. 'url' => $values[1],
  2127. ));
  2128. }
  2129. if (1 === count($values)) {
  2130. $value = strtolower($values[0]);
  2131. if (true === $booleanValidator($value)) {
  2132. if (false === $booleanNormalizer($value)) {
  2133. return $this->configSource->addRepository($matches[1], false);
  2134. }
  2135. } else {
  2136. $value = JsonFile::parseJson($values[0]);
  2137. return $this->configSource->addRepository($matches[1], $value);
  2138. }
  2139. }
  2140. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2141. }
  2142. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2143. if ($input->getOption('unset')) {
  2144. return $this->configSource->removeProperty($settingKey);
  2145. }
  2146. return $this->configSource->addProperty($settingKey, $values[0]);
  2147. }
  2148. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2149. if ($input->getOption('unset')) {
  2150. return $this->configSource->removeConfigSetting($settingKey);
  2151. }
  2152. return $this->configSource->addConfigSetting($settingKey, $values[0]);
  2153. }
  2154. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2155. return $this->configSource->removeConfigSetting($settingKey);
  2156. }
  2157. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
  2158. if ($input->getOption('unset')) {
  2159. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2160. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2161. return;
  2162. }
  2163. if ($matches[1] === 'bitbucket-oauth') {
  2164. if (2 !== count($values)) {
  2165. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2166. }
  2167. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2168. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2169. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
  2170. if (1 !== count($values)) {
  2171. throw new \RuntimeException('Too many arguments, expected only one token');
  2172. }
  2173. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2174. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2175. } elseif ($matches[1] === 'http-basic') {
  2176. if (2 !== count($values)) {
  2177. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2178. }
  2179. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2180. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2181. }
  2182. return;
  2183. }
  2184. if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
  2185. if ($input->getOption('unset')) {
  2186. return $this->configSource->removeProperty($settingKey);
  2187. }
  2188. return $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  2189. }
  2190. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2191. }
  2192. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2193. {
  2194. list($validator, $normalizer) = $callbacks;
  2195. if (1 !== count($values)) {
  2196. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2197. }
  2198. if (true !== $validation = $validator($values[0])) {
  2199. throw new \RuntimeException(sprintf(
  2200. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2201. $values[0]
  2202. ));
  2203. }
  2204. return call_user_func(array($this->configSource, $method), $key, $normalizer($values[0]));
  2205. }
  2206. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2207. {
  2208. list($validator, $normalizer) = $callbacks;
  2209. if (true !== $validation = $validator($values)) {
  2210. throw new \RuntimeException(sprintf(
  2211. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2212. json_encode($values)
  2213. ));
  2214. }
  2215. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2216. }
  2217. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2218. {
  2219. $origK = $k;
  2220. $io = $this->getIO();
  2221. foreach ($contents as $key => $value) {
  2222. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2223. continue;
  2224. }
  2225. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2226. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2227. $k .= preg_replace('{^config\.}', '', $key . '.');
  2228. $this->listConfiguration($value, $rawVal, $output, $k);
  2229. $k = $origK;
  2230. continue;
  2231. }
  2232. if (is_array($value)) {
  2233. $value = array_map(function ($val) {
  2234. return is_array($val) ? json_encode($val) : $val;
  2235. }, $value);
  2236. $value = '['.implode(', ', $value).']';
  2237. }
  2238. if (is_bool($value)) {
  2239. $value = var_export($value, true);
  2240. }
  2241. if (is_string($rawVal) && $rawVal != $value) {
  2242. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>', true, IOInterface::QUIET);
  2243. } else {
  2244. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>', true, IOInterface::QUIET);
  2245. }
  2246. }
  2247. }
  2248. }
  2249. <?php
  2250. namespace Composer\Command;
  2251. use Composer\Config;
  2252. use Composer\Factory;
  2253. use Composer\Installer;
  2254. use Composer\Installer\ProjectInstaller;
  2255. use Composer\Installer\InstallationManager;
  2256. use Composer\Installer\SuggestedPackagesReporter;
  2257. use Composer\IO\IOInterface;
  2258. use Composer\Package\BasePackage;
  2259. use Composer\DependencyResolver\Pool;
  2260. use Composer\DependencyResolver\Operation\InstallOperation;
  2261. use Composer\Package\Version\VersionSelector;
  2262. use Composer\Package\AliasPackage;
  2263. use Composer\Repository\RepositoryFactory;
  2264. use Composer\Repository\CompositeRepository;
  2265. use Composer\Repository\PlatformRepository;
  2266. use Composer\Repository\InstalledFilesystemRepository;
  2267. use Composer\Script\ScriptEvents;
  2268. use Composer\Util\Silencer;
  2269. use Symfony\Component\Console\Input\InputArgument;
  2270. use Symfony\Component\Console\Input\InputInterface;
  2271. use Symfony\Component\Console\Input\InputOption;
  2272. use Symfony\Component\Console\Output\OutputInterface;
  2273. use Symfony\Component\Finder\Finder;
  2274. use Composer\Json\JsonFile;
  2275. use Composer\Config\JsonConfigSource;
  2276. use Composer\Util\Filesystem;
  2277. use Composer\Package\Version\VersionParser;
  2278. class CreateProjectCommand extends BaseCommand
  2279. {
  2280. protected $suggestedPackagesReporter;
  2281. protected function configure()
  2282. {
  2283. $this
  2284. ->setName('create-project')
  2285. ->setDescription('Creates new project from a package into given directory.')
  2286. ->setDefinition(array(
  2287. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2288. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2289. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2290. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2291. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2292. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2293. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2294. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2295. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2296. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2297. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2298. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2299. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2300. new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
  2301. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2302. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2303. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2304. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2305. ))
  2306. ->setHelp(
  2307. <<<EOT
  2308. The <info>create-project</info> command creates a new project from a given
  2309. package into a new directory. If executed without params and in a directory
  2310. with a composer.json file it installs the packages for the current project.
  2311. You can use this command to bootstrap new projects or setup a clean
  2312. version-controlled installation for developers of your project.
  2313. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2314. You can also specify the version with the package name using = or : as separator.
  2315. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2316. To install unstable packages, either specify the version you want, or use the
  2317. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2318. To setup a developer workable version you should create the project using the source
  2319. controlled code by appending the <info>'--prefer-source'</info> flag.
  2320. To install a package from another repository than the default one you
  2321. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2322. Read more at https://getcomposer.org/doc/03-cli.md#create-project
  2323. EOT
  2324. )
  2325. ;
  2326. }
  2327. protected function execute(InputInterface $input, OutputInterface $output)
  2328. {
  2329. $config = Factory::createConfig();
  2330. $io = $this->getIO();
  2331. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2332. if ($input->getOption('dev')) {
  2333. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2334. }
  2335. if ($input->getOption('no-custom-installers')) {
  2336. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2337. $input->setOption('no-plugins', true);
  2338. }
  2339. return $this->installProject(
  2340. $io,
  2341. $config,
  2342. $input,
  2343. $input->getArgument('package'),
  2344. $input->getArgument('directory'),
  2345. $input->getArgument('version'),
  2346. $input->getOption('stability'),
  2347. $preferSource,
  2348. $preferDist,
  2349. !$input->getOption('no-dev'),
  2350. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2351. $input->getOption('no-plugins'),
  2352. $input->getOption('no-scripts'),
  2353. $input->getOption('no-progress'),
  2354. $input->getOption('no-install'),
  2355. $input->getOption('ignore-platform-reqs'),
  2356. !$input->getOption('no-secure-http')
  2357. );
  2358. }
  2359. public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true)
  2360. {
  2361. $oldCwd = getcwd();
  2362. $io->loadConfiguration($config);
  2363. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2364. if ($packageName !== null) {
  2365. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $noProgress, $ignorePlatformReqs, $secureHttp);
  2366. } else {
  2367. $installedFromVcs = false;
  2368. }
  2369. $composer = Factory::create($io, null, $disablePlugins);
  2370. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2371. $fs = new Filesystem();
  2372. if ($noScripts === false) {
  2373. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2374. }
  2375. $config = $composer->getConfig();
  2376. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2377. if ($noInstall === false) {
  2378. $installer = Installer::create($io, $composer);
  2379. $installer->setPreferSource($preferSource)
  2380. ->setPreferDist($preferDist)
  2381. ->setDevMode($installDevPackages)
  2382. ->setRunScripts(!$noScripts)
  2383. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2384. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2385. ->setOptimizeAutoloader($config->get('optimize-autoloader'));
  2386. if ($disablePlugins) {
  2387. $installer->disablePlugins();
  2388. }
  2389. $status = $installer->run();
  2390. if (0 !== $status) {
  2391. return $status;
  2392. }
  2393. }
  2394. $hasVcs = $installedFromVcs;
  2395. if (
  2396. !$input->getOption('keep-vcs')
  2397. && $installedFromVcs
  2398. && (
  2399. $input->getOption('remove-vcs')
  2400. || !$io->isInteractive()
  2401. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2402. )
  2403. ) {
  2404. $finder = new Finder();
  2405. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2406. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2407. $finder->name($vcsName);
  2408. }
  2409. try {
  2410. $dirs = iterator_to_array($finder);
  2411. unset($finder);
  2412. foreach ($dirs as $dir) {
  2413. if (!$fs->removeDirectory($dir)) {
  2414. throw new \RuntimeException('Could not remove '.$dir);
  2415. }
  2416. }
  2417. } catch (\Exception $e) {
  2418. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2419. }
  2420. $hasVcs = false;
  2421. }
  2422. if (!$hasVcs) {
  2423. $package = $composer->getPackage();
  2424. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2425. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2426. foreach ($package->{'get'.$meta['method']}() as $link) {
  2427. if ($link->getPrettyConstraint() === 'self.version') {
  2428. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2429. }
  2430. }
  2431. }
  2432. }
  2433. if ($noScripts === false) {
  2434. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2435. }
  2436. chdir($oldCwd);
  2437. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2438. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2439. Silencer::call('rmdir', $vendorComposerDir);
  2440. $vendorDir = $config->get('vendor-dir');
  2441. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2442. Silencer::call('rmdir', $vendorDir);
  2443. }
  2444. }
  2445. return 0;
  2446. }
  2447. protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2448. {
  2449. if (!$secureHttp) {
  2450. $config->merge(array('config' => array('secure-http' => false)));
  2451. }
  2452. if (null === $repository) {
  2453. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2454. } else {
  2455. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2456. }
  2457. $parser = new VersionParser();
  2458. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2459. $name = strtolower($requirements[0]['name']);
  2460. if (!$packageVersion && isset($requirements[0]['version'])) {
  2461. $packageVersion = $requirements[0]['version'];
  2462. }
  2463. if (null === $stability) {
  2464. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2465. $stability = $match[1];
  2466. } else {
  2467. $stability = VersionParser::parseStability($packageVersion);
  2468. }
  2469. }
  2470. $stability = VersionParser::normalizeStability($stability);
  2471. if (!isset(BasePackage::$stabilities[$stability])) {
  2472. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2473. }
  2474. $pool = new Pool($stability);
  2475. $pool->addRepository($sourceRepo);
  2476. $phpVersion = null;
  2477. $prettyPhpVersion = null;
  2478. if (!$ignorePlatformReqs) {
  2479. $platformOverrides = $config->get('platform') ?: array();
  2480. $platform = new PlatformRepository(array(), $platformOverrides);
  2481. $phpPackage = $platform->findPackage('php', '*');
  2482. $phpVersion = $phpPackage->getVersion();
  2483. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2484. }
  2485. $versionSelector = new VersionSelector($pool);
  2486. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2487. if (!$package) {
  2488. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2489. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2490. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2491. }
  2492. throw new \InvalidArgumentException($errorMessage .'.');
  2493. }
  2494. if (null === $directory) {
  2495. $parts = explode("/", $name, 2);
  2496. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2497. }
  2498. if (function_exists('pcntl_async_signals')) {
  2499. @mkdir($directory, 0777, true);
  2500. if ($realDir = realpath($directory)) {
  2501. pcntl_async_signals(true);
  2502. pcntl_signal(SIGINT, function () use ($realDir) {
  2503. $fs = new Filesystem();
  2504. $fs->removeDirectory($realDir);
  2505. exit(130);
  2506. });
  2507. }
  2508. }
  2509. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2510. if ($disablePlugins) {
  2511. $io->writeError('<info>Plugins have been disabled.</info>');
  2512. }
  2513. if ($package instanceof AliasPackage) {
  2514. $package = $package->getAliasOf();
  2515. }
  2516. $dm = $this->createDownloadManager($io, $config);
  2517. $dm->setPreferSource($preferSource)
  2518. ->setPreferDist($preferDist)
  2519. ->setOutputProgress(!$noProgress);
  2520. $projectInstaller = new ProjectInstaller($directory, $dm);
  2521. $im = $this->createInstallationManager();
  2522. $im->addInstaller($projectInstaller);
  2523. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2524. $im->notifyInstalls($io);
  2525. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2526. $installedFromVcs = 'source' === $package->getInstallationSource();
  2527. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2528. chdir($directory);
  2529. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2530. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2531. return $installedFromVcs;
  2532. }
  2533. protected function createDownloadManager(IOInterface $io, Config $config)
  2534. {
  2535. $factory = new Factory();
  2536. return $factory->createDownloadManager($io, $config);
  2537. }
  2538. protected function createInstallationManager()
  2539. {
  2540. return new InstallationManager();
  2541. }
  2542. }
  2543. <?php
  2544. namespace Composer\Command;
  2545. use Symfony\Component\Console\Input\InputInterface;
  2546. use Symfony\Component\Console\Output\OutputInterface;
  2547. class DependsCommand extends BaseDependencyCommand
  2548. {
  2549. protected function configure()
  2550. {
  2551. parent::configure();
  2552. $this
  2553. ->setName('depends')
  2554. ->setAliases(array('why'))
  2555. ->setDescription('Shows which packages cause the given package to be installed.')
  2556. ->setHelp(
  2557. <<<EOT
  2558. Displays detailed information about where a package is referenced.
  2559. <info>php composer.phar depends composer/composer</info>
  2560. Read more at https://getcomposer.org/doc/03-cli.md#depends-why-
  2561. EOT
  2562. )
  2563. ;
  2564. }
  2565. protected function execute(InputInterface $input, OutputInterface $output)
  2566. {
  2567. return parent::doExecute($input, $output, false);
  2568. }
  2569. }
  2570. <?php
  2571. namespace Composer\Command;
  2572. use Composer\Composer;
  2573. use Composer\Factory;
  2574. use Composer\Config;
  2575. use Composer\Downloader\TransportException;
  2576. use Composer\Repository\PlatformRepository;
  2577. use Composer\Plugin\CommandEvent;
  2578. use Composer\Plugin\PluginEvents;
  2579. use Composer\Util\ConfigValidator;
  2580. use Composer\Util\IniHelper;
  2581. use Composer\Util\ProcessExecutor;
  2582. use Composer\Util\RemoteFilesystem;
  2583. use Composer\Util\StreamContextFactory;
  2584. use Composer\SelfUpdate\Keys;
  2585. use Composer\SelfUpdate\Versions;
  2586. use Composer\IO\NullIO;
  2587. use Symfony\Component\Console\Input\InputInterface;
  2588. use Symfony\Component\Console\Output\OutputInterface;
  2589. class DiagnoseCommand extends BaseCommand
  2590. {
  2591. protected $rfs;
  2592. protected $process;
  2593. protected $exitCode = 0;
  2594. protected function configure()
  2595. {
  2596. $this
  2597. ->setName('diagnose')
  2598. ->setDescription('Diagnoses the system to identify common errors.')
  2599. ->setHelp(
  2600. <<<EOT
  2601. The <info>diagnose</info> command checks common errors to help debugging problems.
  2602. The process exit code will be 1 in case of warnings and 2 for errors.
  2603. Read more at https://getcomposer.org/doc/03-cli.md#diagnose
  2604. EOT
  2605. )
  2606. ;
  2607. }
  2608. protected function execute(InputInterface $input, OutputInterface $output)
  2609. {
  2610. $composer = $this->getComposer(false);
  2611. $io = $this->getIO();
  2612. if ($composer) {
  2613. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2614. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2615. $io->write('Checking composer.json: ', false);
  2616. $this->outputResult($this->checkComposerSchema());
  2617. }
  2618. if ($composer) {
  2619. $config = $composer->getConfig();
  2620. } else {
  2621. $config = Factory::createConfig();
  2622. }
  2623. $config->merge(array('config' => array('secure-http' => false)));
  2624. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  2625. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2626. $this->process = new ProcessExecutor($io);
  2627. $io->write('Checking platform settings: ', false);
  2628. $this->outputResult($this->checkPlatform());
  2629. $io->write('Checking git settings: ', false);
  2630. $this->outputResult($this->checkGit());
  2631. $io->write('Checking http connectivity to packagist: ', false);
  2632. $this->outputResult($this->checkHttp('http', $config));
  2633. $io->write('Checking https connectivity to packagist: ', false);
  2634. $this->outputResult($this->checkHttp('https', $config));
  2635. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2636. if (!empty($opts['http']['proxy'])) {
  2637. $io->write('Checking HTTP proxy: ', false);
  2638. $this->outputResult($this->checkHttpProxy());
  2639. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2640. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2641. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2642. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2643. }
  2644. if ($oauth = $config->get('github-oauth')) {
  2645. foreach ($oauth as $domain => $token) {
  2646. $io->write('Checking '.$domain.' oauth access: ', false);
  2647. $this->outputResult($this->checkGithubOauth($domain, $token));
  2648. }
  2649. } else {
  2650. $io->write('Checking github.com rate limit: ', false);
  2651. try {
  2652. $rate = $this->getGithubRateLimit('github.com');
  2653. if (!is_array($rate)) {
  2654. $this->outputResult($rate);
  2655. } elseif (10 > $rate['remaining']) {
  2656. $io->write('<warning>WARNING</warning>');
  2657. $io->write(sprintf(
  2658. '<comment>Github has a rate limit on their API. '
  2659. . 'You currently have <options=bold>%u</options=bold> '
  2660. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2661. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2662. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2663. $rate['remaining'],
  2664. $rate['limit']
  2665. ));
  2666. } else {
  2667. $this->outputResult(true);
  2668. }
  2669. } catch (\Exception $e) {
  2670. if ($e instanceof TransportException && $e->getCode() === 401) {
  2671. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2672. } else {
  2673. $this->outputResult($e);
  2674. }
  2675. }
  2676. }
  2677. $io->write('Checking disk free space: ', false);
  2678. $this->outputResult($this->checkDiskSpace($config));
  2679. if ('phar:' === substr(__FILE__, 0, 5)) {
  2680. $io->write('Checking pubkeys: ', false);
  2681. $this->outputResult($this->checkPubKeys($config));
  2682. $io->write('Checking composer version: ', false);
  2683. $this->outputResult($this->checkVersion($config));
  2684. }
  2685. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2686. $platformOverrides = $config->get('platform') ?: array();
  2687. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  2688. $phpPkg = $platformRepo->findPackage('php', '*');
  2689. $phpVersion = $phpPkg->getPrettyVersion();
  2690. if (false !== strpos($phpPkg->getDescription(), 'overridden')) {
  2691. $phpVersion .= ' - ' . $phpPkg->getDescription();
  2692. }
  2693. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  2694. if (defined('PHP_BINARY')) {
  2695. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2696. }
  2697. return $this->exitCode;
  2698. }
  2699. private function checkComposerSchema()
  2700. {
  2701. $validator = new ConfigValidator($this->getIO());
  2702. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2703. if ($errors || $warnings) {
  2704. $messages = array(
  2705. 'error' => $errors,
  2706. 'warning' => $warnings,
  2707. );
  2708. $output = '';
  2709. foreach ($messages as $style => $msgs) {
  2710. foreach ($msgs as $msg) {
  2711. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2712. }
  2713. }
  2714. return rtrim($output);
  2715. }
  2716. return true;
  2717. }
  2718. private function checkGit()
  2719. {
  2720. $this->process->execute('git config color.ui', $output);
  2721. if (strtolower(trim($output)) === 'always') {
  2722. return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
  2723. }
  2724. return true;
  2725. }
  2726. private function checkHttp($proto, Config $config)
  2727. {
  2728. $result = $this->checkConnectivity();
  2729. if ($result !== true) {
  2730. return $result;
  2731. }
  2732. $disableTls = false;
  2733. $result = array();
  2734. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2735. $disableTls = true;
  2736. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2737. }
  2738. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2739. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2740. }
  2741. try {
  2742. $this->rfs->getContents('packagist.org', $proto . '://repo.packagist.org/packages.json', false);
  2743. } catch (TransportException $e) {
  2744. if (false !== strpos($e->getMessage(), 'cafile')) {
  2745. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2746. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2747. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2748. } else {
  2749. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2750. }
  2751. }
  2752. if (count($result) > 0) {
  2753. return $result;
  2754. }
  2755. return true;
  2756. }
  2757. private function checkHttpProxy()
  2758. {
  2759. $result = $this->checkConnectivity();
  2760. if ($result !== true) {
  2761. return $result;
  2762. }
  2763. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2764. try {
  2765. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/packages.json', false), true);
  2766. $hash = reset($json['provider-includes']);
  2767. $hash = $hash['sha256'];
  2768. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2769. $provider = $this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/'.$path, false);
  2770. if (hash('sha256', $provider) !== $hash) {
  2771. return 'It seems that your proxy is modifying http traffic on the fly';
  2772. }
  2773. } catch (\Exception $e) {
  2774. return $e;
  2775. }
  2776. return true;
  2777. }
  2778. private function checkHttpProxyFullUriRequestParam()
  2779. {
  2780. $result = $this->checkConnectivity();
  2781. if ($result !== true) {
  2782. return $result;
  2783. }
  2784. $url = 'http://repo.packagist.org/packages.json';
  2785. try {
  2786. $this->rfs->getContents('packagist.org', $url, false);
  2787. } catch (TransportException $e) {
  2788. try {
  2789. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2790. } catch (TransportException $e) {
  2791. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2792. }
  2793. return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" and "HTTPS_PROXY_REQUEST_FULLURI" environment variables to "false"';
  2794. }
  2795. return true;
  2796. }
  2797. private function checkHttpsProxyFullUriRequestParam()
  2798. {
  2799. $result = $this->checkConnectivity();
  2800. if ($result !== true) {
  2801. return $result;
  2802. }
  2803. if (!extension_loaded('openssl')) {
  2804. return 'You need the openssl extension installed for this check';
  2805. }
  2806. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2807. try {
  2808. $this->rfs->getContents('github.com', $url, false);
  2809. } catch (TransportException $e) {
  2810. try {
  2811. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2812. } catch (TransportException $e) {
  2813. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2814. }
  2815. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2816. }
  2817. return true;
  2818. }
  2819. private function checkGithubOauth($domain, $token)
  2820. {
  2821. $result = $this->checkConnectivity();
  2822. if ($result !== true) {
  2823. return $result;
  2824. }
  2825. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2826. try {
  2827. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2828. return $this->rfs->getContents($domain, $url, false, array(
  2829. 'retry-auth-failure' => false,
  2830. )) ? true : 'Unexpected error';
  2831. } catch (\Exception $e) {
  2832. if ($e instanceof TransportException && $e->getCode() === 401) {
  2833. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2834. }
  2835. return $e;
  2836. }
  2837. }
  2838. private function getGithubRateLimit($domain, $token = null)
  2839. {
  2840. $result = $this->checkConnectivity();
  2841. if ($result !== true) {
  2842. return $result;
  2843. }
  2844. if ($token) {
  2845. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2846. }
  2847. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2848. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2849. $data = json_decode($json, true);
  2850. return $data['resources']['core'];
  2851. }
  2852. private function checkDiskSpace($config)
  2853. {
  2854. $minSpaceFree = 1024 * 1024;
  2855. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2856. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2857. ) {
  2858. return '<error>The disk hosting '.$dir.' is full</error>';
  2859. }
  2860. return true;
  2861. }
  2862. private function checkPubKeys($config)
  2863. {
  2864. $home = $config->get('home');
  2865. $errors = array();
  2866. $io = $this->getIO();
  2867. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2868. $io->write('');
  2869. }
  2870. if (file_exists($home.'/keys.tags.pub')) {
  2871. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2872. } else {
  2873. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2874. }
  2875. if (file_exists($home.'/keys.dev.pub')) {
  2876. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2877. } else {
  2878. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2879. }
  2880. if ($errors) {
  2881. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2882. }
  2883. return $errors ?: true;
  2884. }
  2885. private function checkVersion($config)
  2886. {
  2887. $result = $this->checkConnectivity();
  2888. if ($result !== true) {
  2889. return $result;
  2890. }
  2891. $versionsUtil = new Versions($config, $this->rfs);
  2892. $latest = $versionsUtil->getLatest();
  2893. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2894. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2895. }
  2896. return true;
  2897. }
  2898. private function outputResult($result)
  2899. {
  2900. $io = $this->getIO();
  2901. if (true === $result) {
  2902. $io->write('<info>OK</info>');
  2903. return;
  2904. }
  2905. $hadError = false;
  2906. $hadWarning = false;
  2907. if ($result instanceof \Exception) {
  2908. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2909. }
  2910. if (!$result) {
  2911. $hadError = true;
  2912. } else {
  2913. if (!is_array($result)) {
  2914. $result = array($result);
  2915. }
  2916. foreach ($result as $message) {
  2917. if (false !== strpos($message, '<error>')) {
  2918. $hadError = true;
  2919. } elseif (false !== strpos($message, '<warning>')) {
  2920. $hadWarning = true;
  2921. }
  2922. }
  2923. }
  2924. if ($hadError) {
  2925. $io->write('<error>FAIL</error>');
  2926. $this->exitCode = max($this->exitCode, 2);
  2927. } elseif ($hadWarning) {
  2928. $io->write('<warning>WARNING</warning>');
  2929. $this->exitCode = max($this->exitCode, 1);
  2930. }
  2931. if ($result) {
  2932. foreach ($result as $message) {
  2933. $io->write($message);
  2934. }
  2935. }
  2936. }
  2937. private function checkPlatform()
  2938. {
  2939. $output = '';
  2940. $out = function ($msg, $style) use (&$output) {
  2941. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2942. };
  2943. $errors = array();
  2944. $warnings = array();
  2945. $displayIniMessage = false;
  2946. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  2947. $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
  2948. if (!function_exists('json_decode')) {
  2949. $errors['json'] = true;
  2950. }
  2951. if (!extension_loaded('Phar')) {
  2952. $errors['phar'] = true;
  2953. }
  2954. if (!extension_loaded('filter')) {
  2955. $errors['filter'] = true;
  2956. }
  2957. if (!extension_loaded('hash')) {
  2958. $errors['hash'] = true;
  2959. }
  2960. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2961. $errors['iconv_mbstring'] = true;
  2962. }
  2963. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  2964. $errors['allow_url_fopen'] = true;
  2965. }
  2966. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2967. $errors['ioncube'] = ioncube_loader_version();
  2968. }
  2969. if (PHP_VERSION_ID < 50302) {
  2970. $errors['php'] = PHP_VERSION;
  2971. }
  2972. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2973. $warnings['php'] = PHP_VERSION;
  2974. }
  2975. if (!extension_loaded('openssl')) {
  2976. $errors['openssl'] = true;
  2977. }
  2978. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2979. $warnings['openssl_version'] = true;
  2980. }
  2981. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  2982. $warnings['apc_cli'] = true;
  2983. }
  2984. if (!extension_loaded('zlib')) {
  2985. $warnings['zlib'] = true;
  2986. }
  2987. ob_start();
  2988. phpinfo(INFO_GENERAL);
  2989. $phpinfo = ob_get_clean();
  2990. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  2991. $configure = $match[1];
  2992. if (false !== strpos($configure, '--enable-sigchild')) {
  2993. $warnings['sigchild'] = true;
  2994. }
  2995. if (false !== strpos($configure, '--with-curlwrappers')) {
  2996. $warnings['curlwrappers'] = true;
  2997. }
  2998. }
  2999. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  3000. $warnings['xdebug_profile'] = true;
  3001. } elseif (extension_loaded('xdebug')) {
  3002. $warnings['xdebug_loaded'] = true;
  3003. }
  3004. if (!empty($errors)) {
  3005. foreach ($errors as $error => $current) {
  3006. switch ($error) {
  3007. case 'json':
  3008. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  3009. $text .= "Install it or recompile php without --disable-json";
  3010. break;
  3011. case 'phar':
  3012. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  3013. $text .= "Install it or recompile php without --disable-phar";
  3014. break;
  3015. case 'filter':
  3016. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  3017. $text .= "Install it or recompile php without --disable-filter";
  3018. break;
  3019. case 'hash':
  3020. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  3021. $text .= "Install it or recompile php without --disable-hash";
  3022. break;
  3023. case 'iconv_mbstring':
  3024. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  3025. $text .= "Install either of them or recompile php without --disable-iconv";
  3026. break;
  3027. case 'unicode':
  3028. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  3029. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3030. $text .= " detect_unicode = Off";
  3031. $displayIniMessage = true;
  3032. break;
  3033. case 'suhosin':
  3034. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  3035. $text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):".PHP_EOL;
  3036. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  3037. $displayIniMessage = true;
  3038. break;
  3039. case 'php':
  3040. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  3041. break;
  3042. case 'allow_url_fopen':
  3043. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  3044. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3045. $text .= " allow_url_fopen = On";
  3046. $displayIniMessage = true;
  3047. break;
  3048. case 'ioncube':
  3049. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  3050. $text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
  3051. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  3052. $displayIniMessage = true;
  3053. break;
  3054. case 'openssl':
  3055. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  3056. $text .= "If possible you should enable it or recompile php with --with-openssl";
  3057. break;
  3058. }
  3059. $out($text, 'error');
  3060. }
  3061. $output .= PHP_EOL;
  3062. }
  3063. if (!empty($warnings)) {
  3064. foreach ($warnings as $warning => $current) {
  3065. switch ($warning) {
  3066. case 'apc_cli':
  3067. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  3068. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3069. $text .= " apc.enable_cli = Off";
  3070. $displayIniMessage = true;
  3071. break;
  3072. case 'zlib':
  3073. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  3074. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  3075. $displayIniMessage = true;
  3076. break;
  3077. case 'sigchild':
  3078. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  3079. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  3080. $text .= " https://bugs.php.net/bug.php?id=22999";
  3081. break;
  3082. case 'curlwrappers':
  3083. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  3084. $text .= " Recompile it without this flag if possible";
  3085. break;
  3086. case 'php':
  3087. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  3088. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  3089. break;
  3090. case 'openssl_version':
  3091. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  3092. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  3093. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  3094. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  3095. break;
  3096. case 'xdebug_loaded':
  3097. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  3098. $text .= " Disabling it when using Composer is recommended.";
  3099. break;
  3100. case 'xdebug_profile':
  3101. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  3102. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  3103. $text .= " xdebug.profiler_enabled = 0";
  3104. $displayIniMessage = true;
  3105. break;
  3106. }
  3107. $out($text, 'comment');
  3108. }
  3109. }
  3110. if ($displayIniMessage) {
  3111. $out($iniMessage, 'comment');
  3112. }
  3113. return !$warnings && !$errors ? true : $output;
  3114. }
  3115. private function checkConnectivity()
  3116. {
  3117. if (!ini_get('allow_url_fopen')) {
  3118. $result = '<info>Skipped because allow_url_fopen is missing.</info>';
  3119. return $result;
  3120. }
  3121. return true;
  3122. }
  3123. }
  3124. <?php
  3125. namespace Composer\Command;
  3126. use Composer\Plugin\CommandEvent;
  3127. use Composer\Plugin\PluginEvents;
  3128. use Symfony\Component\Console\Input\InputInterface;
  3129. use Symfony\Component\Console\Input\InputOption;
  3130. use Symfony\Component\Console\Output\OutputInterface;
  3131. class DumpAutoloadCommand extends BaseCommand
  3132. {
  3133. protected function configure()
  3134. {
  3135. $this
  3136. ->setName('dump-autoload')
  3137. ->setAliases(array('dumpautoload'))
  3138. ->setDescription('Dumps the autoloader.')
  3139. ->setDefinition(array(
  3140. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3141. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3142. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3143. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3144. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3145. ))
  3146. ->setHelp(
  3147. <<<EOT
  3148. <info>php composer.phar dump-autoload</info>
  3149. Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
  3150. EOT
  3151. )
  3152. ;
  3153. }
  3154. protected function execute(InputInterface $input, OutputInterface $output)
  3155. {
  3156. $composer = $this->getComposer();
  3157. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3158. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3159. $installationManager = $composer->getInstallationManager();
  3160. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3161. $package = $composer->getPackage();
  3162. $config = $composer->getConfig();
  3163. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3164. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3165. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3166. if ($authoritative) {
  3167. $this->getIO()->writeError('<info>Generating optimized autoload files (authoritative)</info>', false);
  3168. } elseif ($optimize) {
  3169. $this->getIO()->writeError('<info>Generating optimized autoload files</info>', false);
  3170. } else {
  3171. $this->getIO()->writeError('<info>Generating autoload files</info>', false);
  3172. }
  3173. $generator = $composer->getAutoloadGenerator();
  3174. $generator->setDevMode(!$input->getOption('no-dev'));
  3175. $generator->setClassMapAuthoritative($authoritative);
  3176. $generator->setApcu($apcu);
  3177. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3178. $numberOfClasses = $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3179. if ($authoritative) {
  3180. $this->getIO()->overwriteError('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
  3181. } elseif ($optimize) {
  3182. $this->getIO()->overwriteError('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
  3183. } else {
  3184. $this->getIO()->overwriteError('<info>Generated autoload files containing '. $numberOfClasses .' classes</info>');
  3185. }
  3186. }
  3187. }
  3188. <?php
  3189. namespace Composer\Command;
  3190. use Symfony\Component\Console\Input\InputInterface;
  3191. use Symfony\Component\Console\Input\InputOption;
  3192. use Symfony\Component\Console\Output\OutputInterface;
  3193. use Symfony\Component\Console\Input\InputArgument;
  3194. class ExecCommand extends BaseCommand
  3195. {
  3196. protected function configure()
  3197. {
  3198. $this
  3199. ->setName('exec')
  3200. ->setDescription('Executes a vendored binary/script.')
  3201. ->setDefinition(array(
  3202. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3203. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3204. new InputArgument(
  3205. 'args',
  3206. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3207. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3208. ),
  3209. ))
  3210. ->setHelp(
  3211. <<<EOT
  3212. Executes a vendored binary/script.
  3213. Read more at https://getcomposer.org/doc/03-cli.md#exec
  3214. EOT
  3215. )
  3216. ;
  3217. }
  3218. protected function execute(InputInterface $input, OutputInterface $output)
  3219. {
  3220. $composer = $this->getComposer();
  3221. $binDir = $composer->getConfig()->get('bin-dir');
  3222. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3223. $bins = glob($binDir . '/*');
  3224. $bins = array_merge($bins, array_map(function ($e) {
  3225. return "$e (local)";
  3226. }, $composer->getPackage()->getBinaries()));
  3227. if (!$bins) {
  3228. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3229. }
  3230. $this->getIO()->write(
  3231. <<<EOT
  3232. <comment>Available binaries:</comment>
  3233. EOT
  3234. );
  3235. foreach ($bins as $bin) {
  3236. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3237. continue;
  3238. }
  3239. $previousBin = $bin;
  3240. $bin = basename($bin);
  3241. $this->getIO()->write(
  3242. <<<EOT
  3243. <info>- $bin</info>
  3244. EOT
  3245. );
  3246. }
  3247. return 0;
  3248. }
  3249. $binary = $input->getArgument('binary');
  3250. $dispatcher = $composer->getEventDispatcher();
  3251. $dispatcher->addListener('__exec_command', $binary);
  3252. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3253. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3254. }
  3255. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3256. }
  3257. }
  3258. <?php
  3259. namespace Composer\Command;
  3260. use Composer\Factory;
  3261. use Composer\Util\Filesystem;
  3262. use Symfony\Component\Console\Input\InputInterface;
  3263. use Symfony\Component\Console\Input\InputArgument;
  3264. use Symfony\Component\Console\Input\StringInput;
  3265. use Symfony\Component\Console\Output\OutputInterface;
  3266. class GlobalCommand extends BaseCommand
  3267. {
  3268. protected function configure()
  3269. {
  3270. $this
  3271. ->setName('global')
  3272. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3273. ->setDefinition(array(
  3274. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3275. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3276. ))
  3277. ->setHelp(
  3278. <<<EOT
  3279. Use this command as a wrapper to run other Composer commands
  3280. within the global context of COMPOSER_HOME.
  3281. You can use this to install CLI utilities globally, all you need
  3282. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3283. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3284. and /home/<user>/.composer on unix systems.
  3285. If your system uses freedesktop.org standards, then it will first check
  3286. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3287. Note: This path may vary depending on customizations to bin-dir in
  3288. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3289. Read more at https://getcomposer.org/doc/03-cli.md#global
  3290. EOT
  3291. )
  3292. ;
  3293. }
  3294. public function run(InputInterface $input, OutputInterface $output)
  3295. {
  3296. $tokens = preg_split('{\s+}', $input->__toString());
  3297. $args = array();
  3298. foreach ($tokens as $token) {
  3299. if ($token && $token[0] !== '-') {
  3300. $args[] = $token;
  3301. if (count($args) >= 2) {
  3302. break;
  3303. }
  3304. }
  3305. }
  3306. if (count($args) < 2) {
  3307. return parent::run($input, $output);
  3308. }
  3309. $config = Factory::createConfig();
  3310. $home = $config->get('home');
  3311. if (!is_dir($home)) {
  3312. $fs = new Filesystem();
  3313. $fs->ensureDirectoryExists($home);
  3314. if (!is_dir($home)) {
  3315. throw new \RuntimeException('Could not create home directory');
  3316. }
  3317. }
  3318. try {
  3319. chdir($home);
  3320. } catch (\Exception $e) {
  3321. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  3322. }
  3323. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  3324. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3325. $this->getApplication()->resetComposer();
  3326. return $this->getApplication()->run($input, $output);
  3327. }
  3328. public function isProxyCommand()
  3329. {
  3330. return true;
  3331. }
  3332. }
  3333. <?php
  3334. namespace Composer\Command;
  3335. use Composer\Package\CompletePackageInterface;
  3336. use Composer\Repository\RepositoryInterface;
  3337. use Composer\Repository\ArrayRepository;
  3338. use Composer\Repository\RepositoryFactory;
  3339. use Composer\Util\Platform;
  3340. use Composer\Util\ProcessExecutor;
  3341. use Symfony\Component\Console\Input\InputArgument;
  3342. use Symfony\Component\Console\Input\InputOption;
  3343. use Symfony\Component\Console\Input\InputInterface;
  3344. use Symfony\Component\Console\Output\OutputInterface;
  3345. class HomeCommand extends BaseCommand
  3346. {
  3347. protected function configure()
  3348. {
  3349. $this
  3350. ->setName('browse')
  3351. ->setAliases(array('home'))
  3352. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3353. ->setDefinition(array(
  3354. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3355. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3356. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3357. ))
  3358. ->setHelp(
  3359. <<<EOT
  3360. The home command opens or shows a package's repository URL or
  3361. homepage in your default browser.
  3362. To open the homepage by default, use -H or --homepage.
  3363. To show instead of open the repository or homepage URL, use -s or --show.
  3364. Read more at https://getcomposer.org/doc/03-cli.md#browse-home
  3365. EOT
  3366. );
  3367. }
  3368. protected function execute(InputInterface $input, OutputInterface $output)
  3369. {
  3370. $repos = $this->initializeRepos();
  3371. $io = $this->getIO();
  3372. $return = 0;
  3373. $packages = $input->getArgument('packages');
  3374. if (!$packages) {
  3375. $io->writeError('No package specified, opening homepage for the root package');
  3376. $packages = array($this->getComposer()->getPackage()->getName());
  3377. }
  3378. foreach ($packages as $packageName) {
  3379. $handled = false;
  3380. $packageExists = false;
  3381. foreach ($repos as $repo) {
  3382. foreach ($repo->findPackages($packageName) as $package) {
  3383. $packageExists = true;
  3384. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3385. $handled = true;
  3386. break 2;
  3387. }
  3388. }
  3389. }
  3390. if (!$packageExists) {
  3391. $return = 1;
  3392. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3393. }
  3394. if (!$handled) {
  3395. $return = 1;
  3396. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3397. }
  3398. }
  3399. return $return;
  3400. }
  3401. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3402. {
  3403. $support = $package->getSupport();
  3404. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3405. if (!$url || $showHomepage) {
  3406. $url = $package->getHomepage();
  3407. }
  3408. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3409. return false;
  3410. }
  3411. if ($showOnly) {
  3412. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3413. } else {
  3414. $this->openBrowser($url);
  3415. }
  3416. return true;
  3417. }
  3418. private function openBrowser($url)
  3419. {
  3420. $url = ProcessExecutor::escape($url);
  3421. $process = new ProcessExecutor($this->getIO());
  3422. if (Platform::isWindows()) {
  3423. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3424. }
  3425. $linux = $process->execute('which xdg-open', $output);
  3426. $osx = $process->execute('which open', $output);
  3427. if (0 === $linux) {
  3428. $process->execute('xdg-open ' . $url, $output);
  3429. } elseif (0 === $osx) {
  3430. $process->execute('open ' . $url, $output);
  3431. } else {
  3432. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3433. }
  3434. }
  3435. private function initializeRepos()
  3436. {
  3437. $composer = $this->getComposer(false);
  3438. if ($composer) {
  3439. return array_merge(
  3440. array(new ArrayRepository(array($composer->getPackage()))),
  3441. array($composer->getRepositoryManager()->getLocalRepository()),
  3442. $composer->getRepositoryManager()->getRepositories()
  3443. );
  3444. }
  3445. return RepositoryFactory::defaultRepos($this->getIO());
  3446. }
  3447. }
  3448. <?php
  3449. namespace Composer\Command;
  3450. use Composer\DependencyResolver\Pool;
  3451. use Composer\Factory;
  3452. use Composer\Json\JsonFile;
  3453. use Composer\Package\BasePackage;
  3454. use Composer\Package\Version\VersionParser;
  3455. use Composer\Package\Version\VersionSelector;
  3456. use Composer\Repository\CompositeRepository;
  3457. use Composer\Repository\PlatformRepository;
  3458. use Composer\Repository\RepositoryFactory;
  3459. use Composer\Util\ProcessExecutor;
  3460. use Symfony\Component\Console\Input\ArrayInput;
  3461. use Symfony\Component\Console\Input\InputInterface;
  3462. use Symfony\Component\Console\Input\InputOption;
  3463. use Symfony\Component\Console\Output\OutputInterface;
  3464. use Symfony\Component\Process\ExecutableFinder;
  3465. use Symfony\Component\Process\Process;
  3466. class InitCommand extends BaseCommand
  3467. {
  3468. protected $repos;
  3469. private $gitConfig;
  3470. private $pools;
  3471. protected function configure()
  3472. {
  3473. $this
  3474. ->setName('init')
  3475. ->setDescription('Creates a basic composer.json file in current directory.')
  3476. ->setDefinition(array(
  3477. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3478. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3479. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3480. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3481. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3482. new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3483. new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3484. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3485. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3486. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3487. ))
  3488. ->setHelp(
  3489. <<<EOT
  3490. The <info>init</info> command creates a basic composer.json file
  3491. in the current directory.
  3492. <info>php composer.phar init</info>
  3493. Read more at https://getcomposer.org/doc/03-cli.md#init
  3494. EOT
  3495. )
  3496. ;
  3497. }
  3498. protected function execute(InputInterface $input, OutputInterface $output)
  3499. {
  3500. $io = $this->getIO();
  3501. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3502. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3503. if (isset($options['author'])) {
  3504. $options['authors'] = $this->formatAuthors($options['author']);
  3505. unset($options['author']);
  3506. }
  3507. $repositories = $input->getOption('repository');
  3508. if ($repositories) {
  3509. $config = Factory::createConfig($io);
  3510. foreach ($repositories as $repo) {
  3511. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3512. }
  3513. }
  3514. if (isset($options['stability'])) {
  3515. $options['minimum-stability'] = $options['stability'];
  3516. unset($options['stability']);
  3517. }
  3518. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3519. if (array() === $options['require']) {
  3520. $options['require'] = new \stdClass;
  3521. }
  3522. if (isset($options['require-dev'])) {
  3523. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3524. if (array() === $options['require-dev']) {
  3525. $options['require-dev'] = new \stdClass;
  3526. }
  3527. }
  3528. $file = new JsonFile(Factory::getComposerFile());
  3529. $json = $file->encode($options);
  3530. if ($input->isInteractive()) {
  3531. $io->writeError(array('', $json, ''));
  3532. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3533. $io->writeError('<error>Command aborted</error>');
  3534. return 1;
  3535. }
  3536. }
  3537. $file->write($options);
  3538. if ($input->isInteractive() && is_dir('.git')) {
  3539. $ignoreFile = realpath('.gitignore');
  3540. if (false === $ignoreFile) {
  3541. $ignoreFile = realpath('.') . '/.gitignore';
  3542. }
  3543. if (!$this->hasVendorIgnore($ignoreFile)) {
  3544. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3545. if ($io->askConfirmation($question, true)) {
  3546. $this->addVendorIgnore($ignoreFile);
  3547. }
  3548. }
  3549. }
  3550. $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
  3551. if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question, true)) {
  3552. $this->installDependencies($output);
  3553. }
  3554. }
  3555. protected function interact(InputInterface $input, OutputInterface $output)
  3556. {
  3557. $git = $this->getGitConfig();
  3558. $io = $this->getIO();
  3559. $formatter = $this->getHelperSet()->get('formatter');
  3560. $repositories = $input->getOption('repository');
  3561. if ($repositories) {
  3562. $config = Factory::createConfig($io);
  3563. $repos = array(new PlatformRepository);
  3564. foreach ($repositories as $repo) {
  3565. $repos[] = RepositoryFactory::fromString($io, $config, $repo);
  3566. }
  3567. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3568. 'type' => 'composer',
  3569. 'url' => 'https://repo.packagist.org',
  3570. ));
  3571. $this->repos = new CompositeRepository($repos);
  3572. unset($repos, $config, $repositories);
  3573. }
  3574. $io->writeError(array(
  3575. '',
  3576. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3577. '',
  3578. ));
  3579. $io->writeError(array(
  3580. '',
  3581. 'This command will guide you through creating your composer.json config.',
  3582. '',
  3583. ));
  3584. $cwd = realpath(".");
  3585. if (!$name = $input->getOption('name')) {
  3586. $name = basename($cwd);
  3587. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3588. $name = strtolower($name);
  3589. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3590. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3591. } elseif (isset($git['github.user'])) {
  3592. $name = $git['github.user'] . '/' . $name;
  3593. } elseif (!empty($_SERVER['USERNAME'])) {
  3594. $name = $_SERVER['USERNAME'] . '/' . $name;
  3595. } elseif (!empty($_SERVER['USER'])) {
  3596. $name = $_SERVER['USER'] . '/' . $name;
  3597. } elseif (get_current_user()) {
  3598. $name = get_current_user() . '/' . $name;
  3599. } else {
  3600. $name .= '/' . $name;
  3601. }
  3602. $name = strtolower($name);
  3603. } else {
  3604. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $name)) {
  3605. throw new \InvalidArgumentException(
  3606. 'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3607. );
  3608. }
  3609. }
  3610. $name = $io->askAndValidate(
  3611. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3612. function ($value) use ($name) {
  3613. if (null === $value) {
  3614. return $name;
  3615. }
  3616. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
  3617. throw new \InvalidArgumentException(
  3618. 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3619. );
  3620. }
  3621. return $value;
  3622. },
  3623. null,
  3624. $name
  3625. );
  3626. $input->setOption('name', $name);
  3627. $description = $input->getOption('description') ?: false;
  3628. $description = $io->ask(
  3629. 'Description [<comment>'.$description.'</comment>]: ',
  3630. $description
  3631. );
  3632. $input->setOption('description', $description);
  3633. if (null === $author = $input->getOption('author')) {
  3634. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3635. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3636. } elseif (isset($git['user.name'])) {
  3637. $author_name = $git['user.name'];
  3638. }
  3639. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3640. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3641. } elseif (isset($git['user.email'])) {
  3642. $author_email = $git['user.email'];
  3643. }
  3644. if (isset($author_name) && isset($author_email)) {
  3645. $author = sprintf('%s <%s>', $author_name, $author_email);
  3646. }
  3647. }
  3648. $self = $this;
  3649. $author = $io->askAndValidate(
  3650. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3651. function ($value) use ($self, $author) {
  3652. if ($value === 'n' || $value === 'no') {
  3653. return;
  3654. }
  3655. $value = $value ?: $author;
  3656. $author = $self->parseAuthorString($value);
  3657. return sprintf('%s <%s>', $author['name'], $author['email']);
  3658. },
  3659. null,
  3660. $author
  3661. );
  3662. $input->setOption('author', $author);
  3663. $minimumStability = $input->getOption('stability') ?: null;
  3664. $minimumStability = $io->askAndValidate(
  3665. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3666. function ($value) use ($minimumStability) {
  3667. if (null === $value) {
  3668. return $minimumStability;
  3669. }
  3670. if (!isset(BasePackage::$stabilities[$value])) {
  3671. throw new \InvalidArgumentException(
  3672. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3673. implode(', ', array_keys(BasePackage::$stabilities))
  3674. );
  3675. }
  3676. return $value;
  3677. },
  3678. null,
  3679. $minimumStability
  3680. );
  3681. $input->setOption('stability', $minimumStability);
  3682. $type = $input->getOption('type') ?: false;
  3683. $type = $io->ask(
  3684. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3685. $type
  3686. );
  3687. $input->setOption('type', $type);
  3688. if (null === $license = $input->getOption('license')) {
  3689. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3690. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3691. }
  3692. }
  3693. $license = $io->ask(
  3694. 'License [<comment>'.$license.'</comment>]: ',
  3695. $license
  3696. );
  3697. $input->setOption('license', $license);
  3698. $io->writeError(array('', 'Define your dependencies.', ''));
  3699. $repos = $this->getRepos();
  3700. $preferredStability = $minimumStability ?: 'stable';
  3701. $phpVersion = $repos->findPackage('php', '*')->getPrettyVersion();
  3702. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3703. $require = $input->getOption('require');
  3704. $requirements = array();
  3705. if ($require || $io->askConfirmation($question, true)) {
  3706. $requirements = $this->determineRequirements($input, $output, $require, $phpVersion, $preferredStability);
  3707. }
  3708. $input->setOption('require', $requirements);
  3709. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3710. $requireDev = $input->getOption('require-dev');
  3711. $devRequirements = array();
  3712. if ($requireDev || $io->askConfirmation($question, true)) {
  3713. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $phpVersion, $preferredStability);
  3714. }
  3715. $input->setOption('require-dev', $devRequirements);
  3716. }
  3717. public function parseAuthorString($author)
  3718. {
  3719. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3720. if ($this->isValidEmail($match['email'])) {
  3721. return array(
  3722. 'name' => trim($match['name']),
  3723. 'email' => $match['email'],
  3724. );
  3725. }
  3726. }
  3727. throw new \InvalidArgumentException(
  3728. 'Invalid author string. Must be in the format: '.
  3729. 'John Smith <john@example.com>'
  3730. );
  3731. }
  3732. protected function findPackages($name)
  3733. {
  3734. return $this->getRepos()->search($name);
  3735. }
  3736. protected function getRepos()
  3737. {
  3738. if (!$this->repos) {
  3739. $this->repos = new CompositeRepository(array_merge(
  3740. array(new PlatformRepository),
  3741. RepositoryFactory::defaultRepos($this->getIO())
  3742. ));
  3743. }
  3744. return $this->repos;
  3745. }
  3746. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable', $checkProvidedVersions = true)
  3747. {
  3748. if ($requires) {
  3749. $requires = $this->normalizeRequirements($requires);
  3750. $result = array();
  3751. $io = $this->getIO();
  3752. foreach ($requires as $requirement) {
  3753. if (!isset($requirement['version'])) {
  3754. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability);
  3755. $requirement['version'] = $version;
  3756. $requirement['name'] = $name;
  3757. $io->writeError(sprintf(
  3758. 'Using version <info>%s</info> for <info>%s</info>',
  3759. $requirement['version'],
  3760. $requirement['name']
  3761. ));
  3762. } else {
  3763. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $checkProvidedVersions ? $requirement['version'] : null, 'dev');
  3764. $requirement['name'] = $name;
  3765. }
  3766. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3767. }
  3768. return $result;
  3769. }
  3770. $versionParser = new VersionParser();
  3771. $io = $this->getIO();
  3772. while (null !== $package = $io->ask('Search for a package: ')) {
  3773. $matches = $this->findPackages($package);
  3774. if (count($matches)) {
  3775. $exactMatch = null;
  3776. $choices = array();
  3777. foreach ($matches as $position => $foundPackage) {
  3778. $abandoned = '';
  3779. if (isset($foundPackage['abandoned'])) {
  3780. if (is_string($foundPackage['abandoned'])) {
  3781. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  3782. } else {
  3783. $replacement = 'No replacement was suggested';
  3784. }
  3785. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  3786. }
  3787. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  3788. if ($foundPackage['name'] === $package) {
  3789. $exactMatch = true;
  3790. break;
  3791. }
  3792. }
  3793. if (!$exactMatch) {
  3794. $io->writeError(array(
  3795. '',
  3796. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3797. '',
  3798. ));
  3799. $io->writeError($choices);
  3800. $io->writeError('');
  3801. $validator = function ($selection) use ($matches, $versionParser) {
  3802. if ('' === $selection) {
  3803. return false;
  3804. }
  3805. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3806. $package = $matches[(int) $selection];
  3807. return $package['name'];
  3808. }
  3809. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3810. if (isset($packageMatches['version'])) {
  3811. $versionParser->parseConstraints($packageMatches['version']);
  3812. return $packageMatches['name'].' '.$packageMatches['version'];
  3813. }
  3814. return $packageMatches['name'];
  3815. }
  3816. throw new \Exception('Not a valid selection');
  3817. };
  3818. $package = $io->askAndValidate(
  3819. 'Enter package # to add, or the complete package name if it is not listed: ',
  3820. $validator,
  3821. 3,
  3822. false
  3823. );
  3824. }
  3825. if (false !== $package && false === strpos($package, ' ')) {
  3826. $validator = function ($input) {
  3827. $input = trim($input);
  3828. return $input ?: false;
  3829. };
  3830. $constraint = $io->askAndValidate(
  3831. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3832. $validator,
  3833. 3,
  3834. false
  3835. );
  3836. if (false === $constraint) {
  3837. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  3838. $io->writeError(sprintf(
  3839. 'Using version <info>%s</info> for <info>%s</info>',
  3840. $constraint,
  3841. $package
  3842. ));
  3843. }
  3844. $package .= ' '.$constraint;
  3845. }
  3846. if (false !== $package) {
  3847. $requires[] = $package;
  3848. }
  3849. }
  3850. }
  3851. return $requires;
  3852. }
  3853. protected function formatAuthors($author)
  3854. {
  3855. return array($this->parseAuthorString($author));
  3856. }
  3857. protected function formatRequirements(array $requirements)
  3858. {
  3859. $requires = array();
  3860. $requirements = $this->normalizeRequirements($requirements);
  3861. foreach ($requirements as $requirement) {
  3862. $requires[$requirement['name']] = $requirement['version'];
  3863. }
  3864. return $requires;
  3865. }
  3866. protected function getGitConfig()
  3867. {
  3868. if (null !== $this->gitConfig) {
  3869. return $this->gitConfig;
  3870. }
  3871. $finder = new ExecutableFinder();
  3872. $gitBin = $finder->find('git');
  3873. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  3874. $cmd = new Process(array($gitBin, 'config', '-l'));
  3875. } else {
  3876. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3877. }
  3878. $cmd->run();
  3879. if ($cmd->isSuccessful()) {
  3880. $this->gitConfig = array();
  3881. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3882. foreach ($matches as $match) {
  3883. $this->gitConfig[$match[1]] = $match[2];
  3884. }
  3885. return $this->gitConfig;
  3886. }
  3887. return $this->gitConfig = array();
  3888. }
  3889. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3890. {
  3891. if (!file_exists($ignoreFile)) {
  3892. return false;
  3893. }
  3894. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3895. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3896. foreach ($lines as $line) {
  3897. if (preg_match($pattern, $line)) {
  3898. return true;
  3899. }
  3900. }
  3901. return false;
  3902. }
  3903. protected function normalizeRequirements(array $requirements)
  3904. {
  3905. $parser = new VersionParser();
  3906. return $parser->parseNameVersionPairs($requirements);
  3907. }
  3908. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3909. {
  3910. $contents = "";
  3911. if (file_exists($ignoreFile)) {
  3912. $contents = file_get_contents($ignoreFile);
  3913. if ("\n" !== substr($contents, 0, -1)) {
  3914. $contents .= "\n";
  3915. }
  3916. }
  3917. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3918. }
  3919. protected function isValidEmail($email)
  3920. {
  3921. if (!function_exists('filter_var')) {
  3922. return true;
  3923. }
  3924. if (PHP_VERSION_ID < 50303) {
  3925. return true;
  3926. }
  3927. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3928. }
  3929. private function getPool(InputInterface $input, $minimumStability = null)
  3930. {
  3931. $key = $minimumStability ?: 'default';
  3932. if (!isset($this->pools[$key])) {
  3933. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  3934. $pool->addRepository($this->getRepos());
  3935. }
  3936. return $this->pools[$key];
  3937. }
  3938. private function getMinimumStability(InputInterface $input)
  3939. {
  3940. if ($input->hasOption('stability')) {
  3941. return $input->getOption('stability') ?: 'stable';
  3942. }
  3943. $file = Factory::getComposerFile();
  3944. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3945. if (!empty($composer['minimum-stability'])) {
  3946. return $composer['minimum-stability'];
  3947. }
  3948. }
  3949. return 'stable';
  3950. }
  3951. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null)
  3952. {
  3953. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  3954. $ignorePlatformReqs = $input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs');
  3955. if ($ignorePlatformReqs) {
  3956. $phpVersion = null;
  3957. }
  3958. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3959. if (!$package) {
  3960. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  3961. return array($name, $requiredVersion ?: '*');
  3962. }
  3963. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  3964. throw new \InvalidArgumentException(sprintf(
  3965. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)',
  3966. $name,
  3967. $requiredVersion,
  3968. $phpVersion
  3969. ));
  3970. }
  3971. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  3972. throw new \InvalidArgumentException(sprintf(
  3973. 'Could not find package %s in a version matching %s',
  3974. $name,
  3975. $requiredVersion
  3976. ));
  3977. }
  3978. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  3979. throw new \InvalidArgumentException(sprintf(
  3980. 'Could not find package %s in any version matching your PHP version (%s)',
  3981. $name,
  3982. $phpVersion
  3983. ));
  3984. }
  3985. $similar = $this->findSimilar($name);
  3986. if ($similar) {
  3987. if ($requiredVersion === null && in_array($name, $similar, true)) {
  3988. throw new \InvalidArgumentException(sprintf(
  3989. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  3990. $name,
  3991. $this->getMinimumStability($input)
  3992. ));
  3993. }
  3994. throw new \InvalidArgumentException(sprintf(
  3995. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  3996. $name,
  3997. implode("\n ", $similar)
  3998. ));
  3999. }
  4000. throw new \InvalidArgumentException(sprintf(
  4001. 'Could not find a matching version of package %s. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (%s).',
  4002. $name,
  4003. $this->getMinimumStability($input)
  4004. ));
  4005. }
  4006. return array(
  4007. $package->getPrettyName(),
  4008. $versionSelector->findRecommendedRequireVersion($package),
  4009. );
  4010. }
  4011. private function findSimilar($package)
  4012. {
  4013. try {
  4014. $results = $this->repos->search($package);
  4015. } catch (\Exception $e) {
  4016. return array();
  4017. }
  4018. $similarPackages = array();
  4019. foreach ($results as $result) {
  4020. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  4021. }
  4022. asort($similarPackages);
  4023. return array_keys(array_slice($similarPackages, 0, 5));
  4024. }
  4025. private function installDependencies($output)
  4026. {
  4027. try {
  4028. $installCommand = $this->getApplication()->find('install');
  4029. $installCommand->run(new ArrayInput(array()), $output);
  4030. } catch (\Exception $e) {
  4031. $this->getIO()->writeError('Could not install dependencies. Run `composer install` to see more information.');
  4032. }
  4033. }
  4034. private function hasDependencies($options)
  4035. {
  4036. $requires = (array) $options['require'];
  4037. $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
  4038. return !empty($requires) || !empty($devRequires);
  4039. }
  4040. }
  4041. <?php
  4042. namespace Composer\Command;
  4043. use Composer\Installer;
  4044. use Composer\Plugin\CommandEvent;
  4045. use Composer\Plugin\PluginEvents;
  4046. use Symfony\Component\Console\Input\InputInterface;
  4047. use Symfony\Component\Console\Input\InputOption;
  4048. use Symfony\Component\Console\Input\InputArgument;
  4049. use Symfony\Component\Console\Output\OutputInterface;
  4050. class InstallCommand extends BaseCommand
  4051. {
  4052. protected function configure()
  4053. {
  4054. $this
  4055. ->setName('install')
  4056. ->setAliases(array('i'))
  4057. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  4058. ->setDefinition(array(
  4059. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4060. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4061. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  4062. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  4063. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  4064. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  4065. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  4066. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4067. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4068. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4069. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  4070. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4071. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4072. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4073. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4074. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  4075. ))
  4076. ->setHelp(
  4077. <<<EOT
  4078. The <info>install</info> command reads the composer.lock file from
  4079. the current directory, processes it, and downloads and installs all the
  4080. libraries and dependencies outlined in that file. If the file does not
  4081. exist it will look for composer.json and do the same.
  4082. <info>php composer.phar install</info>
  4083. Read more at https://getcomposer.org/doc/03-cli.md#install-i
  4084. EOT
  4085. )
  4086. ;
  4087. }
  4088. protected function execute(InputInterface $input, OutputInterface $output)
  4089. {
  4090. $io = $this->getIO();
  4091. if ($args = $input->getArgument('packages')) {
  4092. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  4093. return 1;
  4094. }
  4095. if ($input->getOption('no-custom-installers')) {
  4096. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  4097. $input->setOption('no-plugins', true);
  4098. }
  4099. if ($input->getOption('dev')) {
  4100. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  4101. }
  4102. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4103. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4104. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  4105. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4106. $install = Installer::create($io, $composer);
  4107. $config = $composer->getConfig();
  4108. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  4109. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  4110. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4111. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  4112. $install
  4113. ->setDryRun($input->getOption('dry-run'))
  4114. ->setVerbose($input->getOption('verbose'))
  4115. ->setPreferSource($preferSource)
  4116. ->setPreferDist($preferDist)
  4117. ->setDevMode(!$input->getOption('no-dev'))
  4118. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  4119. ->setRunScripts(!$input->getOption('no-scripts'))
  4120. ->setSkipSuggest($input->getOption('no-suggest'))
  4121. ->setOptimizeAutoloader($optimize)
  4122. ->setClassMapAuthoritative($authoritative)
  4123. ->setApcuAutoloader($apcu)
  4124. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4125. ;
  4126. if ($input->getOption('no-plugins')) {
  4127. $install->disablePlugins();
  4128. }
  4129. return $install->run();
  4130. }
  4131. }
  4132. <?php
  4133. namespace Composer\Command;
  4134. use Composer\Json\JsonFile;
  4135. use Composer\Plugin\CommandEvent;
  4136. use Composer\Plugin\PluginEvents;
  4137. use Composer\Package\PackageInterface;
  4138. use Composer\Repository\RepositoryInterface;
  4139. use Symfony\Component\Console\Helper\Table;
  4140. use Symfony\Component\Console\Input\InputInterface;
  4141. use Symfony\Component\Console\Input\InputOption;
  4142. use Symfony\Component\Console\Output\OutputInterface;
  4143. class LicensesCommand extends BaseCommand
  4144. {
  4145. protected function configure()
  4146. {
  4147. $this
  4148. ->setName('licenses')
  4149. ->setDescription('Shows information about licenses of dependencies.')
  4150. ->setDefinition(array(
  4151. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4152. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  4153. ))
  4154. ->setHelp(
  4155. <<<EOT
  4156. The license command displays detailed information about the licenses of
  4157. the installed dependencies.
  4158. Read more at https://getcomposer.org/doc/03-cli.md#licenses
  4159. EOT
  4160. )
  4161. ;
  4162. }
  4163. protected function execute(InputInterface $input, OutputInterface $output)
  4164. {
  4165. $composer = $this->getComposer();
  4166. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  4167. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4168. $root = $composer->getPackage();
  4169. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4170. if ($input->getOption('no-dev')) {
  4171. $packages = $this->filterRequiredPackages($repo, $root);
  4172. } else {
  4173. $packages = $this->appendPackages($repo->getPackages(), array());
  4174. }
  4175. ksort($packages);
  4176. $io = $this->getIO();
  4177. switch ($format = $input->getOption('format')) {
  4178. case 'text':
  4179. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  4180. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  4181. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  4182. $io->write('Dependencies:');
  4183. $io->write('');
  4184. $table = new Table($output);
  4185. $table->setStyle('compact');
  4186. $tableStyle = $table->getStyle();
  4187. $tableStyle->setVerticalBorderChar('');
  4188. $tableStyle->setCellRowContentFormat('%s ');
  4189. $table->setHeaders(array('Name', 'Version', 'License'));
  4190. foreach ($packages as $package) {
  4191. $table->addRow(array(
  4192. $package->getPrettyName(),
  4193. $package->getFullPrettyVersion(),
  4194. implode(', ', $package->getLicense()) ?: 'none',
  4195. ));
  4196. }
  4197. $table->render();
  4198. break;
  4199. case 'json':
  4200. $dependencies = array();
  4201. foreach ($packages as $package) {
  4202. $dependencies[$package->getPrettyName()] = array(
  4203. 'version' => $package->getFullPrettyVersion(),
  4204. 'license' => $package->getLicense(),
  4205. );
  4206. }
  4207. $io->write(JsonFile::encode(array(
  4208. 'name' => $root->getPrettyName(),
  4209. 'version' => $root->getFullPrettyVersion(),
  4210. 'license' => $root->getLicense(),
  4211. 'dependencies' => $dependencies,
  4212. )));
  4213. break;
  4214. default:
  4215. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4216. }
  4217. }
  4218. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4219. {
  4220. $requires = array_keys($package->getRequires());
  4221. $packageListNames = array_keys($bucket);
  4222. $packages = array_filter(
  4223. $repo->getPackages(),
  4224. function ($package) use ($requires, $packageListNames) {
  4225. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4226. }
  4227. );
  4228. $bucket = $this->appendPackages($packages, $bucket);
  4229. foreach ($packages as $package) {
  4230. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4231. }
  4232. return $bucket;
  4233. }
  4234. public function appendPackages(array $packages, array $bucket)
  4235. {
  4236. foreach ($packages as $package) {
  4237. $bucket[$package->getName()] = $package;
  4238. }
  4239. return $bucket;
  4240. }
  4241. }
  4242. <?php
  4243. namespace Composer\Command;
  4244. use Symfony\Component\Console\Input\InputInterface;
  4245. use Symfony\Component\Console\Input\InputArgument;
  4246. use Symfony\Component\Console\Input\ArrayInput;
  4247. use Symfony\Component\Console\Input\InputOption;
  4248. use Symfony\Component\Console\Output\OutputInterface;
  4249. class OutdatedCommand extends ShowCommand
  4250. {
  4251. protected function configure()
  4252. {
  4253. $this
  4254. ->setName('outdated')
  4255. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4256. ->setDefinition(array(
  4257. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4258. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4259. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4260. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4261. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4262. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4263. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4264. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  4265. ))
  4266. ->setHelp(
  4267. <<<EOT
  4268. The outdated command is just a proxy for `composer show -l`
  4269. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4270. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4271. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4272. compatibility breaks according to semver, so upgrade when you can but it
  4273. may involve work.
  4274. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4275. Read more at https://getcomposer.org/doc/03-cli.md#outdated
  4276. EOT
  4277. )
  4278. ;
  4279. }
  4280. protected function execute(InputInterface $input, OutputInterface $output)
  4281. {
  4282. $args = array(
  4283. 'show',
  4284. '--latest' => true,
  4285. );
  4286. if (!$input->getOption('all')) {
  4287. $args['--outdated'] = true;
  4288. }
  4289. if ($input->getOption('direct')) {
  4290. $args['--direct'] = true;
  4291. }
  4292. if ($input->getArgument('package')) {
  4293. $args['package'] = $input->getArgument('package');
  4294. }
  4295. if ($input->getOption('strict')) {
  4296. $args['--strict'] = true;
  4297. }
  4298. if ($input->getOption('minor-only')) {
  4299. $args['--minor-only'] = true;
  4300. }
  4301. $args['--format'] = $input->getOption('format');
  4302. $args['--ignore'] = $input->getOption('ignore');
  4303. $input = new ArrayInput($args);
  4304. return $this->getApplication()->run($input, $output);
  4305. }
  4306. public function isProxyCommand()
  4307. {
  4308. return true;
  4309. }
  4310. }
  4311. <?php
  4312. namespace Composer\Command;
  4313. use Symfony\Component\Console\Input\InputInterface;
  4314. use Symfony\Component\Console\Output\OutputInterface;
  4315. class ProhibitsCommand extends BaseDependencyCommand
  4316. {
  4317. protected function configure()
  4318. {
  4319. parent::configure();
  4320. $this
  4321. ->setName('prohibits')
  4322. ->setAliases(array('why-not'))
  4323. ->setDescription('Shows which packages prevent the given package from being installed.')
  4324. ->setHelp(
  4325. <<<EOT
  4326. Displays detailed information about why a package cannot be installed.
  4327. <info>php composer.phar prohibits composer/composer</info>
  4328. Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not-
  4329. EOT
  4330. )
  4331. ;
  4332. }
  4333. protected function execute(InputInterface $input, OutputInterface $output)
  4334. {
  4335. return parent::doExecute($input, $output, true);
  4336. }
  4337. }
  4338. <?php
  4339. namespace Composer\Command;
  4340. use Composer\Config\JsonConfigSource;
  4341. use Composer\Installer;
  4342. use Composer\Plugin\CommandEvent;
  4343. use Composer\Plugin\PluginEvents;
  4344. use Composer\Json\JsonFile;
  4345. use Composer\Factory;
  4346. use Symfony\Component\Console\Input\InputInterface;
  4347. use Symfony\Component\Console\Input\InputOption;
  4348. use Symfony\Component\Console\Input\InputArgument;
  4349. use Symfony\Component\Console\Output\OutputInterface;
  4350. use Composer\Package\BasePackage;
  4351. class RemoveCommand extends BaseCommand
  4352. {
  4353. protected function configure()
  4354. {
  4355. $this
  4356. ->setName('remove')
  4357. ->setDescription('Removes a package from the require or require-dev.')
  4358. ->setDefinition(array(
  4359. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4360. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4361. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4362. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4363. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4364. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4365. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4366. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4367. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4368. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4369. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4370. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4371. ))
  4372. ->setHelp(
  4373. <<<EOT
  4374. The <info>remove</info> command removes a package from the current
  4375. list of installed packages
  4376. <info>php composer.phar remove</info>
  4377. Read more at https://getcomposer.org/doc/03-cli.md#remove
  4378. EOT
  4379. )
  4380. ;
  4381. }
  4382. protected function execute(InputInterface $input, OutputInterface $output)
  4383. {
  4384. $packages = $input->getArgument('packages');
  4385. $packages = array_map('strtolower', $packages);
  4386. $file = Factory::getComposerFile();
  4387. $jsonFile = new JsonFile($file);
  4388. $composer = $jsonFile->read();
  4389. $composerBackup = file_get_contents($jsonFile->getPath());
  4390. $json = new JsonConfigSource($jsonFile);
  4391. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4392. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4393. $io = $this->getIO();
  4394. if ($input->getOption('update-with-dependencies')) {
  4395. $io->writeError('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>');
  4396. }
  4397. foreach (array('require', 'require-dev') as $linkType) {
  4398. if (isset($composer[$linkType])) {
  4399. foreach ($composer[$linkType] as $name => $version) {
  4400. $composer[$linkType][strtolower($name)] = $name;
  4401. }
  4402. }
  4403. }
  4404. foreach ($packages as $package) {
  4405. if (isset($composer[$type][$package])) {
  4406. $json->removeLink($type, $composer[$type][$package]);
  4407. } elseif (isset($composer[$altType][$package])) {
  4408. $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4409. if ($io->isInteractive()) {
  4410. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4411. $json->removeLink($altType, $composer[$altType][$package]);
  4412. }
  4413. }
  4414. } elseif (isset($composer[$type]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) {
  4415. foreach ($matches as $matchedPackage) {
  4416. $json->removeLink($type, $matchedPackage);
  4417. }
  4418. } elseif (isset($composer[$altType]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) {
  4419. foreach ($matches as $matchedPackage) {
  4420. $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4421. if ($io->isInteractive()) {
  4422. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4423. $json->removeLink($altType, $matchedPackage);
  4424. }
  4425. }
  4426. }
  4427. } else {
  4428. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4429. }
  4430. }
  4431. if ($input->getOption('no-update')) {
  4432. return 0;
  4433. }
  4434. $this->resetComposer();
  4435. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4436. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4437. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4438. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4439. $install = Installer::create($io, $composer);
  4440. $updateDevMode = !$input->getOption('update-no-dev');
  4441. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4442. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4443. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4444. $install
  4445. ->setVerbose($input->getOption('verbose'))
  4446. ->setDevMode($updateDevMode)
  4447. ->setOptimizeAutoloader($optimize)
  4448. ->setClassMapAuthoritative($authoritative)
  4449. ->setApcuAutoloader($apcu)
  4450. ->setUpdate(true)
  4451. ->setUpdateWhitelist($packages)
  4452. ->setWhitelistTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4453. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4454. ->setRunScripts(!$input->getOption('no-scripts'))
  4455. ;
  4456. $status = $install->run();
  4457. if ($status !== 0) {
  4458. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4459. file_put_contents($jsonFile->getPath(), $composerBackup);
  4460. }
  4461. return $status;
  4462. }
  4463. }
  4464. <?php
  4465. namespace Composer\Command;
  4466. use Symfony\Component\Console\Input\InputInterface;
  4467. use Symfony\Component\Console\Input\InputArgument;
  4468. use Symfony\Component\Console\Input\InputOption;
  4469. use Symfony\Component\Console\Output\OutputInterface;
  4470. use Composer\Factory;
  4471. use Composer\Installer;
  4472. use Composer\Json\JsonFile;
  4473. use Composer\Json\JsonManipulator;
  4474. use Composer\Package\Version\VersionParser;
  4475. use Composer\Plugin\CommandEvent;
  4476. use Composer\Plugin\PluginEvents;
  4477. use Composer\Repository\CompositeRepository;
  4478. use Composer\Repository\PlatformRepository;
  4479. use Composer\IO\IOInterface;
  4480. class RequireCommand extends InitCommand
  4481. {
  4482. private $newlyCreated;
  4483. private $json;
  4484. private $file;
  4485. private $composerBackup;
  4486. protected function configure()
  4487. {
  4488. $this
  4489. ->setName('require')
  4490. ->setDescription('Adds required packages to your composer.json and installs them.')
  4491. ->setDefinition(array(
  4492. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name can also include a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  4493. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4494. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4495. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4496. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4497. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4498. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4499. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4500. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4501. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4502. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4503. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4504. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4505. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4506. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4507. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4508. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4509. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4510. ))
  4511. ->setHelp(
  4512. <<<EOT
  4513. The require command adds required packages to your composer.json and installs them.
  4514. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4515. matches to require.
  4516. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4517. If you do not want to install the new dependencies immediately you can call it with --no-update
  4518. Read more at https://getcomposer.org/doc/03-cli.md#require
  4519. EOT
  4520. )
  4521. ;
  4522. }
  4523. protected function execute(InputInterface $input, OutputInterface $output)
  4524. {
  4525. if (function_exists('pcntl_async_signals')) {
  4526. pcntl_async_signals(true);
  4527. pcntl_signal(SIGINT, array($this, 'revertComposerFile'));
  4528. pcntl_signal(SIGTERM, array($this, 'revertComposerFile'));
  4529. pcntl_signal(SIGHUP, array($this, 'revertComposerFile'));
  4530. }
  4531. $this->file = Factory::getComposerFile();
  4532. $io = $this->getIO();
  4533. $this->newlyCreated = !file_exists($this->file);
  4534. if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
  4535. $io->writeError('<error>'.$this->file.' could not be created.</error>');
  4536. return 1;
  4537. }
  4538. if (!is_readable($this->file)) {
  4539. $io->writeError('<error>'.$this->file.' is not readable.</error>');
  4540. return 1;
  4541. }
  4542. if (!is_writable($this->file)) {
  4543. $io->writeError('<error>'.$this->file.' is not writable.</error>');
  4544. return 1;
  4545. }
  4546. if (filesize($this->file) === 0) {
  4547. file_put_contents($this->file, "{\n}\n");
  4548. }
  4549. $this->json = new JsonFile($this->file);
  4550. $this->composerBackup = file_get_contents($this->json->getPath());
  4551. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4552. $repos = $composer->getRepositoryManager()->getRepositories();
  4553. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4554. $this->repos = new CompositeRepository(array_merge(
  4555. array(new PlatformRepository(array(), $platformOverrides)),
  4556. $repos
  4557. ));
  4558. if ($composer->getPackage()->getPreferStable()) {
  4559. $preferredStability = 'stable';
  4560. } else {
  4561. $preferredStability = $composer->getPackage()->getMinimumStability();
  4562. }
  4563. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4564. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability, !$input->getOption('no-update'));
  4565. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4566. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4567. $requirements = $this->formatRequirements($requirements);
  4568. $versionParser = new VersionParser();
  4569. foreach ($requirements as $constraint) {
  4570. $versionParser->parseConstraints($constraint);
  4571. }
  4572. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4573. if (!$this->updateFileCleanly($this->json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4574. $composerDefinition = $this->json->read();
  4575. foreach ($requirements as $package => $version) {
  4576. $composerDefinition[$requireKey][$package] = $version;
  4577. unset($composerDefinition[$removeKey][$package]);
  4578. }
  4579. $this->json->write($composerDefinition);
  4580. }
  4581. $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
  4582. if ($input->getOption('no-update')) {
  4583. return 0;
  4584. }
  4585. try {
  4586. return $this->doUpdate($input, $output, $io, $requirements);
  4587. } catch (\Exception $e) {
  4588. $this->revertComposerFile(false);
  4589. throw $e;
  4590. }
  4591. }
  4592. private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements)
  4593. {
  4594. $this->resetComposer();
  4595. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4596. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4597. $updateDevMode = !$input->getOption('update-no-dev');
  4598. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4599. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4600. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4601. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4602. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4603. $install = Installer::create($io, $composer);
  4604. $install
  4605. ->setVerbose($input->getOption('verbose'))
  4606. ->setPreferSource($input->getOption('prefer-source'))
  4607. ->setPreferDist($input->getOption('prefer-dist'))
  4608. ->setDevMode($updateDevMode)
  4609. ->setRunScripts(!$input->getOption('no-scripts'))
  4610. ->setSkipSuggest($input->getOption('no-suggest'))
  4611. ->setOptimizeAutoloader($optimize)
  4612. ->setClassMapAuthoritative($authoritative)
  4613. ->setApcuAutoloader($apcu)
  4614. ->setUpdate(true)
  4615. ->setUpdateWhitelist(array_keys($requirements))
  4616. ->setWhitelistTransitiveDependencies($input->getOption('update-with-dependencies'))
  4617. ->setWhitelistAllDependencies($input->getOption('update-with-all-dependencies'))
  4618. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4619. ->setPreferStable($input->getOption('prefer-stable'))
  4620. ->setPreferLowest($input->getOption('prefer-lowest'))
  4621. ;
  4622. $status = $install->run();
  4623. if ($status !== 0) {
  4624. $this->revertComposerFile(false);
  4625. }
  4626. return $status;
  4627. }
  4628. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4629. {
  4630. $contents = file_get_contents($json->getPath());
  4631. $manipulator = new JsonManipulator($contents);
  4632. foreach ($new as $package => $constraint) {
  4633. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4634. return false;
  4635. }
  4636. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4637. return false;
  4638. }
  4639. }
  4640. file_put_contents($json->getPath(), $manipulator->getContents());
  4641. return true;
  4642. }
  4643. protected function interact(InputInterface $input, OutputInterface $output)
  4644. {
  4645. return;
  4646. }
  4647. public function revertComposerFile($hardExit = true)
  4648. {
  4649. $io = $this->getIO();
  4650. if ($this->newlyCreated) {
  4651. $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
  4652. unlink($this->json->getPath());
  4653. } else {
  4654. $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.' to its original content.</error>');
  4655. file_put_contents($this->json->getPath(), $this->composerBackup);
  4656. }
  4657. if ($hardExit) {
  4658. exit(1);
  4659. }
  4660. }
  4661. }
  4662. <?php
  4663. namespace Composer\Command;
  4664. use Composer\Script\Event as ScriptEvent;
  4665. use Composer\Script\ScriptEvents;
  4666. use Composer\Util\ProcessExecutor;
  4667. use Symfony\Component\Console\Input\InputInterface;
  4668. use Symfony\Component\Console\Input\InputOption;
  4669. use Symfony\Component\Console\Input\InputArgument;
  4670. use Symfony\Component\Console\Output\OutputInterface;
  4671. use Symfony\Component\Console\Helper\Table;
  4672. class RunScriptCommand extends BaseCommand
  4673. {
  4674. protected $scriptEvents = array(
  4675. ScriptEvents::PRE_INSTALL_CMD,
  4676. ScriptEvents::POST_INSTALL_CMD,
  4677. ScriptEvents::PRE_UPDATE_CMD,
  4678. ScriptEvents::POST_UPDATE_CMD,
  4679. ScriptEvents::PRE_STATUS_CMD,
  4680. ScriptEvents::POST_STATUS_CMD,
  4681. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4682. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4683. ScriptEvents::PRE_ARCHIVE_CMD,
  4684. ScriptEvents::POST_ARCHIVE_CMD,
  4685. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4686. ScriptEvents::POST_AUTOLOAD_DUMP,
  4687. );
  4688. protected function configure()
  4689. {
  4690. $this
  4691. ->setName('run-script')
  4692. ->setDescription('Runs the scripts defined in composer.json.')
  4693. ->setDefinition(array(
  4694. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4695. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4696. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4697. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4698. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4699. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4700. ))
  4701. ->setHelp(
  4702. <<<EOT
  4703. The <info>run-script</info> command runs scripts defined in composer.json:
  4704. <info>php composer.phar run-script post-update-cmd</info>
  4705. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  4706. EOT
  4707. )
  4708. ;
  4709. }
  4710. protected function execute(InputInterface $input, OutputInterface $output)
  4711. {
  4712. if ($input->getOption('list')) {
  4713. return $this->listScripts($output);
  4714. } elseif (!$input->getArgument('script')) {
  4715. throw new \RuntimeException('Missing required argument "script"');
  4716. }
  4717. $script = $input->getArgument('script');
  4718. if (!in_array($script, $this->scriptEvents)) {
  4719. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4720. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4721. }
  4722. }
  4723. $composer = $this->getComposer();
  4724. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  4725. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  4726. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  4727. if (!$hasListeners) {
  4728. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4729. }
  4730. $args = $input->getArgument('args');
  4731. if (null !== $timeout = $input->getOption('timeout')) {
  4732. if (!ctype_digit($timeout)) {
  4733. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4734. }
  4735. ProcessExecutor::setTimeout((int) $timeout);
  4736. }
  4737. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  4738. }
  4739. protected function listScripts(OutputInterface $output)
  4740. {
  4741. $scripts = $this->getComposer()->getPackage()->getScripts();
  4742. if (!count($scripts)) {
  4743. return 0;
  4744. }
  4745. $io = $this->getIO();
  4746. $io->writeError('<info>scripts:</info>');
  4747. $table = array();
  4748. foreach ($scripts as $name => $script) {
  4749. $description = '';
  4750. try {
  4751. $cmd = $this->getApplication()->find($name);
  4752. if ($cmd instanceof ScriptAliasCommand) {
  4753. $description = $cmd->getDescription();
  4754. }
  4755. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  4756. }
  4757. $table[] = array(' '.$name, $description);
  4758. }
  4759. $renderer = new Table($output);
  4760. $renderer->setStyle('compact');
  4761. $rendererStyle = $renderer->getStyle();
  4762. $rendererStyle->setVerticalBorderChar('');
  4763. $rendererStyle->setCellRowContentFormat('%s ');
  4764. $renderer->setRows($table)->render();
  4765. return 0;
  4766. }
  4767. }
  4768. <?php
  4769. namespace Composer\Command;
  4770. use Symfony\Component\Console\Input\InputInterface;
  4771. use Symfony\Component\Console\Input\InputOption;
  4772. use Symfony\Component\Console\Input\InputArgument;
  4773. use Symfony\Component\Console\Output\OutputInterface;
  4774. class ScriptAliasCommand extends BaseCommand
  4775. {
  4776. private $script;
  4777. private $description;
  4778. public function __construct($script, $description)
  4779. {
  4780. $this->script = $script;
  4781. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  4782. parent::__construct();
  4783. }
  4784. protected function configure()
  4785. {
  4786. $this
  4787. ->setName($this->script)
  4788. ->setDescription($this->description)
  4789. ->setDefinition(array(
  4790. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4791. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4792. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4793. ))
  4794. ->setHelp(
  4795. <<<EOT
  4796. The <info>run-script</info> command runs scripts defined in composer.json:
  4797. <info>php composer.phar run-script post-update-cmd</info>
  4798. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  4799. EOT
  4800. )
  4801. ;
  4802. }
  4803. protected function execute(InputInterface $input, OutputInterface $output)
  4804. {
  4805. $composer = $this->getComposer();
  4806. $args = $input->getArguments();
  4807. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4808. }
  4809. }
  4810. <?php
  4811. namespace Composer\Command;
  4812. use Composer\Factory;
  4813. use Symfony\Component\Console\Input\InputInterface;
  4814. use Symfony\Component\Console\Input\InputArgument;
  4815. use Symfony\Component\Console\Input\InputOption;
  4816. use Symfony\Component\Console\Output\OutputInterface;
  4817. use Composer\Repository\CompositeRepository;
  4818. use Composer\Repository\PlatformRepository;
  4819. use Composer\Repository\RepositoryInterface;
  4820. use Composer\Plugin\CommandEvent;
  4821. use Composer\Plugin\PluginEvents;
  4822. class SearchCommand extends BaseCommand
  4823. {
  4824. protected $matches;
  4825. protected $lowMatches = array();
  4826. protected $tokens;
  4827. protected $output;
  4828. protected $onlyName;
  4829. protected function configure()
  4830. {
  4831. $this
  4832. ->setName('search')
  4833. ->setDescription('Searches for packages.')
  4834. ->setDefinition(array(
  4835. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4836. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4837. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4838. ))
  4839. ->setHelp(
  4840. <<<EOT
  4841. The search command searches for packages by its name
  4842. <info>php composer.phar search symfony composer</info>
  4843. Read more at https://getcomposer.org/doc/03-cli.md#search
  4844. EOT
  4845. )
  4846. ;
  4847. }
  4848. protected function execute(InputInterface $input, OutputInterface $output)
  4849. {
  4850. $platformRepo = new PlatformRepository;
  4851. $io = $this->getIO();
  4852. if (!($composer = $this->getComposer(false))) {
  4853. $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
  4854. }
  4855. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4856. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4857. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4858. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4859. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4860. $onlyName = $input->getOption('only-name');
  4861. $type = $input->getOption('type') ?: null;
  4862. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4863. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4864. foreach ($results as $result) {
  4865. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4866. }
  4867. }
  4868. }
  4869. <?php
  4870. namespace Composer\Command;
  4871. use Composer\Composer;
  4872. use Composer\Factory;
  4873. use Composer\Config;
  4874. use Composer\Util\Filesystem;
  4875. use Composer\SelfUpdate\Keys;
  4876. use Composer\SelfUpdate\Versions;
  4877. use Composer\IO\IOInterface;
  4878. use Composer\Downloader\FilesystemException;
  4879. use Symfony\Component\Console\Input\InputInterface;
  4880. use Symfony\Component\Console\Input\InputOption;
  4881. use Symfony\Component\Console\Input\InputArgument;
  4882. use Symfony\Component\Console\Output\OutputInterface;
  4883. use Symfony\Component\Finder\Finder;
  4884. class SelfUpdateCommand extends BaseCommand
  4885. {
  4886. const HOMEPAGE = 'getcomposer.org';
  4887. const OLD_INSTALL_EXT = '-old.phar';
  4888. protected function configure()
  4889. {
  4890. $this
  4891. ->setName('self-update')
  4892. ->setAliases(array('selfupdate'))
  4893. ->setDescription('Updates composer.phar to the latest version.')
  4894. ->setDefinition(array(
  4895. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4896. new InputOption('clean-backups', null, InputOption::VALUE_NONE, 'Delete old backups during an update. This makes the current version of composer the only backup available after the update'),
  4897. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4898. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4899. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4900. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  4901. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  4902. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  4903. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  4904. ))
  4905. ->setHelp(
  4906. <<<EOT
  4907. The <info>self-update</info> command checks getcomposer.org for newer
  4908. versions of composer and if found, installs the latest.
  4909. <info>php composer.phar self-update</info>
  4910. Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate-
  4911. EOT
  4912. )
  4913. ;
  4914. }
  4915. protected function execute(InputInterface $input, OutputInterface $output)
  4916. {
  4917. $config = Factory::createConfig();
  4918. if ($config->get('disable-tls') === true) {
  4919. $baseUrl = 'http://' . self::HOMEPAGE;
  4920. } else {
  4921. $baseUrl = 'https://' . self::HOMEPAGE;
  4922. }
  4923. $io = $this->getIO();
  4924. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4925. $versionsUtil = new Versions($config, $remoteFilesystem);
  4926. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  4927. if ($input->getOption($channel)) {
  4928. $versionsUtil->setChannel($channel);
  4929. }
  4930. }
  4931. if ($input->getOption('set-channel-only')) {
  4932. return 0;
  4933. }
  4934. $cacheDir = $config->get('cache-dir');
  4935. $rollbackDir = $config->get('data-dir');
  4936. $home = $config->get('home');
  4937. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4938. if ($input->getOption('update-keys')) {
  4939. return $this->fetchKeys($io, $config);
  4940. }
  4941. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4942. if (!is_writable($tmpDir)) {
  4943. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4944. }
  4945. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  4946. $composeUser = posix_getpwuid(posix_geteuid());
  4947. $homeOwner = posix_getpwuid(fileowner($home));
  4948. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  4949. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  4950. }
  4951. }
  4952. if ($input->getOption('rollback')) {
  4953. return $this->rollback($output, $rollbackDir, $localFilename);
  4954. }
  4955. $latest = $versionsUtil->getLatest();
  4956. $latestVersion = $latest['version'];
  4957. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4958. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4959. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4960. return 1;
  4961. }
  4962. if (Composer::VERSION === $updateVersion) {
  4963. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  4964. if ($input->getOption('clean-backups')) {
  4965. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  4966. }
  4967. return 0;
  4968. }
  4969. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  4970. $backupFile = sprintf(
  4971. '%s/%s-%s%s',
  4972. $rollbackDir,
  4973. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  4974. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  4975. self::OLD_INSTALL_EXT
  4976. );
  4977. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  4978. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  4979. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  4980. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  4981. $io->writeError(' ', false);
  4982. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  4983. $io->writeError('');
  4984. if (!file_exists($tempFilename) || !$signature) {
  4985. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  4986. return 1;
  4987. }
  4988. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  4989. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  4990. } else {
  4991. if (!extension_loaded('openssl')) {
  4992. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  4993. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  4994. }
  4995. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  4996. if (!file_exists($sigFile)) {
  4997. file_put_contents(
  4998. $home.'/keys.dev.pub',
  4999. <<<DEVPUBKEY
  5000. -----BEGIN PUBLIC KEY-----
  5001. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  5002. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  5003. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  5004. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  5005. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  5006. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  5007. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  5008. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  5009. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  5010. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  5011. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  5012. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  5013. -----END PUBLIC KEY-----
  5014. DEVPUBKEY
  5015. );
  5016. file_put_contents(
  5017. $home.'/keys.tags.pub',
  5018. <<<TAGSPUBKEY
  5019. -----BEGIN PUBLIC KEY-----
  5020. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  5021. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  5022. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  5023. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  5024. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  5025. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  5026. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  5027. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  5028. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  5029. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  5030. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  5031. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  5032. -----END PUBLIC KEY-----
  5033. TAGSPUBKEY
  5034. );
  5035. }
  5036. $pubkeyid = openssl_pkey_get_public($sigFile);
  5037. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  5038. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()))) {
  5039. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  5040. }
  5041. $signature = json_decode($signature, true);
  5042. $signature = base64_decode($signature['sha384']);
  5043. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  5044. openssl_free_key($pubkeyid);
  5045. if (!$verified) {
  5046. throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
  5047. }
  5048. }
  5049. if ($input->getOption('clean-backups')) {
  5050. $this->cleanBackups($rollbackDir);
  5051. }
  5052. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  5053. @unlink($tempFilename);
  5054. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  5055. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  5056. return 1;
  5057. }
  5058. if (file_exists($backupFile)) {
  5059. $io->writeError(sprintf(
  5060. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  5061. Composer::VERSION
  5062. ));
  5063. } else {
  5064. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  5065. }
  5066. }
  5067. protected function fetchKeys(IOInterface $io, Config $config)
  5068. {
  5069. if (!$io->isInteractive()) {
  5070. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  5071. }
  5072. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  5073. $validator = function ($value) {
  5074. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  5075. throw new \UnexpectedValueException('Invalid input');
  5076. }
  5077. return trim($value)."\n";
  5078. };
  5079. $devKey = '';
  5080. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  5081. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  5082. while ($line = $io->ask('')) {
  5083. $devKey .= trim($line)."\n";
  5084. if (trim($line) === '-----END PUBLIC KEY-----') {
  5085. break;
  5086. }
  5087. }
  5088. }
  5089. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  5090. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5091. $tagsKey = '';
  5092. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  5093. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  5094. while ($line = $io->ask('')) {
  5095. $tagsKey .= trim($line)."\n";
  5096. if (trim($line) === '-----END PUBLIC KEY-----') {
  5097. break;
  5098. }
  5099. }
  5100. }
  5101. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  5102. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5103. $io->write('Public keys stored in '.$config->get('home'));
  5104. }
  5105. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  5106. {
  5107. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  5108. if (!$rollbackVersion) {
  5109. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  5110. }
  5111. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  5112. if (!is_file($oldFile)) {
  5113. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  5114. }
  5115. if (!is_readable($oldFile)) {
  5116. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  5117. }
  5118. $io = $this->getIO();
  5119. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  5120. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  5121. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  5122. return 1;
  5123. }
  5124. return 0;
  5125. }
  5126. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  5127. {
  5128. try {
  5129. @chmod($newFilename, fileperms($localFilename));
  5130. if (!ini_get('phar.readonly')) {
  5131. $phar = new \Phar($newFilename);
  5132. unset($phar);
  5133. }
  5134. if ($backupTarget && file_exists($localFilename)) {
  5135. @copy($localFilename, $backupTarget);
  5136. }
  5137. rename($newFilename, $localFilename);
  5138. return null;
  5139. } catch (\Exception $e) {
  5140. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  5141. throw $e;
  5142. }
  5143. return $e;
  5144. }
  5145. }
  5146. protected function cleanBackups($rollbackDir, $except = null)
  5147. {
  5148. $finder = $this->getOldInstallationFinder($rollbackDir);
  5149. $io = $this->getIO();
  5150. $fs = new Filesystem;
  5151. foreach ($finder as $file) {
  5152. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  5153. continue;
  5154. }
  5155. $file = (string) $file;
  5156. $io->writeError('<info>Removing: '.$file.'</info>');
  5157. $fs->remove($file);
  5158. }
  5159. }
  5160. protected function getLastBackupVersion($rollbackDir)
  5161. {
  5162. $finder = $this->getOldInstallationFinder($rollbackDir);
  5163. $finder->sortByName();
  5164. $files = iterator_to_array($finder);
  5165. if (count($files)) {
  5166. return basename(end($files), self::OLD_INSTALL_EXT);
  5167. }
  5168. return false;
  5169. }
  5170. protected function getOldInstallationFinder($rollbackDir)
  5171. {
  5172. $finder = Finder::create()
  5173. ->depth(0)
  5174. ->files()
  5175. ->name('*' . self::OLD_INSTALL_EXT)
  5176. ->in($rollbackDir);
  5177. return $finder;
  5178. }
  5179. }
  5180. <?php
  5181. namespace Composer\Command;
  5182. use Composer\Composer;
  5183. use Composer\DependencyResolver\DefaultPolicy;
  5184. use Composer\DependencyResolver\Pool;
  5185. use Composer\Json\JsonFile;
  5186. use Composer\Package\BasePackage;
  5187. use Composer\Package\CompletePackageInterface;
  5188. use Composer\Package\PackageInterface;
  5189. use Composer\Package\Version\VersionParser;
  5190. use Composer\Package\Version\VersionSelector;
  5191. use Composer\Plugin\CommandEvent;
  5192. use Composer\Plugin\PluginEvents;
  5193. use Composer\Repository\ArrayRepository;
  5194. use Composer\Repository\ComposerRepository;
  5195. use Composer\Repository\CompositeRepository;
  5196. use Composer\Repository\PlatformRepository;
  5197. use Composer\Repository\RepositoryFactory;
  5198. use Composer\Repository\RepositoryInterface;
  5199. use Composer\Semver\Constraint\ConstraintInterface;
  5200. use Composer\Semver\Semver;
  5201. use Composer\Spdx\SpdxLicenses;
  5202. use Composer\Util\Platform;
  5203. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  5204. use Symfony\Component\Console\Input\InputArgument;
  5205. use Symfony\Component\Console\Input\InputInterface;
  5206. use Symfony\Component\Console\Input\InputOption;
  5207. use Symfony\Component\Console\Output\OutputInterface;
  5208. use Symfony\Component\Console\Terminal;
  5209. class ShowCommand extends BaseCommand
  5210. {
  5211. protected $versionParser;
  5212. protected $colors;
  5213. private $pool;
  5214. protected function configure()
  5215. {
  5216. $this
  5217. ->setName('show')
  5218. ->setAliases(array('info'))
  5219. ->setDescription('Shows information about packages.')
  5220. ->setDefinition(array(
  5221. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  5222. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  5223. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  5224. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  5225. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  5226. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  5227. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  5228. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  5229. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  5230. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  5231. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  5232. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  5233. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  5234. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  5235. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  5236. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  5237. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  5238. ))
  5239. ->setHelp(
  5240. <<<EOT
  5241. The show command displays detailed information about a package, or
  5242. lists all packages available.
  5243. Read more at https://getcomposer.org/doc/03-cli.md#show
  5244. EOT
  5245. )
  5246. ;
  5247. }
  5248. protected function execute(InputInterface $input, OutputInterface $output)
  5249. {
  5250. $this->versionParser = new VersionParser;
  5251. if ($input->getOption('tree')) {
  5252. $this->initStyles($output);
  5253. }
  5254. $composer = $this->getComposer(false);
  5255. $io = $this->getIO();
  5256. if ($input->getOption('installed')) {
  5257. $io->writeError('<warning>You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.</warning>');
  5258. }
  5259. if ($input->getOption('outdated')) {
  5260. $input->setOption('latest', true);
  5261. } elseif ($input->getOption('ignore')) {
  5262. $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
  5263. }
  5264. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  5265. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  5266. return 1;
  5267. }
  5268. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  5269. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  5270. return 1;
  5271. }
  5272. if ($input->getOption('tree') && $input->getOption('latest')) {
  5273. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  5274. return 1;
  5275. }
  5276. $format = $input->getOption('format');
  5277. if (!in_array($format, array('text', 'json'))) {
  5278. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5279. return 1;
  5280. }
  5281. $platformOverrides = array();
  5282. if ($composer) {
  5283. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  5284. }
  5285. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  5286. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  5287. if ($input->getOption('self')) {
  5288. $package = $this->getComposer()->getPackage();
  5289. $repos = $installedRepo = new ArrayRepository(array($package));
  5290. } elseif ($input->getOption('platform')) {
  5291. $repos = $installedRepo = $platformRepo;
  5292. } elseif ($input->getOption('available')) {
  5293. $installedRepo = $platformRepo;
  5294. if ($composer) {
  5295. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5296. } else {
  5297. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5298. $repos = new CompositeRepository($defaultRepos);
  5299. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5300. }
  5301. } elseif ($input->getOption('all') && $composer) {
  5302. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5303. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5304. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5305. } elseif ($input->getOption('all')) {
  5306. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5307. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5308. $installedRepo = $platformRepo;
  5309. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5310. } else {
  5311. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5312. $rootPkg = $this->getComposer()->getPackage();
  5313. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5314. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5315. }
  5316. }
  5317. if ($composer) {
  5318. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5319. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5320. }
  5321. if ($input->getOption('latest') && null === $composer) {
  5322. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5323. $input->setOption('latest', false);
  5324. }
  5325. $packageFilter = $input->getArgument('package');
  5326. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5327. if (empty($package)) {
  5328. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5329. if (empty($package)) {
  5330. $options = $input->getOptions();
  5331. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5332. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5333. }
  5334. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5335. return 1;
  5336. }
  5337. } else {
  5338. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5339. }
  5340. $exitCode = 0;
  5341. if ($input->getOption('tree')) {
  5342. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  5343. if ('json' === $format) {
  5344. $io->write(JsonFile::encode(array('installed' => array($arrayTree))));
  5345. } else {
  5346. $this->displayPackageTree(array($arrayTree));
  5347. }
  5348. } else {
  5349. $latestPackage = null;
  5350. if ($input->getOption('latest')) {
  5351. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5352. }
  5353. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5354. $exitCode = 1;
  5355. }
  5356. if ($input->getOption('path')) {
  5357. $io->write($package->getName(), false);
  5358. $io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"));
  5359. return $exitCode;
  5360. }
  5361. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  5362. $this->printLinks($package, 'requires');
  5363. $this->printLinks($package, 'devRequires', 'requires (dev)');
  5364. if ($package->getSuggests()) {
  5365. $io->write("\n<info>suggests</info>");
  5366. foreach ($package->getSuggests() as $suggested => $reason) {
  5367. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  5368. }
  5369. }
  5370. $this->printLinks($package, 'provides');
  5371. $this->printLinks($package, 'conflicts');
  5372. $this->printLinks($package, 'replaces');
  5373. }
  5374. return $exitCode;
  5375. }
  5376. if ($input->getOption('tree')) {
  5377. $rootRequires = $this->getRootRequires();
  5378. $packages = $installedRepo->getPackages();
  5379. usort($packages, 'strcmp');
  5380. $arrayTree = array();
  5381. foreach ($packages as $package) {
  5382. if (in_array($package->getName(), $rootRequires, true)) {
  5383. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  5384. }
  5385. }
  5386. if ('json' === $format) {
  5387. $io->write(JsonFile::encode(array('installed' => $arrayTree)));
  5388. } else {
  5389. $this->displayPackageTree($arrayTree);
  5390. }
  5391. return 0;
  5392. }
  5393. if ($repos instanceof CompositeRepository) {
  5394. $repos = $repos->getRepositories();
  5395. } elseif (!is_array($repos)) {
  5396. $repos = array($repos);
  5397. }
  5398. $packages = array();
  5399. if (null !== $packageFilter) {
  5400. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5401. }
  5402. $packageListFilter = array();
  5403. if ($input->getOption('direct')) {
  5404. $packageListFilter = $this->getRootRequires();
  5405. }
  5406. if (class_exists('Symfony\Component\Console\Terminal')) {
  5407. $terminal = new Terminal();
  5408. $width = $terminal->getWidth();
  5409. } else {
  5410. list($width) = $this->getApplication()->getTerminalDimensions();
  5411. }
  5412. if (null === $width) {
  5413. $width = PHP_INT_MAX;
  5414. }
  5415. if (Platform::isWindows()) {
  5416. $width--;
  5417. } else {
  5418. $width = max(80, $width);
  5419. }
  5420. if ($input->getOption('path') && null === $composer) {
  5421. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5422. $input->setOption('path', false);
  5423. }
  5424. foreach ($repos as $repo) {
  5425. if ($repo === $platformRepo) {
  5426. $type = 'platform';
  5427. } elseif (
  5428. $repo === $installedRepo
  5429. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5430. ) {
  5431. $type = 'installed';
  5432. } else {
  5433. $type = 'available';
  5434. }
  5435. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5436. foreach ($repo->getProviderNames() as $name) {
  5437. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5438. $packages[$type][$name] = $name;
  5439. }
  5440. }
  5441. } else {
  5442. foreach ($repo->getPackages() as $package) {
  5443. if (!isset($packages[$type][$package->getName()])
  5444. || !is_object($packages[$type][$package->getName()])
  5445. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5446. ) {
  5447. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5448. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5449. $packages[$type][$package->getName()] = $package;
  5450. }
  5451. }
  5452. }
  5453. }
  5454. }
  5455. }
  5456. $showAllTypes = $input->getOption('all');
  5457. $showLatest = $input->getOption('latest');
  5458. $showMinorOnly = $input->getOption('minor-only');
  5459. $ignoredPackages = array_map('strtolower', $input->getOption('ignore'));
  5460. $indent = $showAllTypes ? ' ' : '';
  5461. $latestPackages = array();
  5462. $exitCode = 0;
  5463. $viewData = array();
  5464. $viewMetaData = array();
  5465. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5466. if (isset($packages[$type])) {
  5467. ksort($packages[$type]);
  5468. $nameLength = $versionLength = $latestLength = 0;
  5469. if ($showLatest && $showVersion) {
  5470. foreach ($packages[$type] as $package) {
  5471. if (is_object($package)) {
  5472. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5473. if ($latestPackage === false) {
  5474. continue;
  5475. }
  5476. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5477. }
  5478. }
  5479. }
  5480. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5481. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5482. $writeLatest = $writeVersion && $showLatest;
  5483. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5484. $hasOutdatedPackages = false;
  5485. $viewData[$type] = array();
  5486. foreach ($packages[$type] as $package) {
  5487. $packageViewData = array();
  5488. if (is_object($package)) {
  5489. $latestPackage = null;
  5490. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5491. $latestPackage = $latestPackages[$package->getPrettyName()];
  5492. }
  5493. $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned();
  5494. $packageIsIgnored = \in_array($package->getPrettyName(), $ignoredPackages, true);
  5495. if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
  5496. continue;
  5497. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5498. $hasOutdatedPackages = true;
  5499. }
  5500. $packageViewData['name'] = $package->getPrettyName();
  5501. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5502. if ($writeVersion) {
  5503. $packageViewData['version'] = $package->getFullPrettyVersion();
  5504. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5505. }
  5506. if ($writeLatest && $latestPackage) {
  5507. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5508. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5509. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5510. }
  5511. if ($writeDescription) {
  5512. $packageViewData['description'] = $package->getDescription();
  5513. }
  5514. if ($writePath) {
  5515. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5516. }
  5517. if ($latestPackage && $latestPackage->isAbandoned()) {
  5518. $replacement = is_string($latestPackage->getReplacementPackage())
  5519. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5520. : 'No replacement was suggested';
  5521. $packageWarning = sprintf(
  5522. 'Package %s is abandoned, you should avoid using it. %s.',
  5523. $package->getPrettyName(),
  5524. $replacement
  5525. );
  5526. $packageViewData['warning'] = $packageWarning;
  5527. }
  5528. } else {
  5529. $packageViewData['name'] = $package;
  5530. $nameLength = max($nameLength, strlen($package));
  5531. }
  5532. $viewData[$type][] = $packageViewData;
  5533. }
  5534. $viewMetaData[$type] = array(
  5535. 'nameLength' => $nameLength,
  5536. 'versionLength' => $versionLength,
  5537. 'latestLength' => $latestLength,
  5538. );
  5539. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5540. $exitCode = 1;
  5541. break;
  5542. }
  5543. }
  5544. }
  5545. if ('json' === $format) {
  5546. $io->write(JsonFile::encode($viewData));
  5547. } else {
  5548. foreach ($viewData as $type => $packages) {
  5549. $nameLength = $viewMetaData[$type]['nameLength'];
  5550. $versionLength = $viewMetaData[$type]['versionLength'];
  5551. $latestLength = $viewMetaData[$type]['latestLength'];
  5552. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5553. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5554. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  5555. if ($writeLatest && !$io->isDecorated()) {
  5556. $latestLength += 2;
  5557. }
  5558. if ($showAllTypes) {
  5559. if ('available' === $type) {
  5560. $io->write('<comment>' . $type . '</comment>:');
  5561. } else {
  5562. $io->write('<info>' . $type . '</info>:');
  5563. }
  5564. }
  5565. foreach ($packages as $package) {
  5566. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  5567. if (isset($package['version']) && $writeVersion) {
  5568. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  5569. }
  5570. if (isset($package['latest']) && $writeLatest) {
  5571. $latestVersion = $package['latest'];
  5572. $updateStatus = $package['latest-status'];
  5573. $style = $this->updateStatusToVersionStyle($updateStatus);
  5574. if (!$io->isDecorated()) {
  5575. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  5576. }
  5577. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  5578. }
  5579. if (isset($package['description']) && $writeDescription) {
  5580. $description = strtok($package['description'], "\r\n");
  5581. $remaining = $width - $nameLength - $versionLength - 4;
  5582. if ($writeLatest) {
  5583. $remaining -= $latestLength;
  5584. }
  5585. if (strlen($description) > $remaining) {
  5586. $description = substr($description, 0, $remaining - 3) . '...';
  5587. }
  5588. $io->write(' ' . $description, false);
  5589. }
  5590. if (isset($package['path'])) {
  5591. $io->write(' ' . $package['path'], false);
  5592. }
  5593. $io->write('');
  5594. if (isset($package['warning'])) {
  5595. $io->writeError('<warning>' . $package['warning'] . '</warning>');
  5596. }
  5597. }
  5598. if ($showAllTypes) {
  5599. $io->write('');
  5600. }
  5601. }
  5602. }
  5603. return $exitCode;
  5604. }
  5605. protected function getRootRequires()
  5606. {
  5607. $rootPackage = $this->getComposer()->getPackage();
  5608. return array_map(
  5609. 'strtolower',
  5610. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  5611. );
  5612. }
  5613. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  5614. {
  5615. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  5616. }
  5617. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  5618. {
  5619. $name = strtolower($name);
  5620. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  5621. $policy = new DefaultPolicy();
  5622. $pool = new Pool('dev');
  5623. $pool->addRepository($repos);
  5624. $matchedPackage = null;
  5625. $versions = array();
  5626. $matches = $pool->whatProvides($name, $constraint);
  5627. foreach ($matches as $index => $package) {
  5628. if ($package->getName() !== $name) {
  5629. unset($matches[$index]);
  5630. continue;
  5631. }
  5632. if (null === $version && $installedRepo->hasPackage($package)) {
  5633. $matchedPackage = $package;
  5634. }
  5635. $versions[$package->getPrettyVersion()] = $package->getVersion();
  5636. $matches[$index] = $package->getId();
  5637. }
  5638. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  5639. $matchedPackage = $pool->literalToPackage($preferred[0]);
  5640. }
  5641. return array($matchedPackage, $versions);
  5642. }
  5643. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  5644. {
  5645. $io = $this->getIO();
  5646. $io->write('<info>name</info> : ' . $package->getPrettyName());
  5647. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  5648. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  5649. $this->printVersions($package, $versions, $installedRepo);
  5650. if ($latestPackage) {
  5651. $style = $this->getVersionStyle($latestPackage, $package);
  5652. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  5653. } else {
  5654. $latestPackage = $package;
  5655. }
  5656. $io->write('<info>type</info> : ' . $package->getType());
  5657. $this->printLicenses($package);
  5658. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  5659. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  5660. if ($installedRepo->hasPackage($package)) {
  5661. $io->write('<info>path</info> : ' . sprintf('%s', realpath($this->getComposer()->getInstallationManager()->getInstallPath($package))));
  5662. }
  5663. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  5664. if ($latestPackage->isAbandoned()) {
  5665. $replacement = ($latestPackage->getReplacementPackage() !== null)
  5666. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  5667. : null;
  5668. $io->writeError(
  5669. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  5670. );
  5671. }
  5672. if ($package->getSupport()) {
  5673. $io->write("\n<info>support</info>");
  5674. foreach ($package->getSupport() as $type => $value) {
  5675. $io->write('<comment>' . $type . '</comment> : '.$value);
  5676. }
  5677. }
  5678. if ($package->getAutoload()) {
  5679. $io->write("\n<info>autoload</info>");
  5680. foreach ($package->getAutoload() as $type => $autoloads) {
  5681. $io->write('<comment>' . $type . '</comment>');
  5682. if ($type === 'psr-0') {
  5683. foreach ($autoloads as $name => $path) {
  5684. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5685. }
  5686. } elseif ($type === 'psr-4') {
  5687. foreach ($autoloads as $name => $path) {
  5688. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5689. }
  5690. } elseif ($type === 'classmap') {
  5691. $io->write(implode(', ', $autoloads));
  5692. }
  5693. }
  5694. if ($package->getIncludePaths()) {
  5695. $io->write('<comment>include-path</comment>');
  5696. $io->write(implode(', ', $package->getIncludePaths()));
  5697. }
  5698. }
  5699. }
  5700. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  5701. {
  5702. uasort($versions, 'version_compare');
  5703. $versions = array_keys(array_reverse($versions));
  5704. if ($installedRepo->hasPackage($package)) {
  5705. $installedVersion = $package->getPrettyVersion();
  5706. $key = array_search($installedVersion, $versions);
  5707. if (false !== $key) {
  5708. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  5709. }
  5710. }
  5711. $versions = implode(', ', $versions);
  5712. $this->getIO()->write('<info>versions</info> : ' . $versions);
  5713. }
  5714. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  5715. {
  5716. $title = $title ?: $linkType;
  5717. $io = $this->getIO();
  5718. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  5719. $io->write("\n<info>" . $title . "</info>");
  5720. foreach ($links as $link) {
  5721. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  5722. }
  5723. }
  5724. }
  5725. protected function printLicenses(CompletePackageInterface $package)
  5726. {
  5727. $spdxLicenses = new SpdxLicenses();
  5728. $licenses = $package->getLicense();
  5729. $io = $this->getIO();
  5730. foreach ($licenses as $licenseId) {
  5731. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  5732. if (!$license) {
  5733. $out = $licenseId;
  5734. } else {
  5735. if ($license[1] === true) {
  5736. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  5737. } else {
  5738. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  5739. }
  5740. }
  5741. $io->write('<info>license</info> : ' . $out);
  5742. }
  5743. }
  5744. protected function initStyles(OutputInterface $output)
  5745. {
  5746. $this->colors = array(
  5747. 'green',
  5748. 'yellow',
  5749. 'cyan',
  5750. 'magenta',
  5751. 'blue',
  5752. );
  5753. foreach ($this->colors as $color) {
  5754. $style = new OutputFormatterStyle($color);
  5755. $output->getFormatter()->setStyle($color, $style);
  5756. }
  5757. }
  5758. protected function displayPackageTree(array $arrayTree)
  5759. {
  5760. $io = $this->getIO();
  5761. foreach ($arrayTree as $package) {
  5762. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  5763. $io->write(' ' . $package['version'], false);
  5764. $io->write(' ' . strtok($package['description'], "\r\n"));
  5765. if (isset($package['requires'])) {
  5766. $requires = $package['requires'];
  5767. $treeBar = '├';
  5768. $j = 0;
  5769. $total = count($requires);
  5770. foreach ($requires as $require) {
  5771. $requireName = $require['name'];
  5772. $j++;
  5773. if ($j === $total) {
  5774. $treeBar = 'â””';
  5775. }
  5776. $level = 1;
  5777. $color = $this->colors[$level];
  5778. $info = sprintf(
  5779. '%s──<%s>%s</%s> %s',
  5780. $treeBar,
  5781. $color,
  5782. $requireName,
  5783. $color,
  5784. $require['version']
  5785. );
  5786. $this->writeTreeLine($info);
  5787. $treeBar = str_replace('â””', ' ', $treeBar);
  5788. $packagesInTree = array($package['name'], $requireName);
  5789. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  5790. }
  5791. }
  5792. }
  5793. }
  5794. protected function generatePackageTree(
  5795. PackageInterface $package,
  5796. RepositoryInterface $installedRepo,
  5797. RepositoryInterface $distantRepos
  5798. ) {
  5799. $requires = $package->getRequires();
  5800. ksort($requires);
  5801. $children = array();
  5802. foreach ($requires as $requireName => $require) {
  5803. $packagesInTree = array($package->getName(), $requireName);
  5804. $treeChildDesc = array(
  5805. 'name' => $requireName,
  5806. 'version' => $require->getPrettyConstraint(),
  5807. );
  5808. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
  5809. if ($deepChildren) {
  5810. $treeChildDesc['requires'] = $deepChildren;
  5811. }
  5812. $children[] = $treeChildDesc;
  5813. }
  5814. $tree = array(
  5815. 'name' => $package->getPrettyName(),
  5816. 'version' => $package->getPrettyVersion(),
  5817. 'description' => $package->getDescription(),
  5818. );
  5819. if ($children) {
  5820. $tree['requires'] = $children;
  5821. }
  5822. return $tree;
  5823. }
  5824. protected function displayTree(
  5825. $package,
  5826. array $packagesInTree,
  5827. $previousTreeBar = '├',
  5828. $level = 1
  5829. ) {
  5830. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5831. if (isset($package['requires'])) {
  5832. $requires = $package['requires'];
  5833. $treeBar = $previousTreeBar . ' ├';
  5834. $i = 0;
  5835. $total = count($requires);
  5836. foreach ($requires as $require) {
  5837. $currentTree = $packagesInTree;
  5838. $i++;
  5839. if ($i === $total) {
  5840. $treeBar = $previousTreeBar . ' â””';
  5841. }
  5842. $colorIdent = $level % count($this->colors);
  5843. $color = $this->colors[$colorIdent];
  5844. $circularWarn = in_array(
  5845. $require['name'],
  5846. $currentTree,
  5847. true
  5848. ) ? '(circular dependency aborted here)' : '';
  5849. $info = rtrim(sprintf(
  5850. '%s──<%s>%s</%s> %s %s',
  5851. $treeBar,
  5852. $color,
  5853. $require['name'],
  5854. $color,
  5855. $require['version'],
  5856. $circularWarn
  5857. ));
  5858. $this->writeTreeLine($info);
  5859. $treeBar = str_replace('â””', ' ', $treeBar);
  5860. $currentTree[] = $require['name'];
  5861. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  5862. }
  5863. }
  5864. }
  5865. protected function addTree(
  5866. $name,
  5867. $package,
  5868. RepositoryInterface $installedRepo,
  5869. RepositoryInterface $distantRepos,
  5870. array $packagesInTree
  5871. ) {
  5872. $children = array();
  5873. list($package, $versions) = $this->getPackage(
  5874. $installedRepo,
  5875. $distantRepos,
  5876. $name,
  5877. $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint()
  5878. );
  5879. if (is_object($package)) {
  5880. $requires = $package->getRequires();
  5881. ksort($requires);
  5882. foreach ($requires as $requireName => $require) {
  5883. $currentTree = $packagesInTree;
  5884. $treeChildDesc = array(
  5885. 'name' => $requireName,
  5886. 'version' => $require->getPrettyConstraint(),
  5887. );
  5888. if (!in_array($requireName, $currentTree, true)) {
  5889. $currentTree[] = $requireName;
  5890. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $currentTree);
  5891. if ($deepChildren) {
  5892. $treeChildDesc['requires'] = $deepChildren;
  5893. }
  5894. }
  5895. $children[] = $treeChildDesc;
  5896. }
  5897. }
  5898. return $children;
  5899. }
  5900. private function updateStatusToVersionStyle($updateStatus)
  5901. {
  5902. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  5903. }
  5904. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  5905. {
  5906. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  5907. return 'up-to-date';
  5908. }
  5909. $constraint = $package->getVersion();
  5910. if (0 !== strpos($constraint, 'dev-')) {
  5911. $constraint = '^'.$constraint;
  5912. }
  5913. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  5914. return 'semver-safe-update';
  5915. }
  5916. return 'update-possible';
  5917. }
  5918. private function writeTreeLine($line)
  5919. {
  5920. $io = $this->getIO();
  5921. if (!$io->isDecorated()) {
  5922. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  5923. }
  5924. $io->write($line);
  5925. }
  5926. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  5927. {
  5928. $name = $package->getName();
  5929. $versionSelector = new VersionSelector($this->getPool($composer));
  5930. $stability = $composer->getPackage()->getMinimumStability();
  5931. $flags = $composer->getPackage()->getStabilityFlags();
  5932. if (isset($flags[$name])) {
  5933. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  5934. }
  5935. $bestStability = $stability;
  5936. if ($composer->getPackage()->getPreferStable()) {
  5937. $bestStability = $package->getStability();
  5938. }
  5939. $targetVersion = null;
  5940. if (0 === strpos($package->getVersion(), 'dev-')) {
  5941. $targetVersion = $package->getVersion();
  5942. }
  5943. if ($targetVersion === null && $minorOnly) {
  5944. $targetVersion = '^' . $package->getVersion();
  5945. }
  5946. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  5947. }
  5948. private function getPool(Composer $composer)
  5949. {
  5950. if (!$this->pool) {
  5951. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  5952. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  5953. }
  5954. return $this->pool;
  5955. }
  5956. }
  5957. <?php
  5958. namespace Composer\Command;
  5959. use Symfony\Component\Console\Input\InputInterface;
  5960. use Symfony\Component\Console\Input\InputOption;
  5961. use Symfony\Component\Console\Output\OutputInterface;
  5962. use Composer\Downloader\ChangeReportInterface;
  5963. use Composer\Downloader\DvcsDownloaderInterface;
  5964. use Composer\Downloader\VcsCapableDownloaderInterface;
  5965. use Composer\Package\Dumper\ArrayDumper;
  5966. use Composer\Package\Version\VersionGuesser;
  5967. use Composer\Package\Version\VersionParser;
  5968. use Composer\Plugin\CommandEvent;
  5969. use Composer\Plugin\PluginEvents;
  5970. use Composer\Script\ScriptEvents;
  5971. use Composer\Util\ProcessExecutor;
  5972. class StatusCommand extends BaseCommand
  5973. {
  5974. const EXIT_CODE_ERRORS = 1;
  5975. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  5976. const EXIT_CODE_VERSION_CHANGES = 4;
  5977. protected function configure()
  5978. {
  5979. $this
  5980. ->setName('status')
  5981. ->setDescription('Shows a list of locally modified packages, for packages installed from source.')
  5982. ->setDefinition(array(
  5983. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  5984. ))
  5985. ->setHelp(
  5986. <<<EOT
  5987. The status command displays a list of dependencies that have
  5988. been modified locally.
  5989. Read more at https://getcomposer.org/doc/03-cli.md#status
  5990. EOT
  5991. )
  5992. ;
  5993. }
  5994. protected function execute(InputInterface $input, OutputInterface $output)
  5995. {
  5996. $composer = $this->getComposer();
  5997. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  5998. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5999. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  6000. $dm = $composer->getDownloadManager();
  6001. $im = $composer->getInstallationManager();
  6002. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  6003. $errors = array();
  6004. $io = $this->getIO();
  6005. $unpushedChanges = array();
  6006. $vcsVersionChanges = array();
  6007. $parser = new VersionParser;
  6008. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  6009. $dumper = new ArrayDumper;
  6010. foreach ($installedRepo->getCanonicalPackages() as $package) {
  6011. $downloader = $dm->getDownloaderForInstalledPackage($package);
  6012. $targetDir = $im->getInstallPath($package);
  6013. if ($downloader instanceof ChangeReportInterface) {
  6014. if (is_link($targetDir)) {
  6015. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  6016. }
  6017. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  6018. $errors[$targetDir] = $changes;
  6019. }
  6020. }
  6021. if ($downloader instanceof VcsCapableDownloaderInterface) {
  6022. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  6023. switch ($package->getInstallationSource()) {
  6024. case 'source':
  6025. $previousRef = $package->getSourceReference();
  6026. break;
  6027. case 'dist':
  6028. $previousRef = $package->getDistReference();
  6029. break;
  6030. default:
  6031. $previousRef = null;
  6032. }
  6033. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  6034. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  6035. $vcsVersionChanges[$targetDir] = array(
  6036. 'previous' => array(
  6037. 'version' => $package->getPrettyVersion(),
  6038. 'ref' => $previousRef,
  6039. ),
  6040. 'current' => array(
  6041. 'version' => $currentVersion['pretty_version'],
  6042. 'ref' => $currentVersion['commit'],
  6043. ),
  6044. );
  6045. }
  6046. }
  6047. }
  6048. if ($downloader instanceof DvcsDownloaderInterface) {
  6049. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  6050. $unpushedChanges[$targetDir] = $unpushed;
  6051. }
  6052. }
  6053. }
  6054. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  6055. $io->writeError('<info>No local changes</info>');
  6056. return 0;
  6057. }
  6058. if ($errors) {
  6059. $io->writeError('<error>You have changes in the following dependencies:</error>');
  6060. foreach ($errors as $path => $changes) {
  6061. if ($input->getOption('verbose')) {
  6062. $indentedChanges = implode("\n", array_map(function ($line) {
  6063. return ' ' . ltrim($line);
  6064. }, explode("\n", $changes)));
  6065. $io->write('<info>'.$path.'</info>:');
  6066. $io->write($indentedChanges);
  6067. } else {
  6068. $io->write($path);
  6069. }
  6070. }
  6071. }
  6072. if ($unpushedChanges) {
  6073. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  6074. foreach ($unpushedChanges as $path => $changes) {
  6075. if ($input->getOption('verbose')) {
  6076. $indentedChanges = implode("\n", array_map(function ($line) {
  6077. return ' ' . ltrim($line);
  6078. }, explode("\n", $changes)));
  6079. $io->write('<info>'.$path.'</info>:');
  6080. $io->write($indentedChanges);
  6081. } else {
  6082. $io->write($path);
  6083. }
  6084. }
  6085. }
  6086. if ($vcsVersionChanges) {
  6087. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  6088. foreach ($vcsVersionChanges as $path => $changes) {
  6089. if ($input->getOption('verbose')) {
  6090. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  6091. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  6092. if ($io->isVeryVerbose()) {
  6093. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  6094. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  6095. }
  6096. $io->write('<info>'.$path.'</info>:');
  6097. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  6098. } else {
  6099. $io->write($path);
  6100. }
  6101. }
  6102. }
  6103. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  6104. $io->writeError('Use --verbose (-v) to see a list of files');
  6105. }
  6106. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  6107. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  6108. }
  6109. }
  6110. <?php
  6111. namespace Composer\Command;
  6112. use Composer\Repository\PlatformRepository;
  6113. use Symfony\Component\Console\Input\InputArgument;
  6114. use Symfony\Component\Console\Input\InputInterface;
  6115. use Symfony\Component\Console\Input\InputOption;
  6116. use Symfony\Component\Console\Output\OutputInterface;
  6117. class SuggestsCommand extends BaseCommand
  6118. {
  6119. protected function configure()
  6120. {
  6121. $this
  6122. ->setName('suggests')
  6123. ->setDescription('Shows package suggestions.')
  6124. ->setDefinition(array(
  6125. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  6126. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  6127. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  6128. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  6129. ))
  6130. ->setHelp(
  6131. <<<EOT
  6132. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  6133. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  6134. Read more at https://getcomposer.org/doc/03-cli.md#suggests
  6135. EOT
  6136. )
  6137. ;
  6138. }
  6139. protected function execute(InputInterface $input, OutputInterface $output)
  6140. {
  6141. $lock = $this->getComposer()->getLocker()->getLockData();
  6142. if (empty($lock)) {
  6143. throw new \RuntimeException('Lockfile seems to be empty?');
  6144. }
  6145. $packages = $lock['packages'];
  6146. if (!$input->getOption('no-dev')) {
  6147. $packages += $lock['packages-dev'];
  6148. }
  6149. $filter = $input->getArgument('packages');
  6150. $installed = array();
  6151. foreach ($packages as $package) {
  6152. $installed[] = $package['name'];
  6153. if (!empty($package['provide'])) {
  6154. $installed = array_merge($installed, array_keys($package['provide']));
  6155. }
  6156. if (!empty($package['replace'])) {
  6157. $installed = array_merge($installed, array_keys($package['replace']));
  6158. }
  6159. }
  6160. $installed = array_flip($installed);
  6161. ksort($installed);
  6162. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  6163. $suggesters = array();
  6164. $suggested = array();
  6165. foreach ($packages as $package) {
  6166. $packageName = $package['name'];
  6167. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  6168. continue;
  6169. }
  6170. foreach ($package['suggest'] as $suggestion => $reason) {
  6171. if (false === strpos('/', $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  6172. continue;
  6173. }
  6174. if (!isset($installed[$suggestion])) {
  6175. $suggesters[$packageName][$suggestion] = $reason;
  6176. $suggested[$suggestion][$packageName] = $reason;
  6177. }
  6178. }
  6179. }
  6180. ksort($suggesters);
  6181. ksort($suggested);
  6182. $mode = 0;
  6183. $io = $this->getIO();
  6184. if ($input->getOption('by-package') || $io->isVerbose()) {
  6185. $mode |= 1;
  6186. }
  6187. if ($input->getOption('by-suggestion')) {
  6188. $mode |= 2;
  6189. }
  6190. if ($mode === 0) {
  6191. foreach (array_keys($suggested) as $suggestion) {
  6192. $io->write(sprintf('<info>%s</info>', $suggestion));
  6193. }
  6194. return;
  6195. }
  6196. if ($mode & 1) {
  6197. foreach ($suggesters as $suggester => $suggestions) {
  6198. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  6199. foreach ($suggestions as $suggestion => $reason) {
  6200. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  6201. }
  6202. $io->write('');
  6203. }
  6204. }
  6205. if ($mode & 2) {
  6206. if ($mode & 1) {
  6207. $io->write(str_repeat('-', 78));
  6208. }
  6209. foreach ($suggested as $suggestion => $suggesters) {
  6210. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  6211. foreach ($suggesters as $suggester => $reason) {
  6212. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  6213. }
  6214. $io->write('');
  6215. }
  6216. }
  6217. }
  6218. }
  6219. <?php
  6220. namespace Composer\Command;
  6221. use Composer\Composer;
  6222. use Composer\Installer;
  6223. use Composer\IO\IOInterface;
  6224. use Composer\Plugin\CommandEvent;
  6225. use Composer\Plugin\PluginEvents;
  6226. use Symfony\Component\Console\Helper\Table;
  6227. use Symfony\Component\Console\Input\InputInterface;
  6228. use Symfony\Component\Console\Input\InputOption;
  6229. use Symfony\Component\Console\Input\InputArgument;
  6230. use Symfony\Component\Console\Output\OutputInterface;
  6231. use Symfony\Component\Console\Question\Question;
  6232. class UpdateCommand extends BaseCommand
  6233. {
  6234. protected function configure()
  6235. {
  6236. $this
  6237. ->setName('update')
  6238. ->setAliases(array('u', 'upgrade'))
  6239. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  6240. ->setDefinition(array(
  6241. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  6242. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6243. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  6244. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6245. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  6246. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  6247. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  6248. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  6249. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6250. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  6251. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6252. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  6253. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of whitelisted packages to the whitelist, except those defined in root package.'),
  6254. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist, including those defined in root package.'),
  6255. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  6256. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  6257. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6258. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6259. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  6260. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  6261. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  6262. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  6263. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  6264. ))
  6265. ->setHelp(
  6266. <<<EOT
  6267. The <info>update</info> command reads the composer.json file from the
  6268. current directory, processes it, and updates, removes or installs all the
  6269. dependencies.
  6270. <info>php composer.phar update</info>
  6271. To limit the update operation to a few packages, you can list the package(s)
  6272. you want to update as such:
  6273. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  6274. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  6275. from a specific vendor:
  6276. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  6277. To select packages names interactively with auto-completion use <info>-i</info>.
  6278. Read more at https://getcomposer.org/doc/03-cli.md#update-u
  6279. EOT
  6280. )
  6281. ;
  6282. }
  6283. protected function execute(InputInterface $input, OutputInterface $output)
  6284. {
  6285. $io = $this->getIO();
  6286. if ($input->getOption('no-custom-installers')) {
  6287. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  6288. $input->setOption('no-plugins', true);
  6289. }
  6290. if ($input->getOption('dev')) {
  6291. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  6292. }
  6293. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  6294. $packages = $input->getArgument('packages');
  6295. if ($input->getOption('interactive')) {
  6296. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  6297. }
  6298. if ($input->getOption('root-reqs')) {
  6299. $require = array_keys($composer->getPackage()->getRequires());
  6300. if (!$input->getOption('no-dev')) {
  6301. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  6302. $require = array_merge($require, $requireDev);
  6303. }
  6304. if (!empty($packages)) {
  6305. $packages = array_intersect($packages, $require);
  6306. } else {
  6307. $packages = $require;
  6308. }
  6309. }
  6310. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  6311. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  6312. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6313. $install = Installer::create($io, $composer);
  6314. $config = $composer->getConfig();
  6315. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  6316. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6317. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6318. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6319. $install
  6320. ->setDryRun($input->getOption('dry-run'))
  6321. ->setVerbose($input->getOption('verbose'))
  6322. ->setPreferSource($preferSource)
  6323. ->setPreferDist($preferDist)
  6324. ->setDevMode(!$input->getOption('no-dev'))
  6325. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  6326. ->setRunScripts(!$input->getOption('no-scripts'))
  6327. ->setSkipSuggest($input->getOption('no-suggest'))
  6328. ->setOptimizeAutoloader($optimize)
  6329. ->setClassMapAuthoritative($authoritative)
  6330. ->setApcuAutoloader($apcu)
  6331. ->setUpdate(true)
  6332. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  6333. ->setWhitelistTransitiveDependencies($input->getOption('with-dependencies'))
  6334. ->setWhitelistAllDependencies($input->getOption('with-all-dependencies'))
  6335. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  6336. ->setPreferStable($input->getOption('prefer-stable'))
  6337. ->setPreferLowest($input->getOption('prefer-lowest'))
  6338. ;
  6339. if ($input->getOption('no-plugins')) {
  6340. $install->disablePlugins();
  6341. }
  6342. return $install->run();
  6343. }
  6344. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  6345. {
  6346. if (!$input->isInteractive()) {
  6347. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  6348. }
  6349. $requires = array_merge(
  6350. $composer->getPackage()->getRequires(),
  6351. $composer->getPackage()->getDevRequires()
  6352. );
  6353. $autocompleterValues = array();
  6354. foreach ($requires as $require) {
  6355. $target = $require->getTarget();
  6356. $autocompleterValues[strtolower($target)] = $target;
  6357. }
  6358. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  6359. foreach ($installedPackages as $package) {
  6360. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  6361. }
  6362. $helper = $this->getHelper('question');
  6363. $question = new Question('<comment>Enter package name: </comment>', null);
  6364. $io->writeError('<info>Press enter without value to end submission</info>');
  6365. do {
  6366. $autocompleterValues = array_diff($autocompleterValues, $packages);
  6367. $question->setAutocompleterValues($autocompleterValues);
  6368. $addedPackage = $helper->ask($input, $output, $question);
  6369. if (!is_string($addedPackage) || empty($addedPackage)) {
  6370. break;
  6371. }
  6372. $addedPackage = strtolower($addedPackage);
  6373. if (!in_array($addedPackage, $packages)) {
  6374. $packages[] = $addedPackage;
  6375. }
  6376. } while (true);
  6377. $packages = array_filter($packages);
  6378. if (!$packages) {
  6379. throw new \InvalidArgumentException('You must enter minimum one package.');
  6380. }
  6381. $table = new Table($output);
  6382. $table->setHeaders(array('Selected packages'));
  6383. foreach ($packages as $package) {
  6384. $table->addRow(array($package));
  6385. }
  6386. $table->render();
  6387. if ($io->askConfirmation(sprintf(
  6388. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  6389. 1 === count($packages) ? '' : 's'
  6390. ), true)) {
  6391. return $packages;
  6392. }
  6393. throw new \RuntimeException('Installation aborted.');
  6394. }
  6395. }
  6396. <?php
  6397. namespace Composer\Command;
  6398. use Composer\Factory;
  6399. use Composer\Package\Loader\ValidatingArrayLoader;
  6400. use Composer\Plugin\CommandEvent;
  6401. use Composer\Plugin\PluginEvents;
  6402. use Composer\Util\ConfigValidator;
  6403. use Symfony\Component\Console\Input\InputArgument;
  6404. use Symfony\Component\Console\Input\InputInterface;
  6405. use Symfony\Component\Console\Input\InputOption;
  6406. use Symfony\Component\Console\Output\OutputInterface;
  6407. class ValidateCommand extends BaseCommand
  6408. {
  6409. protected function configure()
  6410. {
  6411. $this
  6412. ->setName('validate')
  6413. ->setDescription('Validates a composer.json and composer.lock.')
  6414. ->setDefinition(array(
  6415. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
  6416. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  6417. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  6418. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  6419. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  6420. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  6421. ))
  6422. ->setHelp(
  6423. <<<EOT
  6424. The validate command validates a given composer.json and composer.lock
  6425. Exit codes in case of errors are:
  6426. 1 validation warning(s), only when --strict is given
  6427. 2 validation error(s)
  6428. 3 file unreadable or missing
  6429. Read more at https://getcomposer.org/doc/03-cli.md#validate
  6430. EOT
  6431. );
  6432. }
  6433. protected function execute(InputInterface $input, OutputInterface $output)
  6434. {
  6435. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  6436. $io = $this->getIO();
  6437. if (!file_exists($file)) {
  6438. $io->writeError('<error>' . $file . ' not found.</error>');
  6439. return 3;
  6440. }
  6441. if (!is_readable($file)) {
  6442. $io->writeError('<error>' . $file . ' is not readable.</error>');
  6443. return 3;
  6444. }
  6445. $validator = new ConfigValidator($io);
  6446. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  6447. $checkPublish = !$input->getOption('no-check-publish');
  6448. $checkLock = !$input->getOption('no-check-lock');
  6449. $isStrict = $input->getOption('strict');
  6450. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6451. $lockErrors = array();
  6452. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  6453. $locker = $composer->getLocker();
  6454. if ($locker->isLocked() && !$locker->isFresh()) {
  6455. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  6456. }
  6457. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true, $isStrict);
  6458. $exitCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  6459. if ($input->getOption('with-dependencies')) {
  6460. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6461. foreach ($localRepo->getPackages() as $package) {
  6462. $path = $composer->getInstallationManager()->getInstallPath($package);
  6463. $file = $path . '/composer.json';
  6464. if (is_dir($path) && file_exists($file)) {
  6465. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6466. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  6467. $depCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  6468. $exitCode = max($depCode, $exitCode);
  6469. }
  6470. }
  6471. }
  6472. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  6473. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6474. $exitCode = max($eventCode, $exitCode);
  6475. return $exitCode;
  6476. }
  6477. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false, $isStrict = false)
  6478. {
  6479. if (!$errors && !$publishErrors && !$warnings) {
  6480. $io->write('<info>' . $name . ' is valid</info>');
  6481. } elseif (!$errors && !$publishErrors) {
  6482. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  6483. if ($printSchemaUrl) {
  6484. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6485. }
  6486. } elseif (!$errors) {
  6487. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  6488. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  6489. if ($printSchemaUrl) {
  6490. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6491. }
  6492. } else {
  6493. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  6494. }
  6495. if ($checkPublish) {
  6496. $errors = array_merge($errors, $publishErrors);
  6497. } elseif (!$isStrict) {
  6498. $warnings = array_merge($warnings, $publishErrors);
  6499. }
  6500. if ($checkLock) {
  6501. $errors = array_merge($errors, $lockErrors);
  6502. } elseif (!$isStrict) {
  6503. $warnings = array_merge($warnings, $lockErrors);
  6504. }
  6505. $messages = array(
  6506. 'error' => $errors,
  6507. 'warning' => $warnings,
  6508. );
  6509. foreach ($messages as $style => $msgs) {
  6510. foreach ($msgs as $msg) {
  6511. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  6512. }
  6513. }
  6514. }
  6515. }
  6516. <?php
  6517. namespace Composer;
  6518. use Composer\Package\RootPackageInterface;
  6519. use Composer\Package\Locker;
  6520. use Composer\Repository\RepositoryManager;
  6521. use Composer\Installer\InstallationManager;
  6522. use Composer\Plugin\PluginManager;
  6523. use Composer\Downloader\DownloadManager;
  6524. use Composer\EventDispatcher\EventDispatcher;
  6525. use Composer\Autoload\AutoloadGenerator;
  6526. use Composer\Package\Archiver\ArchiveManager;
  6527. class Composer
  6528. {
  6529. const VERSION = '1.8.5';
  6530. const BRANCH_ALIAS_VERSION = '';
  6531. const RELEASE_DATE = '2019-04-09 17:46:47';
  6532. const SOURCE_VERSION = '';
  6533. public static function getVersion()
  6534. {
  6535. if (self::VERSION === '@package_version'.'@') {
  6536. return self::SOURCE_VERSION;
  6537. }
  6538. if (self::BRANCH_ALIAS_VERSION !== '' && preg_match('{^[a-f0-9]{40}$}', self::VERSION)) {
  6539. return self::BRANCH_ALIAS_VERSION.'+'.self::VERSION;
  6540. }
  6541. return self::VERSION;
  6542. }
  6543. private $package;
  6544. private $locker;
  6545. private $repositoryManager;
  6546. private $downloadManager;
  6547. private $installationManager;
  6548. private $pluginManager;
  6549. private $config;
  6550. private $eventDispatcher;
  6551. private $autoloadGenerator;
  6552. private $archiveManager;
  6553. public function setPackage(RootPackageInterface $package)
  6554. {
  6555. $this->package = $package;
  6556. }
  6557. public function getPackage()
  6558. {
  6559. return $this->package;
  6560. }
  6561. public function setConfig(Config $config)
  6562. {
  6563. $this->config = $config;
  6564. }
  6565. public function getConfig()
  6566. {
  6567. return $this->config;
  6568. }
  6569. public function setLocker(Locker $locker)
  6570. {
  6571. $this->locker = $locker;
  6572. }
  6573. public function getLocker()
  6574. {
  6575. return $this->locker;
  6576. }
  6577. public function setRepositoryManager(RepositoryManager $manager)
  6578. {
  6579. $this->repositoryManager = $manager;
  6580. }
  6581. public function getRepositoryManager()
  6582. {
  6583. return $this->repositoryManager;
  6584. }
  6585. public function setDownloadManager(DownloadManager $manager)
  6586. {
  6587. $this->downloadManager = $manager;
  6588. }
  6589. public function getDownloadManager()
  6590. {
  6591. return $this->downloadManager;
  6592. }
  6593. public function setArchiveManager(ArchiveManager $manager)
  6594. {
  6595. $this->archiveManager = $manager;
  6596. }
  6597. public function getArchiveManager()
  6598. {
  6599. return $this->archiveManager;
  6600. }
  6601. public function setInstallationManager(InstallationManager $manager)
  6602. {
  6603. $this->installationManager = $manager;
  6604. }
  6605. public function getInstallationManager()
  6606. {
  6607. return $this->installationManager;
  6608. }
  6609. public function setPluginManager(PluginManager $manager)
  6610. {
  6611. $this->pluginManager = $manager;
  6612. }
  6613. public function getPluginManager()
  6614. {
  6615. return $this->pluginManager;
  6616. }
  6617. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  6618. {
  6619. $this->eventDispatcher = $eventDispatcher;
  6620. }
  6621. public function getEventDispatcher()
  6622. {
  6623. return $this->eventDispatcher;
  6624. }
  6625. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  6626. {
  6627. $this->autoloadGenerator = $autoloadGenerator;
  6628. }
  6629. public function getAutoloadGenerator()
  6630. {
  6631. return $this->autoloadGenerator;
  6632. }
  6633. }
  6634. <?php
  6635. namespace Composer;
  6636. use Composer\Config\ConfigSourceInterface;
  6637. use Composer\Downloader\TransportException;
  6638. use Composer\IO\IOInterface;
  6639. use Composer\Util\Platform;
  6640. class Config
  6641. {
  6642. const RELATIVE_PATHS = 1;
  6643. public static $defaultConfig = array(
  6644. 'process-timeout' => 300,
  6645. 'use-include-path' => false,
  6646. 'preferred-install' => 'auto',
  6647. 'notify-on-install' => true,
  6648. 'github-protocols' => array('https', 'ssh', 'git'),
  6649. 'vendor-dir' => 'vendor',
  6650. 'bin-dir' => '{$vendor-dir}/bin',
  6651. 'cache-dir' => '{$home}/cache',
  6652. 'data-dir' => '{$home}',
  6653. 'cache-files-dir' => '{$cache-dir}/files',
  6654. 'cache-repo-dir' => '{$cache-dir}/repo',
  6655. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  6656. 'cache-ttl' => 15552000,
  6657. 'cache-files-ttl' => null,
  6658. 'cache-files-maxsize' => '300MiB',
  6659. 'bin-compat' => 'auto',
  6660. 'discard-changes' => false,
  6661. 'autoloader-suffix' => null,
  6662. 'sort-packages' => false,
  6663. 'optimize-autoloader' => false,
  6664. 'classmap-authoritative' => false,
  6665. 'apcu-autoloader' => false,
  6666. 'prepend-autoloader' => true,
  6667. 'github-domains' => array('github.com'),
  6668. 'bitbucket-expose-hostname' => true,
  6669. 'disable-tls' => false,
  6670. 'secure-http' => true,
  6671. 'cafile' => null,
  6672. 'capath' => null,
  6673. 'github-expose-hostname' => true,
  6674. 'gitlab-domains' => array('gitlab.com'),
  6675. 'store-auths' => 'prompt',
  6676. 'platform' => array(),
  6677. 'archive-format' => 'tar',
  6678. 'archive-dir' => '.',
  6679. 'htaccess-protect' => true,
  6680. );
  6681. public static $defaultRepositories = array(
  6682. 'packagist.org' => array(
  6683. 'type' => 'composer',
  6684. 'url' => 'https?://repo.packagist.org',
  6685. 'allow_ssl_downgrade' => true,
  6686. ),
  6687. );
  6688. private $config;
  6689. private $baseDir;
  6690. private $repositories;
  6691. private $configSource;
  6692. private $authConfigSource;
  6693. private $useEnvironment;
  6694. private $warnedHosts = array();
  6695. public function __construct($useEnvironment = true, $baseDir = null)
  6696. {
  6697. $this->config = static::$defaultConfig;
  6698. $this->repositories = static::$defaultRepositories;
  6699. $this->useEnvironment = (bool) $useEnvironment;
  6700. $this->baseDir = $baseDir;
  6701. }
  6702. public function setConfigSource(ConfigSourceInterface $source)
  6703. {
  6704. $this->configSource = $source;
  6705. }
  6706. public function getConfigSource()
  6707. {
  6708. return $this->configSource;
  6709. }
  6710. public function setAuthConfigSource(ConfigSourceInterface $source)
  6711. {
  6712. $this->authConfigSource = $source;
  6713. }
  6714. public function getAuthConfigSource()
  6715. {
  6716. return $this->authConfigSource;
  6717. }
  6718. public function merge($config)
  6719. {
  6720. if (!empty($config['config']) && is_array($config['config'])) {
  6721. foreach ($config['config'] as $key => $val) {
  6722. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic')) && isset($this->config[$key])) {
  6723. $this->config[$key] = array_merge($this->config[$key], $val);
  6724. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  6725. if (is_array($val) || is_array($this->config[$key])) {
  6726. if (is_string($val)) {
  6727. $val = array('*' => $val);
  6728. }
  6729. if (is_string($this->config[$key])) {
  6730. $this->config[$key] = array('*' => $this->config[$key]);
  6731. }
  6732. $this->config[$key] = array_merge($this->config[$key], $val);
  6733. if (isset($this->config[$key]['*'])) {
  6734. $wildcard = $this->config[$key]['*'];
  6735. unset($this->config[$key]['*']);
  6736. $this->config[$key]['*'] = $wildcard;
  6737. }
  6738. } else {
  6739. $this->config[$key] = $val;
  6740. }
  6741. } else {
  6742. $this->config[$key] = $val;
  6743. }
  6744. }
  6745. }
  6746. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  6747. $this->repositories = array_reverse($this->repositories, true);
  6748. $newRepos = array_reverse($config['repositories'], true);
  6749. foreach ($newRepos as $name => $repository) {
  6750. if (false === $repository) {
  6751. $this->disableRepoByName($name);
  6752. continue;
  6753. }
  6754. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  6755. $this->disableRepoByName(key($repository));
  6756. continue;
  6757. }
  6758. if (is_int($name)) {
  6759. $this->repositories[] = $repository;
  6760. } else {
  6761. if ($name === 'packagist') {
  6762. $this->repositories[$name . '.org'] = $repository;
  6763. } else {
  6764. $this->repositories[$name] = $repository;
  6765. }
  6766. }
  6767. }
  6768. $this->repositories = array_reverse($this->repositories, true);
  6769. }
  6770. }
  6771. public function getRepositories()
  6772. {
  6773. return $this->repositories;
  6774. }
  6775. public function get($key, $flags = 0)
  6776. {
  6777. switch ($key) {
  6778. case 'vendor-dir':
  6779. case 'bin-dir':
  6780. case 'process-timeout':
  6781. case 'data-dir':
  6782. case 'cache-dir':
  6783. case 'cache-files-dir':
  6784. case 'cache-repo-dir':
  6785. case 'cache-vcs-dir':
  6786. case 'cafile':
  6787. case 'capath':
  6788. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  6789. $val = $this->getComposerEnv($env);
  6790. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  6791. $val = Platform::expandPath($val);
  6792. if (substr($key, -4) !== '-dir') {
  6793. return $val;
  6794. }
  6795. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  6796. case 'htaccess-protect':
  6797. $value = $this->getComposerEnv('COMPOSER_HTACCESS_PROTECT');
  6798. if (false === $value) {
  6799. $value = $this->config[$key];
  6800. }
  6801. return $value !== 'false' && (bool) $value;
  6802. case 'cache-ttl':
  6803. return (int) $this->config[$key];
  6804. case 'cache-files-maxsize':
  6805. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  6806. throw new \RuntimeException(
  6807. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  6808. );
  6809. }
  6810. $size = $matches[1];
  6811. if (isset($matches[2])) {
  6812. switch (strtolower($matches[2])) {
  6813. case 'g':
  6814. $size *= 1024;
  6815. case 'm':
  6816. $size *= 1024;
  6817. case 'k':
  6818. $size *= 1024;
  6819. break;
  6820. }
  6821. }
  6822. return $size;
  6823. case 'cache-files-ttl':
  6824. if (isset($this->config[$key])) {
  6825. return (int) $this->config[$key];
  6826. }
  6827. return (int) $this->config['cache-ttl'];
  6828. case 'home':
  6829. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  6830. return rtrim($this->process($val, $flags), '/\\');
  6831. case 'bin-compat':
  6832. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  6833. if (!in_array($value, array('auto', 'full'))) {
  6834. throw new \RuntimeException(
  6835. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  6836. );
  6837. }
  6838. return $value;
  6839. case 'discard-changes':
  6840. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  6841. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  6842. throw new \RuntimeException(
  6843. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  6844. );
  6845. }
  6846. if ('stash' === $env) {
  6847. return 'stash';
  6848. }
  6849. return $env !== 'false' && (bool) $env;
  6850. }
  6851. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  6852. throw new \RuntimeException(
  6853. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  6854. );
  6855. }
  6856. return $this->config[$key];
  6857. case 'github-protocols':
  6858. $protos = $this->config['github-protocols'];
  6859. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  6860. unset($protos[$index]);
  6861. }
  6862. if (reset($protos) === 'http') {
  6863. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  6864. }
  6865. return $protos;
  6866. case 'disable-tls':
  6867. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6868. case 'secure-http':
  6869. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6870. default:
  6871. if (!isset($this->config[$key])) {
  6872. return null;
  6873. }
  6874. return $this->process($this->config[$key], $flags);
  6875. }
  6876. }
  6877. public function all($flags = 0)
  6878. {
  6879. $all = array(
  6880. 'repositories' => $this->getRepositories(),
  6881. );
  6882. foreach (array_keys($this->config) as $key) {
  6883. $all['config'][$key] = $this->get($key, $flags);
  6884. }
  6885. return $all;
  6886. }
  6887. public function raw()
  6888. {
  6889. return array(
  6890. 'repositories' => $this->getRepositories(),
  6891. 'config' => $this->config,
  6892. );
  6893. }
  6894. public function has($key)
  6895. {
  6896. return array_key_exists($key, $this->config);
  6897. }
  6898. private function process($value, $flags)
  6899. {
  6900. $config = $this;
  6901. if (!is_string($value)) {
  6902. return $value;
  6903. }
  6904. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  6905. return $config->get($match[1], $flags);
  6906. }, $value);
  6907. }
  6908. private function realpath($path)
  6909. {
  6910. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  6911. return $path;
  6912. }
  6913. return $this->baseDir . '/' . $path;
  6914. }
  6915. private function getComposerEnv($var)
  6916. {
  6917. if ($this->useEnvironment) {
  6918. return getenv($var);
  6919. }
  6920. return false;
  6921. }
  6922. private function disableRepoByName($name)
  6923. {
  6924. if (isset($this->repositories[$name])) {
  6925. unset($this->repositories[$name]);
  6926. } elseif ($name === 'packagist') {
  6927. unset($this->repositories['packagist.org']);
  6928. }
  6929. }
  6930. public function prohibitUrlByConfig($url, IOInterface $io = null)
  6931. {
  6932. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  6933. return;
  6934. }
  6935. $scheme = parse_url($url, PHP_URL_SCHEME);
  6936. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  6937. if ($this->get('secure-http')) {
  6938. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  6939. } elseif ($io) {
  6940. $host = parse_url($url, PHP_URL_HOST);
  6941. if (!isset($this->warnedHosts[$host])) {
  6942. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  6943. }
  6944. $this->warnedHosts[$host] = true;
  6945. }
  6946. }
  6947. }
  6948. }
  6949. <?php
  6950. namespace Composer\Config;
  6951. interface ConfigSourceInterface
  6952. {
  6953. public function addRepository($name, $config);
  6954. public function removeRepository($name);
  6955. public function addConfigSetting($name, $value);
  6956. public function removeConfigSetting($name);
  6957. public function addProperty($name, $value);
  6958. public function removeProperty($name);
  6959. public function addLink($type, $name, $value);
  6960. public function removeLink($type, $name);
  6961. public function getName();
  6962. }
  6963. <?php
  6964. namespace Composer\Config;
  6965. use Composer\Json\JsonFile;
  6966. use Composer\Json\JsonManipulator;
  6967. use Composer\Util\Silencer;
  6968. class JsonConfigSource implements ConfigSourceInterface
  6969. {
  6970. private $file;
  6971. private $authConfig;
  6972. public function __construct(JsonFile $file, $authConfig = false)
  6973. {
  6974. $this->file = $file;
  6975. $this->authConfig = $authConfig;
  6976. }
  6977. public function getName()
  6978. {
  6979. return $this->file->getPath();
  6980. }
  6981. public function addRepository($name, $config)
  6982. {
  6983. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  6984. if (isset($config['repositories'])) {
  6985. foreach ($config['repositories'] as $index => $val) {
  6986. if ($index === $repo) {
  6987. continue;
  6988. }
  6989. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  6990. unset($config['repositories'][$index]);
  6991. $config['repositories']['packagist.org'] = false;
  6992. break;
  6993. }
  6994. }
  6995. }
  6996. $config['repositories'][$repo] = $repoConfig;
  6997. });
  6998. }
  6999. public function removeRepository($name)
  7000. {
  7001. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  7002. unset($config['repositories'][$repo]);
  7003. });
  7004. }
  7005. public function addConfigSetting($name, $value)
  7006. {
  7007. $authConfig = $this->authConfig;
  7008. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  7009. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  7010. list($key, $host) = explode('.', $key, 2);
  7011. if ($authConfig) {
  7012. $config[$key][$host] = $val;
  7013. } else {
  7014. $config['config'][$key][$host] = $val;
  7015. }
  7016. } else {
  7017. $config['config'][$key] = $val;
  7018. }
  7019. });
  7020. }
  7021. public function removeConfigSetting($name)
  7022. {
  7023. $authConfig = $this->authConfig;
  7024. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  7025. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  7026. list($key, $host) = explode('.', $key, 2);
  7027. if ($authConfig) {
  7028. unset($config[$key][$host]);
  7029. } else {
  7030. unset($config['config'][$key][$host]);
  7031. }
  7032. } else {
  7033. unset($config['config'][$key]);
  7034. }
  7035. });
  7036. }
  7037. public function addProperty($name, $value)
  7038. {
  7039. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  7040. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7041. $bits = explode('.', $key);
  7042. $last = array_pop($bits);
  7043. $arr = &$config[reset($bits)];
  7044. foreach ($bits as $bit) {
  7045. if (!isset($arr[$bit])) {
  7046. $arr[$bit] = array();
  7047. }
  7048. $arr = &$arr[$bit];
  7049. }
  7050. $arr[$last] = $val;
  7051. } else {
  7052. $config[$key] = $val;
  7053. }
  7054. });
  7055. }
  7056. public function removeProperty($name)
  7057. {
  7058. $authConfig = $this->authConfig;
  7059. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  7060. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7061. $bits = explode('.', $key);
  7062. $last = array_pop($bits);
  7063. $arr = &$config[reset($bits)];
  7064. foreach ($bits as $bit) {
  7065. if (!isset($arr[$bit])) {
  7066. return;
  7067. }
  7068. $arr = &$arr[$bit];
  7069. }
  7070. unset($arr[$last]);
  7071. } else {
  7072. unset($config[$key]);
  7073. }
  7074. });
  7075. }
  7076. public function addLink($type, $name, $value)
  7077. {
  7078. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  7079. $config[$type][$name] = $value;
  7080. });
  7081. }
  7082. public function removeLink($type, $name)
  7083. {
  7084. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  7085. unset($config[$type][$name]);
  7086. });
  7087. }
  7088. protected function manipulateJson($method, $args, $fallback)
  7089. {
  7090. $args = func_get_args();
  7091. array_shift($args);
  7092. $fallback = array_pop($args);
  7093. if ($this->file->exists()) {
  7094. if (!is_writable($this->file->getPath())) {
  7095. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  7096. }
  7097. if (!is_readable($this->file->getPath())) {
  7098. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  7099. }
  7100. $contents = file_get_contents($this->file->getPath());
  7101. } elseif ($this->authConfig) {
  7102. $contents = "{\n}\n";
  7103. } else {
  7104. $contents = "{\n \"config\": {\n }\n}\n";
  7105. }
  7106. $manipulator = new JsonManipulator($contents);
  7107. $newFile = !$this->file->exists();
  7108. if ($this->authConfig && $method === 'addConfigSetting') {
  7109. $method = 'addSubNode';
  7110. list($mainNode, $name) = explode('.', $args[0], 2);
  7111. $args = array($mainNode, $name, $args[1]);
  7112. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  7113. $method = 'removeSubNode';
  7114. list($mainNode, $name) = explode('.', $args[0], 2);
  7115. $args = array($mainNode, $name);
  7116. }
  7117. if (call_user_func_array(array($manipulator, $method), $args)) {
  7118. file_put_contents($this->file->getPath(), $manipulator->getContents());
  7119. } else {
  7120. $config = $this->file->read();
  7121. $this->arrayUnshiftRef($args, $config);
  7122. call_user_func_array($fallback, $args);
  7123. $this->file->write($config);
  7124. }
  7125. if ($newFile) {
  7126. Silencer::call('chmod', $this->file->getPath(), 0600);
  7127. }
  7128. }
  7129. private function arrayUnshiftRef(&$array, &$value)
  7130. {
  7131. $return = array_unshift($array, '');
  7132. $array[0] = &$value;
  7133. return $return;
  7134. }
  7135. }
  7136. <?php
  7137. namespace Composer\Console;
  7138. use Composer\IO\NullIO;
  7139. use Composer\Util\Platform;
  7140. use Composer\Util\Silencer;
  7141. use Symfony\Component\Console\Application as BaseApplication;
  7142. use Symfony\Component\Console\Exception\CommandNotFoundException;
  7143. use Symfony\Component\Console\Input\InputInterface;
  7144. use Symfony\Component\Console\Input\InputOption;
  7145. use Symfony\Component\Console\Output\OutputInterface;
  7146. use Composer\Command;
  7147. use Composer\Composer;
  7148. use Composer\Factory;
  7149. use Composer\IO\IOInterface;
  7150. use Composer\IO\ConsoleIO;
  7151. use Composer\Json\JsonValidationException;
  7152. use Composer\Util\ErrorHandler;
  7153. use Composer\EventDispatcher\ScriptExecutionException;
  7154. use Composer\Exception\NoSslException;
  7155. class Application extends BaseApplication
  7156. {
  7157. protected $composer;
  7158. protected $io;
  7159. private static $logo = ' ______
  7160. / ____/___ ____ ___ ____ ____ ________ _____
  7161. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  7162. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  7163. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  7164. /_/
  7165. ';
  7166. private $hasPluginCommands = false;
  7167. private $disablePluginsByDefault = false;
  7168. public function __construct()
  7169. {
  7170. static $shutdownRegistered = false;
  7171. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  7172. ini_set('xdebug.show_exception_trace', false);
  7173. ini_set('xdebug.scream', false);
  7174. }
  7175. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  7176. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  7177. }
  7178. if (!$shutdownRegistered) {
  7179. $shutdownRegistered = true;
  7180. register_shutdown_function(function () {
  7181. $lastError = error_get_last();
  7182. if ($lastError && $lastError['message'] &&
  7183. (strpos($lastError['message'], 'Allowed memory') !== false ||
  7184. strpos($lastError['message'], 'exceeded memory') !== false )) {
  7185. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  7186. }
  7187. });
  7188. }
  7189. $this->io = new NullIO();
  7190. parent::__construct('Composer', Composer::getVersion());
  7191. }
  7192. public function run(InputInterface $input = null, OutputInterface $output = null)
  7193. {
  7194. if (null === $output) {
  7195. $output = Factory::createOutput();
  7196. }
  7197. return parent::run($input, $output);
  7198. }
  7199. public function doRun(InputInterface $input, OutputInterface $output)
  7200. {
  7201. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  7202. $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
  7203. ErrorHandler::register($io);
  7204. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  7205. $oldWorkingDir = getcwd();
  7206. chdir($newWorkDir);
  7207. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  7208. }
  7209. $commandName = '';
  7210. if ($name = $this->getCommandName($input)) {
  7211. try {
  7212. $commandName = $this->find($name)->getName();
  7213. } catch (CommandNotFoundException $e) {
  7214. $commandName = false;
  7215. } catch (\InvalidArgumentException $e) {
  7216. }
  7217. }
  7218. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) {
  7219. $dir = dirname(getcwd());
  7220. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  7221. while (dirname($dir) !== $dir && $dir !== $home) {
  7222. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  7223. if ($io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ', true)) {
  7224. $oldWorkingDir = getcwd();
  7225. chdir($dir);
  7226. }
  7227. break;
  7228. }
  7229. $dir = dirname($dir);
  7230. }
  7231. }
  7232. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  7233. try {
  7234. foreach ($this->getPluginCommands() as $command) {
  7235. if ($this->has($command->getName())) {
  7236. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  7237. } else {
  7238. $this->add($command);
  7239. }
  7240. }
  7241. } catch (NoSslException $e) {
  7242. }
  7243. $this->hasPluginCommands = true;
  7244. }
  7245. $isProxyCommand = false;
  7246. if ($name = $this->getCommandName($input)) {
  7247. try {
  7248. $command = $this->find($name);
  7249. $commandName = $command->getName();
  7250. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  7251. } catch (\InvalidArgumentException $e) {
  7252. }
  7253. }
  7254. if (!$isProxyCommand) {
  7255. $io->writeError(sprintf(
  7256. 'Running %s (%s) with %s on %s',
  7257. Composer::getVersion(),
  7258. Composer::RELEASE_DATE,
  7259. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  7260. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  7261. ), true, IOInterface::DEBUG);
  7262. if (PHP_VERSION_ID < 50302) {
  7263. $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
  7264. }
  7265. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  7266. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  7267. }
  7268. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  7269. $io->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
  7270. }
  7271. if (getenv('COMPOSER_NO_INTERACTION')) {
  7272. $input->setInteractive(false);
  7273. }
  7274. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
  7275. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  7276. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  7277. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  7278. }
  7279. if ($uid = (int) getenv('SUDO_UID')) {
  7280. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  7281. }
  7282. }
  7283. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  7284. }
  7285. Silencer::call(function () use ($io) {
  7286. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  7287. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  7288. $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
  7289. }
  7290. });
  7291. $file = Factory::getComposerFile();
  7292. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  7293. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  7294. foreach ($composer['scripts'] as $script => $dummy) {
  7295. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7296. if ($this->has($script)) {
  7297. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  7298. } else {
  7299. $description = null;
  7300. if (isset($composer['scripts-descriptions'][$script])) {
  7301. $description = $composer['scripts-descriptions'][$script];
  7302. }
  7303. $this->add(new Command\ScriptAliasCommand($script, $description));
  7304. }
  7305. }
  7306. }
  7307. }
  7308. }
  7309. }
  7310. try {
  7311. if ($input->hasParameterOption('--profile')) {
  7312. $startTime = microtime(true);
  7313. $this->io->enableDebugging($startTime);
  7314. }
  7315. $result = parent::doRun($input, $output);
  7316. if (isset($oldWorkingDir)) {
  7317. chdir($oldWorkingDir);
  7318. }
  7319. if (isset($startTime)) {
  7320. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MiB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MiB), time: '.round(microtime(true) - $startTime, 2).'s');
  7321. }
  7322. restore_error_handler();
  7323. return $result;
  7324. } catch (ScriptExecutionException $e) {
  7325. return $e->getCode();
  7326. } catch (\Exception $e) {
  7327. $this->hintCommonErrors($e);
  7328. restore_error_handler();
  7329. throw $e;
  7330. }
  7331. }
  7332. private function getNewWorkingDir(InputInterface $input)
  7333. {
  7334. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  7335. if (false !== $workingDir && !is_dir($workingDir)) {
  7336. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  7337. }
  7338. return $workingDir;
  7339. }
  7340. private function hintCommonErrors($exception)
  7341. {
  7342. $io = $this->getIO();
  7343. Silencer::suppress();
  7344. try {
  7345. $composer = $this->getComposer(false, true);
  7346. if ($composer) {
  7347. $config = $composer->getConfig();
  7348. $minSpaceFree = 1024 * 1024;
  7349. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  7350. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  7351. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  7352. ) {
  7353. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  7354. }
  7355. }
  7356. } catch (\Exception $e) {
  7357. }
  7358. Silencer::restore();
  7359. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  7360. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  7361. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>', true, IOInterface::QUIET);
  7362. }
  7363. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  7364. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  7365. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  7366. }
  7367. }
  7368. public function getComposer($required = true, $disablePlugins = null)
  7369. {
  7370. if (null === $disablePlugins) {
  7371. $disablePlugins = $this->disablePluginsByDefault;
  7372. }
  7373. if (null === $this->composer) {
  7374. try {
  7375. $this->composer = Factory::create($this->io, null, $disablePlugins);
  7376. } catch (\InvalidArgumentException $e) {
  7377. if ($required) {
  7378. $this->io->writeError($e->getMessage());
  7379. exit(1);
  7380. }
  7381. } catch (JsonValidationException $e) {
  7382. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  7383. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  7384. throw new JsonValidationException($message);
  7385. }
  7386. }
  7387. return $this->composer;
  7388. }
  7389. public function resetComposer()
  7390. {
  7391. $this->composer = null;
  7392. }
  7393. public function getIO()
  7394. {
  7395. return $this->io;
  7396. }
  7397. public function getHelp()
  7398. {
  7399. return self::$logo . parent::getHelp();
  7400. }
  7401. protected function getDefaultCommands()
  7402. {
  7403. $commands = array_merge(parent::getDefaultCommands(), array(
  7404. new Command\AboutCommand(),
  7405. new Command\ConfigCommand(),
  7406. new Command\DependsCommand(),
  7407. new Command\ProhibitsCommand(),
  7408. new Command\InitCommand(),
  7409. new Command\InstallCommand(),
  7410. new Command\CreateProjectCommand(),
  7411. new Command\UpdateCommand(),
  7412. new Command\SearchCommand(),
  7413. new Command\ValidateCommand(),
  7414. new Command\ShowCommand(),
  7415. new Command\SuggestsCommand(),
  7416. new Command\RequireCommand(),
  7417. new Command\DumpAutoloadCommand(),
  7418. new Command\StatusCommand(),
  7419. new Command\ArchiveCommand(),
  7420. new Command\DiagnoseCommand(),
  7421. new Command\RunScriptCommand(),
  7422. new Command\LicensesCommand(),
  7423. new Command\GlobalCommand(),
  7424. new Command\ClearCacheCommand(),
  7425. new Command\RemoveCommand(),
  7426. new Command\HomeCommand(),
  7427. new Command\ExecCommand(),
  7428. new Command\OutdatedCommand(),
  7429. new Command\CheckPlatformReqsCommand(),
  7430. ));
  7431. if ('phar:' === substr(__FILE__, 0, 5)) {
  7432. $commands[] = new Command\SelfUpdateCommand();
  7433. }
  7434. return $commands;
  7435. }
  7436. public function getLongVersion()
  7437. {
  7438. if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
  7439. return sprintf(
  7440. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  7441. $this->getName(),
  7442. Composer::BRANCH_ALIAS_VERSION,
  7443. $this->getVersion(),
  7444. Composer::RELEASE_DATE
  7445. );
  7446. }
  7447. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  7448. }
  7449. protected function getDefaultInputDefinition()
  7450. {
  7451. $definition = parent::getDefaultInputDefinition();
  7452. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  7453. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  7454. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  7455. return $definition;
  7456. }
  7457. private function getPluginCommands()
  7458. {
  7459. $commands = array();
  7460. $composer = $this->getComposer(false, false);
  7461. if (null === $composer) {
  7462. $composer = Factory::createGlobal($this->io, false);
  7463. }
  7464. if (null !== $composer) {
  7465. $pm = $composer->getPluginManager();
  7466. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  7467. $newCommands = $capability->getCommands();
  7468. if (!is_array($newCommands)) {
  7469. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  7470. }
  7471. foreach ($newCommands as $command) {
  7472. if (!$command instanceof Command\BaseCommand) {
  7473. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  7474. }
  7475. }
  7476. $commands = array_merge($commands, $newCommands);
  7477. }
  7478. }
  7479. return $commands;
  7480. }
  7481. }
  7482. <?php
  7483. namespace Composer\Console;
  7484. use Symfony\Component\Console\Formatter\OutputFormatter;
  7485. class HtmlOutputFormatter extends OutputFormatter
  7486. {
  7487. private static $availableForegroundColors = array(
  7488. 30 => 'black',
  7489. 31 => 'red',
  7490. 32 => 'green',
  7491. 33 => 'yellow',
  7492. 34 => 'blue',
  7493. 35 => 'magenta',
  7494. 36 => 'cyan',
  7495. 37 => 'white',
  7496. );
  7497. private static $availableBackgroundColors = array(
  7498. 40 => 'black',
  7499. 41 => 'red',
  7500. 42 => 'green',
  7501. 43 => 'yellow',
  7502. 44 => 'blue',
  7503. 45 => 'magenta',
  7504. 46 => 'cyan',
  7505. 47 => 'white',
  7506. );
  7507. private static $availableOptions = array(
  7508. 1 => 'bold',
  7509. 4 => 'underscore',
  7510. );
  7511. public function __construct(array $styles = array())
  7512. {
  7513. parent::__construct(true, $styles);
  7514. }
  7515. public function format($message)
  7516. {
  7517. $formatted = parent::format($message);
  7518. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  7519. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  7520. }
  7521. private function formatHtml($matches)
  7522. {
  7523. $out = '<span style="';
  7524. foreach (explode(';', $matches[1]) as $code) {
  7525. if (isset(self::$availableForegroundColors[$code])) {
  7526. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  7527. } elseif (isset(self::$availableBackgroundColors[$code])) {
  7528. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  7529. } elseif (isset(self::$availableOptions[$code])) {
  7530. switch (self::$availableOptions[$code]) {
  7531. case 'bold':
  7532. $out .= 'font-weight:bold;';
  7533. break;
  7534. case 'underscore':
  7535. $out .= 'text-decoration:underline;';
  7536. break;
  7537. }
  7538. }
  7539. }
  7540. return $out.'">'.$matches[2].'</span>';
  7541. }
  7542. }
  7543. <?php
  7544. namespace Composer\DependencyResolver;
  7545. class Decisions implements \Iterator, \Countable
  7546. {
  7547. const DECISION_LITERAL = 0;
  7548. const DECISION_REASON = 1;
  7549. protected $pool;
  7550. protected $decisionMap;
  7551. protected $decisionQueue = array();
  7552. public function __construct($pool)
  7553. {
  7554. $this->pool = $pool;
  7555. $this->decisionMap = array();
  7556. }
  7557. public function decide($literal, $level, $why)
  7558. {
  7559. $this->addDecision($literal, $level);
  7560. $this->decisionQueue[] = array(
  7561. self::DECISION_LITERAL => $literal,
  7562. self::DECISION_REASON => $why,
  7563. );
  7564. }
  7565. public function satisfy($literal)
  7566. {
  7567. $packageId = abs($literal);
  7568. return (
  7569. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  7570. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  7571. );
  7572. }
  7573. public function conflict($literal)
  7574. {
  7575. $packageId = abs($literal);
  7576. return (
  7577. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  7578. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  7579. );
  7580. }
  7581. public function decided($literalOrPackageId)
  7582. {
  7583. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  7584. }
  7585. public function undecided($literalOrPackageId)
  7586. {
  7587. return empty($this->decisionMap[abs($literalOrPackageId)]);
  7588. }
  7589. public function decidedInstall($literalOrPackageId)
  7590. {
  7591. $packageId = abs($literalOrPackageId);
  7592. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  7593. }
  7594. public function decisionLevel($literalOrPackageId)
  7595. {
  7596. $packageId = abs($literalOrPackageId);
  7597. if (isset($this->decisionMap[$packageId])) {
  7598. return abs($this->decisionMap[$packageId]);
  7599. }
  7600. return 0;
  7601. }
  7602. public function decisionRule($literalOrPackageId)
  7603. {
  7604. $packageId = abs($literalOrPackageId);
  7605. foreach ($this->decisionQueue as $i => $decision) {
  7606. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  7607. return $decision[self::DECISION_REASON];
  7608. }
  7609. }
  7610. return null;
  7611. }
  7612. public function atOffset($queueOffset)
  7613. {
  7614. return $this->decisionQueue[$queueOffset];
  7615. }
  7616. public function validOffset($queueOffset)
  7617. {
  7618. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  7619. }
  7620. public function lastReason()
  7621. {
  7622. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  7623. }
  7624. public function lastLiteral()
  7625. {
  7626. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  7627. }
  7628. public function reset()
  7629. {
  7630. while ($decision = array_pop($this->decisionQueue)) {
  7631. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7632. }
  7633. }
  7634. public function resetToOffset($offset)
  7635. {
  7636. while (count($this->decisionQueue) > $offset + 1) {
  7637. $decision = array_pop($this->decisionQueue);
  7638. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7639. }
  7640. }
  7641. public function revertLast()
  7642. {
  7643. $this->decisionMap[abs($this->lastLiteral())] = 0;
  7644. array_pop($this->decisionQueue);
  7645. }
  7646. public function count()
  7647. {
  7648. return count($this->decisionQueue);
  7649. }
  7650. public function rewind()
  7651. {
  7652. end($this->decisionQueue);
  7653. }
  7654. public function current()
  7655. {
  7656. return current($this->decisionQueue);
  7657. }
  7658. public function key()
  7659. {
  7660. return key($this->decisionQueue);
  7661. }
  7662. public function next()
  7663. {
  7664. return prev($this->decisionQueue);
  7665. }
  7666. public function valid()
  7667. {
  7668. return false !== current($this->decisionQueue);
  7669. }
  7670. public function isEmpty()
  7671. {
  7672. return count($this->decisionQueue) === 0;
  7673. }
  7674. protected function addDecision($literal, $level)
  7675. {
  7676. $packageId = abs($literal);
  7677. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  7678. if ($previousDecision != 0) {
  7679. $literalString = $this->pool->literalToString($literal);
  7680. $package = $this->pool->literalToPackage($literal);
  7681. throw new SolverBugException(
  7682. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  7683. );
  7684. }
  7685. if ($literal > 0) {
  7686. $this->decisionMap[$packageId] = $level;
  7687. } else {
  7688. $this->decisionMap[$packageId] = -$level;
  7689. }
  7690. }
  7691. public function __toString()
  7692. {
  7693. $decisionMap = $this->decisionMap;
  7694. ksort($decisionMap);
  7695. $str = '[';
  7696. foreach ($decisionMap as $packageId => $level) {
  7697. $str .= $packageId.':'.$level.',';
  7698. }
  7699. $str .= ']';
  7700. return $str;
  7701. }
  7702. }
  7703. <?php
  7704. namespace Composer\DependencyResolver;
  7705. use Composer\Package\PackageInterface;
  7706. use Composer\Package\AliasPackage;
  7707. use Composer\Package\BasePackage;
  7708. use Composer\Semver\Constraint\Constraint;
  7709. class DefaultPolicy implements PolicyInterface
  7710. {
  7711. private $preferStable;
  7712. private $preferLowest;
  7713. public function __construct($preferStable = false, $preferLowest = false)
  7714. {
  7715. $this->preferStable = $preferStable;
  7716. $this->preferLowest = $preferLowest;
  7717. }
  7718. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  7719. {
  7720. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  7721. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  7722. }
  7723. $constraint = new Constraint($operator, $b->getVersion());
  7724. $version = new Constraint('==', $a->getVersion());
  7725. return $constraint->matchSpecific($version, true);
  7726. }
  7727. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  7728. {
  7729. $packages = array();
  7730. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  7731. if ($candidate !== $package) {
  7732. $packages[] = $candidate;
  7733. }
  7734. }
  7735. return $packages;
  7736. }
  7737. public function getPriority(Pool $pool, PackageInterface $package)
  7738. {
  7739. return $pool->getPriority($package->getRepository());
  7740. }
  7741. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  7742. {
  7743. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  7744. foreach ($packages as &$literals) {
  7745. $policy = $this;
  7746. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7747. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  7748. });
  7749. }
  7750. foreach ($packages as &$literals) {
  7751. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  7752. $literals = $this->pruneToBestVersion($pool, $literals);
  7753. $literals = $this->pruneRemoteAliases($pool, $literals);
  7754. }
  7755. $selected = call_user_func_array('array_merge', $packages);
  7756. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7757. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  7758. });
  7759. return $selected;
  7760. }
  7761. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  7762. {
  7763. $packages = array();
  7764. foreach ($literals as $literal) {
  7765. $packageName = $pool->literalToPackage($literal)->getName();
  7766. if (!isset($packages[$packageName])) {
  7767. $packages[$packageName] = array();
  7768. }
  7769. if (isset($installedMap[abs($literal)])) {
  7770. array_unshift($packages[$packageName], $literal);
  7771. } else {
  7772. $packages[$packageName][] = $literal;
  7773. }
  7774. }
  7775. return $packages;
  7776. }
  7777. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  7778. {
  7779. if ($a->getRepository() === $b->getRepository()) {
  7780. if ($a->getName() === $b->getName()) {
  7781. $aAliased = $a instanceof AliasPackage;
  7782. $bAliased = $b instanceof AliasPackage;
  7783. if ($aAliased && !$bAliased) {
  7784. return -1;
  7785. }
  7786. if (!$aAliased && $bAliased) {
  7787. return 1;
  7788. }
  7789. }
  7790. if (!$ignoreReplace) {
  7791. if ($this->replaces($a, $b)) {
  7792. return 1;
  7793. }
  7794. if ($this->replaces($b, $a)) {
  7795. return -1;
  7796. }
  7797. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  7798. $requiredVendor = substr($requiredPackage, 0, $pos);
  7799. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  7800. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  7801. if ($bIsSameVendor !== $aIsSameVendor) {
  7802. return $aIsSameVendor ? -1 : 1;
  7803. }
  7804. }
  7805. }
  7806. if ($a->id === $b->id) {
  7807. return 0;
  7808. }
  7809. return ($a->id < $b->id) ? -1 : 1;
  7810. }
  7811. if (isset($installedMap[$a->id])) {
  7812. return -1;
  7813. }
  7814. if (isset($installedMap[$b->id])) {
  7815. return 1;
  7816. }
  7817. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  7818. }
  7819. protected function replaces(PackageInterface $source, PackageInterface $target)
  7820. {
  7821. foreach ($source->getReplaces() as $link) {
  7822. if ($link->getTarget() === $target->getName()
  7823. ) {
  7824. return true;
  7825. }
  7826. }
  7827. return false;
  7828. }
  7829. protected function pruneToBestVersion(Pool $pool, $literals)
  7830. {
  7831. $operator = $this->preferLowest ? '<' : '>';
  7832. $bestLiterals = array($literals[0]);
  7833. $bestPackage = $pool->literalToPackage($literals[0]);
  7834. foreach ($literals as $i => $literal) {
  7835. if (0 === $i) {
  7836. continue;
  7837. }
  7838. $package = $pool->literalToPackage($literal);
  7839. if ($this->versionCompare($package, $bestPackage, $operator)) {
  7840. $bestPackage = $package;
  7841. $bestLiterals = array($literal);
  7842. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  7843. $bestLiterals[] = $literal;
  7844. }
  7845. }
  7846. return $bestLiterals;
  7847. }
  7848. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  7849. {
  7850. $selected = array();
  7851. $priority = null;
  7852. foreach ($literals as $literal) {
  7853. $package = $pool->literalToPackage($literal);
  7854. if (isset($installedMap[$package->id])) {
  7855. $selected[] = $literal;
  7856. continue;
  7857. }
  7858. if (null === $priority) {
  7859. $priority = $this->getPriority($pool, $package);
  7860. }
  7861. if ($this->getPriority($pool, $package) != $priority) {
  7862. break;
  7863. }
  7864. $selected[] = $literal;
  7865. }
  7866. return $selected;
  7867. }
  7868. protected function pruneRemoteAliases(Pool $pool, array $literals)
  7869. {
  7870. $hasLocalAlias = false;
  7871. foreach ($literals as $literal) {
  7872. $package = $pool->literalToPackage($literal);
  7873. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7874. $hasLocalAlias = true;
  7875. break;
  7876. }
  7877. }
  7878. if (!$hasLocalAlias) {
  7879. return $literals;
  7880. }
  7881. $selected = array();
  7882. foreach ($literals as $literal) {
  7883. $package = $pool->literalToPackage($literal);
  7884. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7885. $selected[] = $literal;
  7886. }
  7887. }
  7888. return $selected;
  7889. }
  7890. }
  7891. <?php
  7892. namespace Composer\DependencyResolver;
  7893. use Composer\Package\PackageInterface;
  7894. use Composer\Package\Link;
  7895. class GenericRule extends Rule
  7896. {
  7897. protected $literals;
  7898. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7899. {
  7900. parent::__construct($reason, $reasonData, $job);
  7901. sort($literals);
  7902. $this->literals = $literals;
  7903. }
  7904. public function getLiterals()
  7905. {
  7906. return $this->literals;
  7907. }
  7908. public function getHash()
  7909. {
  7910. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7911. return $data['hash'];
  7912. }
  7913. public function equals(Rule $rule)
  7914. {
  7915. return $this->literals === $rule->getLiterals();
  7916. }
  7917. public function isAssertion()
  7918. {
  7919. return 1 === count($this->literals);
  7920. }
  7921. public function __toString()
  7922. {
  7923. $result = $this->isDisabled() ? 'disabled(' : '(';
  7924. foreach ($this->literals as $i => $literal) {
  7925. if ($i != 0) {
  7926. $result .= '|';
  7927. }
  7928. $result .= $literal;
  7929. }
  7930. $result .= ')';
  7931. return $result;
  7932. }
  7933. }
  7934. <?php
  7935. namespace Composer\DependencyResolver\Operation;
  7936. use Composer\Package\PackageInterface;
  7937. class InstallOperation extends SolverOperation
  7938. {
  7939. protected $package;
  7940. public function __construct(PackageInterface $package, $reason = null)
  7941. {
  7942. parent::__construct($reason);
  7943. $this->package = $package;
  7944. }
  7945. public function getPackage()
  7946. {
  7947. return $this->package;
  7948. }
  7949. public function getJobType()
  7950. {
  7951. return 'install';
  7952. }
  7953. public function __toString()
  7954. {
  7955. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7956. }
  7957. }
  7958. <?php
  7959. namespace Composer\DependencyResolver\Operation;
  7960. use Composer\Package\AliasPackage;
  7961. use Composer\Package\PackageInterface;
  7962. class MarkAliasInstalledOperation extends SolverOperation
  7963. {
  7964. protected $package;
  7965. public function __construct(AliasPackage $package, $reason = null)
  7966. {
  7967. parent::__construct($reason);
  7968. $this->package = $package;
  7969. }
  7970. public function getPackage()
  7971. {
  7972. return $this->package;
  7973. }
  7974. public function getJobType()
  7975. {
  7976. return 'markAliasInstalled';
  7977. }
  7978. public function __toString()
  7979. {
  7980. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7981. }
  7982. }
  7983. <?php
  7984. namespace Composer\DependencyResolver\Operation;
  7985. use Composer\Package\AliasPackage;
  7986. use Composer\Package\PackageInterface;
  7987. class MarkAliasUninstalledOperation extends SolverOperation
  7988. {
  7989. protected $package;
  7990. public function __construct(AliasPackage $package, $reason = null)
  7991. {
  7992. parent::__construct($reason);
  7993. $this->package = $package;
  7994. }
  7995. public function getPackage()
  7996. {
  7997. return $this->package;
  7998. }
  7999. public function getJobType()
  8000. {
  8001. return 'markAliasUninstalled';
  8002. }
  8003. public function __toString()
  8004. {
  8005. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8006. }
  8007. }
  8008. <?php
  8009. namespace Composer\DependencyResolver\Operation;
  8010. interface OperationInterface
  8011. {
  8012. public function getJobType();
  8013. public function getReason();
  8014. public function __toString();
  8015. }
  8016. <?php
  8017. namespace Composer\DependencyResolver\Operation;
  8018. use Composer\Package\PackageInterface;
  8019. abstract class SolverOperation implements OperationInterface
  8020. {
  8021. protected $reason;
  8022. public function __construct($reason = null)
  8023. {
  8024. $this->reason = $reason;
  8025. }
  8026. public function getReason()
  8027. {
  8028. return $this->reason;
  8029. }
  8030. protected function formatVersion(PackageInterface $package)
  8031. {
  8032. return $package->getFullPrettyVersion();
  8033. }
  8034. }
  8035. <?php
  8036. namespace Composer\DependencyResolver\Operation;
  8037. use Composer\Package\PackageInterface;
  8038. class UninstallOperation extends SolverOperation
  8039. {
  8040. protected $package;
  8041. public function __construct(PackageInterface $package, $reason = null)
  8042. {
  8043. parent::__construct($reason);
  8044. $this->package = $package;
  8045. }
  8046. public function getPackage()
  8047. {
  8048. return $this->package;
  8049. }
  8050. public function getJobType()
  8051. {
  8052. return 'uninstall';
  8053. }
  8054. public function __toString()
  8055. {
  8056. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8057. }
  8058. }
  8059. <?php
  8060. namespace Composer\DependencyResolver\Operation;
  8061. use Composer\Package\PackageInterface;
  8062. class UpdateOperation extends SolverOperation
  8063. {
  8064. protected $initialPackage;
  8065. protected $targetPackage;
  8066. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  8067. {
  8068. parent::__construct($reason);
  8069. $this->initialPackage = $initial;
  8070. $this->targetPackage = $target;
  8071. }
  8072. public function getInitialPackage()
  8073. {
  8074. return $this->initialPackage;
  8075. }
  8076. public function getTargetPackage()
  8077. {
  8078. return $this->targetPackage;
  8079. }
  8080. public function getJobType()
  8081. {
  8082. return 'update';
  8083. }
  8084. public function __toString()
  8085. {
  8086. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  8087. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  8088. }
  8089. }
  8090. <?php
  8091. namespace Composer\DependencyResolver;
  8092. use Composer\Package\PackageInterface;
  8093. interface PolicyInterface
  8094. {
  8095. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  8096. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  8097. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  8098. }
  8099. <?php
  8100. namespace Composer\DependencyResolver;
  8101. use Composer\Package\BasePackage;
  8102. use Composer\Package\AliasPackage;
  8103. use Composer\Package\Version\VersionParser;
  8104. use Composer\Semver\Constraint\ConstraintInterface;
  8105. use Composer\Semver\Constraint\Constraint;
  8106. use Composer\Semver\Constraint\EmptyConstraint;
  8107. use Composer\Repository\RepositoryInterface;
  8108. use Composer\Repository\CompositeRepository;
  8109. use Composer\Repository\ComposerRepository;
  8110. use Composer\Repository\InstalledRepositoryInterface;
  8111. use Composer\Repository\PlatformRepository;
  8112. use Composer\Package\PackageInterface;
  8113. class Pool implements \Countable
  8114. {
  8115. const MATCH_NAME = -1;
  8116. const MATCH_NONE = 0;
  8117. const MATCH = 1;
  8118. const MATCH_PROVIDE = 2;
  8119. const MATCH_REPLACE = 3;
  8120. const MATCH_FILTERED = 4;
  8121. protected $repositories = array();
  8122. protected $providerRepos = array();
  8123. protected $packages = array();
  8124. protected $packageByName = array();
  8125. protected $packageByExactName = array();
  8126. protected $acceptableStabilities;
  8127. protected $stabilityFlags;
  8128. protected $versionParser;
  8129. protected $providerCache = array();
  8130. protected $filterRequires;
  8131. protected $whitelist = null;
  8132. protected $id = 1;
  8133. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  8134. {
  8135. $this->versionParser = new VersionParser;
  8136. $this->acceptableStabilities = array();
  8137. foreach (BasePackage::$stabilities as $stability => $value) {
  8138. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  8139. $this->acceptableStabilities[$stability] = $value;
  8140. }
  8141. }
  8142. $this->stabilityFlags = $stabilityFlags;
  8143. $this->filterRequires = $filterRequires;
  8144. foreach ($filterRequires as $name => $constraint) {
  8145. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  8146. unset($this->filterRequires[$name]);
  8147. }
  8148. }
  8149. }
  8150. public function setWhitelist($whitelist)
  8151. {
  8152. $this->whitelist = $whitelist;
  8153. $this->providerCache = array();
  8154. }
  8155. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  8156. {
  8157. if ($repo instanceof CompositeRepository) {
  8158. $repos = $repo->getRepositories();
  8159. } else {
  8160. $repos = array($repo);
  8161. }
  8162. foreach ($repos as $repo) {
  8163. $this->repositories[] = $repo;
  8164. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  8165. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  8166. $this->providerRepos[] = $repo;
  8167. $repo->setRootAliases($rootAliases);
  8168. $repo->resetPackageIds();
  8169. } else {
  8170. foreach ($repo->getPackages() as $package) {
  8171. $names = $package->getNames();
  8172. $stability = $package->getStability();
  8173. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  8174. $package->setId($this->id++);
  8175. $this->packages[] = $package;
  8176. $this->packageByExactName[$package->getName()][$package->id] = $package;
  8177. foreach ($names as $provided) {
  8178. $this->packageByName[$provided][] = $package;
  8179. }
  8180. $name = $package->getName();
  8181. if (isset($rootAliases[$name][$package->getVersion()])) {
  8182. $alias = $rootAliases[$name][$package->getVersion()];
  8183. if ($package instanceof AliasPackage) {
  8184. $package = $package->getAliasOf();
  8185. }
  8186. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  8187. $aliasPackage->setRootPackageAlias(true);
  8188. $aliasPackage->setId($this->id++);
  8189. $package->getRepository()->addPackage($aliasPackage);
  8190. $this->packages[] = $aliasPackage;
  8191. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  8192. foreach ($aliasPackage->getNames() as $name) {
  8193. $this->packageByName[$name][] = $aliasPackage;
  8194. }
  8195. }
  8196. }
  8197. }
  8198. }
  8199. }
  8200. }
  8201. public function getPriority(RepositoryInterface $repo)
  8202. {
  8203. $priority = array_search($repo, $this->repositories, true);
  8204. if (false === $priority) {
  8205. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  8206. }
  8207. return -$priority;
  8208. }
  8209. public function packageById($id)
  8210. {
  8211. return $this->packages[$id - 1];
  8212. }
  8213. public function count()
  8214. {
  8215. return count($this->packages);
  8216. }
  8217. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  8218. {
  8219. if ($bypassFilters) {
  8220. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  8221. }
  8222. $key = ((int) $mustMatchName).$constraint;
  8223. if (isset($this->providerCache[$name][$key])) {
  8224. return $this->providerCache[$name][$key];
  8225. }
  8226. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  8227. }
  8228. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  8229. {
  8230. $candidates = array();
  8231. foreach ($this->providerRepos as $repo) {
  8232. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  8233. $candidates[] = $candidate;
  8234. if ($candidate->id < 1) {
  8235. $candidate->setId($this->id++);
  8236. $this->packages[$this->id - 2] = $candidate;
  8237. }
  8238. }
  8239. }
  8240. if ($mustMatchName) {
  8241. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  8242. return $candidate->getName() == $name;
  8243. });
  8244. if (isset($this->packageByExactName[$name])) {
  8245. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  8246. }
  8247. } elseif (isset($this->packageByName[$name])) {
  8248. $candidates = array_merge($candidates, $this->packageByName[$name]);
  8249. }
  8250. $matches = $provideMatches = array();
  8251. $nameMatch = false;
  8252. foreach ($candidates as $candidate) {
  8253. $aliasOfCandidate = null;
  8254. if ($candidate instanceof AliasPackage) {
  8255. $aliasOfCandidate = $candidate->getAliasOf();
  8256. }
  8257. if ($this->whitelist !== null && !$bypassFilters && (
  8258. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  8259. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  8260. )) {
  8261. continue;
  8262. }
  8263. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  8264. case self::MATCH_NONE:
  8265. break;
  8266. case self::MATCH_NAME:
  8267. $nameMatch = true;
  8268. break;
  8269. case self::MATCH:
  8270. $nameMatch = true;
  8271. $matches[] = $candidate;
  8272. break;
  8273. case self::MATCH_PROVIDE:
  8274. $provideMatches[] = $candidate;
  8275. break;
  8276. case self::MATCH_REPLACE:
  8277. $matches[] = $candidate;
  8278. break;
  8279. case self::MATCH_FILTERED:
  8280. break;
  8281. default:
  8282. throw new \UnexpectedValueException('Unexpected match type');
  8283. }
  8284. }
  8285. if ($nameMatch) {
  8286. return $matches;
  8287. }
  8288. return array_merge($matches, $provideMatches);
  8289. }
  8290. public function literalToPackage($literal)
  8291. {
  8292. $packageId = abs($literal);
  8293. return $this->packageById($packageId);
  8294. }
  8295. public function literalToPrettyString($literal, $installedMap)
  8296. {
  8297. $package = $this->literalToPackage($literal);
  8298. if (isset($installedMap[$package->id])) {
  8299. $prefix = ($literal > 0 ? 'keep' : 'remove');
  8300. } else {
  8301. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  8302. }
  8303. return $prefix.' '.$package->getPrettyString();
  8304. }
  8305. public function isPackageAcceptable($name, $stability)
  8306. {
  8307. foreach ((array) $name as $n) {
  8308. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  8309. return true;
  8310. }
  8311. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  8312. return true;
  8313. }
  8314. }
  8315. return false;
  8316. }
  8317. public function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  8318. {
  8319. $candidateName = $candidate->getName();
  8320. $candidateVersion = $candidate->getVersion();
  8321. $isDev = $candidate->getStability() === 'dev';
  8322. $isAlias = $candidate instanceof AliasPackage;
  8323. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  8324. $requireFilter = $this->filterRequires[$name];
  8325. } else {
  8326. $requireFilter = new EmptyConstraint;
  8327. }
  8328. if ($candidateName === $name) {
  8329. $pkgConstraint = new Constraint('==', $candidateVersion);
  8330. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  8331. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  8332. }
  8333. return self::MATCH_NAME;
  8334. }
  8335. $provides = $candidate->getProvides();
  8336. $replaces = $candidate->getReplaces();
  8337. if (isset($replaces[0]) || isset($provides[0])) {
  8338. foreach ($provides as $link) {
  8339. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8340. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8341. }
  8342. }
  8343. foreach ($replaces as $link) {
  8344. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8345. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8346. }
  8347. }
  8348. return self::MATCH_NONE;
  8349. }
  8350. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  8351. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8352. }
  8353. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  8354. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8355. }
  8356. return self::MATCH_NONE;
  8357. }
  8358. }
  8359. <?php
  8360. namespace Composer\DependencyResolver;
  8361. use Composer\Package\CompletePackageInterface;
  8362. class Problem
  8363. {
  8364. protected $reasonSeen;
  8365. protected $reasons = array();
  8366. protected $section = 0;
  8367. protected $pool;
  8368. public function __construct(Pool $pool)
  8369. {
  8370. $this->pool = $pool;
  8371. }
  8372. public function addRule(Rule $rule)
  8373. {
  8374. $this->addReason(spl_object_hash($rule), array(
  8375. 'rule' => $rule,
  8376. 'job' => $rule->getJob(),
  8377. ));
  8378. }
  8379. public function getReasons()
  8380. {
  8381. return $this->reasons;
  8382. }
  8383. public function getPrettyString(array $installedMap = array())
  8384. {
  8385. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  8386. if (count($reasons) === 1) {
  8387. reset($reasons);
  8388. $reason = current($reasons);
  8389. $rule = $reason['rule'];
  8390. $job = $reason['job'];
  8391. if (isset($job['constraint'])) {
  8392. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8393. } else {
  8394. $packages = array();
  8395. }
  8396. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  8397. if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
  8398. $version = phpversion();
  8399. $available = $this->pool->whatProvides($job['packageName']);
  8400. if (count($available)) {
  8401. $firstAvailable = reset($available);
  8402. $version = $firstAvailable->getPrettyVersion();
  8403. $extra = $firstAvailable->getExtra();
  8404. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  8405. $version .= '; ' . $firstAvailable->getDescription();
  8406. }
  8407. }
  8408. $msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
  8409. if (defined('HHVM_VERSION') || count($available)) {
  8410. return $msg . 'your HHVM version does not satisfy that requirement.';
  8411. }
  8412. if ($job['packageName'] === 'hhvm') {
  8413. return $msg . 'you are running this with PHP and not HHVM.';
  8414. }
  8415. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  8416. }
  8417. if (0 === stripos($job['packageName'], 'ext-')) {
  8418. if (false !== strpos($job['packageName'], ' ')) {
  8419. return "\n - The requested PHP extension ".$job['packageName'].' should be required as '.str_replace(' ', '-', $job['packageName']).'.';
  8420. }
  8421. $ext = substr($job['packageName'], 4);
  8422. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8423. return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  8424. }
  8425. if (0 === stripos($job['packageName'], 'lib-')) {
  8426. if (strtolower($job['packageName']) === 'lib-icu') {
  8427. $error = extension_loaded('intl') ? 'has the wrong version installed, try upgrading the intl extension.' : 'is missing from your system, make sure the intl extension is loaded.';
  8428. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error;
  8429. }
  8430. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  8431. }
  8432. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $job['packageName'])) {
  8433. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $job['packageName']);
  8434. return "\n - The requested package ".$job['packageName'].' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  8435. }
  8436. if ($providers = $this->pool->whatProvides($job['packageName'], $job['constraint'], true, true)) {
  8437. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  8438. }
  8439. if ($providers = $this->pool->whatProvides($job['packageName'], null, true, true)) {
  8440. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  8441. }
  8442. return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';
  8443. }
  8444. }
  8445. $messages = array();
  8446. foreach ($reasons as $reason) {
  8447. $rule = $reason['rule'];
  8448. $job = $reason['job'];
  8449. if ($job) {
  8450. $messages[] = $this->jobToText($job);
  8451. } elseif ($rule) {
  8452. if ($rule instanceof Rule) {
  8453. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  8454. }
  8455. }
  8456. }
  8457. return "\n - ".implode("\n - ", $messages);
  8458. }
  8459. protected function addReason($id, $reason)
  8460. {
  8461. if (!isset($this->reasonSeen[$id])) {
  8462. $this->reasonSeen[$id] = true;
  8463. $this->reasons[$this->section][] = $reason;
  8464. }
  8465. }
  8466. public function nextSection()
  8467. {
  8468. $this->section++;
  8469. }
  8470. protected function jobToText($job)
  8471. {
  8472. switch ($job['cmd']) {
  8473. case 'install':
  8474. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8475. if (!$packages) {
  8476. return 'No package found to satisfy install request for '.$job['packageName'].$this->constraintToText($job['constraint']);
  8477. }
  8478. return 'Installation request for '.$job['packageName'].$this->constraintToText($job['constraint']).' -> satisfiable by '.$this->getPackageList($packages).'.';
  8479. case 'update':
  8480. return 'Update request for '.$job['packageName'].$this->constraintToText($job['constraint']).'.';
  8481. case 'remove':
  8482. return 'Removal request for '.$job['packageName'].$this->constraintToText($job['constraint']).'';
  8483. }
  8484. if (isset($job['constraint'])) {
  8485. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8486. } else {
  8487. $packages = array();
  8488. }
  8489. return 'Job(cmd='.$job['cmd'].', target='.$job['packageName'].', packages=['.$this->getPackageList($packages).'])';
  8490. }
  8491. protected function getPackageList($packages)
  8492. {
  8493. $prepared = array();
  8494. foreach ($packages as $package) {
  8495. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8496. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8497. }
  8498. foreach ($prepared as $name => $package) {
  8499. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8500. }
  8501. return implode(', ', $prepared);
  8502. }
  8503. protected function constraintToText($constraint)
  8504. {
  8505. return $constraint ? ' '.$constraint->getPrettyString() : '';
  8506. }
  8507. }
  8508. <?php
  8509. namespace Composer\DependencyResolver;
  8510. use Composer\Semver\Constraint\ConstraintInterface;
  8511. class Request
  8512. {
  8513. protected $jobs;
  8514. public function __construct()
  8515. {
  8516. $this->jobs = array();
  8517. }
  8518. public function install($packageName, ConstraintInterface $constraint = null)
  8519. {
  8520. $this->addJob($packageName, 'install', $constraint);
  8521. }
  8522. public function update($packageName, ConstraintInterface $constraint = null)
  8523. {
  8524. $this->addJob($packageName, 'update', $constraint);
  8525. }
  8526. public function remove($packageName, ConstraintInterface $constraint = null)
  8527. {
  8528. $this->addJob($packageName, 'remove', $constraint);
  8529. }
  8530. public function fix($packageName, ConstraintInterface $constraint = null)
  8531. {
  8532. $this->addJob($packageName, 'install', $constraint, true);
  8533. }
  8534. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  8535. {
  8536. $packageName = strtolower($packageName);
  8537. $this->jobs[] = array(
  8538. 'cmd' => $cmd,
  8539. 'packageName' => $packageName,
  8540. 'constraint' => $constraint,
  8541. 'fixed' => $fixed,
  8542. );
  8543. }
  8544. public function updateAll()
  8545. {
  8546. $this->jobs[] = array('cmd' => 'update-all');
  8547. }
  8548. public function getJobs()
  8549. {
  8550. return $this->jobs;
  8551. }
  8552. }
  8553. <?php
  8554. namespace Composer\DependencyResolver;
  8555. use Composer\Package\CompletePackage;
  8556. use Composer\Package\Link;
  8557. use Composer\Package\PackageInterface;
  8558. abstract class Rule
  8559. {
  8560. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  8561. const RULE_JOB_INSTALL = 2;
  8562. const RULE_JOB_REMOVE = 3;
  8563. const RULE_PACKAGE_CONFLICT = 6;
  8564. const RULE_PACKAGE_REQUIRES = 7;
  8565. const RULE_PACKAGE_OBSOLETES = 8;
  8566. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  8567. const RULE_PACKAGE_SAME_NAME = 10;
  8568. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  8569. const RULE_LEARNED = 12;
  8570. const RULE_PACKAGE_ALIAS = 13;
  8571. const BITFIELD_TYPE = 0;
  8572. const BITFIELD_REASON = 8;
  8573. const BITFIELD_DISABLED = 16;
  8574. protected $bitfield;
  8575. protected $job;
  8576. protected $reasonData;
  8577. public function __construct($reason, $reasonData, $job = null)
  8578. {
  8579. $this->reasonData = $reasonData;
  8580. if ($job) {
  8581. $this->job = $job;
  8582. }
  8583. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  8584. ($reason << self::BITFIELD_REASON) |
  8585. (255 << self::BITFIELD_TYPE);
  8586. }
  8587. abstract public function getLiterals();
  8588. abstract public function getHash();
  8589. public function getJob()
  8590. {
  8591. return $this->job;
  8592. }
  8593. abstract public function equals(Rule $rule);
  8594. public function getReason()
  8595. {
  8596. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  8597. }
  8598. public function getReasonData()
  8599. {
  8600. return $this->reasonData;
  8601. }
  8602. public function getRequiredPackage()
  8603. {
  8604. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  8605. return $this->reasonData;
  8606. }
  8607. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  8608. return $this->reasonData->getTarget();
  8609. }
  8610. }
  8611. public function setType($type)
  8612. {
  8613. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  8614. }
  8615. public function getType()
  8616. {
  8617. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  8618. }
  8619. public function disable()
  8620. {
  8621. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  8622. }
  8623. public function enable()
  8624. {
  8625. $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
  8626. }
  8627. public function isDisabled()
  8628. {
  8629. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8630. }
  8631. public function isEnabled()
  8632. {
  8633. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8634. }
  8635. abstract public function isAssertion();
  8636. public function getPrettyString(Pool $pool, array $installedMap = array())
  8637. {
  8638. $literals = $this->getLiterals();
  8639. $ruleText = '';
  8640. foreach ($literals as $i => $literal) {
  8641. if ($i != 0) {
  8642. $ruleText .= '|';
  8643. }
  8644. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  8645. }
  8646. switch ($this->getReason()) {
  8647. case self::RULE_INTERNAL_ALLOW_UPDATE:
  8648. return $ruleText;
  8649. case self::RULE_JOB_INSTALL:
  8650. return "Install command rule ($ruleText)";
  8651. case self::RULE_JOB_REMOVE:
  8652. return "Remove command rule ($ruleText)";
  8653. case self::RULE_PACKAGE_CONFLICT:
  8654. $package1 = $pool->literalToPackage($literals[0]);
  8655. $package2 = $pool->literalToPackage($literals[1]);
  8656. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  8657. case self::RULE_PACKAGE_REQUIRES:
  8658. $sourceLiteral = array_shift($literals);
  8659. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  8660. $requires = array();
  8661. foreach ($literals as $literal) {
  8662. $requires[] = $pool->literalToPackage($literal);
  8663. }
  8664. $text = $this->reasonData->getPrettyString($sourcePackage);
  8665. if ($requires) {
  8666. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  8667. } else {
  8668. $targetName = $this->reasonData->getTarget();
  8669. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  8670. if (defined('HHVM_VERSION')) {
  8671. return $text . ' -> your HHVM version does not satisfy that requirement.';
  8672. }
  8673. $packages = $pool->whatProvides($targetName);
  8674. $package = count($packages) ? current($packages) : phpversion();
  8675. if ($targetName === 'hhvm') {
  8676. if ($package instanceof CompletePackage) {
  8677. return $text . ' -> your HHVM version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8678. } else {
  8679. return $text . ' -> you are running this with PHP and not HHVM.';
  8680. }
  8681. }
  8682. if (!($package instanceof CompletePackage)) {
  8683. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  8684. }
  8685. $extra = $package->getExtra();
  8686. if (!empty($extra['config.platform'])) {
  8687. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8688. } else {
  8689. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8690. }
  8691. return $text;
  8692. }
  8693. if (0 === strpos($targetName, 'ext-')) {
  8694. $ext = substr($targetName, 4);
  8695. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8696. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  8697. }
  8698. if (0 === strpos($targetName, 'lib-')) {
  8699. $lib = substr($targetName, 4);
  8700. return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
  8701. }
  8702. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  8703. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  8704. }
  8705. return $text . ' -> no matching package found.';
  8706. }
  8707. return $text;
  8708. case self::RULE_PACKAGE_OBSOLETES:
  8709. return $ruleText;
  8710. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  8711. return $ruleText;
  8712. case self::RULE_PACKAGE_SAME_NAME:
  8713. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  8714. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  8715. return $ruleText;
  8716. case self::RULE_LEARNED:
  8717. return 'Conclusion: '.$ruleText;
  8718. case self::RULE_PACKAGE_ALIAS:
  8719. return $ruleText;
  8720. default:
  8721. return '('.$ruleText.')';
  8722. }
  8723. }
  8724. protected function formatPackagesUnique($pool, array $packages)
  8725. {
  8726. $prepared = array();
  8727. foreach ($packages as $package) {
  8728. if (!is_object($package)) {
  8729. $package = $pool->literalToPackage($package);
  8730. }
  8731. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8732. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8733. }
  8734. foreach ($prepared as $name => $package) {
  8735. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8736. }
  8737. return implode(', ', $prepared);
  8738. }
  8739. }
  8740. <?php
  8741. namespace Composer\DependencyResolver;
  8742. use Composer\Package\PackageInterface;
  8743. use Composer\Package\Link;
  8744. class Rule2Literals extends Rule
  8745. {
  8746. protected $literal1;
  8747. protected $literal2;
  8748. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  8749. {
  8750. parent::__construct($reason, $reasonData, $job);
  8751. if ($literal1 < $literal2) {
  8752. $this->literal1 = $literal1;
  8753. $this->literal2 = $literal2;
  8754. } else {
  8755. $this->literal1 = $literal2;
  8756. $this->literal2 = $literal1;
  8757. }
  8758. }
  8759. public function getLiterals()
  8760. {
  8761. return array($this->literal1, $this->literal2);
  8762. }
  8763. public function getHash()
  8764. {
  8765. return $this->literal1.','.$this->literal2;
  8766. }
  8767. public function equals(Rule $rule)
  8768. {
  8769. if ($rule instanceof self) {
  8770. if ($this->literal1 !== $rule->literal1) {
  8771. return false;
  8772. }
  8773. if ($this->literal2 !== $rule->literal2) {
  8774. return false;
  8775. }
  8776. return true;
  8777. }
  8778. $literals = $rule->getLiterals();
  8779. if (2 != count($literals)) {
  8780. return false;
  8781. }
  8782. if ($this->literal1 !== $literals[0]) {
  8783. return false;
  8784. }
  8785. if ($this->literal2 !== $literals[1]) {
  8786. return false;
  8787. }
  8788. return true;
  8789. }
  8790. public function isAssertion()
  8791. {
  8792. return false;
  8793. }
  8794. public function __toString()
  8795. {
  8796. $result = $this->isDisabled() ? 'disabled(' : '(';
  8797. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  8798. return $result;
  8799. }
  8800. }
  8801. <?php
  8802. namespace Composer\DependencyResolver;
  8803. class RuleSet implements \IteratorAggregate, \Countable
  8804. {
  8805. const TYPE_PACKAGE = 0;
  8806. const TYPE_JOB = 1;
  8807. const TYPE_LEARNED = 4;
  8808. public $ruleById;
  8809. protected static $types = array(
  8810. 255 => 'UNKNOWN',
  8811. self::TYPE_PACKAGE => 'PACKAGE',
  8812. self::TYPE_JOB => 'JOB',
  8813. self::TYPE_LEARNED => 'LEARNED',
  8814. );
  8815. protected $rules;
  8816. protected $nextRuleId;
  8817. protected $rulesByHash;
  8818. public function __construct()
  8819. {
  8820. $this->nextRuleId = 0;
  8821. foreach ($this->getTypes() as $type) {
  8822. $this->rules[$type] = array();
  8823. }
  8824. $this->rulesByHash = array();
  8825. }
  8826. public function add(Rule $rule, $type)
  8827. {
  8828. if (!isset(self::$types[$type])) {
  8829. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  8830. }
  8831. $hash = $rule->getHash();
  8832. if (isset($this->rulesByHash[$hash])) {
  8833. $potentialDuplicates = $this->rulesByHash[$hash];
  8834. if (is_array($potentialDuplicates)) {
  8835. foreach ($potentialDuplicates as $potentialDuplicate) {
  8836. if ($rule->equals($potentialDuplicate)) {
  8837. return;
  8838. }
  8839. }
  8840. } else {
  8841. if ($rule->equals($potentialDuplicates)) {
  8842. return;
  8843. }
  8844. }
  8845. }
  8846. if (!isset($this->rules[$type])) {
  8847. $this->rules[$type] = array();
  8848. }
  8849. $this->rules[$type][] = $rule;
  8850. $this->ruleById[$this->nextRuleId] = $rule;
  8851. $rule->setType($type);
  8852. $this->nextRuleId++;
  8853. if (!isset($this->rulesByHash[$hash])) {
  8854. $this->rulesByHash[$hash] = $rule;
  8855. } elseif (is_array($this->rulesByHash[$hash])) {
  8856. $this->rulesByHash[$hash][] = $rule;
  8857. } else {
  8858. $originalRule = $this->rulesByHash[$hash];
  8859. $this->rulesByHash[$hash] = array($originalRule, $rule);
  8860. }
  8861. }
  8862. public function count()
  8863. {
  8864. return $this->nextRuleId;
  8865. }
  8866. public function ruleById($id)
  8867. {
  8868. return $this->ruleById[$id];
  8869. }
  8870. public function getRules()
  8871. {
  8872. return $this->rules;
  8873. }
  8874. public function getIterator()
  8875. {
  8876. return new RuleSetIterator($this->getRules());
  8877. }
  8878. public function getIteratorFor($types)
  8879. {
  8880. if (!is_array($types)) {
  8881. $types = array($types);
  8882. }
  8883. $allRules = $this->getRules();
  8884. $rules = array();
  8885. foreach ($types as $type) {
  8886. $rules[$type] = $allRules[$type];
  8887. }
  8888. return new RuleSetIterator($rules);
  8889. }
  8890. public function getIteratorWithout($types)
  8891. {
  8892. if (!is_array($types)) {
  8893. $types = array($types);
  8894. }
  8895. $rules = $this->getRules();
  8896. foreach ($types as $type) {
  8897. unset($rules[$type]);
  8898. }
  8899. return new RuleSetIterator($rules);
  8900. }
  8901. public function getTypes()
  8902. {
  8903. $types = self::$types;
  8904. unset($types[255]);
  8905. return array_keys($types);
  8906. }
  8907. public function getPrettyString(Pool $pool = null)
  8908. {
  8909. $string = "\n";
  8910. foreach ($this->rules as $type => $rules) {
  8911. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  8912. foreach ($rules as $rule) {
  8913. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  8914. }
  8915. $string .= "\n\n";
  8916. }
  8917. return $string;
  8918. }
  8919. public function __toString()
  8920. {
  8921. return $this->getPrettyString(null);
  8922. }
  8923. }
  8924. <?php
  8925. namespace Composer\DependencyResolver;
  8926. use Composer\Package\PackageInterface;
  8927. use Composer\Package\AliasPackage;
  8928. use Composer\Repository\PlatformRepository;
  8929. class RuleSetGenerator
  8930. {
  8931. protected $policy;
  8932. protected $pool;
  8933. protected $rules;
  8934. protected $jobs;
  8935. protected $installedMap;
  8936. protected $whitelistedMap;
  8937. protected $addedMap;
  8938. protected $conflictAddedMap;
  8939. protected $addedPackages;
  8940. protected $addedPackagesByNames;
  8941. public function __construct(PolicyInterface $policy, Pool $pool)
  8942. {
  8943. $this->policy = $policy;
  8944. $this->pool = $pool;
  8945. }
  8946. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  8947. {
  8948. $literals = array(-$package->id);
  8949. foreach ($providers as $provider) {
  8950. if ($provider === $package) {
  8951. return null;
  8952. }
  8953. $literals[] = $provider->id;
  8954. }
  8955. return new GenericRule($literals, $reason, $reasonData);
  8956. }
  8957. protected function createInstallOneOfRule(array $packages, $reason, $job)
  8958. {
  8959. $literals = array();
  8960. foreach ($packages as $package) {
  8961. $literals[] = $package->id;
  8962. }
  8963. return new GenericRule($literals, $reason, $job['packageName'], $job);
  8964. }
  8965. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  8966. {
  8967. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  8968. }
  8969. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  8970. {
  8971. if ($issuer === $provider) {
  8972. return null;
  8973. }
  8974. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  8975. }
  8976. private function addRule($type, Rule $newRule = null)
  8977. {
  8978. if (!$newRule) {
  8979. return;
  8980. }
  8981. $this->rules->add($newRule, $type);
  8982. }
  8983. protected function whitelistFromPackage(PackageInterface $package)
  8984. {
  8985. $workQueue = new \SplQueue;
  8986. $workQueue->enqueue($package);
  8987. while (!$workQueue->isEmpty()) {
  8988. $package = $workQueue->dequeue();
  8989. if (isset($this->whitelistedMap[$package->id])) {
  8990. continue;
  8991. }
  8992. $this->whitelistedMap[$package->id] = true;
  8993. foreach ($package->getRequires() as $link) {
  8994. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  8995. foreach ($possibleRequires as $require) {
  8996. $workQueue->enqueue($require);
  8997. }
  8998. }
  8999. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  9000. foreach ($obsoleteProviders as $provider) {
  9001. if ($provider === $package) {
  9002. continue;
  9003. }
  9004. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9005. $workQueue->enqueue($provider);
  9006. }
  9007. }
  9008. }
  9009. }
  9010. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  9011. {
  9012. $workQueue = new \SplQueue;
  9013. $workQueue->enqueue($package);
  9014. while (!$workQueue->isEmpty()) {
  9015. $package = $workQueue->dequeue();
  9016. if (isset($this->addedMap[$package->id])) {
  9017. continue;
  9018. }
  9019. $this->addedMap[$package->id] = true;
  9020. $this->addedPackages[] = $package;
  9021. foreach ($package->getNames() as $name) {
  9022. $this->addedPackagesByNames[$name][] = $package;
  9023. }
  9024. foreach ($package->getRequires() as $link) {
  9025. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9026. continue;
  9027. }
  9028. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9029. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  9030. foreach ($possibleRequires as $require) {
  9031. $workQueue->enqueue($require);
  9032. }
  9033. }
  9034. $packageName = $package->getName();
  9035. $obsoleteProviders = $this->pool->whatProvides($packageName, null);
  9036. foreach ($obsoleteProviders as $provider) {
  9037. if ($provider === $package) {
  9038. continue;
  9039. }
  9040. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9041. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  9042. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9043. $reason = ($packageName == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  9044. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $package));
  9045. }
  9046. }
  9047. }
  9048. }
  9049. protected function addConflictRules()
  9050. {
  9051. foreach ($this->addedPackages as $package) {
  9052. foreach ($package->getConflicts() as $link) {
  9053. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9054. continue;
  9055. }
  9056. foreach ($this->addedPackagesByNames[$link->getTarget()] as $possibleConflict) {
  9057. $conflictMatch = $this->pool->match($possibleConflict, $link->getTarget(), $link->getConstraint(), true);
  9058. if ($conflictMatch === Pool::MATCH || $conflictMatch === Pool::MATCH_REPLACE) {
  9059. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $possibleConflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  9060. }
  9061. }
  9062. }
  9063. $isInstalled = isset($this->installedMap[$package->id]);
  9064. foreach ($package->getReplaces() as $link) {
  9065. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9066. continue;
  9067. }
  9068. foreach ($this->addedPackagesByNames[$link->getTarget()] as $provider) {
  9069. if ($provider === $package) {
  9070. continue;
  9071. }
  9072. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9073. $reason = $isInstalled ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  9074. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  9075. }
  9076. }
  9077. }
  9078. }
  9079. }
  9080. protected function obsoleteImpossibleForAlias($package, $provider)
  9081. {
  9082. $packageIsAlias = $package instanceof AliasPackage;
  9083. $providerIsAlias = $provider instanceof AliasPackage;
  9084. $impossible = (
  9085. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  9086. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  9087. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  9088. );
  9089. return $impossible;
  9090. }
  9091. protected function whitelistFromJobs()
  9092. {
  9093. foreach ($this->jobs as $job) {
  9094. switch ($job['cmd']) {
  9095. case 'install':
  9096. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  9097. foreach ($packages as $package) {
  9098. $this->whitelistFromPackage($package);
  9099. }
  9100. break;
  9101. }
  9102. }
  9103. }
  9104. protected function addRulesForJobs($ignorePlatformReqs)
  9105. {
  9106. foreach ($this->jobs as $job) {
  9107. switch ($job['cmd']) {
  9108. case 'install':
  9109. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9110. break;
  9111. }
  9112. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9113. if ($packages) {
  9114. foreach ($packages as $package) {
  9115. if (!isset($this->installedMap[$package->id])) {
  9116. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9117. }
  9118. }
  9119. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  9120. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9121. }
  9122. break;
  9123. case 'remove':
  9124. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9125. foreach ($packages as $package) {
  9126. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  9127. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9128. }
  9129. break;
  9130. }
  9131. }
  9132. }
  9133. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  9134. {
  9135. $this->jobs = $jobs;
  9136. $this->rules = new RuleSet;
  9137. $this->installedMap = $installedMap;
  9138. $this->whitelistedMap = array();
  9139. foreach ($this->installedMap as $package) {
  9140. $this->whitelistFromPackage($package);
  9141. }
  9142. $this->whitelistFromJobs();
  9143. $this->pool->setWhitelist($this->whitelistedMap);
  9144. $this->addedMap = array();
  9145. $this->conflictAddedMap = array();
  9146. $this->addedPackages = array();
  9147. $this->addedPackagesByNames = array();
  9148. foreach ($this->installedMap as $package) {
  9149. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9150. }
  9151. $this->addRulesForJobs($ignorePlatformReqs);
  9152. $this->addConflictRules();
  9153. $this->addedPackages = $this->addedPackagesByNames = null;
  9154. return $this->rules;
  9155. }
  9156. }
  9157. <?php
  9158. namespace Composer\DependencyResolver;
  9159. class RuleSetIterator implements \Iterator
  9160. {
  9161. protected $rules;
  9162. protected $types;
  9163. protected $currentOffset;
  9164. protected $currentType;
  9165. protected $currentTypeOffset;
  9166. public function __construct(array $rules)
  9167. {
  9168. $this->rules = $rules;
  9169. $this->types = array_keys($rules);
  9170. sort($this->types);
  9171. $this->rewind();
  9172. }
  9173. public function current()
  9174. {
  9175. return $this->rules[$this->currentType][$this->currentOffset];
  9176. }
  9177. public function key()
  9178. {
  9179. return $this->currentType;
  9180. }
  9181. public function next()
  9182. {
  9183. $this->currentOffset++;
  9184. if (!isset($this->rules[$this->currentType])) {
  9185. return;
  9186. }
  9187. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  9188. $this->currentOffset = 0;
  9189. do {
  9190. $this->currentTypeOffset++;
  9191. if (!isset($this->types[$this->currentTypeOffset])) {
  9192. $this->currentType = -1;
  9193. break;
  9194. }
  9195. $this->currentType = $this->types[$this->currentTypeOffset];
  9196. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9197. }
  9198. }
  9199. public function rewind()
  9200. {
  9201. $this->currentOffset = 0;
  9202. $this->currentTypeOffset = -1;
  9203. $this->currentType = -1;
  9204. do {
  9205. $this->currentTypeOffset++;
  9206. if (!isset($this->types[$this->currentTypeOffset])) {
  9207. $this->currentType = -1;
  9208. break;
  9209. }
  9210. $this->currentType = $this->types[$this->currentTypeOffset];
  9211. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9212. }
  9213. public function valid()
  9214. {
  9215. return isset($this->rules[$this->currentType])
  9216. && isset($this->rules[$this->currentType][$this->currentOffset]);
  9217. }
  9218. }
  9219. <?php
  9220. namespace Composer\DependencyResolver;
  9221. class RuleWatchChain extends \SplDoublyLinkedList
  9222. {
  9223. protected $offset = 0;
  9224. public function seek($offset)
  9225. {
  9226. $this->rewind();
  9227. for ($i = 0; $i < $offset; $i++, $this->next());
  9228. }
  9229. public function remove()
  9230. {
  9231. $offset = $this->key();
  9232. $this->offsetUnset($offset);
  9233. $this->seek($offset);
  9234. }
  9235. }
  9236. <?php
  9237. namespace Composer\DependencyResolver;
  9238. class RuleWatchGraph
  9239. {
  9240. protected $watchChains = array();
  9241. public function insert(RuleWatchNode $node)
  9242. {
  9243. if ($node->getRule()->isAssertion()) {
  9244. return;
  9245. }
  9246. foreach (array($node->watch1, $node->watch2) as $literal) {
  9247. if (!isset($this->watchChains[$literal])) {
  9248. $this->watchChains[$literal] = new RuleWatchChain;
  9249. }
  9250. $this->watchChains[$literal]->unshift($node);
  9251. }
  9252. }
  9253. public function propagateLiteral($decidedLiteral, $level, $decisions)
  9254. {
  9255. $literal = -$decidedLiteral;
  9256. if (!isset($this->watchChains[$literal])) {
  9257. return null;
  9258. }
  9259. $chain = $this->watchChains[$literal];
  9260. $chain->rewind();
  9261. while ($chain->valid()) {
  9262. $node = $chain->current();
  9263. $otherWatch = $node->getOtherWatch($literal);
  9264. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  9265. $ruleLiterals = $node->getRule()->getLiterals();
  9266. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  9267. return $literal !== $ruleLiteral &&
  9268. $otherWatch !== $ruleLiteral &&
  9269. !$decisions->conflict($ruleLiteral);
  9270. });
  9271. if ($alternativeLiterals) {
  9272. reset($alternativeLiterals);
  9273. $this->moveWatch($literal, current($alternativeLiterals), $node);
  9274. continue;
  9275. }
  9276. if ($decisions->conflict($otherWatch)) {
  9277. return $node->getRule();
  9278. }
  9279. $decisions->decide($otherWatch, $level, $node->getRule());
  9280. }
  9281. $chain->next();
  9282. }
  9283. return null;
  9284. }
  9285. protected function moveWatch($fromLiteral, $toLiteral, $node)
  9286. {
  9287. if (!isset($this->watchChains[$toLiteral])) {
  9288. $this->watchChains[$toLiteral] = new RuleWatchChain;
  9289. }
  9290. $node->moveWatch($fromLiteral, $toLiteral);
  9291. $this->watchChains[$fromLiteral]->remove();
  9292. $this->watchChains[$toLiteral]->unshift($node);
  9293. }
  9294. }
  9295. <?php
  9296. namespace Composer\DependencyResolver;
  9297. class RuleWatchNode
  9298. {
  9299. public $watch1;
  9300. public $watch2;
  9301. protected $rule;
  9302. public function __construct($rule)
  9303. {
  9304. $this->rule = $rule;
  9305. $literals = $rule->getLiterals();
  9306. $literalCount = count($literals);
  9307. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  9308. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  9309. }
  9310. public function watch2OnHighest(Decisions $decisions)
  9311. {
  9312. $literals = $this->rule->getLiterals();
  9313. if (count($literals) < 3) {
  9314. return;
  9315. }
  9316. $watchLevel = 0;
  9317. foreach ($literals as $literal) {
  9318. $level = $decisions->decisionLevel($literal);
  9319. if ($level > $watchLevel) {
  9320. $this->watch2 = $literal;
  9321. $watchLevel = $level;
  9322. }
  9323. }
  9324. }
  9325. public function getRule()
  9326. {
  9327. return $this->rule;
  9328. }
  9329. public function getOtherWatch($literal)
  9330. {
  9331. if ($this->watch1 == $literal) {
  9332. return $this->watch2;
  9333. }
  9334. return $this->watch1;
  9335. }
  9336. public function moveWatch($from, $to)
  9337. {
  9338. if ($this->watch1 == $from) {
  9339. $this->watch1 = $to;
  9340. } else {
  9341. $this->watch2 = $to;
  9342. }
  9343. }
  9344. }
  9345. <?php
  9346. namespace Composer\DependencyResolver;
  9347. use Composer\IO\IOInterface;
  9348. use Composer\Repository\RepositoryInterface;
  9349. use Composer\Repository\PlatformRepository;
  9350. class Solver
  9351. {
  9352. const BRANCH_LITERALS = 0;
  9353. const BRANCH_LEVEL = 1;
  9354. protected $policy;
  9355. protected $pool;
  9356. protected $installed;
  9357. protected $rules;
  9358. protected $ruleSetGenerator;
  9359. protected $jobs;
  9360. protected $updateMap = array();
  9361. protected $watchGraph;
  9362. protected $decisions;
  9363. protected $installedMap;
  9364. protected $propagateIndex;
  9365. protected $branches = array();
  9366. protected $problems = array();
  9367. protected $learnedPool = array();
  9368. protected $learnedWhy = array();
  9369. public $testFlagLearnedPositiveLiteral = false;
  9370. protected $io;
  9371. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  9372. {
  9373. $this->io = $io;
  9374. $this->policy = $policy;
  9375. $this->pool = $pool;
  9376. $this->installed = $installed;
  9377. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  9378. }
  9379. public function getRuleSetSize()
  9380. {
  9381. return count($this->rules);
  9382. }
  9383. private function makeAssertionRuleDecisions()
  9384. {
  9385. $decisionStart = count($this->decisions) - 1;
  9386. $rulesCount = count($this->rules);
  9387. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  9388. $rule = $this->rules->ruleById[$ruleIndex];
  9389. if (!$rule->isAssertion() || $rule->isDisabled()) {
  9390. continue;
  9391. }
  9392. $literals = $rule->getLiterals();
  9393. $literal = $literals[0];
  9394. if (!$this->decisions->decided($literal)) {
  9395. $this->decisions->decide($literal, 1, $rule);
  9396. continue;
  9397. }
  9398. if ($this->decisions->satisfy($literal)) {
  9399. continue;
  9400. }
  9401. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  9402. $rule->disable();
  9403. continue;
  9404. }
  9405. $conflict = $this->decisions->decisionRule($literal);
  9406. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  9407. $problem = new Problem($this->pool);
  9408. $problem->addRule($rule);
  9409. $problem->addRule($conflict);
  9410. $this->disableProblem($rule);
  9411. $this->problems[] = $problem;
  9412. continue;
  9413. }
  9414. $problem = new Problem($this->pool);
  9415. $problem->addRule($rule);
  9416. $problem->addRule($conflict);
  9417. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  9418. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  9419. continue;
  9420. }
  9421. $assertRuleLiterals = $assertRule->getLiterals();
  9422. $assertRuleLiteral = $assertRuleLiterals[0];
  9423. if (abs($literal) !== abs($assertRuleLiteral)) {
  9424. continue;
  9425. }
  9426. $problem->addRule($assertRule);
  9427. $this->disableProblem($assertRule);
  9428. }
  9429. $this->problems[] = $problem;
  9430. $this->decisions->resetToOffset($decisionStart);
  9431. $ruleIndex = -1;
  9432. }
  9433. }
  9434. protected function setupInstalledMap()
  9435. {
  9436. $this->installedMap = array();
  9437. foreach ($this->installed->getPackages() as $package) {
  9438. $this->installedMap[$package->id] = $package;
  9439. }
  9440. }
  9441. protected function checkForRootRequireProblems($ignorePlatformReqs)
  9442. {
  9443. foreach ($this->jobs as $job) {
  9444. switch ($job['cmd']) {
  9445. case 'update':
  9446. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9447. foreach ($packages as $package) {
  9448. if (isset($this->installedMap[$package->id])) {
  9449. $this->updateMap[$package->id] = true;
  9450. }
  9451. }
  9452. break;
  9453. case 'update-all':
  9454. foreach ($this->installedMap as $package) {
  9455. $this->updateMap[$package->id] = true;
  9456. }
  9457. break;
  9458. case 'install':
  9459. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9460. break;
  9461. }
  9462. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  9463. $problem = new Problem($this->pool);
  9464. $problem->addRule(new GenericRule(array(), null, null, $job));
  9465. $this->problems[] = $problem;
  9466. }
  9467. break;
  9468. }
  9469. }
  9470. }
  9471. public function solve(Request $request, $ignorePlatformReqs = false)
  9472. {
  9473. $this->jobs = $request->getJobs();
  9474. $this->setupInstalledMap();
  9475. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  9476. $this->checkForRootRequireProblems($ignorePlatformReqs);
  9477. $this->decisions = new Decisions($this->pool);
  9478. $this->watchGraph = new RuleWatchGraph;
  9479. foreach ($this->rules as $rule) {
  9480. $this->watchGraph->insert(new RuleWatchNode($rule));
  9481. }
  9482. $this->makeAssertionRuleDecisions();
  9483. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  9484. $before = microtime(true);
  9485. $this->runSat(true);
  9486. $this->io->writeError('', true, IOInterface::DEBUG);
  9487. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  9488. foreach ($this->installedMap as $packageId => $void) {
  9489. if ($this->decisions->undecided($packageId)) {
  9490. $this->decisions->decide(-$packageId, 1, null);
  9491. }
  9492. }
  9493. if ($this->problems) {
  9494. throw new SolverProblemsException($this->problems, $this->installedMap);
  9495. }
  9496. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  9497. return $transaction->getOperations();
  9498. }
  9499. protected function propagate($level)
  9500. {
  9501. while ($this->decisions->validOffset($this->propagateIndex)) {
  9502. $decision = $this->decisions->atOffset($this->propagateIndex);
  9503. $conflict = $this->watchGraph->propagateLiteral(
  9504. $decision[Decisions::DECISION_LITERAL],
  9505. $level,
  9506. $this->decisions
  9507. );
  9508. $this->propagateIndex++;
  9509. if ($conflict) {
  9510. return $conflict;
  9511. }
  9512. }
  9513. return null;
  9514. }
  9515. private function revert($level)
  9516. {
  9517. while (!$this->decisions->isEmpty()) {
  9518. $literal = $this->decisions->lastLiteral();
  9519. if ($this->decisions->undecided($literal)) {
  9520. break;
  9521. }
  9522. $decisionLevel = $this->decisions->decisionLevel($literal);
  9523. if ($decisionLevel <= $level) {
  9524. break;
  9525. }
  9526. $this->decisions->revertLast();
  9527. $this->propagateIndex = count($this->decisions);
  9528. }
  9529. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  9530. array_pop($this->branches);
  9531. }
  9532. }
  9533. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  9534. {
  9535. $level++;
  9536. $this->decisions->decide($literal, $level, $rule);
  9537. while (true) {
  9538. $rule = $this->propagate($level);
  9539. if (!$rule) {
  9540. break;
  9541. }
  9542. if ($level == 1) {
  9543. return $this->analyzeUnsolvable($rule, $disableRules);
  9544. }
  9545. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  9546. if ($newLevel <= 0 || $newLevel >= $level) {
  9547. throw new SolverBugException(
  9548. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  9549. );
  9550. } elseif (!$newRule) {
  9551. throw new SolverBugException(
  9552. "No rule was learned from analyzing $rule at level $level."
  9553. );
  9554. }
  9555. $level = $newLevel;
  9556. $this->revert($level);
  9557. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  9558. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  9559. $ruleNode = new RuleWatchNode($newRule);
  9560. $ruleNode->watch2OnHighest($this->decisions);
  9561. $this->watchGraph->insert($ruleNode);
  9562. $this->decisions->decide($learnLiteral, $level, $newRule);
  9563. }
  9564. return $level;
  9565. }
  9566. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  9567. {
  9568. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  9569. $selectedLiteral = array_shift($literals);
  9570. if (count($literals)) {
  9571. $this->branches[] = array($literals, $level);
  9572. }
  9573. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  9574. }
  9575. protected function analyze($level, Rule $rule)
  9576. {
  9577. $analyzedRule = $rule;
  9578. $ruleLevel = 1;
  9579. $num = 0;
  9580. $l1num = 0;
  9581. $seen = array();
  9582. $learnedLiterals = array(null);
  9583. $decisionId = count($this->decisions);
  9584. $this->learnedPool[] = array();
  9585. while (true) {
  9586. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  9587. foreach ($rule->getLiterals() as $literal) {
  9588. if ($this->decisions->satisfy($literal)) {
  9589. continue;
  9590. }
  9591. if (isset($seen[abs($literal)])) {
  9592. continue;
  9593. }
  9594. $seen[abs($literal)] = true;
  9595. $l = $this->decisions->decisionLevel($literal);
  9596. if (1 === $l) {
  9597. $l1num++;
  9598. } elseif ($level === $l) {
  9599. $num++;
  9600. } else {
  9601. $learnedLiterals[] = $literal;
  9602. if ($l > $ruleLevel) {
  9603. $ruleLevel = $l;
  9604. }
  9605. }
  9606. }
  9607. $l1retry = true;
  9608. while ($l1retry) {
  9609. $l1retry = false;
  9610. if (!$num && !--$l1num) {
  9611. break 2;
  9612. }
  9613. while (true) {
  9614. if ($decisionId <= 0) {
  9615. throw new SolverBugException(
  9616. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  9617. );
  9618. }
  9619. $decisionId--;
  9620. $decision = $this->decisions->atOffset($decisionId);
  9621. $literal = $decision[Decisions::DECISION_LITERAL];
  9622. if (isset($seen[abs($literal)])) {
  9623. break;
  9624. }
  9625. }
  9626. unset($seen[abs($literal)]);
  9627. if ($num && 0 === --$num) {
  9628. if ($literal < 0) {
  9629. $this->testFlagLearnedPositiveLiteral = true;
  9630. }
  9631. $learnedLiterals[0] = -$literal;
  9632. if (!$l1num) {
  9633. break 2;
  9634. }
  9635. foreach ($learnedLiterals as $i => $learnedLiteral) {
  9636. if ($i !== 0) {
  9637. unset($seen[abs($learnedLiteral)]);
  9638. }
  9639. }
  9640. $l1num++;
  9641. $l1retry = true;
  9642. }
  9643. }
  9644. $decision = $this->decisions->atOffset($decisionId);
  9645. $rule = $decision[Decisions::DECISION_REASON];
  9646. }
  9647. $why = count($this->learnedPool) - 1;
  9648. if (!$learnedLiterals[0]) {
  9649. throw new SolverBugException(
  9650. "Did not find a learnable literal in analyzed rule $analyzedRule."
  9651. );
  9652. }
  9653. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  9654. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  9655. }
  9656. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  9657. {
  9658. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  9659. $why = spl_object_hash($conflictRule);
  9660. $learnedWhy = $this->learnedWhy[$why];
  9661. $problemRules = $this->learnedPool[$learnedWhy];
  9662. foreach ($problemRules as $problemRule) {
  9663. $this->analyzeUnsolvableRule($problem, $problemRule);
  9664. }
  9665. return;
  9666. }
  9667. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  9668. return;
  9669. }
  9670. $problem->nextSection();
  9671. $problem->addRule($conflictRule);
  9672. }
  9673. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  9674. {
  9675. $problem = new Problem($this->pool);
  9676. $problem->addRule($conflictRule);
  9677. $this->analyzeUnsolvableRule($problem, $conflictRule);
  9678. $this->problems[] = $problem;
  9679. $seen = array();
  9680. $literals = $conflictRule->getLiterals();
  9681. foreach ($literals as $literal) {
  9682. if ($this->decisions->satisfy($literal)) {
  9683. continue;
  9684. }
  9685. $seen[abs($literal)] = true;
  9686. }
  9687. foreach ($this->decisions as $decision) {
  9688. $literal = $decision[Decisions::DECISION_LITERAL];
  9689. if (!isset($seen[abs($literal)])) {
  9690. continue;
  9691. }
  9692. $why = $decision[Decisions::DECISION_REASON];
  9693. $problem->addRule($why);
  9694. $this->analyzeUnsolvableRule($problem, $why);
  9695. $literals = $why->getLiterals();
  9696. foreach ($literals as $literal) {
  9697. if ($this->decisions->satisfy($literal)) {
  9698. continue;
  9699. }
  9700. $seen[abs($literal)] = true;
  9701. }
  9702. }
  9703. if ($disableRules) {
  9704. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  9705. $this->disableProblem($reason['rule']);
  9706. }
  9707. $this->resetSolver();
  9708. return 1;
  9709. }
  9710. return 0;
  9711. }
  9712. private function disableProblem(Rule $why)
  9713. {
  9714. $job = $why->getJob();
  9715. if (!$job) {
  9716. $why->disable();
  9717. return;
  9718. }
  9719. foreach ($this->rules as $rule) {
  9720. if ($job === $rule->getJob()) {
  9721. $rule->disable();
  9722. }
  9723. }
  9724. }
  9725. private function resetSolver()
  9726. {
  9727. $this->decisions->reset();
  9728. $this->propagateIndex = 0;
  9729. $this->branches = array();
  9730. $this->enableDisableLearnedRules();
  9731. $this->makeAssertionRuleDecisions();
  9732. }
  9733. private function enableDisableLearnedRules()
  9734. {
  9735. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  9736. $why = $this->learnedWhy[spl_object_hash($rule)];
  9737. $problemRules = $this->learnedPool[$why];
  9738. $foundDisabled = false;
  9739. foreach ($problemRules as $problemRule) {
  9740. if ($problemRule->isDisabled()) {
  9741. $foundDisabled = true;
  9742. break;
  9743. }
  9744. }
  9745. if ($foundDisabled && $rule->isEnabled()) {
  9746. $rule->disable();
  9747. } elseif (!$foundDisabled && $rule->isDisabled()) {
  9748. $rule->enable();
  9749. }
  9750. }
  9751. }
  9752. private function runSat($disableRules = true)
  9753. {
  9754. $this->propagateIndex = 0;
  9755. $decisionQueue = array();
  9756. $decisionSupplementQueue = array();
  9757. $disableRules = array();
  9758. $level = 1;
  9759. $systemLevel = $level + 1;
  9760. $installedPos = 0;
  9761. while (true) {
  9762. if (1 === $level) {
  9763. $conflictRule = $this->propagate($level);
  9764. if (null !== $conflictRule) {
  9765. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  9766. continue;
  9767. }
  9768. return;
  9769. }
  9770. }
  9771. if ($level < $systemLevel) {
  9772. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  9773. foreach ($iterator as $rule) {
  9774. if ($rule->isEnabled()) {
  9775. $decisionQueue = array();
  9776. $noneSatisfied = true;
  9777. foreach ($rule->getLiterals() as $literal) {
  9778. if ($this->decisions->satisfy($literal)) {
  9779. $noneSatisfied = false;
  9780. break;
  9781. }
  9782. if ($literal > 0 && $this->decisions->undecided($literal)) {
  9783. $decisionQueue[] = $literal;
  9784. }
  9785. }
  9786. if ($noneSatisfied && count($decisionQueue)) {
  9787. if (count($this->installed) != count($this->updateMap)) {
  9788. $prunedQueue = array();
  9789. foreach ($decisionQueue as $literal) {
  9790. if (isset($this->installedMap[abs($literal)])) {
  9791. $prunedQueue[] = $literal;
  9792. if (isset($this->updateMap[abs($literal)])) {
  9793. $prunedQueue = $decisionQueue;
  9794. break;
  9795. }
  9796. }
  9797. }
  9798. $decisionQueue = $prunedQueue;
  9799. }
  9800. }
  9801. if ($noneSatisfied && count($decisionQueue)) {
  9802. $oLevel = $level;
  9803. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9804. if (0 === $level) {
  9805. return;
  9806. }
  9807. if ($level <= $oLevel) {
  9808. break;
  9809. }
  9810. }
  9811. }
  9812. }
  9813. $systemLevel = $level + 1;
  9814. $iterator->next();
  9815. if ($iterator->valid()) {
  9816. continue;
  9817. }
  9818. }
  9819. if ($level < $systemLevel) {
  9820. $systemLevel = $level;
  9821. }
  9822. $rulesCount = count($this->rules);
  9823. $pass = 1;
  9824. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  9825. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  9826. if ($i == $rulesCount) {
  9827. if (1 === $pass) {
  9828. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  9829. } else {
  9830. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  9831. }
  9832. $i = 0;
  9833. $pass++;
  9834. }
  9835. $rule = $this->rules->ruleById[$i];
  9836. $literals = $rule->getLiterals();
  9837. if ($rule->isDisabled()) {
  9838. continue;
  9839. }
  9840. $decisionQueue = array();
  9841. foreach ($literals as $literal) {
  9842. if ($literal <= 0) {
  9843. if (!$this->decisions->decidedInstall($literal)) {
  9844. continue 2;
  9845. }
  9846. } else {
  9847. if ($this->decisions->decidedInstall($literal)) {
  9848. continue 2;
  9849. }
  9850. if ($this->decisions->undecided($literal)) {
  9851. $decisionQueue[] = $literal;
  9852. }
  9853. }
  9854. }
  9855. if (count($decisionQueue) < 2) {
  9856. continue;
  9857. }
  9858. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9859. if (0 === $level) {
  9860. return;
  9861. }
  9862. $rulesCount = count($this->rules);
  9863. $n = -1;
  9864. }
  9865. if ($level < $systemLevel) {
  9866. continue;
  9867. }
  9868. if (count($this->branches)) {
  9869. $lastLiteral = null;
  9870. $lastLevel = null;
  9871. $lastBranchIndex = 0;
  9872. $lastBranchOffset = 0;
  9873. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  9874. list($literals, $l) = $this->branches[$i];
  9875. foreach ($literals as $offset => $literal) {
  9876. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  9877. $lastLiteral = $literal;
  9878. $lastBranchIndex = $i;
  9879. $lastBranchOffset = $offset;
  9880. $lastLevel = $l;
  9881. }
  9882. }
  9883. }
  9884. if ($lastLiteral) {
  9885. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  9886. $level = $lastLevel;
  9887. $this->revert($level);
  9888. $why = $this->decisions->lastReason();
  9889. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  9890. if ($level == 0) {
  9891. return;
  9892. }
  9893. continue;
  9894. }
  9895. }
  9896. break;
  9897. }
  9898. }
  9899. }
  9900. <?php
  9901. namespace Composer\DependencyResolver;
  9902. class SolverBugException extends \RuntimeException
  9903. {
  9904. public function __construct($message)
  9905. {
  9906. parent::__construct(
  9907. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  9908. "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n"
  9909. );
  9910. }
  9911. }
  9912. <?php
  9913. namespace Composer\DependencyResolver;
  9914. use Composer\Util\IniHelper;
  9915. class SolverProblemsException extends \RuntimeException
  9916. {
  9917. protected $problems;
  9918. protected $installedMap;
  9919. public function __construct(array $problems, array $installedMap)
  9920. {
  9921. $this->problems = $problems;
  9922. $this->installedMap = $installedMap;
  9923. parent::__construct($this->createMessage(), 2);
  9924. }
  9925. protected function createMessage()
  9926. {
  9927. $text = "\n";
  9928. $hasExtensionProblems = false;
  9929. foreach ($this->problems as $i => $problem) {
  9930. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  9931. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  9932. $hasExtensionProblems = true;
  9933. }
  9934. }
  9935. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  9936. $text .= "\nPotential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n - It's a private package and you forgot to add a custom repository to find it\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  9937. }
  9938. if ($hasExtensionProblems) {
  9939. $text .= $this->createExtensionHint();
  9940. }
  9941. return $text;
  9942. }
  9943. public function getProblems()
  9944. {
  9945. return $this->problems;
  9946. }
  9947. private function createExtensionHint()
  9948. {
  9949. $paths = IniHelper::getAll();
  9950. if (count($paths) === 1 && empty($paths[0])) {
  9951. return '';
  9952. }
  9953. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  9954. $text .= implode("\n - ", $paths);
  9955. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  9956. return $text;
  9957. }
  9958. private function hasExtensionProblems(array $reasonSets)
  9959. {
  9960. foreach ($reasonSets as $reasonSet) {
  9961. foreach ($reasonSet as $reason) {
  9962. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  9963. return true;
  9964. }
  9965. }
  9966. }
  9967. return false;
  9968. }
  9969. }
  9970. <?php
  9971. namespace Composer\DependencyResolver;
  9972. use Composer\Package\AliasPackage;
  9973. class Transaction
  9974. {
  9975. protected $policy;
  9976. protected $pool;
  9977. protected $installedMap;
  9978. protected $decisions;
  9979. protected $transaction;
  9980. public function __construct($policy, $pool, $installedMap, $decisions)
  9981. {
  9982. $this->policy = $policy;
  9983. $this->pool = $pool;
  9984. $this->installedMap = $installedMap;
  9985. $this->decisions = $decisions;
  9986. $this->transaction = array();
  9987. }
  9988. public function getOperations()
  9989. {
  9990. $installMeansUpdateMap = $this->findUpdates();
  9991. $updateMap = array();
  9992. $installMap = array();
  9993. $uninstallMap = array();
  9994. foreach ($this->decisions as $i => $decision) {
  9995. $literal = $decision[Decisions::DECISION_LITERAL];
  9996. $reason = $decision[Decisions::DECISION_REASON];
  9997. $package = $this->pool->literalToPackage($literal);
  9998. if (($literal > 0) == isset($this->installedMap[$package->id])) {
  9999. continue;
  10000. }
  10001. if ($literal > 0) {
  10002. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  10003. $source = $installMeansUpdateMap[abs($literal)];
  10004. $updateMap[$package->id] = array(
  10005. 'package' => $package,
  10006. 'source' => $source,
  10007. 'reason' => $reason,
  10008. );
  10009. unset($installMeansUpdateMap[abs($literal)]);
  10010. $ignoreRemove[$source->id] = true;
  10011. } else {
  10012. $installMap[$package->id] = array(
  10013. 'package' => $package,
  10014. 'reason' => $reason,
  10015. );
  10016. }
  10017. }
  10018. }
  10019. foreach ($this->decisions as $i => $decision) {
  10020. $literal = $decision[Decisions::DECISION_LITERAL];
  10021. $reason = $decision[Decisions::DECISION_REASON];
  10022. $package = $this->pool->literalToPackage($literal);
  10023. if ($literal <= 0 &&
  10024. isset($this->installedMap[$package->id]) &&
  10025. !isset($ignoreRemove[$package->id])) {
  10026. $uninstallMap[$package->id] = array(
  10027. 'package' => $package,
  10028. 'reason' => $reason,
  10029. );
  10030. }
  10031. }
  10032. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  10033. return $this->transaction;
  10034. }
  10035. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  10036. {
  10037. $queue = array_map(
  10038. function ($operation) {
  10039. return $operation['package'];
  10040. },
  10041. $this->findRootPackages($installMap, $updateMap)
  10042. );
  10043. $visited = array();
  10044. while (!empty($queue)) {
  10045. $package = array_pop($queue);
  10046. $packageId = $package->id;
  10047. if (!isset($visited[$packageId])) {
  10048. $queue[] = $package;
  10049. if ($package instanceof AliasPackage) {
  10050. $queue[] = $package->getAliasOf();
  10051. } else {
  10052. foreach ($package->getRequires() as $link) {
  10053. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10054. foreach ($possibleRequires as $require) {
  10055. $queue[] = $require;
  10056. }
  10057. }
  10058. }
  10059. $visited[$package->id] = true;
  10060. } else {
  10061. if (isset($installMap[$packageId])) {
  10062. $this->install(
  10063. $installMap[$packageId]['package'],
  10064. $installMap[$packageId]['reason']
  10065. );
  10066. unset($installMap[$packageId]);
  10067. }
  10068. if (isset($updateMap[$packageId])) {
  10069. $this->update(
  10070. $updateMap[$packageId]['source'],
  10071. $updateMap[$packageId]['package'],
  10072. $updateMap[$packageId]['reason']
  10073. );
  10074. unset($updateMap[$packageId]);
  10075. }
  10076. }
  10077. }
  10078. foreach ($uninstallMap as $uninstall) {
  10079. $this->uninstall($uninstall['package'], $uninstall['reason']);
  10080. }
  10081. }
  10082. protected function findRootPackages($installMap, $updateMap)
  10083. {
  10084. $packages = $installMap + $updateMap;
  10085. $roots = $packages;
  10086. foreach ($packages as $packageId => $operation) {
  10087. $package = $operation['package'];
  10088. if (!isset($roots[$packageId])) {
  10089. continue;
  10090. }
  10091. foreach ($package->getRequires() as $link) {
  10092. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10093. foreach ($possibleRequires as $require) {
  10094. if ($require !== $package) {
  10095. unset($roots[$require->id]);
  10096. }
  10097. }
  10098. }
  10099. }
  10100. return $roots;
  10101. }
  10102. protected function findUpdates()
  10103. {
  10104. $installMeansUpdateMap = array();
  10105. foreach ($this->decisions as $i => $decision) {
  10106. $literal = $decision[Decisions::DECISION_LITERAL];
  10107. $package = $this->pool->literalToPackage($literal);
  10108. if ($package instanceof AliasPackage) {
  10109. continue;
  10110. }
  10111. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  10112. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  10113. $literals = array($package->id);
  10114. foreach ($updates as $update) {
  10115. $literals[] = $update->id;
  10116. }
  10117. foreach ($literals as $updateLiteral) {
  10118. if ($updateLiteral !== $literal) {
  10119. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  10120. }
  10121. }
  10122. }
  10123. }
  10124. return $installMeansUpdateMap;
  10125. }
  10126. protected function install($package, $reason)
  10127. {
  10128. if ($package instanceof AliasPackage) {
  10129. return $this->markAliasInstalled($package, $reason);
  10130. }
  10131. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  10132. }
  10133. protected function update($from, $to, $reason)
  10134. {
  10135. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  10136. }
  10137. protected function uninstall($package, $reason)
  10138. {
  10139. if ($package instanceof AliasPackage) {
  10140. return $this->markAliasUninstalled($package, $reason);
  10141. }
  10142. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  10143. }
  10144. protected function markAliasInstalled($package, $reason)
  10145. {
  10146. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  10147. }
  10148. protected function markAliasUninstalled($package, $reason)
  10149. {
  10150. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  10151. }
  10152. }
  10153. <?php
  10154. namespace Composer\Downloader;
  10155. use Composer\Package\PackageInterface;
  10156. use Symfony\Component\Finder\Finder;
  10157. use Composer\IO\IOInterface;
  10158. abstract class ArchiveDownloader extends FileDownloader
  10159. {
  10160. public function download(PackageInterface $package, $path, $output = true)
  10161. {
  10162. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  10163. $retries = 3;
  10164. while ($retries--) {
  10165. $fileName = parent::download($package, $path, $output);
  10166. if ($output) {
  10167. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  10168. }
  10169. try {
  10170. $this->filesystem->ensureDirectoryExists($temporaryDir);
  10171. try {
  10172. $this->extract($fileName, $temporaryDir);
  10173. } catch (\Exception $e) {
  10174. parent::clearLastCacheWrite($package);
  10175. throw $e;
  10176. }
  10177. $this->filesystem->unlink($fileName);
  10178. $contentDir = $this->getFolderContent($temporaryDir);
  10179. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  10180. $contentDir = $this->getFolderContent((string) reset($contentDir));
  10181. }
  10182. foreach ($contentDir as $file) {
  10183. $file = (string) $file;
  10184. $this->filesystem->rename($file, $path . '/' . basename($file));
  10185. }
  10186. $this->filesystem->removeDirectory($temporaryDir);
  10187. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  10188. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  10189. }
  10190. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  10191. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  10192. }
  10193. } catch (\Exception $e) {
  10194. $this->filesystem->removeDirectory($path);
  10195. $this->filesystem->removeDirectory($temporaryDir);
  10196. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  10197. $this->io->writeError('');
  10198. if ($this->io->isDebug()) {
  10199. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  10200. } else {
  10201. $this->io->writeError(' Invalid zip file, retrying...');
  10202. }
  10203. usleep(500000);
  10204. continue;
  10205. }
  10206. throw $e;
  10207. }
  10208. break;
  10209. }
  10210. }
  10211. protected function getFileName(PackageInterface $package, $path)
  10212. {
  10213. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  10214. }
  10215. abstract protected function extract($file, $path);
  10216. private function getFolderContent($dir)
  10217. {
  10218. $finder = Finder::create()
  10219. ->ignoreVCS(false)
  10220. ->ignoreDotFiles(false)
  10221. ->notName('.DS_Store')
  10222. ->depth(0)
  10223. ->in($dir);
  10224. return iterator_to_array($finder);
  10225. }
  10226. }
  10227. <?php
  10228. namespace Composer\Downloader;
  10229. use Composer\Package\PackageInterface;
  10230. interface ChangeReportInterface
  10231. {
  10232. public function getLocalChanges(PackageInterface $package, $path);
  10233. }
  10234. <?php
  10235. namespace Composer\Downloader;
  10236. use Composer\Package\PackageInterface;
  10237. use Composer\IO\IOInterface;
  10238. use Composer\Util\Filesystem;
  10239. class DownloadManager
  10240. {
  10241. private $io;
  10242. private $preferDist = false;
  10243. private $preferSource = false;
  10244. private $packagePreferences = array();
  10245. private $filesystem;
  10246. private $downloaders = array();
  10247. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  10248. {
  10249. $this->io = $io;
  10250. $this->preferSource = $preferSource;
  10251. $this->filesystem = $filesystem ?: new Filesystem();
  10252. }
  10253. public function setPreferSource($preferSource)
  10254. {
  10255. $this->preferSource = $preferSource;
  10256. return $this;
  10257. }
  10258. public function setPreferDist($preferDist)
  10259. {
  10260. $this->preferDist = $preferDist;
  10261. return $this;
  10262. }
  10263. public function setPreferences(array $preferences)
  10264. {
  10265. $this->packagePreferences = $preferences;
  10266. return $this;
  10267. }
  10268. public function setOutputProgress($outputProgress)
  10269. {
  10270. foreach ($this->downloaders as $downloader) {
  10271. $downloader->setOutputProgress($outputProgress);
  10272. }
  10273. return $this;
  10274. }
  10275. public function setDownloader($type, DownloaderInterface $downloader)
  10276. {
  10277. $type = strtolower($type);
  10278. $this->downloaders[$type] = $downloader;
  10279. return $this;
  10280. }
  10281. public function getDownloader($type)
  10282. {
  10283. $type = strtolower($type);
  10284. if (!isset($this->downloaders[$type])) {
  10285. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  10286. }
  10287. return $this->downloaders[$type];
  10288. }
  10289. public function getDownloaderForInstalledPackage(PackageInterface $package)
  10290. {
  10291. $installationSource = $package->getInstallationSource();
  10292. if ('metapackage' === $package->getType()) {
  10293. return;
  10294. }
  10295. if ('dist' === $installationSource) {
  10296. $downloader = $this->getDownloader($package->getDistType());
  10297. } elseif ('source' === $installationSource) {
  10298. $downloader = $this->getDownloader($package->getSourceType());
  10299. } else {
  10300. throw new \InvalidArgumentException(
  10301. 'Package '.$package.' seems not been installed properly'
  10302. );
  10303. }
  10304. if ($installationSource !== $downloader->getInstallationSource()) {
  10305. throw new \LogicException(sprintf(
  10306. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  10307. get_class($downloader),
  10308. $downloader->getInstallationSource(),
  10309. $installationSource,
  10310. $package
  10311. ));
  10312. }
  10313. return $downloader;
  10314. }
  10315. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  10316. {
  10317. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  10318. $sourceType = $package->getSourceType();
  10319. $distType = $package->getDistType();
  10320. $sources = array();
  10321. if ($sourceType) {
  10322. $sources[] = 'source';
  10323. }
  10324. if ($distType) {
  10325. $sources[] = 'dist';
  10326. }
  10327. if (empty($sources)) {
  10328. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  10329. }
  10330. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  10331. $sources = array_reverse($sources);
  10332. }
  10333. $this->filesystem->ensureDirectoryExists($targetDir);
  10334. foreach ($sources as $i => $source) {
  10335. if (isset($e)) {
  10336. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  10337. }
  10338. $package->setInstallationSource($source);
  10339. try {
  10340. $downloader = $this->getDownloaderForInstalledPackage($package);
  10341. if ($downloader) {
  10342. $downloader->download($package, $targetDir);
  10343. }
  10344. break;
  10345. } catch (\RuntimeException $e) {
  10346. if ($i === count($sources) - 1) {
  10347. throw $e;
  10348. }
  10349. $this->io->writeError(
  10350. ' <warning>Failed to download '.
  10351. $package->getPrettyName().
  10352. ' from ' . $source . ': '.
  10353. $e->getMessage().'</warning>'
  10354. );
  10355. }
  10356. }
  10357. }
  10358. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  10359. {
  10360. $downloader = $this->getDownloaderForInstalledPackage($initial);
  10361. if (!$downloader) {
  10362. return;
  10363. }
  10364. $installationSource = $initial->getInstallationSource();
  10365. if ('dist' === $installationSource) {
  10366. $initialType = $initial->getDistType();
  10367. $targetType = $target->getDistType();
  10368. } else {
  10369. $initialType = $initial->getSourceType();
  10370. $targetType = $target->getSourceType();
  10371. }
  10372. if ($target->isDev() && 'dist' === $installationSource) {
  10373. $downloader->remove($initial, $targetDir);
  10374. $this->download($target, $targetDir);
  10375. return;
  10376. }
  10377. if ($initialType === $targetType) {
  10378. $target->setInstallationSource($installationSource);
  10379. try {
  10380. $downloader->update($initial, $target, $targetDir);
  10381. return;
  10382. } catch (\RuntimeException $e) {
  10383. if (!$this->io->isInteractive()) {
  10384. throw $e;
  10385. }
  10386. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  10387. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  10388. throw $e;
  10389. }
  10390. }
  10391. }
  10392. $downloader->remove($initial, $targetDir);
  10393. $this->download($target, $targetDir, 'source' === $installationSource);
  10394. }
  10395. public function remove(PackageInterface $package, $targetDir)
  10396. {
  10397. $downloader = $this->getDownloaderForInstalledPackage($package);
  10398. if ($downloader) {
  10399. $downloader->remove($package, $targetDir);
  10400. }
  10401. }
  10402. protected function resolvePackageInstallPreference(PackageInterface $package)
  10403. {
  10404. foreach ($this->packagePreferences as $pattern => $preference) {
  10405. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  10406. if (preg_match($pattern, $package->getName())) {
  10407. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  10408. return 'dist';
  10409. }
  10410. return 'source';
  10411. }
  10412. }
  10413. return $package->isDev() ? 'source' : 'dist';
  10414. }
  10415. }
  10416. <?php
  10417. namespace Composer\Downloader;
  10418. use Composer\Package\PackageInterface;
  10419. interface DownloaderInterface
  10420. {
  10421. public function getInstallationSource();
  10422. public function download(PackageInterface $package, $path);
  10423. public function update(PackageInterface $initial, PackageInterface $target, $path);
  10424. public function remove(PackageInterface $package, $path);
  10425. public function setOutputProgress($outputProgress);
  10426. }
  10427. <?php
  10428. namespace Composer\Downloader;
  10429. use Composer\Package\PackageInterface;
  10430. interface DvcsDownloaderInterface
  10431. {
  10432. public function getUnpushedChanges(PackageInterface $package, $path);
  10433. }
  10434. <?php
  10435. namespace Composer\Downloader;
  10436. use Composer\Config;
  10437. use Composer\Cache;
  10438. use Composer\Factory;
  10439. use Composer\IO\IOInterface;
  10440. use Composer\IO\NullIO;
  10441. use Composer\Package\Comparer\Comparer;
  10442. use Composer\Package\PackageInterface;
  10443. use Composer\Package\Version\VersionParser;
  10444. use Composer\Plugin\PluginEvents;
  10445. use Composer\Plugin\PreFileDownloadEvent;
  10446. use Composer\EventDispatcher\EventDispatcher;
  10447. use Composer\Util\Filesystem;
  10448. use Composer\Util\RemoteFilesystem;
  10449. use Composer\Util\Url as UrlUtil;
  10450. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  10451. {
  10452. protected $io;
  10453. protected $config;
  10454. protected $rfs;
  10455. protected $filesystem;
  10456. protected $cache;
  10457. protected $outputProgress = true;
  10458. private $lastCacheWrites = array();
  10459. private $eventDispatcher;
  10460. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  10461. {
  10462. $this->io = $io;
  10463. $this->config = $config;
  10464. $this->eventDispatcher = $eventDispatcher;
  10465. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  10466. $this->filesystem = $filesystem ?: new Filesystem();
  10467. $this->cache = $cache;
  10468. if ($this->cache && $this->cache->gcIsNecessary()) {
  10469. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  10470. }
  10471. }
  10472. public function getInstallationSource()
  10473. {
  10474. return 'dist';
  10475. }
  10476. public function download(PackageInterface $package, $path, $output = true)
  10477. {
  10478. if (!$package->getDistUrl()) {
  10479. throw new \InvalidArgumentException('The given package is missing url information');
  10480. }
  10481. if ($output) {
  10482. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  10483. }
  10484. $urls = $package->getDistUrls();
  10485. while ($url = array_shift($urls)) {
  10486. try {
  10487. $fileName = $this->doDownload($package, $path, $url);
  10488. break;
  10489. } catch (\Exception $e) {
  10490. if ($this->io->isDebug()) {
  10491. $this->io->writeError('');
  10492. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  10493. } elseif (count($urls)) {
  10494. $this->io->writeError('');
  10495. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  10496. }
  10497. if (!count($urls)) {
  10498. throw $e;
  10499. }
  10500. }
  10501. }
  10502. if ($output) {
  10503. $this->io->writeError('');
  10504. }
  10505. return $fileName;
  10506. }
  10507. protected function doDownload(PackageInterface $package, $path, $url)
  10508. {
  10509. $this->filesystem->emptyDirectory($path);
  10510. $fileName = $this->getFileName($package, $path);
  10511. $processedUrl = $this->processUrl($package, $url);
  10512. $hostname = parse_url($processedUrl, PHP_URL_HOST);
  10513. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  10514. if ($this->eventDispatcher) {
  10515. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  10516. }
  10517. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  10518. try {
  10519. $checksum = $package->getDistSha1Checksum();
  10520. $cacheKey = $this->getCacheKey($package, $processedUrl);
  10521. if ($this->cache && (!$checksum || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
  10522. $this->io->writeError('Loading from cache', false);
  10523. } else {
  10524. if (!$this->outputProgress) {
  10525. $this->io->writeError('Downloading', false);
  10526. }
  10527. $retries = 3;
  10528. while ($retries--) {
  10529. try {
  10530. $rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  10531. break;
  10532. } catch (TransportException $e) {
  10533. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  10534. throw $e;
  10535. }
  10536. $this->io->writeError('');
  10537. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  10538. usleep(500000);
  10539. }
  10540. }
  10541. if (!$this->outputProgress) {
  10542. $this->io->writeError(' (<comment>100%</comment>)', false);
  10543. }
  10544. if ($this->cache) {
  10545. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  10546. $this->cache->copyFrom($cacheKey, $fileName);
  10547. }
  10548. }
  10549. if (!file_exists($fileName)) {
  10550. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  10551. .' directory is writable and you have internet connectivity');
  10552. }
  10553. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  10554. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  10555. }
  10556. } catch (\Exception $e) {
  10557. $this->filesystem->removeDirectory($path);
  10558. $this->clearLastCacheWrite($package);
  10559. throw $e;
  10560. }
  10561. return $fileName;
  10562. }
  10563. public function setOutputProgress($outputProgress)
  10564. {
  10565. $this->outputProgress = $outputProgress;
  10566. return $this;
  10567. }
  10568. protected function clearLastCacheWrite(PackageInterface $package)
  10569. {
  10570. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  10571. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  10572. unset($this->lastCacheWrites[$package->getName()]);
  10573. }
  10574. }
  10575. public function update(PackageInterface $initial, PackageInterface $target, $path)
  10576. {
  10577. $name = $target->getName();
  10578. $from = $initial->getFullPrettyVersion();
  10579. $to = $target->getFullPrettyVersion();
  10580. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  10581. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  10582. $this->remove($initial, $path, false);
  10583. $this->download($target, $path, false);
  10584. $this->io->writeError('');
  10585. }
  10586. public function remove(PackageInterface $package, $path, $output = true)
  10587. {
  10588. if ($output) {
  10589. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10590. }
  10591. if (!$this->filesystem->removeDirectory($path)) {
  10592. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10593. }
  10594. }
  10595. protected function getFileName(PackageInterface $package, $path)
  10596. {
  10597. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10598. }
  10599. protected function processUrl(PackageInterface $package, $url)
  10600. {
  10601. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  10602. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  10603. }
  10604. if ($package->getDistReference()) {
  10605. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  10606. }
  10607. return $url;
  10608. }
  10609. private function getCacheKey(PackageInterface $package, $processedUrl)
  10610. {
  10611. $cacheKey = sha1($processedUrl);
  10612. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  10613. }
  10614. public function getLocalChanges(PackageInterface $package, $targetDir)
  10615. {
  10616. $prevIO = $this->io;
  10617. $prevProgress = $this->outputProgress;
  10618. $this->io = new NullIO;
  10619. $this->io->loadConfiguration($this->config);
  10620. $this->outputProgress = false;
  10621. $e = null;
  10622. try {
  10623. $this->download($package, $targetDir.'_compare', false);
  10624. $comparer = new Comparer();
  10625. $comparer->setSource($targetDir.'_compare');
  10626. $comparer->setUpdate($targetDir);
  10627. $comparer->doCompare();
  10628. $output = $comparer->getChanged(true, true);
  10629. $this->filesystem->removeDirectory($targetDir.'_compare');
  10630. } catch (\Exception $e) {
  10631. }
  10632. $this->io = $prevIO;
  10633. $this->outputProgress = $prevProgress;
  10634. if ($e) {
  10635. throw $e;
  10636. }
  10637. return trim($output);
  10638. }
  10639. }
  10640. <?php
  10641. namespace Composer\Downloader;
  10642. class FilesystemException extends \Exception
  10643. {
  10644. public function __construct($message = '', $code = 0, \Exception $previous = null)
  10645. {
  10646. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  10647. }
  10648. }
  10649. <?php
  10650. namespace Composer\Downloader;
  10651. use Composer\Package\PackageInterface;
  10652. use Composer\Util\ProcessExecutor;
  10653. class FossilDownloader extends VcsDownloader
  10654. {
  10655. public function doDownload(PackageInterface $package, $path, $url)
  10656. {
  10657. $this->config->prohibitUrlByConfig($url, $this->io);
  10658. $url = ProcessExecutor::escape($url);
  10659. $ref = ProcessExecutor::escape($package->getSourceReference());
  10660. $repoFile = $path . '.fossil';
  10661. $this->io->writeError("Cloning ".$package->getSourceReference());
  10662. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  10663. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10664. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10665. }
  10666. $command = sprintf('fossil open %s --nested', ProcessExecutor::escape($repoFile));
  10667. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10668. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10669. }
  10670. $command = sprintf('fossil update %s', $ref);
  10671. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10672. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10673. }
  10674. }
  10675. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10676. {
  10677. $this->config->prohibitUrlByConfig($url, $this->io);
  10678. $url = ProcessExecutor::escape($url);
  10679. $ref = ProcessExecutor::escape($target->getSourceReference());
  10680. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10681. if (!$this->hasMetadataRepository($path)) {
  10682. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10683. }
  10684. $command = sprintf('fossil pull && fossil up %s', $ref);
  10685. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10686. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10687. }
  10688. }
  10689. public function getLocalChanges(PackageInterface $package, $path)
  10690. {
  10691. if (!$this->hasMetadataRepository($path)) {
  10692. return null;
  10693. }
  10694. $this->process->execute('fossil changes', $output, realpath($path));
  10695. return trim($output) ?: null;
  10696. }
  10697. protected function getCommitLogs($fromReference, $toReference, $path)
  10698. {
  10699. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  10700. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10701. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10702. }
  10703. $log = '';
  10704. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  10705. foreach ($this->process->splitLines($output) as $line) {
  10706. if (preg_match($match, $line)) {
  10707. break;
  10708. }
  10709. $log .= $line;
  10710. }
  10711. return $log;
  10712. }
  10713. protected function hasMetadataRepository($path)
  10714. {
  10715. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  10716. }
  10717. }
  10718. <?php
  10719. namespace Composer\Downloader;
  10720. use Composer\Config;
  10721. use Composer\IO\IOInterface;
  10722. use Composer\Package\PackageInterface;
  10723. use Composer\Util\Filesystem;
  10724. use Composer\Util\Git as GitUtil;
  10725. use Composer\Util\Platform;
  10726. use Composer\Util\ProcessExecutor;
  10727. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  10728. {
  10729. private $hasStashedChanges = false;
  10730. private $hasDiscardedChanges = false;
  10731. private $gitUtil;
  10732. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10733. {
  10734. parent::__construct($io, $config, $process, $fs);
  10735. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  10736. }
  10737. public function doDownload(PackageInterface $package, $path, $url)
  10738. {
  10739. GitUtil::cleanEnv();
  10740. $path = $this->normalizePath($path);
  10741. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  10742. $ref = $package->getSourceReference();
  10743. $flag = Platform::isWindows() ? '/D ' : '';
  10744. $gitVersion = $this->gitUtil->getVersion();
  10745. $msg = "Cloning ".$this->getShortHash($ref);
  10746. $command = 'git clone --no-checkout %url% %path% && cd '.$flag.'%path% && git remote add composer %url% && git fetch composer';
  10747. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=')) {
  10748. $this->io->writeError('', true, IOInterface::DEBUG);
  10749. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  10750. try {
  10751. $this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref);
  10752. if (is_dir($cachePath)) {
  10753. $command =
  10754. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  10755. . '&& cd '.$flag.'%path% '
  10756. . '&& git remote set-url origin %url% && git remote add composer %url%';
  10757. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  10758. }
  10759. } catch (\RuntimeException $e) {
  10760. }
  10761. }
  10762. $this->io->writeError($msg);
  10763. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  10764. return str_replace(
  10765. array('%url%', '%path%', '%cachePath%'),
  10766. array(
  10767. ProcessExecutor::escape($url),
  10768. ProcessExecutor::escape($path),
  10769. ProcessExecutor::escape($cachePath),
  10770. ),
  10771. $command
  10772. );
  10773. };
  10774. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  10775. if ($url !== $package->getSourceUrl()) {
  10776. $this->updateOriginUrl($path, $package->getSourceUrl());
  10777. } else {
  10778. $this->setPushUrl($path, $url);
  10779. }
  10780. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  10781. if ($package->getDistReference() === $package->getSourceReference()) {
  10782. $package->setDistReference($newRef);
  10783. }
  10784. $package->setSourceReference($newRef);
  10785. }
  10786. }
  10787. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10788. {
  10789. GitUtil::cleanEnv();
  10790. if (!$this->hasMetadataRepository($path)) {
  10791. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10792. }
  10793. $updateOriginUrl = false;
  10794. if (
  10795. 0 === $this->process->execute('git remote -v', $output, $path)
  10796. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  10797. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  10798. ) {
  10799. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  10800. $updateOriginUrl = true;
  10801. }
  10802. }
  10803. $ref = $target->getSourceReference();
  10804. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  10805. $command = 'git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)';
  10806. $commandCallable = function ($url) use ($command, $ref) {
  10807. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($ref.'^{commit}'));
  10808. };
  10809. $this->gitUtil->runCommand($commandCallable, $url, $path);
  10810. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  10811. if ($target->getDistReference() === $target->getSourceReference()) {
  10812. $target->setDistReference($newRef);
  10813. }
  10814. $target->setSourceReference($newRef);
  10815. }
  10816. if ($updateOriginUrl) {
  10817. $this->updateOriginUrl($path, $target->getSourceUrl());
  10818. }
  10819. }
  10820. public function getLocalChanges(PackageInterface $package, $path)
  10821. {
  10822. GitUtil::cleanEnv();
  10823. if (!$this->hasMetadataRepository($path)) {
  10824. return;
  10825. }
  10826. $command = 'git status --porcelain --untracked-files=no';
  10827. if (0 !== $this->process->execute($command, $output, $path)) {
  10828. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10829. }
  10830. return trim($output) ?: null;
  10831. }
  10832. public function getUnpushedChanges(PackageInterface $package, $path)
  10833. {
  10834. GitUtil::cleanEnv();
  10835. $path = $this->normalizePath($path);
  10836. if (!$this->hasMetadataRepository($path)) {
  10837. return;
  10838. }
  10839. $command = 'git show-ref --head -d';
  10840. if (0 !== $this->process->execute($command, $output, $path)) {
  10841. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10842. }
  10843. $refs = trim($output);
  10844. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  10845. return;
  10846. }
  10847. $headRef = $match[1];
  10848. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  10849. return;
  10850. }
  10851. $branch = $matches[1][0];
  10852. $unpushedChanges = null;
  10853. for ($i = 0; $i <= 1; $i++) {
  10854. foreach ($matches[1] as $candidate) {
  10855. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  10856. $branch = $candidate;
  10857. $remoteBranch = $match[1];
  10858. break;
  10859. }
  10860. }
  10861. if (!isset($remoteBranch)) {
  10862. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  10863. } else {
  10864. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  10865. if (0 !== $this->process->execute($command, $output, $path)) {
  10866. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10867. }
  10868. $unpushedChanges = trim($output) ?: null;
  10869. }
  10870. if ($unpushedChanges && $i === 0) {
  10871. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  10872. }
  10873. if (!$unpushedChanges) {
  10874. break;
  10875. }
  10876. }
  10877. return $unpushedChanges;
  10878. }
  10879. protected function cleanChanges(PackageInterface $package, $path, $update)
  10880. {
  10881. GitUtil::cleanEnv();
  10882. $path = $this->normalizePath($path);
  10883. $unpushed = $this->getUnpushedChanges($package, $path);
  10884. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  10885. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  10886. }
  10887. if (!$changes = $this->getLocalChanges($package, $path)) {
  10888. return;
  10889. }
  10890. if (!$this->io->isInteractive()) {
  10891. $discardChanges = $this->config->get('discard-changes');
  10892. if (true === $discardChanges) {
  10893. return $this->discardChanges($path);
  10894. }
  10895. if ('stash' === $discardChanges) {
  10896. if (!$update) {
  10897. return parent::cleanChanges($package, $path, $update);
  10898. }
  10899. return $this->stashChanges($path);
  10900. }
  10901. return parent::cleanChanges($package, $path, $update);
  10902. }
  10903. $changes = array_map(function ($elem) {
  10904. return ' '.$elem;
  10905. }, preg_split('{\s*\r?\n\s*}', $changes));
  10906. $this->io->writeError(' <error>The package has modified files:</error>');
  10907. $this->io->writeError(array_slice($changes, 0, 10));
  10908. if (count($changes) > 10) {
  10909. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  10910. }
  10911. while (true) {
  10912. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  10913. case 'y':
  10914. $this->discardChanges($path);
  10915. break 2;
  10916. case 's':
  10917. if (!$update) {
  10918. goto help;
  10919. }
  10920. $this->stashChanges($path);
  10921. break 2;
  10922. case 'n':
  10923. throw new \RuntimeException('Update aborted');
  10924. case 'v':
  10925. $this->io->writeError($changes);
  10926. break;
  10927. case 'd':
  10928. $this->viewDiff($path);
  10929. break;
  10930. case '?':
  10931. default:
  10932. help:
  10933. $this->io->writeError(array(
  10934. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  10935. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  10936. ' v - view modified files',
  10937. ' d - view local modifications (diff)',
  10938. ));
  10939. if ($update) {
  10940. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  10941. }
  10942. $this->io->writeError(' ? - print help');
  10943. break;
  10944. }
  10945. }
  10946. }
  10947. protected function reapplyChanges($path)
  10948. {
  10949. $path = $this->normalizePath($path);
  10950. if ($this->hasStashedChanges) {
  10951. $this->hasStashedChanges = false;
  10952. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  10953. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  10954. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  10955. }
  10956. }
  10957. $this->hasDiscardedChanges = false;
  10958. }
  10959. protected function updateToCommit($path, $reference, $branch, $date)
  10960. {
  10961. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  10962. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  10963. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  10964. $branches = null;
  10965. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  10966. $branches = $output;
  10967. }
  10968. $gitRef = $reference;
  10969. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  10970. && $branches
  10971. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  10972. ) {
  10973. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  10974. if (0 === $this->process->execute($command, $output, $path)) {
  10975. return;
  10976. }
  10977. }
  10978. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  10979. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  10980. $branch = 'v' . $branch;
  10981. }
  10982. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  10983. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  10984. if (0 === $this->process->execute($command, $output, $path)
  10985. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  10986. ) {
  10987. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  10988. if (0 === $this->process->execute($command, $output, $path)) {
  10989. return;
  10990. }
  10991. }
  10992. }
  10993. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  10994. if (0 === $this->process->execute($command, $output, $path)) {
  10995. return;
  10996. }
  10997. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  10998. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  10999. }
  11000. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  11001. }
  11002. protected function updateOriginUrl($path, $url)
  11003. {
  11004. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  11005. $this->setPushUrl($path, $url);
  11006. }
  11007. protected function setPushUrl($path, $url)
  11008. {
  11009. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  11010. $protocols = $this->config->get('github-protocols');
  11011. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  11012. if (!in_array('ssh', $protocols, true)) {
  11013. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  11014. }
  11015. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  11016. $this->process->execute($cmd, $ignoredOutput, $path);
  11017. }
  11018. }
  11019. protected function getCommitLogs($fromReference, $toReference, $path)
  11020. {
  11021. $path = $this->normalizePath($path);
  11022. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11023. if (0 !== $this->process->execute($command, $output, $path)) {
  11024. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11025. }
  11026. return $output;
  11027. }
  11028. protected function discardChanges($path)
  11029. {
  11030. $path = $this->normalizePath($path);
  11031. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  11032. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11033. }
  11034. $this->hasDiscardedChanges = true;
  11035. }
  11036. protected function stashChanges($path)
  11037. {
  11038. $path = $this->normalizePath($path);
  11039. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  11040. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  11041. }
  11042. $this->hasStashedChanges = true;
  11043. }
  11044. protected function viewDiff($path)
  11045. {
  11046. $path = $this->normalizePath($path);
  11047. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  11048. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  11049. }
  11050. $this->io->writeError($output);
  11051. }
  11052. protected function normalizePath($path)
  11053. {
  11054. if (Platform::isWindows() && strlen($path) > 0) {
  11055. $basePath = $path;
  11056. $removed = array();
  11057. while (!is_dir($basePath) && $basePath !== '\\') {
  11058. array_unshift($removed, basename($basePath));
  11059. $basePath = dirname($basePath);
  11060. }
  11061. if ($basePath === '\\') {
  11062. return $path;
  11063. }
  11064. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  11065. }
  11066. return $path;
  11067. }
  11068. protected function hasMetadataRepository($path)
  11069. {
  11070. $path = $this->normalizePath($path);
  11071. return is_dir($path.'/.git');
  11072. }
  11073. protected function getShortHash($reference)
  11074. {
  11075. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  11076. return substr($reference, 0, 10);
  11077. }
  11078. return $reference;
  11079. }
  11080. }
  11081. <?php
  11082. namespace Composer\Downloader;
  11083. use Composer\Config;
  11084. use Composer\Cache;
  11085. use Composer\EventDispatcher\EventDispatcher;
  11086. use Composer\Package\PackageInterface;
  11087. use Composer\Util\Platform;
  11088. use Composer\Util\ProcessExecutor;
  11089. use Composer\Util\RemoteFilesystem;
  11090. use Composer\IO\IOInterface;
  11091. class GzipDownloader extends ArchiveDownloader
  11092. {
  11093. protected $process;
  11094. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11095. {
  11096. $this->process = $process ?: new ProcessExecutor($io);
  11097. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11098. }
  11099. protected function extract($file, $path)
  11100. {
  11101. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  11102. if (!Platform::isWindows()) {
  11103. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  11104. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11105. return;
  11106. }
  11107. if (extension_loaded('zlib')) {
  11108. $this->extractUsingExt($file, $targetFilepath);
  11109. return;
  11110. }
  11111. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11112. throw new \RuntimeException($processError);
  11113. }
  11114. $this->extractUsingExt($file, $targetFilepath);
  11115. }
  11116. protected function getFileName(PackageInterface $package, $path)
  11117. {
  11118. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11119. }
  11120. private function extractUsingExt($file, $targetFilepath)
  11121. {
  11122. $archiveFile = gzopen($file, 'rb');
  11123. $targetFile = fopen($targetFilepath, 'wb');
  11124. while ($string = gzread($archiveFile, 4096)) {
  11125. fwrite($targetFile, $string, Platform::strlen($string));
  11126. }
  11127. gzclose($archiveFile);
  11128. fclose($targetFile);
  11129. }
  11130. }
  11131. <?php
  11132. namespace Composer\Downloader;
  11133. use Composer\Package\PackageInterface;
  11134. use Composer\Util\ProcessExecutor;
  11135. use Composer\Util\Hg as HgUtils;
  11136. class HgDownloader extends VcsDownloader
  11137. {
  11138. public function doDownload(PackageInterface $package, $path, $url)
  11139. {
  11140. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11141. $cloneCommand = function ($url) use ($path) {
  11142. return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  11143. };
  11144. $hgUtils->runCommand($cloneCommand, $url, $path);
  11145. $ref = ProcessExecutor::escape($package->getSourceReference());
  11146. $command = sprintf('hg up %s', $ref);
  11147. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11148. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11149. }
  11150. }
  11151. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11152. {
  11153. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11154. $ref = $target->getSourceReference();
  11155. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11156. if (!$this->hasMetadataRepository($path)) {
  11157. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11158. }
  11159. $command = function ($url) use ($ref) {
  11160. return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  11161. };
  11162. $hgUtils->runCommand($command, $url, $path);
  11163. }
  11164. public function getLocalChanges(PackageInterface $package, $path)
  11165. {
  11166. if (!is_dir($path.'/.hg')) {
  11167. return null;
  11168. }
  11169. $this->process->execute('hg st', $output, realpath($path));
  11170. return trim($output) ?: null;
  11171. }
  11172. protected function getCommitLogs($fromReference, $toReference, $path)
  11173. {
  11174. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11175. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11176. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11177. }
  11178. return $output;
  11179. }
  11180. protected function hasMetadataRepository($path)
  11181. {
  11182. return is_dir($path . '/.hg');
  11183. }
  11184. }
  11185. <?php
  11186. namespace Composer\Downloader;
  11187. use Composer\Package\Archiver\ArchivableFilesFinder;
  11188. use Composer\Package\Dumper\ArrayDumper;
  11189. use Composer\Package\PackageInterface;
  11190. use Composer\Package\Version\VersionGuesser;
  11191. use Composer\Package\Version\VersionParser;
  11192. use Composer\Util\Platform;
  11193. use Composer\Util\ProcessExecutor;
  11194. use Composer\Util\Filesystem as ComposerFilesystem;
  11195. use Symfony\Component\Filesystem\Exception\IOException;
  11196. use Symfony\Component\Filesystem\Filesystem;
  11197. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  11198. {
  11199. const STRATEGY_SYMLINK = 10;
  11200. const STRATEGY_MIRROR = 20;
  11201. public function download(PackageInterface $package, $path, $output = true)
  11202. {
  11203. $url = $package->getDistUrl();
  11204. $realUrl = realpath($url);
  11205. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  11206. throw new \RuntimeException(sprintf(
  11207. 'Source path "%s" is not found for package %s',
  11208. $url,
  11209. $package->getName()
  11210. ));
  11211. }
  11212. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  11213. throw new \RuntimeException(sprintf(
  11214. 'Package %s cannot install to "%s" inside its source at "%s"',
  11215. $package->getName(),
  11216. realpath($path),
  11217. $realUrl
  11218. ));
  11219. }
  11220. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  11221. $currentStrategy = self::STRATEGY_SYMLINK;
  11222. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  11223. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  11224. if ($mirrorPathRepos) {
  11225. $currentStrategy = self::STRATEGY_MIRROR;
  11226. }
  11227. if (true === $transportOptions['symlink']) {
  11228. $currentStrategy = self::STRATEGY_SYMLINK;
  11229. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  11230. } elseif (false === $transportOptions['symlink']) {
  11231. $currentStrategy = self::STRATEGY_MIRROR;
  11232. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11233. }
  11234. if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
  11235. $currentStrategy = self::STRATEGY_MIRROR;
  11236. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11237. }
  11238. $fileSystem = new Filesystem();
  11239. $this->filesystem->removeDirectory($path);
  11240. if ($output) {
  11241. $this->io->writeError(sprintf(
  11242. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  11243. $package->getName(),
  11244. $package->getFullPrettyVersion()
  11245. ), false);
  11246. }
  11247. $isFallback = false;
  11248. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  11249. try {
  11250. if (Platform::isWindows()) {
  11251. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  11252. $this->filesystem->junction($realUrl, $path);
  11253. } else {
  11254. $absolutePath = $path;
  11255. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  11256. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  11257. }
  11258. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  11259. $path = rtrim($path, "/");
  11260. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  11261. $fileSystem->symlink($shortestPath, $path);
  11262. }
  11263. } catch (IOException $e) {
  11264. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  11265. $this->io->writeError('');
  11266. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  11267. $currentStrategy = self::STRATEGY_MIRROR;
  11268. $isFallback = true;
  11269. } else {
  11270. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  11271. }
  11272. }
  11273. }
  11274. if (self::STRATEGY_MIRROR == $currentStrategy) {
  11275. $fs = new ComposerFilesystem();
  11276. $realUrl = $fs->normalizePath($realUrl);
  11277. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  11278. $iterator = new ArchivableFilesFinder($realUrl, array());
  11279. $fileSystem->mirror($realUrl, $path, $iterator);
  11280. }
  11281. $this->io->writeError('');
  11282. }
  11283. public function remove(PackageInterface $package, $path, $output = true)
  11284. {
  11285. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  11286. if ($output) {
  11287. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11288. }
  11289. if (!$this->filesystem->removeJunction($path)) {
  11290. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  11291. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  11292. }
  11293. } else {
  11294. parent::remove($package, $path, $output);
  11295. }
  11296. }
  11297. public function getVcsReference(PackageInterface $package, $path)
  11298. {
  11299. $parser = new VersionParser;
  11300. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  11301. $dumper = new ArrayDumper;
  11302. $packageConfig = $dumper->dump($package);
  11303. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11304. return $packageVersion['commit'];
  11305. }
  11306. }
  11307. private function safeJunctions()
  11308. {
  11309. return function_exists('proc_open') &&
  11310. (PHP_WINDOWS_VERSION_MAJOR > 6 ||
  11311. (PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1));
  11312. }
  11313. }
  11314. <?php
  11315. namespace Composer\Downloader;
  11316. use Composer\Util\Filesystem;
  11317. class PearPackageExtractor
  11318. {
  11319. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  11320. private $filesystem;
  11321. private $file;
  11322. public function __construct($file)
  11323. {
  11324. if (!is_file($file)) {
  11325. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  11326. }
  11327. $this->filesystem = new Filesystem();
  11328. $this->file = $file;
  11329. }
  11330. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  11331. {
  11332. $extractionPath = $target.'/tarball';
  11333. try {
  11334. $archive = new \PharData($this->file);
  11335. $archive->extractTo($extractionPath, null, true);
  11336. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  11337. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  11338. }
  11339. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  11340. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  11341. $this->filesystem->removeDirectory($extractionPath);
  11342. } catch (\Exception $exception) {
  11343. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  11344. }
  11345. }
  11346. private function copyFiles($files, $source, $target, $roles, $vars)
  11347. {
  11348. foreach ($files as $file) {
  11349. $from = $this->combine($source, $file['from']);
  11350. $to = $this->combine($target, $roles[$file['role']]);
  11351. $to = $this->combine($to, $file['to']);
  11352. $tasks = $file['tasks'];
  11353. $this->copyFile($from, $to, $tasks, $vars);
  11354. }
  11355. }
  11356. private function copyFile($from, $to, $tasks, $vars)
  11357. {
  11358. if (!is_file($from)) {
  11359. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  11360. }
  11361. $this->filesystem->ensureDirectoryExists(dirname($to));
  11362. if (0 == count($tasks)) {
  11363. $copied = copy($from, $to);
  11364. } else {
  11365. $content = file_get_contents($from);
  11366. $replacements = array();
  11367. foreach ($tasks as $task) {
  11368. $pattern = $task['from'];
  11369. $varName = $task['to'];
  11370. if (isset($vars[$varName])) {
  11371. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  11372. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  11373. } else {
  11374. $replacements[$pattern] = $vars[$varName];
  11375. }
  11376. }
  11377. }
  11378. $content = strtr($content, $replacements);
  11379. $copied = file_put_contents($to, $content);
  11380. }
  11381. if (false === $copied) {
  11382. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  11383. }
  11384. }
  11385. private function buildCopyActions($source, array $roles, $vars)
  11386. {
  11387. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  11388. if (false === $package) {
  11389. throw new \RuntimeException('Package definition file is not valid.');
  11390. }
  11391. $packageSchemaVersion = $package['version'];
  11392. if ('1.0' == $packageSchemaVersion) {
  11393. $children = $package->release->filelist->children();
  11394. $packageName = (string) $package->name;
  11395. $packageVersion = (string) $package->release->version;
  11396. $sourceDir = $packageName . '-' . $packageVersion;
  11397. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  11398. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  11399. $children = $package->contents->children();
  11400. $packageName = (string) $package->name;
  11401. $packageVersion = (string) $package->version->release;
  11402. $sourceDir = $packageName . '-' . $packageVersion;
  11403. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  11404. $namespaces = $package->getNamespaces();
  11405. $package->registerXPathNamespace('ns', $namespaces['']);
  11406. $releaseNodes = $package->xpath('ns:phprelease');
  11407. $this->applyRelease($result, $releaseNodes, $vars);
  11408. } else {
  11409. throw new \RuntimeException('Unsupported schema version of package definition file.');
  11410. }
  11411. return $result;
  11412. }
  11413. private function applyRelease(&$actions, $releaseNodes, $vars)
  11414. {
  11415. foreach ($releaseNodes as $releaseNode) {
  11416. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  11417. if ($requiredOs && $vars['os'] != $requiredOs) {
  11418. continue;
  11419. }
  11420. if ($releaseNode->filelist) {
  11421. foreach ($releaseNode->filelist->children() as $action) {
  11422. if ('install' == $action->getName()) {
  11423. $name = (string) $action['name'];
  11424. $as = (string) $action['as'];
  11425. if (isset($actions[$name])) {
  11426. $actions[$name]['to'] = $as;
  11427. }
  11428. } elseif ('ignore' == $action->getName()) {
  11429. $name = (string) $action['name'];
  11430. unset($actions[$name]);
  11431. } else {
  11432. }
  11433. }
  11434. }
  11435. break;
  11436. }
  11437. }
  11438. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  11439. {
  11440. $result = array();
  11441. foreach ($children as $child) {
  11442. if ($child->getName() == 'dir') {
  11443. $dirSource = $this->combine($source, (string) $child['name']);
  11444. $dirTarget = $child['baseinstalldir'] ?: $target;
  11445. $dirRole = $child['role'] ?: $role;
  11446. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11447. $result = array_merge($result, $dirFiles);
  11448. } elseif ($child->getName() == 'file') {
  11449. $fileRole = (string) $child['role'] ?: $role;
  11450. if (isset($targetRoles[$fileRole])) {
  11451. $fileName = (string) ($child['name'] ?: $child[0]);
  11452. $fileSource = $this->combine($source, $fileName);
  11453. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  11454. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11455. $fileTarget = $packageName . '/' . $fileTarget;
  11456. }
  11457. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  11458. }
  11459. }
  11460. }
  11461. return $result;
  11462. }
  11463. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  11464. {
  11465. $result = array();
  11466. foreach ($children as $child) {
  11467. if ('dir' == $child->getName()) {
  11468. $dirSource = $this->combine($source, $child['name']);
  11469. $dirTarget = $child['baseinstalldir'] ?: $target;
  11470. $dirRole = $child['role'] ?: $role;
  11471. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11472. $result = array_merge($result, $dirFiles);
  11473. } elseif ('file' == $child->getName()) {
  11474. $fileRole = (string) $child['role'] ?: $role;
  11475. if (isset($targetRoles[$fileRole])) {
  11476. $fileSource = $this->combine($source, (string) $child['name']);
  11477. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  11478. $fileTasks = array();
  11479. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  11480. if ('replace' == $taskNode->getName()) {
  11481. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  11482. }
  11483. }
  11484. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11485. $fileTarget = $packageName . '/' . $fileTarget;
  11486. }
  11487. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  11488. }
  11489. }
  11490. }
  11491. return $result;
  11492. }
  11493. private function combine($left, $right)
  11494. {
  11495. return rtrim($left, '/') . '/' . ltrim($right, '/');
  11496. }
  11497. }
  11498. <?php
  11499. namespace Composer\Downloader;
  11500. use Composer\Package\PackageInterface;
  11501. use Composer\Repository\VcsRepository;
  11502. use Composer\Util\Perforce;
  11503. class PerforceDownloader extends VcsDownloader
  11504. {
  11505. protected $perforce;
  11506. public function doDownload(PackageInterface $package, $path, $url)
  11507. {
  11508. $ref = $package->getSourceReference();
  11509. $label = $this->getLabelFromSourceReference($ref);
  11510. $this->io->writeError('Cloning ' . $ref);
  11511. $this->initPerforce($package, $path, $url);
  11512. $this->perforce->setStream($ref);
  11513. $this->perforce->p4Login();
  11514. $this->perforce->writeP4ClientSpec();
  11515. $this->perforce->connectClient();
  11516. $this->perforce->syncCodeBase($label);
  11517. $this->perforce->cleanupClientSpec();
  11518. }
  11519. private function getLabelFromSourceReference($ref)
  11520. {
  11521. $pos = strpos($ref, '@');
  11522. if (false !== $pos) {
  11523. return substr($ref, $pos + 1);
  11524. }
  11525. return null;
  11526. }
  11527. public function initPerforce(PackageInterface $package, $path, $url)
  11528. {
  11529. if (!empty($this->perforce)) {
  11530. $this->perforce->initializePath($path);
  11531. return;
  11532. }
  11533. $repository = $package->getRepository();
  11534. $repoConfig = null;
  11535. if ($repository instanceof VcsRepository) {
  11536. $repoConfig = $this->getRepoConfig($repository);
  11537. }
  11538. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  11539. }
  11540. private function getRepoConfig(VcsRepository $repository)
  11541. {
  11542. return $repository->getRepoConfig();
  11543. }
  11544. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11545. {
  11546. $this->doDownload($target, $path, $url);
  11547. }
  11548. public function getLocalChanges(PackageInterface $package, $path)
  11549. {
  11550. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  11551. return;
  11552. }
  11553. protected function getCommitLogs($fromReference, $toReference, $path)
  11554. {
  11555. return $this->perforce->getCommitLogs($fromReference, $toReference);
  11556. }
  11557. public function setPerforce($perforce)
  11558. {
  11559. $this->perforce = $perforce;
  11560. }
  11561. protected function hasMetadataRepository($path)
  11562. {
  11563. return true;
  11564. }
  11565. }
  11566. <?php
  11567. namespace Composer\Downloader;
  11568. class PharDownloader extends ArchiveDownloader
  11569. {
  11570. protected function extract($file, $path)
  11571. {
  11572. $archive = new \Phar($file);
  11573. $archive->extractTo($path, null, true);
  11574. }
  11575. }
  11576. <?php
  11577. namespace Composer\Downloader;
  11578. use Composer\Config;
  11579. use Composer\Cache;
  11580. use Composer\EventDispatcher\EventDispatcher;
  11581. use Composer\Util\IniHelper;
  11582. use Composer\Util\Platform;
  11583. use Composer\Util\ProcessExecutor;
  11584. use Composer\Util\RemoteFilesystem;
  11585. use Composer\IO\IOInterface;
  11586. use RarArchive;
  11587. class RarDownloader extends ArchiveDownloader
  11588. {
  11589. protected $process;
  11590. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11591. {
  11592. $this->process = $process ?: new ProcessExecutor($io);
  11593. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11594. }
  11595. protected function extract($file, $path)
  11596. {
  11597. $processError = null;
  11598. if (!Platform::isWindows()) {
  11599. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  11600. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11601. return;
  11602. }
  11603. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11604. }
  11605. if (!class_exists('RarArchive')) {
  11606. $iniMessage = IniHelper::getMessage();
  11607. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  11608. . $iniMessage . "\n" . $processError;
  11609. if (!Platform::isWindows()) {
  11610. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  11611. }
  11612. throw new \RuntimeException($error);
  11613. }
  11614. $rarArchive = RarArchive::open($file);
  11615. if (false === $rarArchive) {
  11616. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  11617. }
  11618. $entries = $rarArchive->getEntries();
  11619. if (false === $entries) {
  11620. throw new \RuntimeException('Could not retrieve RAR archive entries');
  11621. }
  11622. foreach ($entries as $entry) {
  11623. if (false === $entry->extract($path)) {
  11624. throw new \RuntimeException('Could not extract entry');
  11625. }
  11626. }
  11627. $rarArchive->close();
  11628. }
  11629. }
  11630. <?php
  11631. namespace Composer\Downloader;
  11632. use Composer\Package\PackageInterface;
  11633. use Composer\Util\Svn as SvnUtil;
  11634. use Composer\Repository\VcsRepository;
  11635. use Composer\Util\ProcessExecutor;
  11636. class SvnDownloader extends VcsDownloader
  11637. {
  11638. protected $cacheCredentials = true;
  11639. public function doDownload(PackageInterface $package, $path, $url)
  11640. {
  11641. SvnUtil::cleanEnv();
  11642. $ref = $package->getSourceReference();
  11643. $repo = $package->getRepository();
  11644. if ($repo instanceof VcsRepository) {
  11645. $repoConfig = $repo->getRepoConfig();
  11646. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  11647. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  11648. }
  11649. }
  11650. $this->io->writeError(" Checking out ".$package->getSourceReference());
  11651. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  11652. }
  11653. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11654. {
  11655. SvnUtil::cleanEnv();
  11656. $ref = $target->getSourceReference();
  11657. if (!$this->hasMetadataRepository($path)) {
  11658. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11659. }
  11660. $util = new SvnUtil($url, $this->io, $this->config);
  11661. $flags = "";
  11662. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  11663. $flags .= ' --ignore-ancestry';
  11664. }
  11665. $this->io->writeError(" Checking out " . $ref);
  11666. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  11667. }
  11668. public function getLocalChanges(PackageInterface $package, $path)
  11669. {
  11670. if (!$this->hasMetadataRepository($path)) {
  11671. return null;
  11672. }
  11673. $this->process->execute('svn status --ignore-externals', $output, $path);
  11674. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  11675. }
  11676. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  11677. {
  11678. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11679. $util->setCacheCredentials($this->cacheCredentials);
  11680. try {
  11681. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  11682. } catch (\RuntimeException $e) {
  11683. throw new \RuntimeException(
  11684. 'Package could not be downloaded, '.$e->getMessage()
  11685. );
  11686. }
  11687. }
  11688. protected function cleanChanges(PackageInterface $package, $path, $update)
  11689. {
  11690. if (!$changes = $this->getLocalChanges($package, $path)) {
  11691. return;
  11692. }
  11693. if (!$this->io->isInteractive()) {
  11694. if (true === $this->config->get('discard-changes')) {
  11695. return $this->discardChanges($path);
  11696. }
  11697. return parent::cleanChanges($package, $path, $update);
  11698. }
  11699. $changes = array_map(function ($elem) {
  11700. return ' '.$elem;
  11701. }, preg_split('{\s*\r?\n\s*}', $changes));
  11702. $countChanges = count($changes);
  11703. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  11704. $this->io->writeError(array_slice($changes, 0, 10));
  11705. if ($countChanges > 10) {
  11706. $remaingChanges = $countChanges - 10;
  11707. $this->io->writeError(
  11708. sprintf(
  11709. ' <info>'.$remaingChanges.' more file%s modified, choose "v" to view the full list</info>',
  11710. $remaingChanges === 1 ? '' : 's'
  11711. )
  11712. );
  11713. }
  11714. while (true) {
  11715. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  11716. case 'y':
  11717. $this->discardChanges($path);
  11718. break 2;
  11719. case 'n':
  11720. throw new \RuntimeException('Update aborted');
  11721. case 'v':
  11722. $this->io->writeError($changes);
  11723. break;
  11724. case '?':
  11725. default:
  11726. $this->io->writeError(array(
  11727. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11728. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11729. ' v - view modified files',
  11730. ' ? - print help',
  11731. ));
  11732. break;
  11733. }
  11734. }
  11735. }
  11736. protected function getCommitLogs($fromReference, $toReference, $path)
  11737. {
  11738. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  11739. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  11740. if (0 !== $this->process->execute($command, $output, $path)) {
  11741. throw new \RuntimeException(
  11742. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  11743. );
  11744. }
  11745. $urlPattern = '#<url>(.*)</url>#';
  11746. if (preg_match($urlPattern, $output, $matches)) {
  11747. $baseUrl = $matches[1];
  11748. } else {
  11749. throw new \RuntimeException(
  11750. 'Unable to determine svn url for path '. $path
  11751. );
  11752. }
  11753. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  11754. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  11755. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  11756. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11757. $util->setCacheCredentials($this->cacheCredentials);
  11758. try {
  11759. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  11760. } catch (\RuntimeException $e) {
  11761. throw new \RuntimeException(
  11762. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  11763. );
  11764. }
  11765. }
  11766. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  11767. }
  11768. protected function discardChanges($path)
  11769. {
  11770. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  11771. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11772. }
  11773. }
  11774. protected function hasMetadataRepository($path)
  11775. {
  11776. return is_dir($path.'/.svn');
  11777. }
  11778. }
  11779. <?php
  11780. namespace Composer\Downloader;
  11781. class TarDownloader extends ArchiveDownloader
  11782. {
  11783. protected function extract($file, $path)
  11784. {
  11785. $archive = new \PharData($file);
  11786. $archive->extractTo($path, null, true);
  11787. }
  11788. }
  11789. <?php
  11790. namespace Composer\Downloader;
  11791. class TransportException extends \RuntimeException
  11792. {
  11793. protected $headers;
  11794. protected $response;
  11795. protected $statusCode;
  11796. public function setHeaders($headers)
  11797. {
  11798. $this->headers = $headers;
  11799. }
  11800. public function getHeaders()
  11801. {
  11802. return $this->headers;
  11803. }
  11804. public function setResponse($response)
  11805. {
  11806. $this->response = $response;
  11807. }
  11808. public function getResponse()
  11809. {
  11810. return $this->response;
  11811. }
  11812. public function setStatusCode($statusCode)
  11813. {
  11814. $this->statusCode = $statusCode;
  11815. }
  11816. public function getStatusCode()
  11817. {
  11818. return $this->statusCode;
  11819. }
  11820. }
  11821. <?php
  11822. namespace Composer\Downloader;
  11823. use Composer\Package\PackageInterface;
  11824. interface VcsCapableDownloaderInterface
  11825. {
  11826. public function getVcsReference(PackageInterface $package, $path);
  11827. }
  11828. <?php
  11829. namespace Composer\Downloader;
  11830. use Composer\Config;
  11831. use Composer\Package\Dumper\ArrayDumper;
  11832. use Composer\Package\PackageInterface;
  11833. use Composer\Package\Version\VersionGuesser;
  11834. use Composer\Package\Version\VersionParser;
  11835. use Composer\Util\ProcessExecutor;
  11836. use Composer\IO\IOInterface;
  11837. use Composer\Util\Filesystem;
  11838. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  11839. {
  11840. protected $io;
  11841. protected $config;
  11842. protected $process;
  11843. protected $filesystem;
  11844. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11845. {
  11846. $this->io = $io;
  11847. $this->config = $config;
  11848. $this->process = $process ?: new ProcessExecutor($io);
  11849. $this->filesystem = $fs ?: new Filesystem($this->process);
  11850. }
  11851. public function getInstallationSource()
  11852. {
  11853. return 'source';
  11854. }
  11855. public function download(PackageInterface $package, $path)
  11856. {
  11857. if (!$package->getSourceReference()) {
  11858. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  11859. }
  11860. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11861. $this->filesystem->emptyDirectory($path);
  11862. $urls = $package->getSourceUrls();
  11863. while ($url = array_shift($urls)) {
  11864. try {
  11865. if (Filesystem::isLocalPath($url)) {
  11866. $needle = 'file://';
  11867. $isFileProtocol = false;
  11868. if (0 === strpos($url, $needle)) {
  11869. $url = substr($url, strlen($needle));
  11870. $isFileProtocol = true;
  11871. }
  11872. if (false !== strpos($url, '%')) {
  11873. $url = rawurldecode($url);
  11874. }
  11875. $url = realpath($url);
  11876. if ($isFileProtocol) {
  11877. $url = $needle . $url;
  11878. }
  11879. }
  11880. $this->doDownload($package, $path, $url);
  11881. break;
  11882. } catch (\Exception $e) {
  11883. if ($e instanceof \PHPUnit_Framework_Exception) {
  11884. throw $e;
  11885. }
  11886. if ($this->io->isDebug()) {
  11887. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  11888. } elseif (count($urls)) {
  11889. $this->io->writeError(' Failed, trying the next URL');
  11890. }
  11891. if (!count($urls)) {
  11892. throw $e;
  11893. }
  11894. }
  11895. }
  11896. }
  11897. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11898. {
  11899. if (!$target->getSourceReference()) {
  11900. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  11901. }
  11902. $name = $target->getName();
  11903. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  11904. if ($target->getSourceType() === 'svn') {
  11905. $from = $initial->getSourceReference();
  11906. $to = $target->getSourceReference();
  11907. } else {
  11908. $from = substr($initial->getSourceReference(), 0, 7);
  11909. $to = substr($target->getSourceReference(), 0, 7);
  11910. }
  11911. $name .= ' '.$initial->getPrettyVersion();
  11912. } else {
  11913. $from = $initial->getFullPrettyVersion();
  11914. $to = $target->getFullPrettyVersion();
  11915. }
  11916. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  11917. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11918. $this->cleanChanges($initial, $path, true);
  11919. $urls = $target->getSourceUrls();
  11920. $exception = null;
  11921. while ($url = array_shift($urls)) {
  11922. try {
  11923. if (Filesystem::isLocalPath($url)) {
  11924. $url = realpath($url);
  11925. }
  11926. $this->doUpdate($initial, $target, $path, $url);
  11927. $exception = null;
  11928. break;
  11929. } catch (\Exception $exception) {
  11930. if ($exception instanceof \PHPUnit_Framework_Exception) {
  11931. throw $exception;
  11932. }
  11933. if ($this->io->isDebug()) {
  11934. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  11935. } elseif (count($urls)) {
  11936. $this->io->writeError(' Failed, trying the next URL');
  11937. }
  11938. }
  11939. }
  11940. $this->reapplyChanges($path);
  11941. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  11942. $message = 'Pulling in changes:';
  11943. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  11944. if (!trim($logs)) {
  11945. $message = 'Rolling back changes:';
  11946. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  11947. }
  11948. if (trim($logs)) {
  11949. $logs = implode("\n", array_map(function ($line) {
  11950. return ' ' . $line;
  11951. }, explode("\n", $logs)));
  11952. $logs = str_replace('<', '\<', $logs);
  11953. $this->io->writeError(' '.$message);
  11954. $this->io->writeError($logs);
  11955. }
  11956. }
  11957. if (!$urls && $exception) {
  11958. throw $exception;
  11959. }
  11960. }
  11961. public function remove(PackageInterface $package, $path)
  11962. {
  11963. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  11964. $this->cleanChanges($package, $path, false);
  11965. if (!$this->filesystem->removeDirectory($path)) {
  11966. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  11967. }
  11968. }
  11969. public function setOutputProgress($outputProgress)
  11970. {
  11971. return $this;
  11972. }
  11973. public function getVcsReference(PackageInterface $package, $path)
  11974. {
  11975. $parser = new VersionParser;
  11976. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  11977. $dumper = new ArrayDumper;
  11978. $packageConfig = $dumper->dump($package);
  11979. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11980. return $packageVersion['commit'];
  11981. }
  11982. }
  11983. protected function cleanChanges(PackageInterface $package, $path, $update)
  11984. {
  11985. if (null !== $this->getLocalChanges($package, $path)) {
  11986. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  11987. }
  11988. }
  11989. protected function reapplyChanges($path)
  11990. {
  11991. }
  11992. abstract protected function doDownload(PackageInterface $package, $path, $url);
  11993. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  11994. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  11995. abstract protected function hasMetadataRepository($path);
  11996. }
  11997. <?php
  11998. namespace Composer\Downloader;
  11999. use Composer\Config;
  12000. use Composer\Cache;
  12001. use Composer\EventDispatcher\EventDispatcher;
  12002. use Composer\Package\PackageInterface;
  12003. use Composer\Util\ProcessExecutor;
  12004. use Composer\Util\RemoteFilesystem;
  12005. use Composer\IO\IOInterface;
  12006. class XzDownloader extends ArchiveDownloader
  12007. {
  12008. protected $process;
  12009. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12010. {
  12011. $this->process = $process ?: new ProcessExecutor($io);
  12012. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12013. }
  12014. protected function extract($file, $path)
  12015. {
  12016. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  12017. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12018. return;
  12019. }
  12020. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  12021. throw new \RuntimeException($processError);
  12022. }
  12023. protected function getFileName(PackageInterface $package, $path)
  12024. {
  12025. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  12026. }
  12027. }
  12028. <?php
  12029. namespace Composer\Downloader;
  12030. use Composer\Config;
  12031. use Composer\Cache;
  12032. use Composer\EventDispatcher\EventDispatcher;
  12033. use Composer\Package\PackageInterface;
  12034. use Composer\Util\IniHelper;
  12035. use Composer\Util\Platform;
  12036. use Composer\Util\ProcessExecutor;
  12037. use Composer\Util\RemoteFilesystem;
  12038. use Composer\IO\IOInterface;
  12039. use Symfony\Component\Process\ExecutableFinder;
  12040. use ZipArchive;
  12041. class ZipDownloader extends ArchiveDownloader
  12042. {
  12043. protected static $hasSystemUnzip;
  12044. private static $hasZipArchive;
  12045. private static $isWindows;
  12046. protected $process;
  12047. private $zipArchiveObject;
  12048. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12049. {
  12050. $this->process = $process ?: new ProcessExecutor($io);
  12051. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12052. }
  12053. public function download(PackageInterface $package, $path, $output = true)
  12054. {
  12055. if (null === self::$hasSystemUnzip) {
  12056. $finder = new ExecutableFinder;
  12057. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  12058. }
  12059. if (null === self::$hasZipArchive) {
  12060. self::$hasZipArchive = class_exists('ZipArchive');
  12061. }
  12062. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  12063. $iniMessage = IniHelper::getMessage();
  12064. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  12065. throw new \RuntimeException($error);
  12066. }
  12067. if (null === self::$isWindows) {
  12068. self::$isWindows = Platform::isWindows();
  12069. if (!self::$isWindows && !self::$hasSystemUnzip) {
  12070. $this->io->writeError("<warning>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  12071. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.</warning>");
  12072. $this->io->writeError("<warning>Installing 'unzip' may remediate them.</warning>");
  12073. }
  12074. }
  12075. return parent::download($package, $path, $output);
  12076. }
  12077. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  12078. {
  12079. if (!self::$hasZipArchive) {
  12080. $isLastChance = true;
  12081. }
  12082. if (!self::$hasSystemUnzip && !$isLastChance) {
  12083. return $this->extractWithZipArchive($file, $path, true);
  12084. }
  12085. $processError = null;
  12086. $overwrite = $isLastChance ? '-o' : '';
  12087. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  12088. try {
  12089. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12090. return true;
  12091. }
  12092. $processError = new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  12093. } catch (\Exception $e) {
  12094. $processError = $e;
  12095. }
  12096. if ($isLastChance) {
  12097. throw $processError;
  12098. }
  12099. $this->io->writeError(' '.$processError->getMessage());
  12100. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  12101. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  12102. return $this->extractWithZipArchive($file, $path, true);
  12103. }
  12104. protected function extractWithZipArchive($file, $path, $isLastChance)
  12105. {
  12106. if (!self::$hasSystemUnzip) {
  12107. $isLastChance = true;
  12108. }
  12109. if (!self::$hasZipArchive && !$isLastChance) {
  12110. return $this->extractWithSystemUnzip($file, $path, true);
  12111. }
  12112. $processError = null;
  12113. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  12114. try {
  12115. if (true === ($retval = $zipArchive->open($file))) {
  12116. $extractResult = $zipArchive->extractTo($path);
  12117. if (true === $extractResult) {
  12118. $zipArchive->close();
  12119. return true;
  12120. }
  12121. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  12122. } else {
  12123. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  12124. }
  12125. } catch (\ErrorException $e) {
  12126. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  12127. } catch (\Exception $e) {
  12128. $processError = $e;
  12129. }
  12130. if ($isLastChance) {
  12131. throw $processError;
  12132. }
  12133. $this->io->writeError(' '.$processError->getMessage());
  12134. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  12135. return $this->extractWithSystemUnzip($file, $path, true);
  12136. }
  12137. public function extract($file, $path)
  12138. {
  12139. if (self::$isWindows) {
  12140. $this->extractWithZipArchive($file, $path, false);
  12141. } else {
  12142. $this->extractWithSystemUnzip($file, $path, false);
  12143. }
  12144. }
  12145. protected function getErrorMessage($retval, $file)
  12146. {
  12147. switch ($retval) {
  12148. case ZipArchive::ER_EXISTS:
  12149. return sprintf("File '%s' already exists.", $file);
  12150. case ZipArchive::ER_INCONS:
  12151. return sprintf("Zip archive '%s' is inconsistent.", $file);
  12152. case ZipArchive::ER_INVAL:
  12153. return sprintf("Invalid argument (%s)", $file);
  12154. case ZipArchive::ER_MEMORY:
  12155. return sprintf("Malloc failure (%s)", $file);
  12156. case ZipArchive::ER_NOENT:
  12157. return sprintf("No such zip file: '%s'", $file);
  12158. case ZipArchive::ER_NOZIP:
  12159. return sprintf("'%s' is not a zip archive.", $file);
  12160. case ZipArchive::ER_OPEN:
  12161. return sprintf("Can't open zip file: %s", $file);
  12162. case ZipArchive::ER_READ:
  12163. return sprintf("Zip read error (%s)", $file);
  12164. case ZipArchive::ER_SEEK:
  12165. return sprintf("Zip seek error (%s)", $file);
  12166. default:
  12167. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  12168. }
  12169. }
  12170. }
  12171. <?php
  12172. namespace Composer\EventDispatcher;
  12173. class Event
  12174. {
  12175. protected $name;
  12176. protected $args;
  12177. protected $flags;
  12178. private $propagationStopped = false;
  12179. public function __construct($name, array $args = array(), array $flags = array())
  12180. {
  12181. $this->name = $name;
  12182. $this->args = $args;
  12183. $this->flags = $flags;
  12184. }
  12185. public function getName()
  12186. {
  12187. return $this->name;
  12188. }
  12189. public function getArguments()
  12190. {
  12191. return $this->args;
  12192. }
  12193. public function getFlags()
  12194. {
  12195. return $this->flags;
  12196. }
  12197. public function isPropagationStopped()
  12198. {
  12199. return $this->propagationStopped;
  12200. }
  12201. public function stopPropagation()
  12202. {
  12203. $this->propagationStopped = true;
  12204. }
  12205. }
  12206. <?php
  12207. namespace Composer\EventDispatcher;
  12208. use Composer\DependencyResolver\PolicyInterface;
  12209. use Composer\DependencyResolver\Pool;
  12210. use Composer\DependencyResolver\Request;
  12211. use Composer\Installer\InstallerEvent;
  12212. use Composer\IO\IOInterface;
  12213. use Composer\Composer;
  12214. use Composer\DependencyResolver\Operation\OperationInterface;
  12215. use Composer\Repository\CompositeRepository;
  12216. use Composer\Script;
  12217. use Composer\Installer\PackageEvent;
  12218. use Composer\Installer\BinaryInstaller;
  12219. use Composer\Util\ProcessExecutor;
  12220. use Composer\Script\Event as ScriptEvent;
  12221. use Symfony\Component\Process\PhpExecutableFinder;
  12222. class EventDispatcher
  12223. {
  12224. protected $composer;
  12225. protected $io;
  12226. protected $loader;
  12227. protected $process;
  12228. protected $listeners;
  12229. private $eventStack;
  12230. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  12231. {
  12232. $this->composer = $composer;
  12233. $this->io = $io;
  12234. $this->process = $process ?: new ProcessExecutor($io);
  12235. $this->eventStack = array();
  12236. }
  12237. public function dispatch($eventName, Event $event = null)
  12238. {
  12239. if (null === $event) {
  12240. $event = new Event($eventName);
  12241. }
  12242. return $this->doDispatch($event);
  12243. }
  12244. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  12245. {
  12246. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  12247. }
  12248. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  12249. {
  12250. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  12251. }
  12252. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  12253. {
  12254. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  12255. }
  12256. protected function doDispatch(Event $event)
  12257. {
  12258. $pathStr = 'PATH';
  12259. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  12260. $pathStr = 'Path';
  12261. }
  12262. $binDir = $this->composer->getConfig()->get('bin-dir');
  12263. if (is_dir($binDir)) {
  12264. $binDir = realpath($binDir);
  12265. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  12266. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  12267. putenv($pathStr.'='.$_SERVER[$pathStr]);
  12268. }
  12269. }
  12270. $listeners = $this->getListeners($event);
  12271. $this->pushEvent($event);
  12272. $return = 0;
  12273. foreach ($listeners as $callable) {
  12274. if (!is_string($callable)) {
  12275. if (!is_callable($callable)) {
  12276. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  12277. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  12278. }
  12279. $event = $this->checkListenerExpectedEvent($callable, $event);
  12280. $return = false === call_user_func($callable, $event) ? 1 : 0;
  12281. } elseif ($this->isComposerScript($callable)) {
  12282. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  12283. $script = explode(' ', substr($callable, 1));
  12284. $scriptName = $script[0];
  12285. unset($script[0]);
  12286. $args = array_merge($script, $event->getArguments());
  12287. $flags = $event->getFlags();
  12288. if (substr($callable, 0, 10) === '@composer ') {
  12289. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  12290. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12291. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12292. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12293. }
  12294. } else {
  12295. if (!$this->getListeners(new Event($scriptName))) {
  12296. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  12297. }
  12298. try {
  12299. $return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
  12300. } catch (ScriptExecutionException $e) {
  12301. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12302. throw $e;
  12303. }
  12304. }
  12305. } elseif ($this->isPhpScript($callable)) {
  12306. $className = substr($callable, 0, strpos($callable, '::'));
  12307. $methodName = substr($callable, strpos($callable, '::') + 2);
  12308. if (!class_exists($className)) {
  12309. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12310. continue;
  12311. }
  12312. if (!is_callable($callable)) {
  12313. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12314. continue;
  12315. }
  12316. try {
  12317. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  12318. } catch (\Exception $e) {
  12319. $message = "Script %s handling the %s event terminated with an exception";
  12320. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  12321. throw $e;
  12322. }
  12323. } else {
  12324. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  12325. $exec = $callable . ($args === '' ? '' : ' '.$args);
  12326. if ($this->io->isVerbose()) {
  12327. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  12328. } else {
  12329. $this->io->writeError(sprintf('> %s', $exec));
  12330. }
  12331. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  12332. if ($possibleLocalBinaries) {
  12333. foreach ($possibleLocalBinaries as $localExec) {
  12334. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  12335. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  12336. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  12337. break;
  12338. }
  12339. }
  12340. }
  12341. if (substr($exec, 0, 5) === '@php ') {
  12342. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  12343. }
  12344. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12345. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12346. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12347. }
  12348. }
  12349. if ($event->isPropagationStopped()) {
  12350. break;
  12351. }
  12352. }
  12353. $this->popEvent();
  12354. return $return;
  12355. }
  12356. protected function getPhpExecCommand()
  12357. {
  12358. $finder = new PhpExecutableFinder();
  12359. $phpPath = $finder->find(false);
  12360. if (!$phpPath) {
  12361. throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
  12362. }
  12363. $phpArgs = $finder->findArguments();
  12364. $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
  12365. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  12366. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  12367. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  12368. return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  12369. }
  12370. protected function executeEventPhpScript($className, $methodName, Event $event)
  12371. {
  12372. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  12373. if ($this->io->isVerbose()) {
  12374. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  12375. } else {
  12376. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  12377. }
  12378. return $className::$methodName($event);
  12379. }
  12380. protected function checkListenerExpectedEvent($target, Event $event)
  12381. {
  12382. if (in_array($event->getName(), array(
  12383. 'init',
  12384. 'command',
  12385. 'pre-file-download',
  12386. ), true)) {
  12387. return $event;
  12388. }
  12389. try {
  12390. $reflected = new \ReflectionParameter($target, 0);
  12391. } catch (\Exception $e) {
  12392. return $event;
  12393. }
  12394. $typehint = $reflected->getClass();
  12395. if (!$typehint instanceof \ReflectionClass) {
  12396. return $event;
  12397. }
  12398. $expected = $typehint->getName();
  12399. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  12400. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  12401. $event = new \Composer\Script\CommandEvent(
  12402. $event->getName(),
  12403. $event->getComposer(),
  12404. $event->getIO(),
  12405. $event->isDevMode(),
  12406. $event->getArguments()
  12407. );
  12408. }
  12409. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  12410. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  12411. $event = new \Composer\Script\PackageEvent(
  12412. $event->getName(),
  12413. $event->getComposer(),
  12414. $event->getIO(),
  12415. $event->isDevMode(),
  12416. $event->getPolicy(),
  12417. $event->getPool(),
  12418. $event->getInstalledRepo(),
  12419. $event->getRequest(),
  12420. $event->getOperations(),
  12421. $event->getOperation()
  12422. );
  12423. }
  12424. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  12425. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  12426. $event = new \Composer\Script\Event(
  12427. $event->getName(),
  12428. $event->getComposer(),
  12429. $event->getIO(),
  12430. $event->isDevMode(),
  12431. $event->getArguments(),
  12432. $event->getFlags()
  12433. );
  12434. }
  12435. return $event;
  12436. }
  12437. private function serializeCallback($cb)
  12438. {
  12439. if (is_array($cb) && count($cb) === 2) {
  12440. if (is_object($cb[0])) {
  12441. $cb[0] = get_class($cb[0]);
  12442. }
  12443. if (is_string($cb[0]) && is_string($cb[1])) {
  12444. $cb = implode('::', $cb);
  12445. }
  12446. }
  12447. if (is_string($cb)) {
  12448. return $cb;
  12449. }
  12450. return var_export($cb, true);
  12451. }
  12452. public function addListener($eventName, $listener, $priority = 0)
  12453. {
  12454. $this->listeners[$eventName][$priority][] = $listener;
  12455. }
  12456. public function addSubscriber(EventSubscriberInterface $subscriber)
  12457. {
  12458. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  12459. if (is_string($params)) {
  12460. $this->addListener($eventName, array($subscriber, $params));
  12461. } elseif (is_string($params[0])) {
  12462. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  12463. } else {
  12464. foreach ($params as $listener) {
  12465. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  12466. }
  12467. }
  12468. }
  12469. }
  12470. protected function getListeners(Event $event)
  12471. {
  12472. $scriptListeners = $this->getScriptListeners($event);
  12473. if (!isset($this->listeners[$event->getName()][0])) {
  12474. $this->listeners[$event->getName()][0] = array();
  12475. }
  12476. krsort($this->listeners[$event->getName()]);
  12477. $listeners = $this->listeners;
  12478. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  12479. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  12480. }
  12481. public function hasEventListeners(Event $event)
  12482. {
  12483. $listeners = $this->getListeners($event);
  12484. return count($listeners) > 0;
  12485. }
  12486. protected function getScriptListeners(Event $event)
  12487. {
  12488. $package = $this->composer->getPackage();
  12489. $scripts = $package->getScripts();
  12490. if (empty($scripts[$event->getName()])) {
  12491. return array();
  12492. }
  12493. if ($this->loader) {
  12494. $this->loader->unregister();
  12495. }
  12496. $generator = $this->composer->getAutoloadGenerator();
  12497. if ($event instanceof ScriptEvent) {
  12498. $generator->setDevMode($event->isDevMode());
  12499. }
  12500. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  12501. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  12502. $map = $generator->parseAutoloads($packageMap, $package);
  12503. $this->loader = $generator->createLoader($map);
  12504. $this->loader->register();
  12505. return $scripts[$event->getName()];
  12506. }
  12507. protected function isPhpScript($callable)
  12508. {
  12509. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  12510. }
  12511. protected function isComposerScript($callable)
  12512. {
  12513. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5);
  12514. }
  12515. protected function pushEvent(Event $event)
  12516. {
  12517. $eventName = $event->getName();
  12518. if (in_array($eventName, $this->eventStack)) {
  12519. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  12520. }
  12521. return array_push($this->eventStack, $eventName);
  12522. }
  12523. protected function popEvent()
  12524. {
  12525. return array_pop($this->eventStack);
  12526. }
  12527. }
  12528. <?php
  12529. namespace Composer\EventDispatcher;
  12530. interface EventSubscriberInterface
  12531. {
  12532. public static function getSubscribedEvents();
  12533. }
  12534. <?php
  12535. namespace Composer\EventDispatcher;
  12536. class ScriptExecutionException extends \RuntimeException
  12537. {
  12538. }
  12539. <?php
  12540. namespace Composer\Exception;
  12541. class NoSslException extends \RuntimeException
  12542. {
  12543. }
  12544. <?php
  12545. namespace Composer;
  12546. use Composer\Config\JsonConfigSource;
  12547. use Composer\Json\JsonFile;
  12548. use Composer\IO\IOInterface;
  12549. use Composer\Package\Archiver;
  12550. use Composer\Package\Version\VersionGuesser;
  12551. use Composer\Repository\RepositoryManager;
  12552. use Composer\Repository\RepositoryFactory;
  12553. use Composer\Repository\WritableRepositoryInterface;
  12554. use Composer\Util\Filesystem;
  12555. use Composer\Util\Platform;
  12556. use Composer\Util\ProcessExecutor;
  12557. use Composer\Util\RemoteFilesystem;
  12558. use Composer\Util\Silencer;
  12559. use Composer\Plugin\PluginEvents;
  12560. use Composer\EventDispatcher\Event;
  12561. use Seld\JsonLint\DuplicateKeyException;
  12562. use Symfony\Component\Console\Formatter\OutputFormatter;
  12563. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  12564. use Symfony\Component\Console\Output\ConsoleOutput;
  12565. use Composer\EventDispatcher\EventDispatcher;
  12566. use Composer\Autoload\AutoloadGenerator;
  12567. use Composer\Package\Version\VersionParser;
  12568. use Composer\Downloader\TransportException;
  12569. use Seld\JsonLint\JsonParser;
  12570. class Factory
  12571. {
  12572. protected static function getHomeDir()
  12573. {
  12574. $home = getenv('COMPOSER_HOME');
  12575. if ($home) {
  12576. return $home;
  12577. }
  12578. if (Platform::isWindows()) {
  12579. if (!getenv('APPDATA')) {
  12580. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12581. }
  12582. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  12583. }
  12584. $userDir = self::getUserDir();
  12585. if (is_dir($userDir . '/.composer')) {
  12586. return $userDir . '/.composer';
  12587. }
  12588. if (self::useXdg()) {
  12589. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  12590. return $xdgConfig . '/composer';
  12591. }
  12592. return $userDir . '/.composer';
  12593. }
  12594. protected static function getCacheDir($home)
  12595. {
  12596. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  12597. if ($cacheDir) {
  12598. return $cacheDir;
  12599. }
  12600. $homeEnv = getenv('COMPOSER_HOME');
  12601. if ($homeEnv) {
  12602. return $homeEnv . '/cache';
  12603. }
  12604. if (Platform::isWindows()) {
  12605. if ($cacheDir = getenv('LOCALAPPDATA')) {
  12606. $cacheDir .= '/Composer';
  12607. } else {
  12608. $cacheDir = $home . '/cache';
  12609. }
  12610. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  12611. }
  12612. $userDir = self::getUserDir();
  12613. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  12614. return $home . '/cache';
  12615. }
  12616. if (self::useXdg()) {
  12617. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  12618. return $xdgCache . '/composer';
  12619. }
  12620. return $home . '/cache';
  12621. }
  12622. protected static function getDataDir($home)
  12623. {
  12624. $homeEnv = getenv('COMPOSER_HOME');
  12625. if ($homeEnv) {
  12626. return $homeEnv;
  12627. }
  12628. if (Platform::isWindows()) {
  12629. return strtr($home, '\\', '/');
  12630. }
  12631. $userDir = self::getUserDir();
  12632. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  12633. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  12634. return $xdgData . '/composer';
  12635. }
  12636. return $home;
  12637. }
  12638. public static function createConfig(IOInterface $io = null, $cwd = null)
  12639. {
  12640. $cwd = $cwd ?: getcwd();
  12641. $config = new Config(true, $cwd);
  12642. $home = self::getHomeDir();
  12643. $config->merge(array('config' => array(
  12644. 'home' => $home,
  12645. 'cache-dir' => self::getCacheDir($home),
  12646. 'data-dir' => self::getDataDir($home),
  12647. )));
  12648. $file = new JsonFile($config->get('home').'/config.json');
  12649. if ($file->exists()) {
  12650. if ($io && $io->isDebug()) {
  12651. $io->writeError('Loading config file ' . $file->getPath());
  12652. }
  12653. $config->merge($file->read());
  12654. }
  12655. $config->setConfigSource(new JsonConfigSource($file));
  12656. $htaccessProtect = (bool) $config->get('htaccess-protect');
  12657. if ($htaccessProtect) {
  12658. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  12659. foreach ($dirs as $dir) {
  12660. if (!file_exists($dir . '/.htaccess')) {
  12661. if (!is_dir($dir)) {
  12662. Silencer::call('mkdir', $dir, 0777, true);
  12663. }
  12664. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  12665. }
  12666. }
  12667. }
  12668. $file = new JsonFile($config->get('home').'/auth.json');
  12669. if ($file->exists()) {
  12670. if ($io && $io->isDebug()) {
  12671. $io->writeError('Loading config file ' . $file->getPath());
  12672. }
  12673. $config->merge(array('config' => $file->read()));
  12674. }
  12675. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  12676. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  12677. $authData = json_decode($composerAuthEnv, true);
  12678. if (null === $authData) {
  12679. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  12680. }
  12681. if ($io && $io->isDebug()) {
  12682. $io->writeError('Loading auth config from COMPOSER_AUTH');
  12683. }
  12684. $config->merge(array('config' => $authData));
  12685. }
  12686. return $config;
  12687. }
  12688. public static function getComposerFile()
  12689. {
  12690. return trim(getenv('COMPOSER')) ?: './composer.json';
  12691. }
  12692. public static function createAdditionalStyles()
  12693. {
  12694. return array(
  12695. 'highlight' => new OutputFormatterStyle('red'),
  12696. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  12697. );
  12698. }
  12699. public static function createOutput()
  12700. {
  12701. $styles = self::createAdditionalStyles();
  12702. $formatter = new OutputFormatter(false, $styles);
  12703. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  12704. }
  12705. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  12706. {
  12707. return RepositoryFactory::defaultRepos($io, $config, $rm);
  12708. }
  12709. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  12710. {
  12711. $cwd = $cwd ?: getcwd();
  12712. if (null === $localConfig) {
  12713. $localConfig = static::getComposerFile();
  12714. }
  12715. if (is_string($localConfig)) {
  12716. $composerFile = $localConfig;
  12717. $file = new JsonFile($localConfig, null, $io);
  12718. if (!$file->exists()) {
  12719. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  12720. $message = 'Composer could not find a composer.json file in '.$cwd;
  12721. } else {
  12722. $message = 'Composer could not find the config file: '.$localConfig;
  12723. }
  12724. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  12725. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  12726. }
  12727. $file->validateSchema(JsonFile::LAX_SCHEMA);
  12728. $jsonParser = new JsonParser;
  12729. try {
  12730. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  12731. } catch (DuplicateKeyException $e) {
  12732. $details = $e->getDetails();
  12733. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  12734. }
  12735. $localConfig = $file->read();
  12736. }
  12737. $config = static::createConfig($io, $cwd);
  12738. $config->merge($localConfig);
  12739. if (isset($composerFile)) {
  12740. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  12741. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  12742. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  12743. if ($localAuthFile->exists()) {
  12744. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  12745. $config->merge(array('config' => $localAuthFile->read()));
  12746. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  12747. }
  12748. }
  12749. $vendorDir = $config->get('vendor-dir');
  12750. $composer = new Composer();
  12751. $composer->setConfig($config);
  12752. if ($fullLoad) {
  12753. $io->loadConfiguration($config);
  12754. }
  12755. $rfs = self::createRemoteFilesystem($io, $config);
  12756. $dispatcher = new EventDispatcher($composer, $io);
  12757. $composer->setEventDispatcher($dispatcher);
  12758. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  12759. $composer->setRepositoryManager($rm);
  12760. $this->addLocalRepository($io, $rm, $vendorDir);
  12761. if (!$fullLoad && !isset($localConfig['version'])) {
  12762. $localConfig['version'] = '1.0.0';
  12763. }
  12764. $parser = new VersionParser;
  12765. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  12766. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
  12767. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  12768. $composer->setPackage($package);
  12769. $im = $this->createInstallationManager();
  12770. $composer->setInstallationManager($im);
  12771. if ($fullLoad) {
  12772. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  12773. $composer->setDownloadManager($dm);
  12774. $generator = new AutoloadGenerator($dispatcher, $io);
  12775. $composer->setAutoloadGenerator($generator);
  12776. $am = $this->createArchiveManager($config, $dm);
  12777. $composer->setArchiveManager($am);
  12778. }
  12779. $this->createDefaultInstallers($im, $composer, $io);
  12780. if ($fullLoad) {
  12781. $globalComposer = null;
  12782. if (realpath($config->get('home')) !== $cwd) {
  12783. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  12784. }
  12785. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  12786. $composer->setPluginManager($pm);
  12787. $pm->loadInstalledPlugins();
  12788. }
  12789. if ($fullLoad && isset($composerFile)) {
  12790. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  12791. ? substr($composerFile, 0, -4).'lock'
  12792. : $composerFile . '.lock';
  12793. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  12794. $composer->setLocker($locker);
  12795. }
  12796. if ($fullLoad) {
  12797. $initEvent = new Event(PluginEvents::INIT);
  12798. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  12799. if ($rm->getLocalRepository()) {
  12800. $this->purgePackages($rm->getLocalRepository(), $im);
  12801. }
  12802. }
  12803. return $composer;
  12804. }
  12805. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  12806. {
  12807. $factory = new static();
  12808. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  12809. }
  12810. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  12811. {
  12812. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  12813. }
  12814. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  12815. {
  12816. $composer = null;
  12817. try {
  12818. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  12819. } catch (\Exception $e) {
  12820. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  12821. }
  12822. return $composer;
  12823. }
  12824. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  12825. {
  12826. $cache = null;
  12827. if ($config->get('cache-files-ttl') > 0) {
  12828. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  12829. }
  12830. $dm = new Downloader\DownloadManager($io);
  12831. switch ($preferred = $config->get('preferred-install')) {
  12832. case 'dist':
  12833. $dm->setPreferDist(true);
  12834. break;
  12835. case 'source':
  12836. $dm->setPreferSource(true);
  12837. break;
  12838. case 'auto':
  12839. default:
  12840. break;
  12841. }
  12842. if (is_array($preferred)) {
  12843. $dm->setPreferences($preferred);
  12844. }
  12845. $executor = new ProcessExecutor($io);
  12846. $fs = new Filesystem($executor);
  12847. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  12848. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  12849. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  12850. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  12851. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  12852. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12853. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12854. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12855. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12856. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12857. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12858. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12859. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12860. return $dm;
  12861. }
  12862. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  12863. {
  12864. if (null === $dm) {
  12865. $io = new IO\NullIO();
  12866. $io->loadConfiguration($config);
  12867. $dm = $this->createDownloadManager($io, $config);
  12868. }
  12869. $am = new Archiver\ArchiveManager($dm);
  12870. $am->addArchiver(new Archiver\ZipArchiver);
  12871. $am->addArchiver(new Archiver\PharArchiver);
  12872. return $am;
  12873. }
  12874. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  12875. {
  12876. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  12877. }
  12878. protected function createInstallationManager()
  12879. {
  12880. return new Installer\InstallationManager();
  12881. }
  12882. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  12883. {
  12884. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  12885. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  12886. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  12887. $im->addInstaller(new Installer\MetapackageInstaller($io));
  12888. }
  12889. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  12890. {
  12891. foreach ($repo->getPackages() as $package) {
  12892. if (!$im->isPackageInstalled($repo, $package)) {
  12893. $repo->removePackage($package);
  12894. }
  12895. }
  12896. }
  12897. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  12898. {
  12899. $factory = new static();
  12900. return $factory->createComposer($io, $config, $disablePlugins);
  12901. }
  12902. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  12903. {
  12904. static $warned = false;
  12905. $disableTls = false;
  12906. if ($config && $config->get('disable-tls') === true) {
  12907. if (!$warned) {
  12908. $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  12909. }
  12910. $warned = true;
  12911. $disableTls = true;
  12912. } elseif (!extension_loaded('openssl')) {
  12913. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  12914. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  12915. }
  12916. $remoteFilesystemOptions = array();
  12917. if ($disableTls === false) {
  12918. if ($config && $config->get('cafile')) {
  12919. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  12920. }
  12921. if ($config && $config->get('capath')) {
  12922. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  12923. }
  12924. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  12925. }
  12926. try {
  12927. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  12928. } catch (TransportException $e) {
  12929. if (false !== strpos($e->getMessage(), 'cafile')) {
  12930. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  12931. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  12932. if (PHP_VERSION_ID < 50600) {
  12933. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  12934. }
  12935. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  12936. }
  12937. throw $e;
  12938. }
  12939. return $remoteFilesystem;
  12940. }
  12941. private static function useXdg()
  12942. {
  12943. foreach (array_keys($_SERVER) as $key) {
  12944. if (substr($key, 0, 4) === 'XDG_') {
  12945. return true;
  12946. }
  12947. }
  12948. return false;
  12949. }
  12950. private static function getUserDir()
  12951. {
  12952. $home = getenv('HOME');
  12953. if (!$home) {
  12954. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12955. }
  12956. return rtrim(strtr($home, '\\', '/'), '/');
  12957. }
  12958. }
  12959. <?php
  12960. namespace Composer\IO;
  12961. use Composer\Config;
  12962. use Composer\Util\ProcessExecutor;
  12963. use Psr\Log\LoggerInterface;
  12964. use Psr\Log\LogLevel;
  12965. abstract class BaseIO implements IOInterface, LoggerInterface
  12966. {
  12967. protected $authentications = array();
  12968. public function getAuthentications()
  12969. {
  12970. return $this->authentications;
  12971. }
  12972. public function hasAuthentication($repositoryName)
  12973. {
  12974. return isset($this->authentications[$repositoryName]);
  12975. }
  12976. public function getAuthentication($repositoryName)
  12977. {
  12978. if (isset($this->authentications[$repositoryName])) {
  12979. return $this->authentications[$repositoryName];
  12980. }
  12981. return array('username' => null, 'password' => null);
  12982. }
  12983. public function setAuthentication($repositoryName, $username, $password = null)
  12984. {
  12985. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  12986. }
  12987. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  12988. {
  12989. if ($this->hasAuthentication($repositoryName)) {
  12990. $auth = $this->getAuthentication($repositoryName);
  12991. if ($auth['username'] === $username && $auth['password'] === $password) {
  12992. return;
  12993. }
  12994. $this->writeError(
  12995. sprintf(
  12996. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  12997. $repositoryName
  12998. )
  12999. );
  13000. }
  13001. $this->setAuthentication($repositoryName, $username, $password);
  13002. }
  13003. public function loadConfiguration(Config $config)
  13004. {
  13005. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  13006. $githubOauth = $config->get('github-oauth') ?: array();
  13007. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  13008. $gitlabToken = $config->get('gitlab-token') ?: array();
  13009. $httpBasic = $config->get('http-basic') ?: array();
  13010. foreach ($bitbucketOauth as $domain => $cred) {
  13011. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  13012. }
  13013. foreach ($githubOauth as $domain => $token) {
  13014. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  13015. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  13016. }
  13017. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  13018. }
  13019. foreach ($gitlabOauth as $domain => $token) {
  13020. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  13021. }
  13022. foreach ($gitlabToken as $domain => $token) {
  13023. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  13024. }
  13025. foreach ($httpBasic as $domain => $cred) {
  13026. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  13027. }
  13028. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  13029. }
  13030. public function emergency($message, array $context = array())
  13031. {
  13032. return $this->log(LogLevel::EMERGENCY, $message, $context);
  13033. }
  13034. public function alert($message, array $context = array())
  13035. {
  13036. return $this->log(LogLevel::ALERT, $message, $context);
  13037. }
  13038. public function critical($message, array $context = array())
  13039. {
  13040. return $this->log(LogLevel::CRITICAL, $message, $context);
  13041. }
  13042. public function error($message, array $context = array())
  13043. {
  13044. return $this->log(LogLevel::ERROR, $message, $context);
  13045. }
  13046. public function warning($message, array $context = array())
  13047. {
  13048. return $this->log(LogLevel::WARNING, $message, $context);
  13049. }
  13050. public function notice($message, array $context = array())
  13051. {
  13052. return $this->log(LogLevel::NOTICE, $message, $context);
  13053. }
  13054. public function info($message, array $context = array())
  13055. {
  13056. return $this->log(LogLevel::INFO, $message, $context);
  13057. }
  13058. public function debug($message, array $context = array())
  13059. {
  13060. return $this->log(LogLevel::DEBUG, $message, $context);
  13061. }
  13062. public function log($level, $message, array $context = array())
  13063. {
  13064. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  13065. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  13066. } elseif ($level === LogLevel::WARNING) {
  13067. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  13068. } elseif ($level === LogLevel::NOTICE) {
  13069. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  13070. } elseif ($level === LogLevel::INFO) {
  13071. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  13072. } else {
  13073. $this->writeError($message, true, self::DEBUG);
  13074. }
  13075. }
  13076. }
  13077. <?php
  13078. namespace Composer\IO;
  13079. use Symfony\Component\Console\Output\StreamOutput;
  13080. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  13081. use Symfony\Component\Console\Input\StringInput;
  13082. use Symfony\Component\Console\Helper\HelperSet;
  13083. class BufferIO extends ConsoleIO
  13084. {
  13085. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  13086. {
  13087. $input = new StringInput($input);
  13088. $input->setInteractive(false);
  13089. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  13090. parent::__construct($input, $output, new HelperSet(array()));
  13091. }
  13092. public function getOutput()
  13093. {
  13094. fseek($this->output->getStream(), 0);
  13095. $output = stream_get_contents($this->output->getStream());
  13096. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  13097. $pre = strip_tags($matches[1]);
  13098. if (strlen($pre) === strlen($matches[2])) {
  13099. return '';
  13100. }
  13101. return rtrim($matches[1])."\n";
  13102. }, $output);
  13103. return $output;
  13104. }
  13105. }
  13106. <?php
  13107. namespace Composer\IO;
  13108. use Composer\Question\StrictConfirmationQuestion;
  13109. use Symfony\Component\Console\Helper\HelperSet;
  13110. use Symfony\Component\Console\Input\InputInterface;
  13111. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  13112. use Symfony\Component\Console\Output\OutputInterface;
  13113. use Symfony\Component\Console\Question\ChoiceQuestion;
  13114. use Symfony\Component\Console\Question\Question;
  13115. class ConsoleIO extends BaseIO
  13116. {
  13117. protected $input;
  13118. protected $output;
  13119. protected $helperSet;
  13120. protected $lastMessage;
  13121. protected $lastMessageErr;
  13122. private $startTime;
  13123. private $verbosityMap;
  13124. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  13125. {
  13126. $this->input = $input;
  13127. $this->output = $output;
  13128. $this->helperSet = $helperSet;
  13129. $this->verbosityMap = array(
  13130. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  13131. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  13132. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  13133. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  13134. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  13135. );
  13136. }
  13137. public function enableDebugging($startTime)
  13138. {
  13139. $this->startTime = $startTime;
  13140. }
  13141. public function isInteractive()
  13142. {
  13143. return $this->input->isInteractive();
  13144. }
  13145. public function isDecorated()
  13146. {
  13147. return $this->output->isDecorated();
  13148. }
  13149. public function isVerbose()
  13150. {
  13151. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  13152. }
  13153. public function isVeryVerbose()
  13154. {
  13155. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  13156. }
  13157. public function isDebug()
  13158. {
  13159. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  13160. }
  13161. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13162. {
  13163. $this->doWrite($messages, $newline, false, $verbosity);
  13164. }
  13165. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13166. {
  13167. $this->doWrite($messages, $newline, true, $verbosity);
  13168. }
  13169. private function doWrite($messages, $newline, $stderr, $verbosity)
  13170. {
  13171. $sfVerbosity = $this->verbosityMap[$verbosity];
  13172. if ($sfVerbosity > $this->output->getVerbosity()) {
  13173. return;
  13174. }
  13175. if (OutputInterface::VERBOSITY_QUIET === 0) {
  13176. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  13177. }
  13178. if (null !== $this->startTime) {
  13179. $memoryUsage = memory_get_usage() / 1024 / 1024;
  13180. $timeSpent = microtime(true) - $this->startTime;
  13181. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  13182. return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  13183. }, (array) $messages);
  13184. }
  13185. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  13186. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  13187. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  13188. return;
  13189. }
  13190. $this->output->write($messages, $newline, $sfVerbosity);
  13191. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  13192. }
  13193. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13194. {
  13195. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  13196. }
  13197. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13198. {
  13199. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  13200. }
  13201. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  13202. {
  13203. $messages = implode($newline ? "\n" : '', (array) $messages);
  13204. if (!isset($size)) {
  13205. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  13206. }
  13207. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  13208. $this->doWrite($messages, false, $stderr, $verbosity);
  13209. $fill = $size - strlen(strip_tags($messages));
  13210. if ($fill > 0) {
  13211. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  13212. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  13213. }
  13214. if ($newline) {
  13215. $this->doWrite('', true, $stderr, $verbosity);
  13216. }
  13217. if ($stderr) {
  13218. $this->lastMessageErr = $messages;
  13219. } else {
  13220. $this->lastMessage = $messages;
  13221. }
  13222. }
  13223. public function ask($question, $default = null)
  13224. {
  13225. $helper = $this->helperSet->get('question');
  13226. $question = new Question($question, $default);
  13227. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13228. }
  13229. public function askConfirmation($question, $default = true)
  13230. {
  13231. $helper = $this->helperSet->get('question');
  13232. $question = new StrictConfirmationQuestion($question, $default);
  13233. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13234. }
  13235. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  13236. {
  13237. $helper = $this->helperSet->get('question');
  13238. $question = new Question($question, $default);
  13239. $question->setValidator($validator);
  13240. $question->setMaxAttempts($attempts);
  13241. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13242. }
  13243. public function askAndHideAnswer($question)
  13244. {
  13245. $helper = $this->helperSet->get('question');
  13246. $question = new Question($question);
  13247. $question->setHidden(true);
  13248. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13249. }
  13250. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13251. {
  13252. $helper = $this->helperSet->get('question');
  13253. $question = new ChoiceQuestion($question, $choices, $default);
  13254. $question->setMaxAttempts($attempts ?: null);
  13255. $question->setErrorMessage($errorMessage);
  13256. $question->setMultiselect($multiselect);
  13257. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  13258. if (!is_array($result)) {
  13259. return (string) array_search($result, $choices, true);
  13260. }
  13261. $results = array();
  13262. foreach ($choices as $index => $choice) {
  13263. if (in_array($choice, $result, true)) {
  13264. $results[] = (string) $index;
  13265. }
  13266. }
  13267. return $results;
  13268. }
  13269. private function getErrorOutput()
  13270. {
  13271. if ($this->output instanceof ConsoleOutputInterface) {
  13272. return $this->output->getErrorOutput();
  13273. }
  13274. return $this->output;
  13275. }
  13276. }
  13277. <?php
  13278. namespace Composer\IO;
  13279. use Composer\Config;
  13280. interface IOInterface
  13281. {
  13282. const QUIET = 1;
  13283. const NORMAL = 2;
  13284. const VERBOSE = 4;
  13285. const VERY_VERBOSE = 8;
  13286. const DEBUG = 16;
  13287. public function isInteractive();
  13288. public function isVerbose();
  13289. public function isVeryVerbose();
  13290. public function isDebug();
  13291. public function isDecorated();
  13292. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  13293. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  13294. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13295. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13296. public function ask($question, $default = null);
  13297. public function askConfirmation($question, $default = true);
  13298. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  13299. public function askAndHideAnswer($question);
  13300. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  13301. public function getAuthentications();
  13302. public function hasAuthentication($repositoryName);
  13303. public function getAuthentication($repositoryName);
  13304. public function setAuthentication($repositoryName, $username, $password = null);
  13305. public function loadConfiguration(Config $config);
  13306. }
  13307. <?php
  13308. namespace Composer\IO;
  13309. class NullIO extends BaseIO
  13310. {
  13311. public function isInteractive()
  13312. {
  13313. return false;
  13314. }
  13315. public function isVerbose()
  13316. {
  13317. return false;
  13318. }
  13319. public function isVeryVerbose()
  13320. {
  13321. return false;
  13322. }
  13323. public function isDebug()
  13324. {
  13325. return false;
  13326. }
  13327. public function isDecorated()
  13328. {
  13329. return false;
  13330. }
  13331. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13332. {
  13333. }
  13334. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13335. {
  13336. }
  13337. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13338. {
  13339. }
  13340. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13341. {
  13342. }
  13343. public function ask($question, $default = null)
  13344. {
  13345. return $default;
  13346. }
  13347. public function askConfirmation($question, $default = true)
  13348. {
  13349. return $default;
  13350. }
  13351. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  13352. {
  13353. return $default;
  13354. }
  13355. public function askAndHideAnswer($question)
  13356. {
  13357. return null;
  13358. }
  13359. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13360. {
  13361. return $default;
  13362. }
  13363. }
  13364. <?php
  13365. namespace Composer;
  13366. use Composer\Autoload\AutoloadGenerator;
  13367. use Composer\DependencyResolver\DefaultPolicy;
  13368. use Composer\DependencyResolver\Operation\UpdateOperation;
  13369. use Composer\DependencyResolver\Operation\InstallOperation;
  13370. use Composer\DependencyResolver\Operation\UninstallOperation;
  13371. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  13372. use Composer\DependencyResolver\Operation\OperationInterface;
  13373. use Composer\DependencyResolver\PolicyInterface;
  13374. use Composer\DependencyResolver\Pool;
  13375. use Composer\DependencyResolver\Request;
  13376. use Composer\DependencyResolver\Rule;
  13377. use Composer\DependencyResolver\Solver;
  13378. use Composer\DependencyResolver\SolverProblemsException;
  13379. use Composer\Downloader\DownloadManager;
  13380. use Composer\EventDispatcher\EventDispatcher;
  13381. use Composer\Installer\InstallationManager;
  13382. use Composer\Installer\InstallerEvents;
  13383. use Composer\Installer\NoopInstaller;
  13384. use Composer\Installer\SuggestedPackagesReporter;
  13385. use Composer\IO\IOInterface;
  13386. use Composer\Package\AliasPackage;
  13387. use Composer\Package\BasePackage;
  13388. use Composer\Package\CompletePackage;
  13389. use Composer\Package\Link;
  13390. use Composer\Package\Loader\ArrayLoader;
  13391. use Composer\Package\Dumper\ArrayDumper;
  13392. use Composer\Semver\Constraint\Constraint;
  13393. use Composer\Package\Locker;
  13394. use Composer\Package\PackageInterface;
  13395. use Composer\Package\RootPackageInterface;
  13396. use Composer\Repository\CompositeRepository;
  13397. use Composer\Repository\InstalledArrayRepository;
  13398. use Composer\Repository\PlatformRepository;
  13399. use Composer\Repository\RepositoryInterface;
  13400. use Composer\Repository\RepositoryManager;
  13401. use Composer\Repository\WritableRepositoryInterface;
  13402. use Composer\Script\ScriptEvents;
  13403. class Installer
  13404. {
  13405. protected $io;
  13406. protected $config;
  13407. protected $package;
  13408. protected $downloadManager;
  13409. protected $repositoryManager;
  13410. protected $locker;
  13411. protected $installationManager;
  13412. protected $eventDispatcher;
  13413. protected $autoloadGenerator;
  13414. protected $preferSource = false;
  13415. protected $preferDist = false;
  13416. protected $optimizeAutoloader = false;
  13417. protected $classMapAuthoritative = false;
  13418. protected $apcuAutoloader = false;
  13419. protected $devMode = false;
  13420. protected $dryRun = false;
  13421. protected $verbose = false;
  13422. protected $update = false;
  13423. protected $dumpAutoloader = true;
  13424. protected $runScripts = true;
  13425. protected $ignorePlatformReqs = false;
  13426. protected $preferStable = false;
  13427. protected $preferLowest = false;
  13428. protected $skipSuggest = false;
  13429. protected $writeLock = true;
  13430. protected $executeOperations = true;
  13431. protected $updateWhitelist = null;
  13432. protected $whitelistDependencies = false;
  13433. protected $whitelistAllDependencies = false;
  13434. protected $suggestedPackagesReporter;
  13435. protected $additionalInstalledRepository;
  13436. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  13437. {
  13438. $this->io = $io;
  13439. $this->config = $config;
  13440. $this->package = $package;
  13441. $this->downloadManager = $downloadManager;
  13442. $this->repositoryManager = $repositoryManager;
  13443. $this->locker = $locker;
  13444. $this->installationManager = $installationManager;
  13445. $this->eventDispatcher = $eventDispatcher;
  13446. $this->autoloadGenerator = $autoloadGenerator;
  13447. }
  13448. public function run()
  13449. {
  13450. gc_collect_cycles();
  13451. gc_disable();
  13452. if (!$this->update && !$this->locker->isLocked()) {
  13453. $this->update = true;
  13454. }
  13455. if ($this->dryRun) {
  13456. $this->verbose = true;
  13457. $this->runScripts = false;
  13458. $this->executeOperations = false;
  13459. $this->writeLock = false;
  13460. $this->dumpAutoloader = false;
  13461. $this->installationManager->addInstaller(new NoopInstaller);
  13462. $this->mockLocalRepositories($this->repositoryManager);
  13463. }
  13464. if ($this->runScripts) {
  13465. $devMode = (int) $this->devMode;
  13466. putenv("COMPOSER_DEV_MODE=$devMode");
  13467. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  13468. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13469. }
  13470. $this->downloadManager->setPreferSource($this->preferSource);
  13471. $this->downloadManager->setPreferDist($this->preferDist);
  13472. $localRepo = $this->repositoryManager->getLocalRepository();
  13473. if ($this->update) {
  13474. $platformOverrides = $this->config->get('platform') ?: array();
  13475. } else {
  13476. $platformOverrides = $this->locker->getPlatformOverrides();
  13477. }
  13478. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  13479. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13480. $aliases = $this->getRootAliases();
  13481. $this->aliasPlatformPackages($platformRepo, $aliases);
  13482. if (!$this->suggestedPackagesReporter) {
  13483. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  13484. }
  13485. try {
  13486. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  13487. if ($res !== 0) {
  13488. return $res;
  13489. }
  13490. } catch (\Exception $e) {
  13491. if ($this->executeOperations) {
  13492. $this->installationManager->notifyInstalls($this->io);
  13493. }
  13494. throw $e;
  13495. }
  13496. if ($this->executeOperations) {
  13497. $this->installationManager->notifyInstalls($this->io);
  13498. }
  13499. if ($this->devMode && !$this->skipSuggest) {
  13500. $this->suggestedPackagesReporter->output($installedRepo);
  13501. }
  13502. foreach ($localRepo->getPackages() as $package) {
  13503. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  13504. continue;
  13505. }
  13506. $replacement = is_string($package->getReplacementPackage())
  13507. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  13508. : 'No replacement was suggested';
  13509. $this->io->writeError(
  13510. sprintf(
  13511. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  13512. $package->getPrettyName(),
  13513. $replacement
  13514. )
  13515. );
  13516. }
  13517. if ($this->update && $this->writeLock) {
  13518. $localRepo->reload();
  13519. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  13520. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  13521. $updatedLock = $this->locker->setLockData(
  13522. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  13523. $devPackages,
  13524. $platformReqs,
  13525. $platformDevReqs,
  13526. $aliases,
  13527. $this->package->getMinimumStability(),
  13528. $this->package->getStabilityFlags(),
  13529. $this->preferStable || $this->package->getPreferStable(),
  13530. $this->preferLowest,
  13531. $this->config->get('platform') ?: array()
  13532. );
  13533. if ($updatedLock) {
  13534. $this->io->writeError('<info>Writing lock file</info>');
  13535. }
  13536. }
  13537. if ($this->dumpAutoloader) {
  13538. if ($this->optimizeAutoloader) {
  13539. $this->io->writeError('<info>Generating optimized autoload files</info>');
  13540. } else {
  13541. $this->io->writeError('<info>Generating autoload files</info>');
  13542. }
  13543. $this->autoloadGenerator->setDevMode($this->devMode);
  13544. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  13545. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  13546. $this->autoloadGenerator->setRunScripts($this->runScripts);
  13547. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  13548. }
  13549. if ($this->executeOperations) {
  13550. foreach ($localRepo->getPackages() as $package) {
  13551. $this->installationManager->ensureBinariesPresence($package);
  13552. }
  13553. $vendorDir = $this->config->get('vendor-dir');
  13554. if (is_dir($vendorDir)) {
  13555. @touch($vendorDir);
  13556. }
  13557. }
  13558. if ($this->runScripts) {
  13559. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  13560. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13561. }
  13562. if (!defined('HHVM_VERSION')) {
  13563. gc_enable();
  13564. }
  13565. return 0;
  13566. }
  13567. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  13568. {
  13569. $lockedRepository = null;
  13570. $repositories = null;
  13571. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  13572. try {
  13573. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  13574. } catch (\RuntimeException $e) {
  13575. if ($this->package->getDevRequires()) {
  13576. throw $e;
  13577. }
  13578. $lockedRepository = $this->locker->getLockedRepository();
  13579. }
  13580. }
  13581. $this->whitelistUpdateDependencies(
  13582. $lockedRepository ?: $localRepo,
  13583. $this->package->getRequires(),
  13584. $this->package->getDevRequires()
  13585. );
  13586. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  13587. $policy = $this->createPolicy();
  13588. $pool = $this->createPool($this->update ? null : $lockedRepository);
  13589. $pool->addRepository($installedRepo, $aliases);
  13590. if ($this->update) {
  13591. $repositories = $this->repositoryManager->getRepositories();
  13592. foreach ($repositories as $repository) {
  13593. $pool->addRepository($repository, $aliases);
  13594. }
  13595. }
  13596. if ($lockedRepository) {
  13597. $pool->addRepository($lockedRepository, $aliases);
  13598. }
  13599. $request = $this->createRequest($this->package, $platformRepo);
  13600. if ($this->update) {
  13601. $removedUnstablePackages = array();
  13602. foreach ($localRepo->getPackages() as $package) {
  13603. if (
  13604. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  13605. && $this->installationManager->isPackageInstalled($localRepo, $package)
  13606. ) {
  13607. $removedUnstablePackages[$package->getName()] = true;
  13608. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  13609. }
  13610. }
  13611. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  13612. $request->updateAll();
  13613. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13614. foreach ($links as $link) {
  13615. $request->install($link->getTarget(), $link->getConstraint());
  13616. }
  13617. if ($this->updateWhitelist) {
  13618. $currentPackages = $this->getCurrentPackages($installedRepo);
  13619. $candidates = array();
  13620. foreach ($links as $link) {
  13621. $candidates[$link->getTarget()] = true;
  13622. $rootRequires[$link->getTarget()] = $link;
  13623. }
  13624. foreach ($currentPackages as $package) {
  13625. $candidates[$package->getName()] = true;
  13626. }
  13627. foreach ($candidates as $candidate => $dummy) {
  13628. foreach ($currentPackages as $curPackage) {
  13629. if ($curPackage->getName() === $candidate) {
  13630. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  13631. $constraint = new Constraint('=', $curPackage->getVersion());
  13632. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  13633. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  13634. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  13635. $request->install($curPackage->getName(), $constraint);
  13636. }
  13637. break;
  13638. }
  13639. }
  13640. }
  13641. }
  13642. } else {
  13643. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  13644. if (!$this->locker->isFresh()) {
  13645. $this->io->writeError('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.</warning>', true, IOInterface::QUIET);
  13646. }
  13647. foreach ($lockedRepository->getPackages() as $package) {
  13648. $version = $package->getVersion();
  13649. if (isset($aliases[$package->getName()][$version])) {
  13650. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  13651. }
  13652. $constraint = new Constraint('=', $version);
  13653. $constraint->setPrettyString($package->getPrettyVersion());
  13654. $request->install($package->getName(), $constraint);
  13655. }
  13656. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  13657. $request->install($link->getTarget(), $link->getConstraint());
  13658. }
  13659. }
  13660. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  13661. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  13662. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13663. try {
  13664. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  13665. } catch (SolverProblemsException $e) {
  13666. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  13667. $this->io->writeError($e->getMessage());
  13668. if ($this->update && !$this->devMode) {
  13669. $this->io->writeError('<warning>Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.</warning>', true, IOInterface::QUIET);
  13670. }
  13671. return array(max(1, $e->getCode()), array());
  13672. }
  13673. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  13674. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  13675. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  13676. $this->io->writeError("Analyzed ".$solver->getRuleSetSize()." rules to resolve dependencies", true, IOInterface::VERBOSE);
  13677. if (!$operations) {
  13678. $this->io->writeError('Nothing to install or update');
  13679. }
  13680. $operations = $this->movePluginsToFront($operations);
  13681. $operations = $this->moveUninstallsToFront($operations);
  13682. if ($this->update) {
  13683. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  13684. if (!$this->devMode) {
  13685. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  13686. }
  13687. } else {
  13688. $devPackages = null;
  13689. }
  13690. if ($operations) {
  13691. $installs = $updates = $uninstalls = array();
  13692. foreach ($operations as $operation) {
  13693. if ($operation instanceof InstallOperation) {
  13694. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  13695. } elseif ($operation instanceof UpdateOperation) {
  13696. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  13697. } elseif ($operation instanceof UninstallOperation) {
  13698. $uninstalls[] = $operation->getPackage()->getPrettyName();
  13699. }
  13700. }
  13701. $this->io->writeError(sprintf(
  13702. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  13703. count($installs),
  13704. 1 === count($installs) ? '' : 's',
  13705. count($updates),
  13706. 1 === count($updates) ? '' : 's',
  13707. count($uninstalls),
  13708. 1 === count($uninstalls) ? '' : 's'
  13709. ));
  13710. if ($installs) {
  13711. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  13712. }
  13713. if ($updates) {
  13714. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  13715. }
  13716. if ($uninstalls) {
  13717. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  13718. }
  13719. }
  13720. foreach ($operations as $operation) {
  13721. $jobType = $operation->getJobType();
  13722. if ('install' === $jobType) {
  13723. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  13724. }
  13725. if ($this->update) {
  13726. $package = null;
  13727. if ('update' === $jobType) {
  13728. $package = $operation->getTargetPackage();
  13729. } elseif ('install' === $jobType) {
  13730. $package = $operation->getPackage();
  13731. }
  13732. if ($package && $package->isDev()) {
  13733. $references = $this->package->getReferences();
  13734. if (isset($references[$package->getName()])) {
  13735. $this->updateInstallReferences($package, $references[$package->getName()]);
  13736. }
  13737. }
  13738. if ('update' === $jobType) {
  13739. $targetPackage = $operation->getTargetPackage();
  13740. if ($targetPackage->isDev()) {
  13741. $initialPackage = $operation->getInitialPackage();
  13742. if ($targetPackage->getVersion() === $initialPackage->getVersion()
  13743. && (!$targetPackage->getSourceReference() || $targetPackage->getSourceReference() === $initialPackage->getSourceReference())
  13744. && (!$targetPackage->getDistReference() || $targetPackage->getDistReference() === $initialPackage->getDistReference())
  13745. ) {
  13746. $this->io->writeError(' - Skipping update of ' . $targetPackage->getPrettyName() . ' to the same reference-locked version', true, IOInterface::DEBUG);
  13747. $this->io->writeError('', true, IOInterface::DEBUG);
  13748. continue;
  13749. }
  13750. }
  13751. }
  13752. }
  13753. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($jobType);
  13754. if (defined($event) && $this->runScripts) {
  13755. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13756. }
  13757. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  13758. $this->io->writeError(' - ' . $operation);
  13759. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  13760. $this->io->writeError(' - ' . $operation);
  13761. }
  13762. $this->installationManager->execute($localRepo, $operation);
  13763. if ($this->verbose && $this->io->isVeryVerbose() && in_array($jobType, array('install', 'update'))) {
  13764. $reason = $operation->getReason();
  13765. if ($reason instanceof Rule) {
  13766. switch ($reason->getReason()) {
  13767. case Rule::RULE_JOB_INSTALL:
  13768. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  13769. $this->io->writeError('');
  13770. break;
  13771. case Rule::RULE_PACKAGE_REQUIRES:
  13772. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  13773. $this->io->writeError('');
  13774. break;
  13775. }
  13776. }
  13777. }
  13778. if ($this->executeOperations || $this->writeLock) {
  13779. $localRepo->write();
  13780. }
  13781. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($jobType);
  13782. if (defined($event) && $this->runScripts) {
  13783. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13784. }
  13785. }
  13786. if ($this->executeOperations) {
  13787. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  13788. $localRepo->write();
  13789. }
  13790. return array(0, $devPackages);
  13791. }
  13792. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  13793. {
  13794. if (!$this->package->getDevRequires()) {
  13795. return array();
  13796. }
  13797. $tempLocalRepo = clone $localRepo;
  13798. foreach ($operations as $operation) {
  13799. switch ($operation->getJobType()) {
  13800. case 'install':
  13801. case 'markAliasInstalled':
  13802. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  13803. $tempLocalRepo->addPackage(clone $operation->getPackage());
  13804. }
  13805. break;
  13806. case 'uninstall':
  13807. case 'markAliasUninstalled':
  13808. $tempLocalRepo->removePackage($operation->getPackage());
  13809. break;
  13810. case 'update':
  13811. $tempLocalRepo->removePackage($operation->getInitialPackage());
  13812. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  13813. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  13814. }
  13815. break;
  13816. default:
  13817. throw new \LogicException('Unknown type: '.$operation->getJobType());
  13818. }
  13819. }
  13820. $localRepo = new InstalledArrayRepository(array());
  13821. $loader = new ArrayLoader(null, true);
  13822. $dumper = new ArrayDumper();
  13823. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  13824. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  13825. }
  13826. unset($tempLocalRepo, $loader, $dumper);
  13827. $policy = $this->createPolicy();
  13828. $pool = $this->createPool();
  13829. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13830. $pool->addRepository($installedRepo, $aliases);
  13831. $request = $this->createRequest($this->package, $platformRepo);
  13832. $request->updateAll();
  13833. foreach ($this->package->getRequires() as $link) {
  13834. $request->install($link->getTarget(), $link->getConstraint());
  13835. }
  13836. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  13837. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13838. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  13839. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  13840. $devPackages = array();
  13841. foreach ($ops as $op) {
  13842. if ($op->getJobType() === 'uninstall') {
  13843. $devPackages[] = $op->getPackage();
  13844. }
  13845. }
  13846. return $devPackages;
  13847. }
  13848. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  13849. {
  13850. $finalOps = array();
  13851. $packagesToSkip = array();
  13852. foreach ($devPackages as $pkg) {
  13853. $packagesToSkip[$pkg->getName()] = true;
  13854. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  13855. if ($installedDevPkg instanceof AliasPackage) {
  13856. $finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
  13857. $installedDevPkg = $installedDevPkg->getAliasOf();
  13858. }
  13859. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  13860. }
  13861. }
  13862. foreach ($operations as $op) {
  13863. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  13864. if (isset($packagesToSkip[$package->getName()])) {
  13865. continue;
  13866. }
  13867. $finalOps[] = $op;
  13868. }
  13869. return $finalOps;
  13870. }
  13871. private function movePluginsToFront(array $operations)
  13872. {
  13873. $pluginsNoDeps = array();
  13874. $pluginsWithDeps = array();
  13875. $pluginRequires = array();
  13876. foreach (array_reverse($operations, true) as $idx => $op) {
  13877. if ($op instanceof InstallOperation) {
  13878. $package = $op->getPackage();
  13879. } elseif ($op instanceof UpdateOperation) {
  13880. $package = $op->getTargetPackage();
  13881. } else {
  13882. continue;
  13883. }
  13884. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  13885. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  13886. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  13887. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  13888. });
  13889. if ($isPlugin && !count($requires)) {
  13890. array_unshift($pluginsNoDeps, $op);
  13891. } else {
  13892. $pluginRequires = array_merge($pluginRequires, $requires);
  13893. array_unshift($pluginsWithDeps, $op);
  13894. }
  13895. unset($operations[$idx]);
  13896. }
  13897. }
  13898. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  13899. }
  13900. private function moveUninstallsToFront(array $operations)
  13901. {
  13902. $uninstOps = array();
  13903. foreach ($operations as $idx => $op) {
  13904. if ($op instanceof UninstallOperation) {
  13905. $uninstOps[] = $op;
  13906. unset($operations[$idx]);
  13907. }
  13908. }
  13909. return array_merge($uninstOps, $operations);
  13910. }
  13911. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  13912. {
  13913. $installedRootPackage = clone $this->package;
  13914. $installedRootPackage->setRequires(array());
  13915. $installedRootPackage->setDevRequires(array());
  13916. $repos = array(
  13917. $localRepo,
  13918. new InstalledArrayRepository(array($installedRootPackage)),
  13919. $platformRepo,
  13920. );
  13921. $installedRepo = new CompositeRepository($repos);
  13922. if ($this->additionalInstalledRepository) {
  13923. $installedRepo->addRepository($this->additionalInstalledRepository);
  13924. }
  13925. return $installedRepo;
  13926. }
  13927. private function createPool(RepositoryInterface $lockedRepository = null)
  13928. {
  13929. if ($this->update) {
  13930. $minimumStability = $this->package->getMinimumStability();
  13931. $stabilityFlags = $this->package->getStabilityFlags();
  13932. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13933. } else {
  13934. $minimumStability = $this->locker->getMinimumStability();
  13935. $stabilityFlags = $this->locker->getStabilityFlags();
  13936. $requires = array();
  13937. foreach ($lockedRepository->getPackages() as $package) {
  13938. $constraint = new Constraint('=', $package->getVersion());
  13939. $constraint->setPrettyString($package->getPrettyVersion());
  13940. $requires[$package->getName()] = $constraint;
  13941. }
  13942. }
  13943. $rootConstraints = array();
  13944. foreach ($requires as $req => $constraint) {
  13945. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  13946. continue;
  13947. }
  13948. if ($constraint instanceof Link) {
  13949. $rootConstraints[$req] = $constraint->getConstraint();
  13950. } else {
  13951. $rootConstraints[$req] = $constraint;
  13952. }
  13953. }
  13954. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  13955. }
  13956. private function createPolicy()
  13957. {
  13958. $preferStable = null;
  13959. $preferLowest = null;
  13960. if (!$this->update) {
  13961. $preferStable = $this->locker->getPreferStable();
  13962. $preferLowest = $this->locker->getPreferLowest();
  13963. }
  13964. if (null === $preferStable) {
  13965. $preferStable = $this->preferStable || $this->package->getPreferStable();
  13966. }
  13967. if (null === $preferLowest) {
  13968. $preferLowest = $this->preferLowest;
  13969. }
  13970. return new DefaultPolicy($preferStable, $preferLowest);
  13971. }
  13972. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  13973. {
  13974. $request = new Request();
  13975. $constraint = new Constraint('=', $rootPackage->getVersion());
  13976. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  13977. $request->install($rootPackage->getName(), $constraint);
  13978. $fixedPackages = $platformRepo->getPackages();
  13979. if ($this->additionalInstalledRepository) {
  13980. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  13981. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  13982. }
  13983. $provided = $rootPackage->getProvides();
  13984. foreach ($fixedPackages as $package) {
  13985. $constraint = new Constraint('=', $package->getVersion());
  13986. $constraint->setPrettyString($package->getPrettyVersion());
  13987. if ($package->getRepository() !== $platformRepo
  13988. || !isset($provided[$package->getName()])
  13989. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  13990. ) {
  13991. $request->fix($package->getName(), $constraint);
  13992. }
  13993. }
  13994. return $request;
  13995. }
  13996. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  13997. {
  13998. if ($task === 'force-updates' && null === $operations) {
  13999. throw new \InvalidArgumentException('Missing operations argument');
  14000. }
  14001. if ($task === 'force-links') {
  14002. $operations = array();
  14003. }
  14004. if ($this->update && $this->updateWhitelist) {
  14005. $currentPackages = $this->getCurrentPackages($installedRepo);
  14006. }
  14007. foreach ($localRepo->getCanonicalPackages() as $package) {
  14008. if (!$package->isDev()) {
  14009. continue;
  14010. }
  14011. foreach ($operations as $operation) {
  14012. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  14013. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  14014. ) {
  14015. continue 2;
  14016. }
  14017. }
  14018. if ($this->update) {
  14019. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14020. foreach ($currentPackages as $curPackage) {
  14021. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  14022. if ($task === 'force-links') {
  14023. $package->setRequires($curPackage->getRequires());
  14024. $package->setConflicts($curPackage->getConflicts());
  14025. $package->setProvides($curPackage->getProvides());
  14026. $package->setReplaces($curPackage->getReplaces());
  14027. } elseif ($task === 'force-updates') {
  14028. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  14029. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  14030. ) {
  14031. $operations[] = new UpdateOperation($package, $curPackage);
  14032. }
  14033. }
  14034. break;
  14035. }
  14036. }
  14037. continue;
  14038. }
  14039. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14040. foreach ($matches as $index => $match) {
  14041. if (!in_array($match->getRepository(), $repositories, true)) {
  14042. unset($matches[$index]);
  14043. continue;
  14044. }
  14045. if ($match->getName() !== $package->getName()) {
  14046. unset($matches[$index]);
  14047. continue;
  14048. }
  14049. $matches[$index] = $match->getId();
  14050. }
  14051. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14052. $newPackage = $pool->literalToPackage($matches[0]);
  14053. if ($task === 'force-links' && $newPackage) {
  14054. $package->setRequires($newPackage->getRequires());
  14055. $package->setConflicts($newPackage->getConflicts());
  14056. $package->setProvides($newPackage->getProvides());
  14057. $package->setReplaces($newPackage->getReplaces());
  14058. }
  14059. if (
  14060. $task === 'force-updates'
  14061. && $newPackage
  14062. && (
  14063. ($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  14064. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  14065. )
  14066. ) {
  14067. $operations[] = new UpdateOperation($package, $newPackage);
  14068. continue;
  14069. }
  14070. }
  14071. if ($task === 'force-updates') {
  14072. $references = $this->package->getReferences();
  14073. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  14074. $operations[] = new UpdateOperation($package, clone $package);
  14075. }
  14076. }
  14077. } else {
  14078. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  14079. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  14080. if ($task === 'force-links') {
  14081. $package->setRequires($lockedPackage->getRequires());
  14082. $package->setConflicts($lockedPackage->getConflicts());
  14083. $package->setProvides($lockedPackage->getProvides());
  14084. $package->setReplaces($lockedPackage->getReplaces());
  14085. } elseif ($task === 'force-updates') {
  14086. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  14087. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  14088. ) {
  14089. $operations[] = new UpdateOperation($package, $lockedPackage);
  14090. }
  14091. }
  14092. break;
  14093. }
  14094. }
  14095. }
  14096. }
  14097. return $operations;
  14098. }
  14099. private function getCurrentPackages($installedRepo)
  14100. {
  14101. if ($this->locker->isLocked()) {
  14102. try {
  14103. return $this->locker->getLockedRepository(true)->getPackages();
  14104. } catch (\RuntimeException $e) {
  14105. return $this->locker->getLockedRepository()->getPackages();
  14106. }
  14107. }
  14108. return $installedRepo->getPackages();
  14109. }
  14110. private function getRootAliases()
  14111. {
  14112. if ($this->update) {
  14113. $aliases = $this->package->getAliases();
  14114. } else {
  14115. $aliases = $this->locker->getAliases();
  14116. }
  14117. $normalizedAliases = array();
  14118. foreach ($aliases as $alias) {
  14119. $normalizedAliases[$alias['package']][$alias['version']] = array(
  14120. 'alias' => $alias['alias'],
  14121. 'alias_normalized' => $alias['alias_normalized'],
  14122. );
  14123. }
  14124. return $normalizedAliases;
  14125. }
  14126. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  14127. {
  14128. if (!$this->update) {
  14129. return;
  14130. }
  14131. $rootRefs = $this->package->getReferences();
  14132. foreach ($localRepo->getCanonicalPackages() as $package) {
  14133. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14134. foreach ($matches as $index => $match) {
  14135. if (!in_array($match->getRepository(), $repositories, true)) {
  14136. unset($matches[$index]);
  14137. continue;
  14138. }
  14139. if ($match->getName() !== $package->getName()) {
  14140. unset($matches[$index]);
  14141. continue;
  14142. }
  14143. $matches[$index] = $match->getId();
  14144. }
  14145. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14146. $newPackage = $pool->literalToPackage($matches[0]);
  14147. $sourceUrl = $package->getSourceUrl();
  14148. $newSourceUrl = $newPackage->getSourceUrl();
  14149. $newReference = $newPackage->getSourceReference();
  14150. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  14151. $newReference = $rootRefs[$package->getName()];
  14152. }
  14153. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl());
  14154. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  14155. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  14156. }
  14157. $package->setDistMirrors($newPackage->getDistMirrors());
  14158. $package->setSourceMirrors($newPackage->getSourceMirrors());
  14159. }
  14160. }
  14161. }
  14162. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl)
  14163. {
  14164. $oldSourceRef = $package->getSourceReference();
  14165. if ($package->getSourceUrl() !== $sourceUrl) {
  14166. $package->setSourceType($sourceType);
  14167. $package->setSourceUrl($sourceUrl);
  14168. $package->setSourceReference($sourceReference);
  14169. }
  14170. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
  14171. $package->setDistUrl($distUrl);
  14172. $this->updateInstallReferences($package, $sourceReference);
  14173. }
  14174. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14175. $this->updateInstallReferences($package, $oldSourceRef);
  14176. }
  14177. }
  14178. private function updateInstallReferences(PackageInterface $package, $reference)
  14179. {
  14180. if (!$reference) {
  14181. return;
  14182. }
  14183. $package->setSourceReference($reference);
  14184. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  14185. $package->setDistReference($reference);
  14186. $package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  14187. } elseif ($package->getDistReference()) {
  14188. $package->setDistReference($reference);
  14189. }
  14190. }
  14191. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  14192. {
  14193. foreach ($aliases as $package => $versions) {
  14194. foreach ($versions as $version => $alias) {
  14195. $packages = $platformRepo->findPackages($package, $version);
  14196. foreach ($packages as $package) {
  14197. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  14198. $aliasPackage->setRootPackageAlias(true);
  14199. $platformRepo->addPackage($aliasPackage);
  14200. }
  14201. }
  14202. }
  14203. }
  14204. private function isUpdateable(PackageInterface $package)
  14205. {
  14206. if (!$this->updateWhitelist) {
  14207. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  14208. }
  14209. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  14210. $patternRegexp = BasePackage::packageNameToRegexp($whiteListedPattern);
  14211. if (preg_match($patternRegexp, $package->getName())) {
  14212. return true;
  14213. }
  14214. }
  14215. return false;
  14216. }
  14217. private function extractPlatformRequirements($links)
  14218. {
  14219. $platformReqs = array();
  14220. foreach ($links as $link) {
  14221. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  14222. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  14223. }
  14224. }
  14225. return $platformReqs;
  14226. }
  14227. private function whitelistUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  14228. {
  14229. if (!$this->updateWhitelist) {
  14230. return;
  14231. }
  14232. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  14233. $skipPackages = array();
  14234. if (!$this->whitelistAllDependencies) {
  14235. foreach ($rootRequires as $require) {
  14236. $skipPackages[$require->getTarget()] = true;
  14237. }
  14238. }
  14239. $pool = new Pool('dev');
  14240. $pool->addRepository($localOrLockRepo);
  14241. $seen = array();
  14242. $rootRequiredPackageNames = array_keys($rootRequires);
  14243. foreach ($this->updateWhitelist as $packageName => $void) {
  14244. $packageQueue = new \SplQueue;
  14245. $nameMatchesRequiredPackage = false;
  14246. $depPackages = $pool->whatProvides($packageName);
  14247. $matchesByPattern = array();
  14248. if (empty($depPackages)) {
  14249. $whitelistPatternSearchRegexp = BasePackage::packageNameToRegexp($packageName, '^%s$');
  14250. foreach ($localOrLockRepo->search($whitelistPatternSearchRegexp) as $installedPackage) {
  14251. $matchesByPattern[] = $pool->whatProvides($installedPackage['name']);
  14252. }
  14253. $whitelistPatternRegexp = BasePackage::packageNameToRegexp($packageName);
  14254. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  14255. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  14256. $nameMatchesRequiredPackage = true;
  14257. break;
  14258. }
  14259. }
  14260. }
  14261. if (!empty($matchesByPattern)) {
  14262. $depPackages = array_merge($depPackages, call_user_func_array('array_merge', $matchesByPattern));
  14263. }
  14264. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  14265. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  14266. }
  14267. foreach ($depPackages as $depPackage) {
  14268. $packageQueue->enqueue($depPackage);
  14269. }
  14270. while (!$packageQueue->isEmpty()) {
  14271. $package = $packageQueue->dequeue();
  14272. if (isset($seen[$package->getId()])) {
  14273. continue;
  14274. }
  14275. $seen[$package->getId()] = true;
  14276. $this->updateWhitelist[$package->getName()] = true;
  14277. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  14278. continue;
  14279. }
  14280. $requires = $package->getRequires();
  14281. foreach ($requires as $require) {
  14282. $requirePackages = $pool->whatProvides($require->getTarget());
  14283. foreach ($requirePackages as $requirePackage) {
  14284. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  14285. continue;
  14286. }
  14287. if (isset($skipPackages[$requirePackage->getName()]) && !preg_match(BasePackage::packageNameToRegexp($packageName), $requirePackage->getName())) {
  14288. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  14289. continue;
  14290. }
  14291. $packageQueue->enqueue($requirePackage);
  14292. }
  14293. }
  14294. }
  14295. }
  14296. }
  14297. private function mockLocalRepositories(RepositoryManager $rm)
  14298. {
  14299. $packages = array();
  14300. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  14301. $packages[(string) $package] = clone $package;
  14302. }
  14303. foreach ($packages as $key => $package) {
  14304. if ($package instanceof AliasPackage) {
  14305. $alias = (string) $package->getAliasOf();
  14306. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  14307. }
  14308. }
  14309. $rm->setLocalRepository(
  14310. new InstalledArrayRepository($packages)
  14311. );
  14312. }
  14313. public static function create(IOInterface $io, Composer $composer)
  14314. {
  14315. return new static(
  14316. $io,
  14317. $composer->getConfig(),
  14318. $composer->getPackage(),
  14319. $composer->getDownloadManager(),
  14320. $composer->getRepositoryManager(),
  14321. $composer->getLocker(),
  14322. $composer->getInstallationManager(),
  14323. $composer->getEventDispatcher(),
  14324. $composer->getAutoloadGenerator()
  14325. );
  14326. }
  14327. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  14328. {
  14329. $this->additionalInstalledRepository = $additionalInstalledRepository;
  14330. return $this;
  14331. }
  14332. public function setDryRun($dryRun = true)
  14333. {
  14334. $this->dryRun = (bool) $dryRun;
  14335. return $this;
  14336. }
  14337. public function isDryRun()
  14338. {
  14339. return $this->dryRun;
  14340. }
  14341. public function setPreferSource($preferSource = true)
  14342. {
  14343. $this->preferSource = (bool) $preferSource;
  14344. return $this;
  14345. }
  14346. public function setPreferDist($preferDist = true)
  14347. {
  14348. $this->preferDist = (bool) $preferDist;
  14349. return $this;
  14350. }
  14351. public function setOptimizeAutoloader($optimizeAutoloader = false)
  14352. {
  14353. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  14354. if (!$this->optimizeAutoloader) {
  14355. $this->setClassMapAuthoritative(false);
  14356. }
  14357. return $this;
  14358. }
  14359. public function setClassMapAuthoritative($classMapAuthoritative = false)
  14360. {
  14361. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  14362. if ($this->classMapAuthoritative) {
  14363. $this->setOptimizeAutoloader(true);
  14364. }
  14365. return $this;
  14366. }
  14367. public function setApcuAutoloader($apcuAutoloader = false)
  14368. {
  14369. $this->apcuAutoloader = (bool) $apcuAutoloader;
  14370. return $this;
  14371. }
  14372. public function setUpdate($update = true)
  14373. {
  14374. $this->update = (bool) $update;
  14375. return $this;
  14376. }
  14377. public function setDevMode($devMode = true)
  14378. {
  14379. $this->devMode = (bool) $devMode;
  14380. return $this;
  14381. }
  14382. public function setDumpAutoloader($dumpAutoloader = true)
  14383. {
  14384. $this->dumpAutoloader = (bool) $dumpAutoloader;
  14385. return $this;
  14386. }
  14387. public function setRunScripts($runScripts = true)
  14388. {
  14389. $this->runScripts = (bool) $runScripts;
  14390. return $this;
  14391. }
  14392. public function setConfig(Config $config)
  14393. {
  14394. $this->config = $config;
  14395. return $this;
  14396. }
  14397. public function setVerbose($verbose = true)
  14398. {
  14399. $this->verbose = (bool) $verbose;
  14400. return $this;
  14401. }
  14402. public function isVerbose()
  14403. {
  14404. return $this->verbose;
  14405. }
  14406. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  14407. {
  14408. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  14409. return $this;
  14410. }
  14411. public function setUpdateWhitelist(array $packages)
  14412. {
  14413. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  14414. return $this;
  14415. }
  14416. public function setWhitelistDependencies($updateDependencies = true)
  14417. {
  14418. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  14419. }
  14420. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  14421. {
  14422. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  14423. return $this;
  14424. }
  14425. public function setWhitelistAllDependencies($updateAllDependencies = true)
  14426. {
  14427. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  14428. return $this;
  14429. }
  14430. public function setPreferStable($preferStable = true)
  14431. {
  14432. $this->preferStable = (bool) $preferStable;
  14433. return $this;
  14434. }
  14435. public function setPreferLowest($preferLowest = true)
  14436. {
  14437. $this->preferLowest = (bool) $preferLowest;
  14438. return $this;
  14439. }
  14440. public function setWriteLock($writeLock = true)
  14441. {
  14442. $this->writeLock = (bool) $writeLock;
  14443. return $this;
  14444. }
  14445. public function setExecuteOperations($executeOperations = true)
  14446. {
  14447. $this->executeOperations = (bool) $executeOperations;
  14448. return $this;
  14449. }
  14450. public function setSkipSuggest($skipSuggest = true)
  14451. {
  14452. $this->skipSuggest = (bool) $skipSuggest;
  14453. return $this;
  14454. }
  14455. public function disablePlugins()
  14456. {
  14457. $this->installationManager->disablePlugins();
  14458. return $this;
  14459. }
  14460. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  14461. {
  14462. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  14463. return $this;
  14464. }
  14465. }
  14466. <?php
  14467. namespace Composer\Installer;
  14468. use Composer\IO\IOInterface;
  14469. use Composer\Package\PackageInterface;
  14470. use Composer\Util\Filesystem;
  14471. use Composer\Util\Platform;
  14472. use Composer\Util\ProcessExecutor;
  14473. use Composer\Util\Silencer;
  14474. class BinaryInstaller
  14475. {
  14476. protected $binDir;
  14477. protected $binCompat;
  14478. protected $io;
  14479. protected $filesystem;
  14480. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  14481. {
  14482. $this->binDir = $binDir;
  14483. $this->binCompat = $binCompat;
  14484. $this->io = $io;
  14485. $this->filesystem = $filesystem ?: new Filesystem();
  14486. }
  14487. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  14488. {
  14489. $binaries = $this->getBinaries($package);
  14490. if (!$binaries) {
  14491. return;
  14492. }
  14493. foreach ($binaries as $bin) {
  14494. $binPath = $installPath.'/'.$bin;
  14495. if (!file_exists($binPath)) {
  14496. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  14497. continue;
  14498. }
  14499. $binPath = realpath($binPath);
  14500. $this->initializeBinDir();
  14501. $link = $this->binDir.'/'.basename($bin);
  14502. if (file_exists($link)) {
  14503. if (is_link($link)) {
  14504. Silencer::call('chmod', $link, 0777 & ~umask());
  14505. }
  14506. if ($warnOnOverwrite) {
  14507. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  14508. }
  14509. continue;
  14510. }
  14511. if ($this->binCompat === "auto") {
  14512. if (Platform::isWindows()) {
  14513. $this->installFullBinaries($binPath, $link, $bin, $package);
  14514. } else {
  14515. $this->installSymlinkBinaries($binPath, $link);
  14516. }
  14517. } elseif ($this->binCompat === "full") {
  14518. $this->installFullBinaries($binPath, $link, $bin, $package);
  14519. }
  14520. Silencer::call('chmod', $link, 0777 & ~umask());
  14521. }
  14522. }
  14523. public function removeBinaries(PackageInterface $package)
  14524. {
  14525. $this->initializeBinDir();
  14526. $binaries = $this->getBinaries($package);
  14527. if (!$binaries) {
  14528. return;
  14529. }
  14530. foreach ($binaries as $bin) {
  14531. $link = $this->binDir.'/'.basename($bin);
  14532. if (is_link($link) || file_exists($link)) {
  14533. $this->filesystem->unlink($link);
  14534. }
  14535. if (file_exists($link.'.bat')) {
  14536. $this->filesystem->unlink($link.'.bat');
  14537. }
  14538. }
  14539. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  14540. Silencer::call('rmdir', $this->binDir);
  14541. }
  14542. }
  14543. public static function determineBinaryCaller($bin)
  14544. {
  14545. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  14546. return 'call';
  14547. }
  14548. $handle = fopen($bin, 'r');
  14549. $line = fgets($handle);
  14550. fclose($handle);
  14551. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14552. return trim($match[1]);
  14553. }
  14554. return 'php';
  14555. }
  14556. protected function getBinaries(PackageInterface $package)
  14557. {
  14558. return $package->getBinaries();
  14559. }
  14560. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  14561. {
  14562. if ('.bat' !== substr($binPath, -4)) {
  14563. $this->installUnixyProxyBinaries($binPath, $link);
  14564. @chmod($link, 0777 & ~umask());
  14565. $link .= '.bat';
  14566. if (file_exists($link)) {
  14567. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  14568. }
  14569. }
  14570. if (!file_exists($link)) {
  14571. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  14572. }
  14573. }
  14574. protected function installSymlinkBinaries($binPath, $link)
  14575. {
  14576. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  14577. $this->installUnixyProxyBinaries($binPath, $link);
  14578. }
  14579. }
  14580. protected function installUnixyProxyBinaries($binPath, $link)
  14581. {
  14582. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  14583. }
  14584. protected function initializeBinDir()
  14585. {
  14586. $this->filesystem->ensureDirectoryExists($this->binDir);
  14587. $this->binDir = realpath($this->binDir);
  14588. }
  14589. protected function generateWindowsProxyCode($bin, $link)
  14590. {
  14591. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14592. $caller = self::determineBinaryCaller($bin);
  14593. return "@ECHO OFF\r\n".
  14594. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  14595. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  14596. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  14597. }
  14598. protected function generateUnixyProxyCode($bin, $link)
  14599. {
  14600. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14601. $binDir = ProcessExecutor::escape(dirname($binPath));
  14602. $binFile = basename($binPath);
  14603. $proxyCode = <<<PROXY
  14604. #!/usr/bin/env sh
  14605. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  14606. if [ -d /proc/cygdrive ]; then
  14607. case \$(which php) in
  14608. \$(readlink -n /proc/cygdrive)/*)
  14609. # We are in Cygwin using Windows php, so the path must be translated
  14610. dir=\$(cygpath -m "\$dir");
  14611. ;;
  14612. esac
  14613. fi
  14614. "\${dir}/$binFile" "\$@"
  14615. PROXY;
  14616. return $proxyCode;
  14617. }
  14618. }
  14619. <?php
  14620. namespace Composer\Installer;
  14621. use Composer\Package\PackageInterface;
  14622. interface BinaryPresenceInterface
  14623. {
  14624. public function ensureBinariesPresence(PackageInterface $package);
  14625. }
  14626. <?php
  14627. namespace Composer\Installer;
  14628. use Composer\IO\IOInterface;
  14629. use Composer\Package\PackageInterface;
  14630. use Composer\Package\AliasPackage;
  14631. use Composer\Repository\RepositoryInterface;
  14632. use Composer\Repository\InstalledRepositoryInterface;
  14633. use Composer\DependencyResolver\Operation\OperationInterface;
  14634. use Composer\DependencyResolver\Operation\InstallOperation;
  14635. use Composer\DependencyResolver\Operation\UpdateOperation;
  14636. use Composer\DependencyResolver\Operation\UninstallOperation;
  14637. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  14638. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14639. use Composer\Util\StreamContextFactory;
  14640. class InstallationManager
  14641. {
  14642. private $installers = array();
  14643. private $cache = array();
  14644. private $notifiablePackages = array();
  14645. public function reset()
  14646. {
  14647. $this->notifiablePackages = array();
  14648. }
  14649. public function addInstaller(InstallerInterface $installer)
  14650. {
  14651. array_unshift($this->installers, $installer);
  14652. $this->cache = array();
  14653. }
  14654. public function removeInstaller(InstallerInterface $installer)
  14655. {
  14656. if (false !== ($key = array_search($installer, $this->installers, true))) {
  14657. array_splice($this->installers, $key, 1);
  14658. $this->cache = array();
  14659. }
  14660. }
  14661. public function disablePlugins()
  14662. {
  14663. foreach ($this->installers as $i => $installer) {
  14664. if (!$installer instanceof PluginInstaller) {
  14665. continue;
  14666. }
  14667. unset($this->installers[$i]);
  14668. }
  14669. }
  14670. public function getInstaller($type)
  14671. {
  14672. $type = strtolower($type);
  14673. if (isset($this->cache[$type])) {
  14674. return $this->cache[$type];
  14675. }
  14676. foreach ($this->installers as $installer) {
  14677. if ($installer->supports($type)) {
  14678. return $this->cache[$type] = $installer;
  14679. }
  14680. }
  14681. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  14682. }
  14683. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14684. {
  14685. if ($package instanceof AliasPackage) {
  14686. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  14687. }
  14688. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  14689. }
  14690. public function ensureBinariesPresence(PackageInterface $package)
  14691. {
  14692. try {
  14693. $installer = $this->getInstaller($package->getType());
  14694. } catch (\InvalidArgumentException $e) {
  14695. return;
  14696. }
  14697. if ($installer instanceof BinaryPresenceInterface) {
  14698. $installer->ensureBinariesPresence($package);
  14699. }
  14700. }
  14701. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  14702. {
  14703. $method = $operation->getJobType();
  14704. $this->$method($repo, $operation);
  14705. }
  14706. public function install(RepositoryInterface $repo, InstallOperation $operation)
  14707. {
  14708. $package = $operation->getPackage();
  14709. $installer = $this->getInstaller($package->getType());
  14710. $installer->install($repo, $package);
  14711. $this->markForNotification($package);
  14712. }
  14713. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  14714. {
  14715. $initial = $operation->getInitialPackage();
  14716. $target = $operation->getTargetPackage();
  14717. $initialType = $initial->getType();
  14718. $targetType = $target->getType();
  14719. if ($initialType === $targetType) {
  14720. $installer = $this->getInstaller($initialType);
  14721. $installer->update($repo, $initial, $target);
  14722. $this->markForNotification($target);
  14723. } else {
  14724. $this->getInstaller($initialType)->uninstall($repo, $initial);
  14725. $this->getInstaller($targetType)->install($repo, $target);
  14726. }
  14727. }
  14728. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  14729. {
  14730. $package = $operation->getPackage();
  14731. $installer = $this->getInstaller($package->getType());
  14732. $installer->uninstall($repo, $package);
  14733. }
  14734. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  14735. {
  14736. $package = $operation->getPackage();
  14737. if (!$repo->hasPackage($package)) {
  14738. $repo->addPackage(clone $package);
  14739. }
  14740. }
  14741. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  14742. {
  14743. $package = $operation->getPackage();
  14744. $repo->removePackage($package);
  14745. }
  14746. public function getInstallPath(PackageInterface $package)
  14747. {
  14748. $installer = $this->getInstaller($package->getType());
  14749. return $installer->getInstallPath($package);
  14750. }
  14751. public function notifyInstalls(IOInterface $io)
  14752. {
  14753. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  14754. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  14755. if ($io->hasAuthentication($repositoryName)) {
  14756. $auth = $io->getAuthentication($repositoryName);
  14757. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  14758. $authHeader = 'Authorization: Basic '.$authStr;
  14759. }
  14760. if (strpos($repoUrl, '%package%')) {
  14761. foreach ($packages as $package) {
  14762. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  14763. $params = array(
  14764. 'version' => $package->getPrettyVersion(),
  14765. 'version_normalized' => $package->getVersion(),
  14766. );
  14767. $opts = array('http' =>
  14768. array(
  14769. 'method' => 'POST',
  14770. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  14771. 'content' => http_build_query($params, '', '&'),
  14772. 'timeout' => 3,
  14773. ),
  14774. );
  14775. if (isset($authHeader)) {
  14776. $opts['http']['header'][] = $authHeader;
  14777. }
  14778. $context = StreamContextFactory::getContext($url, $opts);
  14779. @file_get_contents($url, false, $context);
  14780. }
  14781. continue;
  14782. }
  14783. $postData = array('downloads' => array());
  14784. foreach ($packages as $package) {
  14785. $postData['downloads'][] = array(
  14786. 'name' => $package->getPrettyName(),
  14787. 'version' => $package->getVersion(),
  14788. );
  14789. }
  14790. $opts = array('http' =>
  14791. array(
  14792. 'method' => 'POST',
  14793. 'header' => array('Content-Type: application/json'),
  14794. 'content' => json_encode($postData),
  14795. 'timeout' => 6,
  14796. ),
  14797. );
  14798. if (isset($authHeader)) {
  14799. $opts['http']['header'][] = $authHeader;
  14800. }
  14801. $context = StreamContextFactory::getContext($repoUrl, $opts);
  14802. @file_get_contents($repoUrl, false, $context);
  14803. }
  14804. $this->reset();
  14805. }
  14806. private function markForNotification(PackageInterface $package)
  14807. {
  14808. if ($package->getNotificationUrl()) {
  14809. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  14810. }
  14811. }
  14812. }
  14813. <?php
  14814. namespace Composer\Installer;
  14815. use Composer\Composer;
  14816. use Composer\DependencyResolver\PolicyInterface;
  14817. use Composer\DependencyResolver\Operation\OperationInterface;
  14818. use Composer\DependencyResolver\Pool;
  14819. use Composer\DependencyResolver\Request;
  14820. use Composer\EventDispatcher\Event;
  14821. use Composer\IO\IOInterface;
  14822. use Composer\Repository\CompositeRepository;
  14823. class InstallerEvent extends Event
  14824. {
  14825. private $composer;
  14826. private $io;
  14827. private $devMode;
  14828. private $policy;
  14829. private $pool;
  14830. private $installedRepo;
  14831. private $request;
  14832. private $operations;
  14833. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  14834. {
  14835. parent::__construct($eventName);
  14836. $this->composer = $composer;
  14837. $this->io = $io;
  14838. $this->devMode = $devMode;
  14839. $this->policy = $policy;
  14840. $this->pool = $pool;
  14841. $this->installedRepo = $installedRepo;
  14842. $this->request = $request;
  14843. $this->operations = $operations;
  14844. }
  14845. public function getComposer()
  14846. {
  14847. return $this->composer;
  14848. }
  14849. public function getIO()
  14850. {
  14851. return $this->io;
  14852. }
  14853. public function isDevMode()
  14854. {
  14855. return $this->devMode;
  14856. }
  14857. public function getPolicy()
  14858. {
  14859. return $this->policy;
  14860. }
  14861. public function getPool()
  14862. {
  14863. return $this->pool;
  14864. }
  14865. public function getInstalledRepo()
  14866. {
  14867. return $this->installedRepo;
  14868. }
  14869. public function getRequest()
  14870. {
  14871. return $this->request;
  14872. }
  14873. public function getOperations()
  14874. {
  14875. return $this->operations;
  14876. }
  14877. }
  14878. <?php
  14879. namespace Composer\Installer;
  14880. class InstallerEvents
  14881. {
  14882. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  14883. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  14884. }
  14885. <?php
  14886. namespace Composer\Installer;
  14887. use Composer\Package\PackageInterface;
  14888. use Composer\Repository\InstalledRepositoryInterface;
  14889. use InvalidArgumentException;
  14890. interface InstallerInterface
  14891. {
  14892. public function supports($packageType);
  14893. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  14894. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  14895. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  14896. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  14897. public function getInstallPath(PackageInterface $package);
  14898. }
  14899. <?php
  14900. namespace Composer\Installer;
  14901. use Composer\Composer;
  14902. use Composer\IO\IOInterface;
  14903. use Composer\Repository\InstalledRepositoryInterface;
  14904. use Composer\Package\PackageInterface;
  14905. use Composer\Util\Filesystem;
  14906. use Composer\Util\Silencer;
  14907. use Composer\Util\Platform;
  14908. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  14909. {
  14910. protected $composer;
  14911. protected $vendorDir;
  14912. protected $binDir;
  14913. protected $downloadManager;
  14914. protected $io;
  14915. protected $type;
  14916. protected $filesystem;
  14917. protected $binCompat;
  14918. protected $binaryInstaller;
  14919. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  14920. {
  14921. $this->composer = $composer;
  14922. $this->downloadManager = $composer->getDownloadManager();
  14923. $this->io = $io;
  14924. $this->type = $type;
  14925. $this->filesystem = $filesystem ?: new Filesystem();
  14926. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  14927. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  14928. }
  14929. public function supports($packageType)
  14930. {
  14931. return $packageType === $this->type || null === $this->type;
  14932. }
  14933. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14934. {
  14935. if (!$repo->hasPackage($package)) {
  14936. return false;
  14937. }
  14938. $installPath = $this->getInstallPath($package);
  14939. if (is_readable($installPath)) {
  14940. return true;
  14941. }
  14942. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  14943. }
  14944. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14945. {
  14946. $this->initializeVendorDir();
  14947. $downloadPath = $this->getInstallPath($package);
  14948. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  14949. $this->binaryInstaller->removeBinaries($package);
  14950. }
  14951. $this->installCode($package);
  14952. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  14953. if (!$repo->hasPackage($package)) {
  14954. $repo->addPackage(clone $package);
  14955. }
  14956. }
  14957. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14958. {
  14959. if (!$repo->hasPackage($initial)) {
  14960. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14961. }
  14962. $this->initializeVendorDir();
  14963. $this->binaryInstaller->removeBinaries($initial);
  14964. $this->updateCode($initial, $target);
  14965. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  14966. $repo->removePackage($initial);
  14967. if (!$repo->hasPackage($target)) {
  14968. $repo->addPackage(clone $target);
  14969. }
  14970. }
  14971. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14972. {
  14973. if (!$repo->hasPackage($package)) {
  14974. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14975. }
  14976. $this->removeCode($package);
  14977. $this->binaryInstaller->removeBinaries($package);
  14978. $repo->removePackage($package);
  14979. $downloadPath = $this->getPackageBasePath($package);
  14980. if (strpos($package->getName(), '/')) {
  14981. $packageVendorDir = dirname($downloadPath);
  14982. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  14983. Silencer::call('rmdir', $packageVendorDir);
  14984. }
  14985. }
  14986. }
  14987. public function getInstallPath(PackageInterface $package)
  14988. {
  14989. $this->initializeVendorDir();
  14990. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  14991. $targetDir = $package->getTargetDir();
  14992. return $basePath . ($targetDir ? '/'.$targetDir : '');
  14993. }
  14994. public function ensureBinariesPresence(PackageInterface $package)
  14995. {
  14996. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  14997. }
  14998. protected function getPackageBasePath(PackageInterface $package)
  14999. {
  15000. $installPath = $this->getInstallPath($package);
  15001. $targetDir = $package->getTargetDir();
  15002. if ($targetDir) {
  15003. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  15004. }
  15005. return $installPath;
  15006. }
  15007. protected function installCode(PackageInterface $package)
  15008. {
  15009. $downloadPath = $this->getInstallPath($package);
  15010. $this->downloadManager->download($package, $downloadPath);
  15011. }
  15012. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  15013. {
  15014. $initialDownloadPath = $this->getInstallPath($initial);
  15015. $targetDownloadPath = $this->getInstallPath($target);
  15016. if ($targetDownloadPath !== $initialDownloadPath) {
  15017. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  15018. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  15019. ) {
  15020. $this->removeCode($initial);
  15021. $this->installCode($target);
  15022. return;
  15023. }
  15024. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  15025. }
  15026. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  15027. }
  15028. protected function removeCode(PackageInterface $package)
  15029. {
  15030. $downloadPath = $this->getPackageBasePath($package);
  15031. $this->downloadManager->remove($package, $downloadPath);
  15032. }
  15033. protected function initializeVendorDir()
  15034. {
  15035. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  15036. $this->vendorDir = realpath($this->vendorDir);
  15037. }
  15038. }
  15039. <?php
  15040. namespace Composer\Installer;
  15041. use Composer\Repository\InstalledRepositoryInterface;
  15042. use Composer\Package\PackageInterface;
  15043. use Composer\Package\Version\VersionParser;
  15044. use Composer\IO\IOInterface;
  15045. class MetapackageInstaller implements InstallerInterface
  15046. {
  15047. private $io;
  15048. public function __construct(IOInterface $io)
  15049. {
  15050. $this->io = $io;
  15051. }
  15052. public function supports($packageType)
  15053. {
  15054. return $packageType === 'metapackage';
  15055. }
  15056. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15057. {
  15058. return $repo->hasPackage($package);
  15059. }
  15060. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15061. {
  15062. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15063. $repo->addPackage(clone $package);
  15064. }
  15065. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15066. {
  15067. if (!$repo->hasPackage($initial)) {
  15068. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15069. }
  15070. $name = $target->getName();
  15071. $from = $initial->getFullPrettyVersion();
  15072. $to = $target->getFullPrettyVersion();
  15073. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  15074. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
  15075. $repo->removePackage($initial);
  15076. $repo->addPackage(clone $target);
  15077. }
  15078. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15079. {
  15080. if (!$repo->hasPackage($package)) {
  15081. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15082. }
  15083. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15084. $repo->removePackage($package);
  15085. }
  15086. public function getInstallPath(PackageInterface $package)
  15087. {
  15088. return '';
  15089. }
  15090. }
  15091. <?php
  15092. namespace Composer\Installer;
  15093. use Composer\Repository\InstalledRepositoryInterface;
  15094. use Composer\Package\PackageInterface;
  15095. class NoopInstaller implements InstallerInterface
  15096. {
  15097. public function supports($packageType)
  15098. {
  15099. return true;
  15100. }
  15101. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15102. {
  15103. return $repo->hasPackage($package);
  15104. }
  15105. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15106. {
  15107. if (!$repo->hasPackage($package)) {
  15108. $repo->addPackage(clone $package);
  15109. }
  15110. }
  15111. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15112. {
  15113. if (!$repo->hasPackage($initial)) {
  15114. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15115. }
  15116. $repo->removePackage($initial);
  15117. if (!$repo->hasPackage($target)) {
  15118. $repo->addPackage(clone $target);
  15119. }
  15120. }
  15121. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15122. {
  15123. if (!$repo->hasPackage($package)) {
  15124. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15125. }
  15126. $repo->removePackage($package);
  15127. }
  15128. public function getInstallPath(PackageInterface $package)
  15129. {
  15130. $targetDir = $package->getTargetDir();
  15131. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  15132. }
  15133. }
  15134. <?php
  15135. namespace Composer\Installer;
  15136. use Composer\Composer;
  15137. use Composer\IO\IOInterface;
  15138. use Composer\DependencyResolver\Operation\OperationInterface;
  15139. use Composer\DependencyResolver\PolicyInterface;
  15140. use Composer\DependencyResolver\Pool;
  15141. use Composer\DependencyResolver\Request;
  15142. use Composer\Repository\CompositeRepository;
  15143. class PackageEvent extends InstallerEvent
  15144. {
  15145. private $operation;
  15146. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  15147. {
  15148. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  15149. $this->operation = $operation;
  15150. }
  15151. public function getOperation()
  15152. {
  15153. return $this->operation;
  15154. }
  15155. }
  15156. <?php
  15157. namespace Composer\Installer;
  15158. class PackageEvents
  15159. {
  15160. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  15161. const POST_PACKAGE_INSTALL = 'post-package-install';
  15162. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  15163. const POST_PACKAGE_UPDATE = 'post-package-update';
  15164. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  15165. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  15166. }
  15167. <?php
  15168. namespace Composer\Installer;
  15169. use Composer\IO\IOInterface;
  15170. use Composer\Package\PackageInterface;
  15171. use Composer\Util\Filesystem;
  15172. use Composer\Util\ProcessExecutor;
  15173. class PearBinaryInstaller extends BinaryInstaller
  15174. {
  15175. private $installer;
  15176. private $vendorDir;
  15177. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  15178. {
  15179. parent::__construct($io, $binDir, $binCompat, $filesystem);
  15180. $this->installer = $installer;
  15181. $this->vendorDir = $vendorDir;
  15182. }
  15183. protected function getBinaries(PackageInterface $package)
  15184. {
  15185. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  15186. $binaries = array();
  15187. if (file_exists($binariesPath)) {
  15188. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  15189. if (!$value->isDir()) {
  15190. $binaries[] = 'bin/'.$fileName;
  15191. }
  15192. }
  15193. }
  15194. return $binaries;
  15195. }
  15196. protected function initializeBinDir()
  15197. {
  15198. parent::initializeBinDir();
  15199. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  15200. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  15201. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  15202. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  15203. }
  15204. protected function generateWindowsProxyCode($bin, $link)
  15205. {
  15206. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15207. if ('.bat' === substr($bin, -4)) {
  15208. $caller = 'call';
  15209. } else {
  15210. $handle = fopen($bin, 'r');
  15211. $line = fgets($handle);
  15212. fclose($handle);
  15213. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  15214. $caller = trim($match[1]);
  15215. } else {
  15216. $caller = 'php';
  15217. }
  15218. if ($caller === 'php') {
  15219. return "@echo off\r\n".
  15220. "pushd .\r\n".
  15221. "cd %~dp0\r\n".
  15222. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  15223. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  15224. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  15225. "popd\r\n".
  15226. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  15227. }
  15228. }
  15229. return "@echo off\r\n".
  15230. "pushd .\r\n".
  15231. "cd %~dp0\r\n".
  15232. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  15233. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  15234. "popd\r\n".
  15235. $caller." \"%BIN_TARGET%\" %*\r\n";
  15236. }
  15237. private function generateWindowsPhpProxyCode()
  15238. {
  15239. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  15240. return
  15241. "@echo off\r\n" .
  15242. "setlocal enabledelayedexpansion\r\n" .
  15243. "set BIN_DIR=%~dp0\r\n" .
  15244. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  15245. "set DIRS=.\r\n" .
  15246. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  15247. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  15248. " set DIRS=!DIRS!;%%~fP\r\n" .
  15249. " )\r\n" .
  15250. ")\r\n" .
  15251. "php.exe -d include_path=!DIRS! %*\r\n";
  15252. }
  15253. private function generateUnixyPhpProxyCode()
  15254. {
  15255. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  15256. return
  15257. "#!/usr/bin/env sh\n".
  15258. "SRC_DIR=`pwd`\n".
  15259. "BIN_DIR=`dirname $0`\n".
  15260. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  15261. "DIRS=\"\"\n".
  15262. "for vendor in \$VENDOR_DIR/*; do\n".
  15263. " if [ -d \"\$vendor\" ]; then\n".
  15264. " for package in \$vendor/*; do\n".
  15265. " if [ -d \"\$package\" ]; then\n".
  15266. " DIRS=\"\${DIRS}:\${package}\"\n".
  15267. " fi\n".
  15268. " done\n".
  15269. " fi\n".
  15270. "done\n".
  15271. "php -d include_path=\".\$DIRS\" $@\n";
  15272. }
  15273. }
  15274. <?php
  15275. namespace Composer\Installer;
  15276. use Composer\IO\IOInterface;
  15277. use Composer\Composer;
  15278. use Composer\Downloader\PearPackageExtractor;
  15279. use Composer\Repository\InstalledRepositoryInterface;
  15280. use Composer\Package\PackageInterface;
  15281. use Composer\Util\Platform;
  15282. use Composer\Util\Filesystem;
  15283. class PearInstaller extends LibraryInstaller
  15284. {
  15285. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  15286. {
  15287. $filesystem = new Filesystem();
  15288. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  15289. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  15290. }
  15291. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15292. {
  15293. $this->uninstall($repo, $initial);
  15294. $this->install($repo, $target);
  15295. }
  15296. protected function installCode(PackageInterface $package)
  15297. {
  15298. parent::installCode($package);
  15299. $isWindows = Platform::isWindows();
  15300. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  15301. if (!$isWindows) {
  15302. $php_bin = '/usr/bin/env ' . $php_bin;
  15303. }
  15304. $installPath = $this->getInstallPath($package);
  15305. $vars = array(
  15306. 'os' => $isWindows ? 'windows' : 'linux',
  15307. 'php_bin' => $php_bin,
  15308. 'pear_php' => $installPath,
  15309. 'php_dir' => $installPath,
  15310. 'bin_dir' => $installPath . '/bin',
  15311. 'data_dir' => $installPath . '/data',
  15312. 'version' => $package->getPrettyVersion(),
  15313. );
  15314. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  15315. $pearExtractor = new PearPackageExtractor($packageArchive);
  15316. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  15317. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  15318. $this->filesystem->unlink($packageArchive);
  15319. }
  15320. }
  15321. <?php
  15322. namespace Composer\Installer;
  15323. use Composer\Composer;
  15324. use Composer\IO\IOInterface;
  15325. use Composer\Repository\InstalledRepositoryInterface;
  15326. use Composer\Package\PackageInterface;
  15327. class PluginInstaller extends LibraryInstaller
  15328. {
  15329. private $installationManager;
  15330. public function __construct(IOInterface $io, Composer $composer)
  15331. {
  15332. parent::__construct($io, $composer, 'composer-plugin');
  15333. $this->installationManager = $composer->getInstallationManager();
  15334. }
  15335. public function supports($packageType)
  15336. {
  15337. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  15338. }
  15339. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15340. {
  15341. $extra = $package->getExtra();
  15342. if (empty($extra['class'])) {
  15343. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15344. }
  15345. parent::install($repo, $package);
  15346. try {
  15347. $this->composer->getPluginManager()->registerPackage($package, true);
  15348. } catch (\Exception $e) {
  15349. $this->io->writeError('Plugin installation failed, rolling back');
  15350. parent::uninstall($repo, $package);
  15351. throw $e;
  15352. }
  15353. }
  15354. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15355. {
  15356. $extra = $target->getExtra();
  15357. if (empty($extra['class'])) {
  15358. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15359. }
  15360. parent::update($repo, $initial, $target);
  15361. $this->composer->getPluginManager()->registerPackage($target, true);
  15362. }
  15363. }
  15364. <?php
  15365. namespace Composer\Installer;
  15366. use Composer\Package\PackageInterface;
  15367. use Composer\Downloader\DownloadManager;
  15368. use Composer\Repository\InstalledRepositoryInterface;
  15369. use Composer\Util\Filesystem;
  15370. class ProjectInstaller implements InstallerInterface
  15371. {
  15372. private $installPath;
  15373. private $downloadManager;
  15374. private $filesystem;
  15375. public function __construct($installPath, DownloadManager $dm)
  15376. {
  15377. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  15378. $this->downloadManager = $dm;
  15379. $this->filesystem = new Filesystem;
  15380. }
  15381. public function supports($packageType)
  15382. {
  15383. return true;
  15384. }
  15385. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15386. {
  15387. return false;
  15388. }
  15389. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15390. {
  15391. $installPath = $this->installPath;
  15392. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  15393. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  15394. }
  15395. if (!is_dir($installPath)) {
  15396. mkdir($installPath, 0777, true);
  15397. }
  15398. $this->downloadManager->download($package, $installPath);
  15399. }
  15400. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15401. {
  15402. throw new \InvalidArgumentException("not supported");
  15403. }
  15404. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15405. {
  15406. throw new \InvalidArgumentException("not supported");
  15407. }
  15408. public function getInstallPath(PackageInterface $package)
  15409. {
  15410. return $this->installPath;
  15411. }
  15412. }
  15413. <?php
  15414. namespace Composer\Installer;
  15415. use Composer\IO\IOInterface;
  15416. use Composer\Package\PackageInterface;
  15417. use Composer\Repository\RepositoryInterface;
  15418. use Symfony\Component\Console\Formatter\OutputFormatter;
  15419. class SuggestedPackagesReporter
  15420. {
  15421. protected $suggestedPackages = array();
  15422. private $io;
  15423. public function __construct(IOInterface $io)
  15424. {
  15425. $this->io = $io;
  15426. }
  15427. public function getPackages()
  15428. {
  15429. return $this->suggestedPackages;
  15430. }
  15431. public function addPackage($source, $target, $reason)
  15432. {
  15433. $this->suggestedPackages[] = array(
  15434. 'source' => $source,
  15435. 'target' => $target,
  15436. 'reason' => $reason,
  15437. );
  15438. return $this;
  15439. }
  15440. public function addSuggestionsFromPackage(PackageInterface $package)
  15441. {
  15442. $source = $package->getPrettyName();
  15443. foreach ($package->getSuggests() as $target => $reason) {
  15444. $this->addPackage(
  15445. $source,
  15446. $target,
  15447. $reason
  15448. );
  15449. }
  15450. return $this;
  15451. }
  15452. public function output(RepositoryInterface $installedRepo = null)
  15453. {
  15454. $suggestedPackages = $this->getPackages();
  15455. $installedPackages = array();
  15456. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  15457. foreach ($installedRepo->getPackages() as $package) {
  15458. $installedPackages = array_merge(
  15459. $installedPackages,
  15460. $package->getNames()
  15461. );
  15462. }
  15463. }
  15464. foreach ($suggestedPackages as $suggestion) {
  15465. if (in_array($suggestion['target'], $installedPackages)) {
  15466. continue;
  15467. }
  15468. $this->io->writeError(sprintf(
  15469. '%s suggests installing %s%s',
  15470. $suggestion['source'],
  15471. $this->escapeOutput($suggestion['target']),
  15472. $this->escapeOutput('' !== $suggestion['reason'] ? ' ('.$suggestion['reason'].')' : '')
  15473. ));
  15474. }
  15475. return $this;
  15476. }
  15477. private function escapeOutput($string)
  15478. {
  15479. return OutputFormatter::escape(
  15480. $this->removeControlCharacters($string)
  15481. );
  15482. }
  15483. private function removeControlCharacters($string)
  15484. {
  15485. return preg_replace(
  15486. '/[[:cntrl:]]/',
  15487. '',
  15488. str_replace("\n", ' ', $string)
  15489. );
  15490. }
  15491. }
  15492. <?php
  15493. namespace Composer\Json;
  15494. use JsonSchema\Validator;
  15495. use Seld\JsonLint\JsonParser;
  15496. use Seld\JsonLint\ParsingException;
  15497. use Composer\Util\RemoteFilesystem;
  15498. use Composer\IO\IOInterface;
  15499. use Composer\Downloader\TransportException;
  15500. class JsonFile
  15501. {
  15502. const LAX_SCHEMA = 1;
  15503. const STRICT_SCHEMA = 2;
  15504. const JSON_UNESCAPED_SLASHES = 64;
  15505. const JSON_PRETTY_PRINT = 128;
  15506. const JSON_UNESCAPED_UNICODE = 256;
  15507. private $path;
  15508. private $rfs;
  15509. private $io;
  15510. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  15511. {
  15512. $this->path = $path;
  15513. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  15514. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  15515. }
  15516. $this->rfs = $rfs;
  15517. $this->io = $io;
  15518. }
  15519. public function getPath()
  15520. {
  15521. return $this->path;
  15522. }
  15523. public function exists()
  15524. {
  15525. return is_file($this->path);
  15526. }
  15527. public function read()
  15528. {
  15529. try {
  15530. if ($this->rfs) {
  15531. $json = $this->rfs->getContents($this->path, $this->path, false);
  15532. } else {
  15533. if ($this->io && $this->io->isDebug()) {
  15534. $this->io->writeError('Reading ' . $this->path);
  15535. }
  15536. $json = file_get_contents($this->path);
  15537. }
  15538. } catch (TransportException $e) {
  15539. throw new \RuntimeException($e->getMessage(), 0, $e);
  15540. } catch (\Exception $e) {
  15541. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  15542. }
  15543. return static::parseJson($json, $this->path);
  15544. }
  15545. public function write(array $hash, $options = 448)
  15546. {
  15547. $dir = dirname($this->path);
  15548. if (!is_dir($dir)) {
  15549. if (file_exists($dir)) {
  15550. throw new \UnexpectedValueException(
  15551. $dir.' exists and is not a directory.'
  15552. );
  15553. }
  15554. if (!@mkdir($dir, 0777, true)) {
  15555. throw new \UnexpectedValueException(
  15556. $dir.' does not exist and could not be created.'
  15557. );
  15558. }
  15559. }
  15560. $retries = 3;
  15561. while ($retries--) {
  15562. try {
  15563. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  15564. break;
  15565. } catch (\Exception $e) {
  15566. if ($retries) {
  15567. usleep(500000);
  15568. continue;
  15569. }
  15570. throw $e;
  15571. }
  15572. }
  15573. }
  15574. public function validateSchema($schema = self::STRICT_SCHEMA)
  15575. {
  15576. $content = file_get_contents($this->path);
  15577. $data = json_decode($content);
  15578. if (null === $data && 'null' !== $content) {
  15579. self::validateSyntax($content, $this->path);
  15580. }
  15581. $schemaFile = __DIR__ . '/../../../res/composer-schema.json';
  15582. if (false === strpos($schemaFile, '://')) {
  15583. $schemaFile = 'file://' . $schemaFile;
  15584. }
  15585. $schemaData = (object) array('$ref' => $schemaFile);
  15586. if ($schema === self::LAX_SCHEMA) {
  15587. $schemaData->additionalProperties = true;
  15588. $schemaData->required = array();
  15589. }
  15590. $validator = new Validator();
  15591. $validator->check($data, $schemaData);
  15592. if (!$validator->isValid()) {
  15593. $errors = array();
  15594. foreach ((array) $validator->getErrors() as $error) {
  15595. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  15596. }
  15597. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  15598. }
  15599. return true;
  15600. }
  15601. public static function encode($data, $options = 448)
  15602. {
  15603. if (PHP_VERSION_ID >= 50400) {
  15604. $json = json_encode($data, $options);
  15605. if (false === $json) {
  15606. self::throwEncodeError(json_last_error());
  15607. }
  15608. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  15609. $json = preg_replace('/\[\s+\]/', '[]', $json);
  15610. $json = preg_replace('/\{\s+\}/', '{}', $json);
  15611. }
  15612. return $json;
  15613. }
  15614. $json = json_encode($data);
  15615. if (false === $json) {
  15616. self::throwEncodeError(json_last_error());
  15617. }
  15618. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  15619. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  15620. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  15621. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  15622. return $json;
  15623. }
  15624. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  15625. }
  15626. private static function throwEncodeError($code)
  15627. {
  15628. switch ($code) {
  15629. case JSON_ERROR_DEPTH:
  15630. $msg = 'Maximum stack depth exceeded';
  15631. break;
  15632. case JSON_ERROR_STATE_MISMATCH:
  15633. $msg = 'Underflow or the modes mismatch';
  15634. break;
  15635. case JSON_ERROR_CTRL_CHAR:
  15636. $msg = 'Unexpected control character found';
  15637. break;
  15638. case JSON_ERROR_UTF8:
  15639. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  15640. break;
  15641. default:
  15642. $msg = 'Unknown error';
  15643. }
  15644. throw new \RuntimeException('JSON encoding failed: '.$msg);
  15645. }
  15646. public static function parseJson($json, $file = null)
  15647. {
  15648. if (null === $json) {
  15649. return;
  15650. }
  15651. $data = json_decode($json, true);
  15652. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  15653. self::validateSyntax($json, $file);
  15654. }
  15655. return $data;
  15656. }
  15657. protected static function validateSyntax($json, $file = null)
  15658. {
  15659. $parser = new JsonParser();
  15660. $result = $parser->lint($json);
  15661. if (null === $result) {
  15662. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  15663. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  15664. }
  15665. return true;
  15666. }
  15667. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  15668. }
  15669. }
  15670. <?php
  15671. namespace Composer\Json;
  15672. class JsonFormatter
  15673. {
  15674. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  15675. {
  15676. $result = '';
  15677. $pos = 0;
  15678. $strLen = strlen($json);
  15679. $indentStr = ' ';
  15680. $newLine = "\n";
  15681. $outOfQuotes = true;
  15682. $buffer = '';
  15683. $noescape = true;
  15684. for ($i = 0; $i < $strLen; $i++) {
  15685. $char = substr($json, $i, 1);
  15686. if ('"' === $char && $noescape) {
  15687. $outOfQuotes = !$outOfQuotes;
  15688. }
  15689. if (!$outOfQuotes) {
  15690. $buffer .= $char;
  15691. $noescape = '\\' === $char ? !$noescape : true;
  15692. continue;
  15693. } elseif ('' !== $buffer) {
  15694. if ($unescapeSlashes) {
  15695. $buffer = str_replace('\\/', '/', $buffer);
  15696. }
  15697. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  15698. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  15699. $l = strlen($match[1]);
  15700. if ($l % 2) {
  15701. $code = hexdec($match[2]);
  15702. if (0xD800 <= $code && 0xDFFF >= $code) {
  15703. return $match[0];
  15704. }
  15705. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  15706. pack('H*', $match[2]),
  15707. 'UTF-8',
  15708. 'UCS-2BE'
  15709. );
  15710. }
  15711. return $match[0];
  15712. }, $buffer);
  15713. }
  15714. $result .= $buffer.$char;
  15715. $buffer = '';
  15716. continue;
  15717. }
  15718. if (':' === $char) {
  15719. $char .= ' ';
  15720. } elseif ('}' === $char || ']' === $char) {
  15721. $pos--;
  15722. $prevChar = substr($json, $i - 1, 1);
  15723. if ('{' !== $prevChar && '[' !== $prevChar) {
  15724. $result .= $newLine;
  15725. for ($j = 0; $j < $pos; $j++) {
  15726. $result .= $indentStr;
  15727. }
  15728. } else {
  15729. $result = rtrim($result);
  15730. }
  15731. }
  15732. $result .= $char;
  15733. if (',' === $char || '{' === $char || '[' === $char) {
  15734. $result .= $newLine;
  15735. if ('{' === $char || '[' === $char) {
  15736. $pos++;
  15737. }
  15738. for ($j = 0; $j < $pos; $j++) {
  15739. $result .= $indentStr;
  15740. }
  15741. }
  15742. }
  15743. return $result;
  15744. }
  15745. }
  15746. <?php
  15747. namespace Composer\Json;
  15748. use Composer\Repository\PlatformRepository;
  15749. class JsonManipulator
  15750. {
  15751. private static $DEFINES = '(?(DEFINE)
  15752. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  15753. (?<boolean> true | false | null )
  15754. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " )
  15755. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  15756. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  15757. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  15758. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  15759. )';
  15760. private $contents;
  15761. private $newline;
  15762. private $indent;
  15763. public function __construct($contents)
  15764. {
  15765. $contents = trim($contents);
  15766. if ($contents === '') {
  15767. $contents = '{}';
  15768. }
  15769. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  15770. throw new \InvalidArgumentException('The json file must be an object ({})');
  15771. }
  15772. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  15773. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  15774. $this->detectIndenting();
  15775. }
  15776. public function getContents()
  15777. {
  15778. return $this->contents . $this->newline;
  15779. }
  15780. public function addLink($type, $package, $constraint, $sortPackages = false)
  15781. {
  15782. $decoded = JsonFile::parseJson($this->contents);
  15783. if (!isset($decoded[$type])) {
  15784. return $this->addMainKey($type, array($package => $constraint));
  15785. }
  15786. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15787. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  15788. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  15789. return false;
  15790. }
  15791. $links = $matches['value'];
  15792. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  15793. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  15794. if ($this->pregMatch($regex, $links, $packageMatches)) {
  15795. $existingPackage = $packageMatches['package'];
  15796. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  15797. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  15798. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  15799. }, $links);
  15800. } else {
  15801. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  15802. $links = preg_replace(
  15803. '{'.preg_quote($match[1]).'$}',
  15804. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  15805. $links
  15806. );
  15807. } else {
  15808. $links = '{' . $this->newline .
  15809. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  15810. $this->indent . '}';
  15811. }
  15812. }
  15813. if (true === $sortPackages) {
  15814. $requirements = json_decode($links, true);
  15815. $this->sortPackages($requirements);
  15816. $links = $this->format($requirements);
  15817. }
  15818. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  15819. return true;
  15820. }
  15821. private function sortPackages(array &$packages = array())
  15822. {
  15823. $prefix = function ($requirement) {
  15824. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  15825. return preg_replace(
  15826. array(
  15827. '/^php/',
  15828. '/^hhvm/',
  15829. '/^ext/',
  15830. '/^lib/',
  15831. '/^\D/',
  15832. ),
  15833. array(
  15834. '0-$0',
  15835. '1-$0',
  15836. '2-$0',
  15837. '3-$0',
  15838. '4-$0',
  15839. ),
  15840. $requirement
  15841. );
  15842. }
  15843. return '5-'.$requirement;
  15844. };
  15845. uksort($packages, function ($a, $b) use ($prefix) {
  15846. return strnatcmp($prefix($a), $prefix($b));
  15847. });
  15848. }
  15849. public function addRepository($name, $config)
  15850. {
  15851. return $this->addSubNode('repositories', $name, $config);
  15852. }
  15853. public function removeRepository($name)
  15854. {
  15855. return $this->removeSubNode('repositories', $name);
  15856. }
  15857. public function addConfigSetting($name, $value)
  15858. {
  15859. return $this->addSubNode('config', $name, $value);
  15860. }
  15861. public function removeConfigSetting($name)
  15862. {
  15863. return $this->removeSubNode('config', $name);
  15864. }
  15865. public function addProperty($name, $value)
  15866. {
  15867. if (substr($name, 0, 6) === 'extra.') {
  15868. return $this->addSubNode('extra', substr($name, 6), $value);
  15869. }
  15870. if (substr($name, 0, 8) === 'scripts.') {
  15871. return $this->addSubNode('scripts', substr($name, 8), $value);
  15872. }
  15873. return $this->addMainKey($name, $value);
  15874. }
  15875. public function removeProperty($name)
  15876. {
  15877. if (substr($name, 0, 6) === 'extra.') {
  15878. return $this->removeSubNode('extra', substr($name, 6));
  15879. }
  15880. if (substr($name, 0, 8) === 'scripts.') {
  15881. return $this->removeSubNode('scripts', substr($name, 8));
  15882. }
  15883. return $this->removeMainKey($name);
  15884. }
  15885. public function addSubNode($mainNode, $name, $value)
  15886. {
  15887. $decoded = JsonFile::parseJson($this->contents);
  15888. $subName = null;
  15889. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  15890. list($name, $subName) = explode('.', $name, 2);
  15891. }
  15892. if (!isset($decoded[$mainNode])) {
  15893. if ($subName !== null) {
  15894. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  15895. } else {
  15896. $this->addMainKey($mainNode, array($name => $value));
  15897. }
  15898. return true;
  15899. }
  15900. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15901. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15902. try {
  15903. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15904. return false;
  15905. }
  15906. } catch (\RuntimeException $e) {
  15907. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15908. return false;
  15909. }
  15910. throw $e;
  15911. }
  15912. $children = $match['content'];
  15913. if (!@json_decode($children)) {
  15914. return false;
  15915. }
  15916. $that = $this;
  15917. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  15918. if ($this->pregMatch($childRegex, $children, $matches)) {
  15919. $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
  15920. if ($subName !== null) {
  15921. $curVal = json_decode($matches['content'], true);
  15922. if (!is_array($curVal)) {
  15923. $curVal = array();
  15924. }
  15925. $curVal[$subName] = $value;
  15926. $value = $curVal;
  15927. }
  15928. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  15929. }, $children);
  15930. } else {
  15931. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  15932. $whitespace = '';
  15933. if (!empty($match['trailingspace'])) {
  15934. $whitespace = $match['trailingspace'];
  15935. }
  15936. if (!empty($match['content'])) {
  15937. if ($subName !== null) {
  15938. $value = array($subName => $value);
  15939. }
  15940. $children = preg_replace(
  15941. '#'.$whitespace.'}$#',
  15942. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  15943. $children
  15944. );
  15945. } else {
  15946. if ($subName !== null) {
  15947. $value = array($subName => $value);
  15948. }
  15949. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  15950. }
  15951. }
  15952. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  15953. return $m['start'] . $children . $m['end'];
  15954. }, $this->contents);
  15955. return true;
  15956. }
  15957. public function removeSubNode($mainNode, $name)
  15958. {
  15959. $decoded = JsonFile::parseJson($this->contents);
  15960. if (empty($decoded[$mainNode])) {
  15961. return true;
  15962. }
  15963. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15964. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15965. try {
  15966. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15967. return false;
  15968. }
  15969. } catch (\RuntimeException $e) {
  15970. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15971. return false;
  15972. }
  15973. throw $e;
  15974. }
  15975. $children = $match['content'];
  15976. if (!@json_decode($children, true)) {
  15977. return false;
  15978. }
  15979. $subName = null;
  15980. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  15981. list($name, $subName) = explode('.', $name, 2);
  15982. }
  15983. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  15984. return true;
  15985. }
  15986. if ($this->pregMatch('{"'.preg_quote($name).'"\s*:}i', $children)) {
  15987. if (preg_match_all('{'.self::$DEFINES.'"'.preg_quote($name).'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  15988. $bestMatch = '';
  15989. foreach ($matches[0] as $match) {
  15990. if (strlen($bestMatch) < strlen($match)) {
  15991. $bestMatch = $match;
  15992. }
  15993. }
  15994. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  15995. if (1 !== $count) {
  15996. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  15997. if (1 !== $count) {
  15998. return false;
  15999. }
  16000. }
  16001. }
  16002. } else {
  16003. $childrenClean = $children;
  16004. }
  16005. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  16006. if (empty($match['content'])) {
  16007. $newline = $this->newline;
  16008. $indent = $this->indent;
  16009. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  16010. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  16011. }, $this->contents);
  16012. if ($subName !== null) {
  16013. $curVal = json_decode($children, true);
  16014. unset($curVal[$name][$subName]);
  16015. $this->addSubNode($mainNode, $name, $curVal[$name]);
  16016. }
  16017. return true;
  16018. }
  16019. $that = $this;
  16020. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  16021. if ($subName !== null) {
  16022. $curVal = json_decode($matches['content'], true);
  16023. unset($curVal[$name][$subName]);
  16024. $childrenClean = $that->format($curVal, 0);
  16025. }
  16026. return $matches['start'] . $childrenClean . $matches['end'];
  16027. }, $this->contents);
  16028. return true;
  16029. }
  16030. public function addMainKey($key, $content)
  16031. {
  16032. $decoded = JsonFile::parseJson($this->contents);
  16033. $content = $this->format($content);
  16034. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16035. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  16036. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  16037. if (!@json_decode('{'.$matches['key'].'}')) {
  16038. return false;
  16039. }
  16040. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  16041. return true;
  16042. }
  16043. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  16044. $this->contents = preg_replace(
  16045. '#'.$match[1].'\}$#',
  16046. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  16047. $this->contents
  16048. );
  16049. return true;
  16050. }
  16051. $this->contents = preg_replace(
  16052. '#\}$#',
  16053. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  16054. $this->contents
  16055. );
  16056. return true;
  16057. }
  16058. public function removeMainKey($key)
  16059. {
  16060. $decoded = JsonFile::parseJson($this->contents);
  16061. if (!array_key_exists($key, $decoded)) {
  16062. return true;
  16063. }
  16064. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16065. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  16066. if ($this->pregMatch($regex, $this->contents, $matches)) {
  16067. if (!@json_decode('{'.$matches['removal'].'}')) {
  16068. return false;
  16069. }
  16070. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  16071. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  16072. }
  16073. $this->contents = $matches['start'] . $matches['end'];
  16074. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  16075. $this->contents = "{\n}";
  16076. }
  16077. return true;
  16078. }
  16079. return false;
  16080. }
  16081. public function format($data, $depth = 0)
  16082. {
  16083. if (is_array($data)) {
  16084. reset($data);
  16085. if (is_numeric(key($data))) {
  16086. foreach ($data as $key => $val) {
  16087. $data[$key] = $this->format($val, $depth + 1);
  16088. }
  16089. return '['.implode(', ', $data).']';
  16090. }
  16091. $out = '{' . $this->newline;
  16092. $elems = array();
  16093. foreach ($data as $key => $val) {
  16094. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  16095. }
  16096. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  16097. }
  16098. return JsonFile::encode($data);
  16099. }
  16100. protected function detectIndenting()
  16101. {
  16102. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  16103. $this->indent = $match[1];
  16104. } else {
  16105. $this->indent = ' ';
  16106. }
  16107. }
  16108. protected function pregMatch($re, $str, &$matches = array())
  16109. {
  16110. $count = preg_match($re, $str, $matches);
  16111. if ($count === false) {
  16112. switch (preg_last_error()) {
  16113. case PREG_NO_ERROR:
  16114. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  16115. case PREG_INTERNAL_ERROR:
  16116. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  16117. case PREG_BACKTRACK_LIMIT_ERROR:
  16118. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  16119. case PREG_RECURSION_LIMIT_ERROR:
  16120. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  16121. case PREG_BAD_UTF8_ERROR:
  16122. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  16123. case PREG_BAD_UTF8_OFFSET_ERROR:
  16124. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  16125. case 6:
  16126. if (PHP_VERSION_ID > 70000) {
  16127. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  16128. }
  16129. default:
  16130. throw new \RuntimeException('Failed to execute regex: Unknown error');
  16131. }
  16132. }
  16133. return $count;
  16134. }
  16135. }
  16136. <?php
  16137. namespace Composer\Json;
  16138. use Exception;
  16139. class JsonValidationException extends Exception
  16140. {
  16141. protected $errors;
  16142. public function __construct($message, $errors = array(), Exception $previous = null)
  16143. {
  16144. $this->errors = $errors;
  16145. parent::__construct($message, 0, $previous);
  16146. }
  16147. public function getErrors()
  16148. {
  16149. return $this->errors;
  16150. }
  16151. }
  16152. <?php
  16153. namespace Composer\Package;
  16154. use Composer\Semver\Constraint\Constraint;
  16155. use Composer\Package\Version\VersionParser;
  16156. class AliasPackage extends BasePackage implements CompletePackageInterface
  16157. {
  16158. protected $version;
  16159. protected $prettyVersion;
  16160. protected $dev;
  16161. protected $rootPackageAlias = false;
  16162. protected $stability;
  16163. protected $aliasOf;
  16164. protected $requires;
  16165. protected $devRequires;
  16166. protected $conflicts;
  16167. protected $provides;
  16168. protected $replaces;
  16169. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  16170. {
  16171. parent::__construct($aliasOf->getName());
  16172. $this->version = $version;
  16173. $this->prettyVersion = $prettyVersion;
  16174. $this->aliasOf = $aliasOf;
  16175. $this->stability = VersionParser::parseStability($version);
  16176. $this->dev = $this->stability === 'dev';
  16177. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  16178. $links = $aliasOf->{'get' . ucfirst($type)}();
  16179. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  16180. }
  16181. }
  16182. public function getAliasOf()
  16183. {
  16184. return $this->aliasOf;
  16185. }
  16186. public function getVersion()
  16187. {
  16188. return $this->version;
  16189. }
  16190. public function getStability()
  16191. {
  16192. return $this->stability;
  16193. }
  16194. public function getPrettyVersion()
  16195. {
  16196. return $this->prettyVersion;
  16197. }
  16198. public function isDev()
  16199. {
  16200. return $this->dev;
  16201. }
  16202. public function getRequires()
  16203. {
  16204. return $this->requires;
  16205. }
  16206. public function getConflicts()
  16207. {
  16208. return $this->conflicts;
  16209. }
  16210. public function getProvides()
  16211. {
  16212. return $this->provides;
  16213. }
  16214. public function getReplaces()
  16215. {
  16216. return $this->replaces;
  16217. }
  16218. public function getDevRequires()
  16219. {
  16220. return $this->devRequires;
  16221. }
  16222. public function setRootPackageAlias($value)
  16223. {
  16224. return $this->rootPackageAlias = $value;
  16225. }
  16226. public function isRootPackageAlias()
  16227. {
  16228. return $this->rootPackageAlias;
  16229. }
  16230. protected function replaceSelfVersionDependencies(array $links, $linkType)
  16231. {
  16232. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  16233. $newLinks = array();
  16234. foreach ($links as $link) {
  16235. if ('self.version' === $link->getPrettyConstraint()) {
  16236. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  16237. }
  16238. }
  16239. $links = array_merge($links, $newLinks);
  16240. } else {
  16241. foreach ($links as $index => $link) {
  16242. if ('self.version' === $link->getPrettyConstraint()) {
  16243. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  16244. }
  16245. }
  16246. }
  16247. return $links;
  16248. }
  16249. public function getType()
  16250. {
  16251. return $this->aliasOf->getType();
  16252. }
  16253. public function getTargetDir()
  16254. {
  16255. return $this->aliasOf->getTargetDir();
  16256. }
  16257. public function getExtra()
  16258. {
  16259. return $this->aliasOf->getExtra();
  16260. }
  16261. public function setInstallationSource($type)
  16262. {
  16263. $this->aliasOf->setInstallationSource($type);
  16264. }
  16265. public function getInstallationSource()
  16266. {
  16267. return $this->aliasOf->getInstallationSource();
  16268. }
  16269. public function getSourceType()
  16270. {
  16271. return $this->aliasOf->getSourceType();
  16272. }
  16273. public function getSourceUrl()
  16274. {
  16275. return $this->aliasOf->getSourceUrl();
  16276. }
  16277. public function getSourceUrls()
  16278. {
  16279. return $this->aliasOf->getSourceUrls();
  16280. }
  16281. public function getSourceReference()
  16282. {
  16283. return $this->aliasOf->getSourceReference();
  16284. }
  16285. public function setSourceReference($reference)
  16286. {
  16287. return $this->aliasOf->setSourceReference($reference);
  16288. }
  16289. public function setSourceMirrors($mirrors)
  16290. {
  16291. return $this->aliasOf->setSourceMirrors($mirrors);
  16292. }
  16293. public function getSourceMirrors()
  16294. {
  16295. return $this->aliasOf->getSourceMirrors();
  16296. }
  16297. public function getDistType()
  16298. {
  16299. return $this->aliasOf->getDistType();
  16300. }
  16301. public function getDistUrl()
  16302. {
  16303. return $this->aliasOf->getDistUrl();
  16304. }
  16305. public function getDistUrls()
  16306. {
  16307. return $this->aliasOf->getDistUrls();
  16308. }
  16309. public function getDistReference()
  16310. {
  16311. return $this->aliasOf->getDistReference();
  16312. }
  16313. public function setDistReference($reference)
  16314. {
  16315. return $this->aliasOf->setDistReference($reference);
  16316. }
  16317. public function getDistSha1Checksum()
  16318. {
  16319. return $this->aliasOf->getDistSha1Checksum();
  16320. }
  16321. public function setTransportOptions(array $options)
  16322. {
  16323. return $this->aliasOf->setTransportOptions($options);
  16324. }
  16325. public function getTransportOptions()
  16326. {
  16327. return $this->aliasOf->getTransportOptions();
  16328. }
  16329. public function setDistMirrors($mirrors)
  16330. {
  16331. return $this->aliasOf->setDistMirrors($mirrors);
  16332. }
  16333. public function getDistMirrors()
  16334. {
  16335. return $this->aliasOf->getDistMirrors();
  16336. }
  16337. public function getScripts()
  16338. {
  16339. return $this->aliasOf->getScripts();
  16340. }
  16341. public function getLicense()
  16342. {
  16343. return $this->aliasOf->getLicense();
  16344. }
  16345. public function getAutoload()
  16346. {
  16347. return $this->aliasOf->getAutoload();
  16348. }
  16349. public function getDevAutoload()
  16350. {
  16351. return $this->aliasOf->getDevAutoload();
  16352. }
  16353. public function getIncludePaths()
  16354. {
  16355. return $this->aliasOf->getIncludePaths();
  16356. }
  16357. public function getRepositories()
  16358. {
  16359. return $this->aliasOf->getRepositories();
  16360. }
  16361. public function getReleaseDate()
  16362. {
  16363. return $this->aliasOf->getReleaseDate();
  16364. }
  16365. public function getBinaries()
  16366. {
  16367. return $this->aliasOf->getBinaries();
  16368. }
  16369. public function getKeywords()
  16370. {
  16371. return $this->aliasOf->getKeywords();
  16372. }
  16373. public function getDescription()
  16374. {
  16375. return $this->aliasOf->getDescription();
  16376. }
  16377. public function getHomepage()
  16378. {
  16379. return $this->aliasOf->getHomepage();
  16380. }
  16381. public function getSuggests()
  16382. {
  16383. return $this->aliasOf->getSuggests();
  16384. }
  16385. public function getAuthors()
  16386. {
  16387. return $this->aliasOf->getAuthors();
  16388. }
  16389. public function getSupport()
  16390. {
  16391. return $this->aliasOf->getSupport();
  16392. }
  16393. public function getNotificationUrl()
  16394. {
  16395. return $this->aliasOf->getNotificationUrl();
  16396. }
  16397. public function getArchiveExcludes()
  16398. {
  16399. return $this->aliasOf->getArchiveExcludes();
  16400. }
  16401. public function isAbandoned()
  16402. {
  16403. return $this->aliasOf->isAbandoned();
  16404. }
  16405. public function getReplacementPackage()
  16406. {
  16407. return $this->aliasOf->getReplacementPackage();
  16408. }
  16409. public function __toString()
  16410. {
  16411. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  16412. }
  16413. }
  16414. <?php
  16415. namespace Composer\Package\Archiver;
  16416. use FilterIterator;
  16417. use PharData;
  16418. class ArchivableFilesFilter extends FilterIterator
  16419. {
  16420. private $dirs = array();
  16421. public function accept()
  16422. {
  16423. $file = $this->getInnerIterator()->current();
  16424. if ($file->isDir()) {
  16425. $this->dirs[] = (string) $file;
  16426. return false;
  16427. }
  16428. return true;
  16429. }
  16430. public function addEmptyDir(PharData $phar, $sources)
  16431. {
  16432. foreach ($this->dirs as $filepath) {
  16433. $localname = str_replace($sources . "/", '', $filepath);
  16434. $phar->addEmptyDir($localname);
  16435. }
  16436. }
  16437. }
  16438. <?php
  16439. namespace Composer\Package\Archiver;
  16440. use Composer\Util\Filesystem;
  16441. use FilesystemIterator;
  16442. use Symfony\Component\Finder\Finder;
  16443. use Symfony\Component\Finder\SplFileInfo;
  16444. class ArchivableFilesFinder extends \FilterIterator
  16445. {
  16446. protected $finder;
  16447. public function __construct($sources, array $excludes, $ignoreFilters = false)
  16448. {
  16449. $fs = new Filesystem();
  16450. $sources = $fs->normalizePath($sources);
  16451. if ($ignoreFilters) {
  16452. $filters = array();
  16453. } else {
  16454. $filters = array(
  16455. new HgExcludeFilter($sources),
  16456. new GitExcludeFilter($sources),
  16457. new ComposerExcludeFilter($sources, $excludes),
  16458. );
  16459. }
  16460. $this->finder = new Finder();
  16461. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  16462. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  16463. return false;
  16464. }
  16465. $relativePath = preg_replace(
  16466. '#^'.preg_quote($sources, '#').'#',
  16467. '',
  16468. $fs->normalizePath($file->getRealPath())
  16469. );
  16470. $exclude = false;
  16471. foreach ($filters as $filter) {
  16472. $exclude = $filter->filter($relativePath, $exclude);
  16473. }
  16474. return !$exclude;
  16475. };
  16476. if (method_exists($filter, 'bindTo')) {
  16477. $filter = $filter->bindTo(null);
  16478. }
  16479. $this->finder
  16480. ->in($sources)
  16481. ->filter($filter)
  16482. ->ignoreVCS(true)
  16483. ->ignoreDotFiles(false);
  16484. parent::__construct($this->finder->getIterator());
  16485. }
  16486. public function accept()
  16487. {
  16488. $current = $this->getInnerIterator()->current();
  16489. if (!$current->isDir()) {
  16490. return true;
  16491. }
  16492. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  16493. return !$iterator->valid();
  16494. }
  16495. }
  16496. <?php
  16497. namespace Composer\Package\Archiver;
  16498. use Composer\Downloader\DownloadManager;
  16499. use Composer\Package\PackageInterface;
  16500. use Composer\Package\RootPackageInterface;
  16501. use Composer\Util\Filesystem;
  16502. use Composer\Json\JsonFile;
  16503. class ArchiveManager
  16504. {
  16505. protected $downloadManager;
  16506. protected $archivers = array();
  16507. protected $overwriteFiles = true;
  16508. public function __construct(DownloadManager $downloadManager)
  16509. {
  16510. $this->downloadManager = $downloadManager;
  16511. }
  16512. public function addArchiver(ArchiverInterface $archiver)
  16513. {
  16514. $this->archivers[] = $archiver;
  16515. }
  16516. public function setOverwriteFiles($overwriteFiles)
  16517. {
  16518. $this->overwriteFiles = $overwriteFiles;
  16519. return $this;
  16520. }
  16521. public function getPackageFilename(PackageInterface $package)
  16522. {
  16523. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  16524. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  16525. array_push($nameParts, $package->getDistReference(), $package->getDistType());
  16526. } else {
  16527. array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
  16528. }
  16529. if ($package->getSourceReference()) {
  16530. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  16531. }
  16532. $name = implode('-', array_filter($nameParts, function ($p) {
  16533. return !empty($p);
  16534. }));
  16535. return str_replace('/', '-', $name);
  16536. }
  16537. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  16538. {
  16539. if (empty($format)) {
  16540. throw new \InvalidArgumentException('Format must be specified');
  16541. }
  16542. $usableArchiver = null;
  16543. foreach ($this->archivers as $archiver) {
  16544. if ($archiver->supports($format, $package->getSourceType())) {
  16545. $usableArchiver = $archiver;
  16546. break;
  16547. }
  16548. }
  16549. if (null === $usableArchiver) {
  16550. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  16551. }
  16552. $filesystem = new Filesystem();
  16553. if (null === $fileName) {
  16554. $packageName = $this->getPackageFilename($package);
  16555. } else {
  16556. $packageName = $fileName;
  16557. }
  16558. $filesystem->ensureDirectoryExists($targetDir);
  16559. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  16560. $filesystem->ensureDirectoryExists(dirname($target));
  16561. if (!$this->overwriteFiles && file_exists($target)) {
  16562. return $target;
  16563. }
  16564. if ($package instanceof RootPackageInterface) {
  16565. $sourcePath = realpath('.');
  16566. } else {
  16567. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  16568. $filesystem->ensureDirectoryExists($sourcePath);
  16569. try {
  16570. $this->downloadManager->download($package, $sourcePath);
  16571. } catch (\Exception $e) {
  16572. $filesystem->removeDirectory($sourcePath);
  16573. throw $e;
  16574. }
  16575. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  16576. $jsonFile = new JsonFile($composerJsonPath);
  16577. $jsonData = $jsonFile->read();
  16578. if (!empty($jsonData['archive']['exclude'])) {
  16579. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  16580. }
  16581. }
  16582. }
  16583. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  16584. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  16585. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  16586. $filesystem->rename($archivePath, $target);
  16587. if (!$package instanceof RootPackageInterface) {
  16588. $filesystem->removeDirectory($sourcePath);
  16589. }
  16590. $filesystem->remove($tempTarget);
  16591. return $target;
  16592. }
  16593. }
  16594. <?php
  16595. namespace Composer\Package\Archiver;
  16596. interface ArchiverInterface
  16597. {
  16598. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  16599. public function supports($format, $sourceType);
  16600. }
  16601. <?php
  16602. namespace Composer\Package\Archiver;
  16603. use Symfony\Component\Finder;
  16604. abstract class BaseExcludeFilter
  16605. {
  16606. protected $sourcePath;
  16607. protected $excludePatterns;
  16608. public function __construct($sourcePath)
  16609. {
  16610. $this->sourcePath = $sourcePath;
  16611. $this->excludePatterns = array();
  16612. }
  16613. public function filter($relativePath, $exclude)
  16614. {
  16615. foreach ($this->excludePatterns as $patternData) {
  16616. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  16617. if ($stripLeadingSlash) {
  16618. $path = substr($relativePath, 1);
  16619. } else {
  16620. $path = $relativePath;
  16621. }
  16622. if (preg_match($pattern, $path)) {
  16623. $exclude = !$negate;
  16624. }
  16625. }
  16626. return $exclude;
  16627. }
  16628. protected function parseLines(array $lines, $lineParser)
  16629. {
  16630. return array_filter(
  16631. array_map(
  16632. function ($line) use ($lineParser) {
  16633. $line = trim($line);
  16634. if (!$line || 0 === strpos($line, '#')) {
  16635. return null;
  16636. }
  16637. return call_user_func($lineParser, $line);
  16638. },
  16639. $lines
  16640. ),
  16641. function ($pattern) {
  16642. return $pattern !== null;
  16643. }
  16644. );
  16645. }
  16646. protected function generatePatterns($rules)
  16647. {
  16648. $patterns = array();
  16649. foreach ($rules as $rule) {
  16650. $patterns[] = $this->generatePattern($rule);
  16651. }
  16652. return $patterns;
  16653. }
  16654. protected function generatePattern($rule)
  16655. {
  16656. $negate = false;
  16657. $pattern = '{';
  16658. if (strlen($rule) && $rule[0] === '!') {
  16659. $negate = true;
  16660. $rule = substr($rule, 1);
  16661. }
  16662. if (strlen($rule) && $rule[0] === '/') {
  16663. $pattern .= '^/';
  16664. $rule = substr($rule, 1);
  16665. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  16666. $pattern .= '/';
  16667. $rule = substr($rule, 0, -1);
  16668. } elseif (false === strpos($rule, '/')) {
  16669. $pattern .= '/';
  16670. }
  16671. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  16672. return array($pattern . '}', $negate, false);
  16673. }
  16674. }
  16675. <?php
  16676. namespace Composer\Package\Archiver;
  16677. class ComposerExcludeFilter extends BaseExcludeFilter
  16678. {
  16679. public function __construct($sourcePath, array $excludeRules)
  16680. {
  16681. parent::__construct($sourcePath);
  16682. $this->excludePatterns = $this->generatePatterns($excludeRules);
  16683. }
  16684. }
  16685. <?php
  16686. namespace Composer\Package\Archiver;
  16687. class GitExcludeFilter extends BaseExcludeFilter
  16688. {
  16689. public function __construct($sourcePath)
  16690. {
  16691. parent::__construct($sourcePath);
  16692. if (file_exists($sourcePath.'/.gitignore')) {
  16693. $this->excludePatterns = $this->parseLines(
  16694. file($sourcePath.'/.gitignore'),
  16695. array($this, 'parseGitIgnoreLine')
  16696. );
  16697. }
  16698. if (file_exists($sourcePath.'/.gitattributes')) {
  16699. $this->excludePatterns = array_merge(
  16700. $this->excludePatterns,
  16701. $this->parseLines(
  16702. file($sourcePath.'/.gitattributes'),
  16703. array($this, 'parseGitAttributesLine')
  16704. )
  16705. );
  16706. }
  16707. }
  16708. public function parseGitIgnoreLine($line)
  16709. {
  16710. return $this->generatePattern($line);
  16711. }
  16712. public function parseGitAttributesLine($line)
  16713. {
  16714. $parts = preg_split('#\s+#', $line);
  16715. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  16716. return $this->generatePattern($parts[0]);
  16717. }
  16718. return null;
  16719. }
  16720. }
  16721. <?php
  16722. namespace Composer\Package\Archiver;
  16723. use Symfony\Component\Finder;
  16724. class HgExcludeFilter extends BaseExcludeFilter
  16725. {
  16726. const HG_IGNORE_REGEX = 1;
  16727. const HG_IGNORE_GLOB = 2;
  16728. protected $patternMode;
  16729. public function __construct($sourcePath)
  16730. {
  16731. parent::__construct($sourcePath);
  16732. $this->patternMode = self::HG_IGNORE_REGEX;
  16733. if (file_exists($sourcePath.'/.hgignore')) {
  16734. $this->excludePatterns = $this->parseLines(
  16735. file($sourcePath.'/.hgignore'),
  16736. array($this, 'parseHgIgnoreLine')
  16737. );
  16738. }
  16739. }
  16740. public function parseHgIgnoreLine($line)
  16741. {
  16742. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  16743. if ($matches[1] === 'glob') {
  16744. $this->patternMode = self::HG_IGNORE_GLOB;
  16745. } else {
  16746. $this->patternMode = self::HG_IGNORE_REGEX;
  16747. }
  16748. return null;
  16749. }
  16750. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  16751. return $this->patternFromGlob($line);
  16752. }
  16753. return $this->patternFromRegex($line);
  16754. }
  16755. protected function patternFromGlob($line)
  16756. {
  16757. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  16758. $pattern = str_replace('[^/]*', '.*', $pattern);
  16759. return array($pattern, false, true);
  16760. }
  16761. public function patternFromRegex($line)
  16762. {
  16763. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  16764. return array($pattern, false, true);
  16765. }
  16766. }
  16767. <?php
  16768. namespace Composer\Package\Archiver;
  16769. class PharArchiver implements ArchiverInterface
  16770. {
  16771. protected static $formats = array(
  16772. 'zip' => \Phar::ZIP,
  16773. 'tar' => \Phar::TAR,
  16774. 'tar.gz' => \Phar::TAR,
  16775. 'tar.bz2' => \Phar::TAR,
  16776. );
  16777. protected static $compressFormats = array(
  16778. 'tar.gz' => \Phar::GZ,
  16779. 'tar.bz2' => \Phar::BZ2,
  16780. );
  16781. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16782. {
  16783. $sources = realpath($sources);
  16784. if (file_exists($target)) {
  16785. unlink($target);
  16786. }
  16787. try {
  16788. $filename = substr($target, 0, strrpos($target, $format) - 1);
  16789. if (isset(static::$compressFormats[$format])) {
  16790. $target = $filename . '.tar';
  16791. }
  16792. $phar = new \PharData($target, null, null, static::$formats[$format]);
  16793. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16794. $filesOnly = new ArchivableFilesFilter($files);
  16795. $phar->buildFromIterator($filesOnly, $sources);
  16796. $filesOnly->addEmptyDir($phar, $sources);
  16797. if (isset(static::$compressFormats[$format])) {
  16798. if (!$phar->canCompress(static::$compressFormats[$format])) {
  16799. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  16800. }
  16801. unlink($target);
  16802. $phar->compress(static::$compressFormats[$format]);
  16803. $target = $filename . '.' . $format;
  16804. }
  16805. return $target;
  16806. } catch (\UnexpectedValueException $e) {
  16807. $message = sprintf(
  16808. "Could not create archive '%s' from '%s': %s",
  16809. $target,
  16810. $sources,
  16811. $e->getMessage()
  16812. );
  16813. throw new \RuntimeException($message, $e->getCode(), $e);
  16814. }
  16815. }
  16816. public function supports($format, $sourceType)
  16817. {
  16818. return isset(static::$formats[$format]);
  16819. }
  16820. }
  16821. <?php
  16822. namespace Composer\Package\Archiver;
  16823. use ZipArchive;
  16824. use Composer\Util\Filesystem;
  16825. class ZipArchiver implements ArchiverInterface
  16826. {
  16827. protected static $formats = array(
  16828. 'zip' => 1,
  16829. );
  16830. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16831. {
  16832. $fs = new Filesystem();
  16833. $sources = $fs->normalizePath($sources);
  16834. $zip = new ZipArchive();
  16835. $res = $zip->open($target, ZipArchive::CREATE);
  16836. if ($res === true) {
  16837. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16838. foreach ($files as $file) {
  16839. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  16840. $localname = str_replace($sources.'/', '', $filepath);
  16841. if ($file->isDir()) {
  16842. $zip->addEmptyDir($localname);
  16843. } else {
  16844. $zip->addFile($filepath, $localname);
  16845. }
  16846. }
  16847. if ($zip->close()) {
  16848. return $target;
  16849. }
  16850. }
  16851. $message = sprintf(
  16852. "Could not create archive '%s' from '%s': %s",
  16853. $target,
  16854. $sources,
  16855. $zip->getStatusString()
  16856. );
  16857. throw new \RuntimeException($message);
  16858. }
  16859. public function supports($format, $sourceType)
  16860. {
  16861. return isset(static::$formats[$format]) && $this->compressionAvailable();
  16862. }
  16863. private function compressionAvailable()
  16864. {
  16865. return class_exists('ZipArchive');
  16866. }
  16867. }
  16868. <?php
  16869. namespace Composer\Package;
  16870. use Composer\Repository\RepositoryInterface;
  16871. use Composer\Repository\PlatformRepository;
  16872. abstract class BasePackage implements PackageInterface
  16873. {
  16874. public static $supportedLinkTypes = array(
  16875. 'require' => array('description' => 'requires', 'method' => 'requires'),
  16876. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  16877. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  16878. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  16879. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  16880. );
  16881. const STABILITY_STABLE = 0;
  16882. const STABILITY_RC = 5;
  16883. const STABILITY_BETA = 10;
  16884. const STABILITY_ALPHA = 15;
  16885. const STABILITY_DEV = 20;
  16886. public static $stabilities = array(
  16887. 'stable' => self::STABILITY_STABLE,
  16888. 'RC' => self::STABILITY_RC,
  16889. 'beta' => self::STABILITY_BETA,
  16890. 'alpha' => self::STABILITY_ALPHA,
  16891. 'dev' => self::STABILITY_DEV,
  16892. );
  16893. public $id;
  16894. protected $name;
  16895. protected $prettyName;
  16896. protected $repository;
  16897. protected $transportOptions = array();
  16898. public function __construct($name)
  16899. {
  16900. $this->prettyName = $name;
  16901. $this->name = strtolower($name);
  16902. $this->id = -1;
  16903. }
  16904. public function getName()
  16905. {
  16906. return $this->name;
  16907. }
  16908. public function getPrettyName()
  16909. {
  16910. return $this->prettyName;
  16911. }
  16912. public function getNames()
  16913. {
  16914. $names = array(
  16915. $this->getName() => true,
  16916. );
  16917. foreach ($this->getProvides() as $link) {
  16918. $names[$link->getTarget()] = true;
  16919. }
  16920. foreach ($this->getReplaces() as $link) {
  16921. $names[$link->getTarget()] = true;
  16922. }
  16923. return array_keys($names);
  16924. }
  16925. public function setId($id)
  16926. {
  16927. $this->id = $id;
  16928. }
  16929. public function getId()
  16930. {
  16931. return $this->id;
  16932. }
  16933. public function setRepository(RepositoryInterface $repository)
  16934. {
  16935. if ($this->repository && $repository !== $this->repository) {
  16936. throw new \LogicException('A package can only be added to one repository');
  16937. }
  16938. $this->repository = $repository;
  16939. }
  16940. public function getRepository()
  16941. {
  16942. return $this->repository;
  16943. }
  16944. public function getTransportOptions()
  16945. {
  16946. return $this->transportOptions;
  16947. }
  16948. public function setTransportOptions(array $options)
  16949. {
  16950. $this->transportOptions = $options;
  16951. }
  16952. public function isPlatform()
  16953. {
  16954. return $this->getRepository() instanceof PlatformRepository;
  16955. }
  16956. public function getUniqueName()
  16957. {
  16958. return $this->getName().'-'.$this->getVersion();
  16959. }
  16960. public function equals(PackageInterface $package)
  16961. {
  16962. $self = $this;
  16963. if ($this instanceof AliasPackage) {
  16964. $self = $this->getAliasOf();
  16965. }
  16966. if ($package instanceof AliasPackage) {
  16967. $package = $package->getAliasOf();
  16968. }
  16969. return $package === $self;
  16970. }
  16971. public function __toString()
  16972. {
  16973. return $this->getUniqueName();
  16974. }
  16975. public function getPrettyString()
  16976. {
  16977. return $this->getPrettyName().' '.$this->getPrettyVersion();
  16978. }
  16979. public function getFullPrettyVersion($truncate = true)
  16980. {
  16981. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  16982. return $this->getPrettyVersion();
  16983. }
  16984. if ($truncate && strlen($this->getSourceReference()) === 40) {
  16985. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  16986. }
  16987. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  16988. }
  16989. public function getStabilityPriority()
  16990. {
  16991. return self::$stabilities[$this->getStability()];
  16992. }
  16993. public function __clone()
  16994. {
  16995. $this->repository = null;
  16996. $this->id = -1;
  16997. }
  16998. public static function packageNameToRegexp($whiteListedPattern, $wrap = '{^%s$}i')
  16999. {
  17000. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  17001. return sprintf($wrap, $cleanedWhiteListedPattern);
  17002. }
  17003. }
  17004. <?php
  17005. namespace Composer\Package\Comparer;
  17006. class Comparer
  17007. {
  17008. private $source;
  17009. private $update;
  17010. private $changed;
  17011. public function setSource($source)
  17012. {
  17013. $this->source = $source;
  17014. }
  17015. public function setUpdate($update)
  17016. {
  17017. $this->update = $update;
  17018. }
  17019. public function getChanged($toString = false, $explicated = false)
  17020. {
  17021. $changed = $this->changed;
  17022. if (!count($changed)) {
  17023. return false;
  17024. }
  17025. if ($explicated) {
  17026. foreach ($changed as $sectionKey => $itemSection) {
  17027. foreach ($itemSection as $itemKey => $item) {
  17028. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  17029. }
  17030. }
  17031. }
  17032. if ($toString) {
  17033. foreach ($changed as $sectionKey => $itemSection) {
  17034. foreach ($itemSection as $itemKey => $item) {
  17035. $changed['string'][] = $item."\r\n";
  17036. }
  17037. }
  17038. $changed = implode("\r\n", $changed['string']);
  17039. }
  17040. return $changed;
  17041. }
  17042. public function doCompare()
  17043. {
  17044. $source = array();
  17045. $destination = array();
  17046. $this->changed = array();
  17047. $currentDirectory = getcwd();
  17048. chdir($this->source);
  17049. $source = $this->doTree('.', $source);
  17050. if (!is_array($source)) {
  17051. return;
  17052. }
  17053. chdir($currentDirectory);
  17054. chdir($this->update);
  17055. $destination = $this->doTree('.', $destination);
  17056. if (!is_array($destination)) {
  17057. exit;
  17058. }
  17059. chdir($currentDirectory);
  17060. foreach ($source as $dir => $value) {
  17061. foreach ($value as $file => $hash) {
  17062. if (isset($destination[$dir][$file])) {
  17063. if ($hash !== $destination[$dir][$file]) {
  17064. $this->changed['changed'][] = $dir.'/'.$file;
  17065. }
  17066. } else {
  17067. $this->changed['removed'][] = $dir.'/'.$file;
  17068. }
  17069. }
  17070. }
  17071. foreach ($destination as $dir => $value) {
  17072. foreach ($value as $file => $hash) {
  17073. if (!isset($source[$dir][$file])) {
  17074. $this->changed['added'][] = $dir.'/'.$file;
  17075. }
  17076. }
  17077. }
  17078. }
  17079. private function doTree($dir, &$array)
  17080. {
  17081. if ($dh = opendir($dir)) {
  17082. while ($file = readdir($dh)) {
  17083. if ($file !== '.' && $file !== '..') {
  17084. if (is_dir($dir.'/'.$file)) {
  17085. if (!count($array)) {
  17086. $array[0] = 'Temp';
  17087. }
  17088. if (!$this->doTree($dir.'/'.$file, $array)) {
  17089. return false;
  17090. }
  17091. } else {
  17092. if (filesize($dir.'/'.$file)) {
  17093. set_time_limit(30);
  17094. $array[$dir][$file] = md5_file($dir.'/'.$file);
  17095. }
  17096. }
  17097. }
  17098. }
  17099. if (count($array) > 1 && isset($array['0'])) {
  17100. unset($array['0']);
  17101. }
  17102. return $array;
  17103. }
  17104. return false;
  17105. }
  17106. }
  17107. <?php
  17108. namespace Composer\Package;
  17109. class CompletePackage extends Package implements CompletePackageInterface
  17110. {
  17111. protected $repositories;
  17112. protected $license = array();
  17113. protected $keywords;
  17114. protected $authors;
  17115. protected $description;
  17116. protected $homepage;
  17117. protected $scripts = array();
  17118. protected $support = array();
  17119. protected $abandoned = false;
  17120. public function setScripts(array $scripts)
  17121. {
  17122. $this->scripts = $scripts;
  17123. }
  17124. public function getScripts()
  17125. {
  17126. return $this->scripts;
  17127. }
  17128. public function setRepositories($repositories)
  17129. {
  17130. $this->repositories = $repositories;
  17131. }
  17132. public function getRepositories()
  17133. {
  17134. return $this->repositories;
  17135. }
  17136. public function setLicense(array $license)
  17137. {
  17138. $this->license = $license;
  17139. }
  17140. public function getLicense()
  17141. {
  17142. return $this->license;
  17143. }
  17144. public function setKeywords(array $keywords)
  17145. {
  17146. $this->keywords = $keywords;
  17147. }
  17148. public function getKeywords()
  17149. {
  17150. return $this->keywords;
  17151. }
  17152. public function setAuthors(array $authors)
  17153. {
  17154. $this->authors = $authors;
  17155. }
  17156. public function getAuthors()
  17157. {
  17158. return $this->authors;
  17159. }
  17160. public function setDescription($description)
  17161. {
  17162. $this->description = $description;
  17163. }
  17164. public function getDescription()
  17165. {
  17166. return $this->description;
  17167. }
  17168. public function setHomepage($homepage)
  17169. {
  17170. $this->homepage = $homepage;
  17171. }
  17172. public function getHomepage()
  17173. {
  17174. return $this->homepage;
  17175. }
  17176. public function setSupport(array $support)
  17177. {
  17178. $this->support = $support;
  17179. }
  17180. public function getSupport()
  17181. {
  17182. return $this->support;
  17183. }
  17184. public function isAbandoned()
  17185. {
  17186. return (bool) $this->abandoned;
  17187. }
  17188. public function setAbandoned($abandoned)
  17189. {
  17190. $this->abandoned = $abandoned;
  17191. }
  17192. public function getReplacementPackage()
  17193. {
  17194. return is_string($this->abandoned) ? $this->abandoned : null;
  17195. }
  17196. }
  17197. <?php
  17198. namespace Composer\Package;
  17199. interface CompletePackageInterface extends PackageInterface
  17200. {
  17201. public function getScripts();
  17202. public function getRepositories();
  17203. public function getLicense();
  17204. public function getKeywords();
  17205. public function getDescription();
  17206. public function getHomepage();
  17207. public function getAuthors();
  17208. public function getSupport();
  17209. public function isAbandoned();
  17210. public function getReplacementPackage();
  17211. }
  17212. <?php
  17213. namespace Composer\Package\Dumper;
  17214. use Composer\Package\BasePackage;
  17215. use Composer\Package\PackageInterface;
  17216. use Composer\Package\CompletePackageInterface;
  17217. use Composer\Package\RootPackageInterface;
  17218. class ArrayDumper
  17219. {
  17220. public function dump(PackageInterface $package)
  17221. {
  17222. $keys = array(
  17223. 'binaries' => 'bin',
  17224. 'type',
  17225. 'extra',
  17226. 'installationSource' => 'installation-source',
  17227. 'autoload',
  17228. 'devAutoload' => 'autoload-dev',
  17229. 'notificationUrl' => 'notification-url',
  17230. 'includePaths' => 'include-path',
  17231. );
  17232. $data = array();
  17233. $data['name'] = $package->getPrettyName();
  17234. $data['version'] = $package->getPrettyVersion();
  17235. $data['version_normalized'] = $package->getVersion();
  17236. if ($package->getTargetDir()) {
  17237. $data['target-dir'] = $package->getTargetDir();
  17238. }
  17239. if ($package->getSourceType()) {
  17240. $data['source']['type'] = $package->getSourceType();
  17241. $data['source']['url'] = $package->getSourceUrl();
  17242. if (null !== ($value = $package->getSourceReference())) {
  17243. $data['source']['reference'] = $value;
  17244. }
  17245. if ($mirrors = $package->getSourceMirrors()) {
  17246. $data['source']['mirrors'] = $mirrors;
  17247. }
  17248. }
  17249. if ($package->getDistType()) {
  17250. $data['dist']['type'] = $package->getDistType();
  17251. $data['dist']['url'] = $package->getDistUrl();
  17252. if (null !== ($value = $package->getDistReference())) {
  17253. $data['dist']['reference'] = $value;
  17254. }
  17255. if (null !== ($value = $package->getDistSha1Checksum())) {
  17256. $data['dist']['shasum'] = $value;
  17257. }
  17258. if ($mirrors = $package->getDistMirrors()) {
  17259. $data['dist']['mirrors'] = $mirrors;
  17260. }
  17261. }
  17262. if ($package->getArchiveExcludes()) {
  17263. $data['archive']['exclude'] = $package->getArchiveExcludes();
  17264. }
  17265. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  17266. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  17267. foreach ($links as $link) {
  17268. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  17269. }
  17270. ksort($data[$type]);
  17271. }
  17272. }
  17273. if ($packages = $package->getSuggests()) {
  17274. ksort($packages);
  17275. $data['suggest'] = $packages;
  17276. }
  17277. if ($package->getReleaseDate()) {
  17278. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  17279. }
  17280. $data = $this->dumpValues($package, $keys, $data);
  17281. if ($package instanceof CompletePackageInterface) {
  17282. $keys = array(
  17283. 'scripts',
  17284. 'license',
  17285. 'authors',
  17286. 'description',
  17287. 'homepage',
  17288. 'keywords',
  17289. 'repositories',
  17290. 'support',
  17291. );
  17292. $data = $this->dumpValues($package, $keys, $data);
  17293. if (isset($data['keywords']) && is_array($data['keywords'])) {
  17294. sort($data['keywords']);
  17295. }
  17296. if ($package->isAbandoned()) {
  17297. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  17298. }
  17299. }
  17300. if ($package instanceof RootPackageInterface) {
  17301. $minimumStability = $package->getMinimumStability();
  17302. if ($minimumStability) {
  17303. $data['minimum-stability'] = $minimumStability;
  17304. }
  17305. }
  17306. if (count($package->getTransportOptions()) > 0) {
  17307. $data['transport-options'] = $package->getTransportOptions();
  17308. }
  17309. return $data;
  17310. }
  17311. private function dumpValues(PackageInterface $package, array $keys, array $data)
  17312. {
  17313. foreach ($keys as $method => $key) {
  17314. if (is_numeric($method)) {
  17315. $method = $key;
  17316. }
  17317. $getter = 'get'.ucfirst($method);
  17318. $value = $package->$getter();
  17319. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  17320. $data[$key] = $value;
  17321. }
  17322. }
  17323. return $data;
  17324. }
  17325. }
  17326. <?php
  17327. namespace Composer\Package;
  17328. use Composer\Semver\Constraint\ConstraintInterface;
  17329. class Link
  17330. {
  17331. protected $source;
  17332. protected $target;
  17333. protected $constraint;
  17334. protected $description;
  17335. protected $prettyConstraint;
  17336. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  17337. {
  17338. $this->source = strtolower($source);
  17339. $this->target = strtolower($target);
  17340. $this->constraint = $constraint;
  17341. $this->description = $description;
  17342. $this->prettyConstraint = $prettyConstraint;
  17343. }
  17344. public function getDescription()
  17345. {
  17346. return $this->description;
  17347. }
  17348. public function getSource()
  17349. {
  17350. return $this->source;
  17351. }
  17352. public function getTarget()
  17353. {
  17354. return $this->target;
  17355. }
  17356. public function getConstraint()
  17357. {
  17358. return $this->constraint;
  17359. }
  17360. public function getPrettyConstraint()
  17361. {
  17362. if (null === $this->prettyConstraint) {
  17363. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  17364. }
  17365. return $this->prettyConstraint;
  17366. }
  17367. public function __toString()
  17368. {
  17369. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  17370. }
  17371. public function getPrettyString(PackageInterface $sourcePackage)
  17372. {
  17373. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  17374. }
  17375. }
  17376. <?php
  17377. namespace Composer\Package\LinkConstraint;
  17378. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  17379. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  17380. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  17381. {
  17382. }
  17383. <?php
  17384. namespace Composer\Package\LinkConstraint;
  17385. use Composer\Semver\Constraint\ConstraintInterface;
  17386. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  17387. interface LinkConstraintInterface extends ConstraintInterface
  17388. {
  17389. }
  17390. <?php
  17391. namespace Composer\Package\LinkConstraint;
  17392. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  17393. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  17394. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  17395. {
  17396. }
  17397. <?php
  17398. namespace Composer\Package\LinkConstraint;
  17399. use Composer\Semver\Constraint\AbstractConstraint;
  17400. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  17401. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  17402. {
  17403. }
  17404. <?php
  17405. namespace Composer\Package\LinkConstraint;
  17406. use Composer\Semver\Constraint\Constraint;
  17407. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  17408. class VersionConstraint extends Constraint implements LinkConstraintInterface
  17409. {
  17410. }
  17411. <?php
  17412. namespace Composer\Package\Loader;
  17413. use Composer\Package;
  17414. use Composer\Package\AliasPackage;
  17415. use Composer\Package\Link;
  17416. use Composer\Package\RootAliasPackage;
  17417. use Composer\Package\RootPackageInterface;
  17418. use Composer\Package\Version\VersionParser;
  17419. use Composer\Semver\VersionParser as SemverVersionParser;
  17420. class ArrayLoader implements LoaderInterface
  17421. {
  17422. protected $versionParser;
  17423. protected $loadOptions;
  17424. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  17425. {
  17426. if (!$parser) {
  17427. $parser = new VersionParser;
  17428. }
  17429. $this->versionParser = $parser;
  17430. $this->loadOptions = $loadOptions;
  17431. }
  17432. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17433. {
  17434. if (!isset($config['name'])) {
  17435. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  17436. }
  17437. if (!isset($config['version'])) {
  17438. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  17439. }
  17440. if (isset($config['version_normalized'])) {
  17441. $version = $config['version_normalized'];
  17442. } else {
  17443. $version = $this->versionParser->normalize($config['version']);
  17444. }
  17445. $package = new $class($config['name'], $version, $config['version']);
  17446. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  17447. if (isset($config['target-dir'])) {
  17448. $package->setTargetDir($config['target-dir']);
  17449. }
  17450. if (isset($config['extra']) && is_array($config['extra'])) {
  17451. $package->setExtra($config['extra']);
  17452. }
  17453. if (isset($config['bin'])) {
  17454. foreach ((array) $config['bin'] as $key => $bin) {
  17455. $config['bin'][$key] = ltrim($bin, '/');
  17456. }
  17457. $package->setBinaries((array) $config['bin']);
  17458. }
  17459. if (isset($config['installation-source'])) {
  17460. $package->setInstallationSource($config['installation-source']);
  17461. }
  17462. if (isset($config['source'])) {
  17463. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  17464. throw new \UnexpectedValueException(sprintf(
  17465. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  17466. $config['name'],
  17467. json_encode($config['source'])
  17468. ));
  17469. }
  17470. $package->setSourceType($config['source']['type']);
  17471. $package->setSourceUrl($config['source']['url']);
  17472. $package->setSourceReference(isset($config['source']['reference']) ? $config['source']['reference'] : null);
  17473. if (isset($config['source']['mirrors'])) {
  17474. $package->setSourceMirrors($config['source']['mirrors']);
  17475. }
  17476. }
  17477. if (isset($config['dist'])) {
  17478. if (!isset($config['dist']['type'])
  17479. || !isset($config['dist']['url'])) {
  17480. throw new \UnexpectedValueException(sprintf(
  17481. "Package %s's dist key should be specified as ".
  17482. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  17483. $config['name'],
  17484. json_encode($config['dist'])
  17485. ));
  17486. }
  17487. $package->setDistType($config['dist']['type']);
  17488. $package->setDistUrl($config['dist']['url']);
  17489. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  17490. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  17491. if (isset($config['dist']['mirrors'])) {
  17492. $package->setDistMirrors($config['dist']['mirrors']);
  17493. }
  17494. }
  17495. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  17496. if (isset($config[$type])) {
  17497. $method = 'set'.ucfirst($opts['method']);
  17498. $package->{$method}(
  17499. $this->parseLinks(
  17500. $package->getName(),
  17501. $package->getPrettyVersion(),
  17502. $opts['description'],
  17503. $config[$type]
  17504. )
  17505. );
  17506. }
  17507. }
  17508. if (isset($config['suggest']) && is_array($config['suggest'])) {
  17509. foreach ($config['suggest'] as $target => $reason) {
  17510. if ('self.version' === trim($reason)) {
  17511. $config['suggest'][$target] = $package->getPrettyVersion();
  17512. }
  17513. }
  17514. $package->setSuggests($config['suggest']);
  17515. }
  17516. if (isset($config['autoload'])) {
  17517. $package->setAutoload($config['autoload']);
  17518. }
  17519. if (isset($config['autoload-dev'])) {
  17520. $package->setDevAutoload($config['autoload-dev']);
  17521. }
  17522. if (isset($config['include-path'])) {
  17523. $package->setIncludePaths($config['include-path']);
  17524. }
  17525. if (!empty($config['time'])) {
  17526. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  17527. try {
  17528. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  17529. $package->setReleaseDate($date);
  17530. } catch (\Exception $e) {
  17531. }
  17532. }
  17533. if (!empty($config['notification-url'])) {
  17534. $package->setNotificationUrl($config['notification-url']);
  17535. }
  17536. if (!empty($config['archive']['exclude'])) {
  17537. $package->setArchiveExcludes($config['archive']['exclude']);
  17538. }
  17539. if ($package instanceof Package\CompletePackageInterface) {
  17540. if (isset($config['scripts']) && is_array($config['scripts'])) {
  17541. foreach ($config['scripts'] as $event => $listeners) {
  17542. $config['scripts'][$event] = (array) $listeners;
  17543. }
  17544. if (isset($config['scripts']['composer'])) {
  17545. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  17546. }
  17547. $package->setScripts($config['scripts']);
  17548. }
  17549. if (!empty($config['description']) && is_string($config['description'])) {
  17550. $package->setDescription($config['description']);
  17551. }
  17552. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  17553. $package->setHomepage($config['homepage']);
  17554. }
  17555. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  17556. $package->setKeywords($config['keywords']);
  17557. }
  17558. if (!empty($config['license'])) {
  17559. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  17560. }
  17561. if (!empty($config['authors']) && is_array($config['authors'])) {
  17562. $package->setAuthors($config['authors']);
  17563. }
  17564. if (isset($config['support'])) {
  17565. $package->setSupport($config['support']);
  17566. }
  17567. if (isset($config['abandoned'])) {
  17568. $package->setAbandoned($config['abandoned']);
  17569. }
  17570. }
  17571. if ($aliasNormalized = $this->getBranchAlias($config)) {
  17572. if ($package instanceof RootPackageInterface) {
  17573. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17574. } else {
  17575. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17576. }
  17577. }
  17578. if ($this->loadOptions && isset($config['transport-options'])) {
  17579. $package->setTransportOptions($config['transport-options']);
  17580. }
  17581. return $package;
  17582. }
  17583. public function parseLinks($source, $sourceVersion, $description, $links)
  17584. {
  17585. $res = array();
  17586. foreach ($links as $target => $constraint) {
  17587. if (!is_string($constraint)) {
  17588. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  17589. }
  17590. if ('self.version' === $constraint) {
  17591. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  17592. } else {
  17593. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  17594. }
  17595. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  17596. }
  17597. return $res;
  17598. }
  17599. public function getBranchAlias(array $config)
  17600. {
  17601. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  17602. || !isset($config['extra']['branch-alias'])
  17603. || !is_array($config['extra']['branch-alias'])
  17604. ) {
  17605. return;
  17606. }
  17607. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  17608. if ('-dev' !== substr($targetBranch, -4)) {
  17609. continue;
  17610. }
  17611. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  17612. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  17613. continue;
  17614. }
  17615. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  17616. continue;
  17617. }
  17618. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  17619. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  17620. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  17621. ) {
  17622. continue;
  17623. }
  17624. return $validatedTargetBranch;
  17625. }
  17626. }
  17627. }
  17628. <?php
  17629. namespace Composer\Package\Loader;
  17630. class InvalidPackageException extends \Exception
  17631. {
  17632. private $errors;
  17633. private $warnings;
  17634. private $data;
  17635. public function __construct(array $errors, array $warnings, array $data)
  17636. {
  17637. $this->errors = $errors;
  17638. $this->warnings = $warnings;
  17639. $this->data = $data;
  17640. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  17641. }
  17642. public function getData()
  17643. {
  17644. return $this->data;
  17645. }
  17646. public function getErrors()
  17647. {
  17648. return $this->errors;
  17649. }
  17650. public function getWarnings()
  17651. {
  17652. return $this->warnings;
  17653. }
  17654. }
  17655. <?php
  17656. namespace Composer\Package\Loader;
  17657. use Composer\Json\JsonFile;
  17658. class JsonLoader
  17659. {
  17660. private $loader;
  17661. public function __construct(LoaderInterface $loader)
  17662. {
  17663. $this->loader = $loader;
  17664. }
  17665. public function load($json)
  17666. {
  17667. if ($json instanceof JsonFile) {
  17668. $config = $json->read();
  17669. } elseif (file_exists($json)) {
  17670. $config = JsonFile::parseJson(file_get_contents($json), $json);
  17671. } elseif (is_string($json)) {
  17672. $config = JsonFile::parseJson($json);
  17673. }
  17674. return $this->loader->load($config);
  17675. }
  17676. }
  17677. <?php
  17678. namespace Composer\Package\Loader;
  17679. interface LoaderInterface
  17680. {
  17681. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  17682. }
  17683. <?php
  17684. namespace Composer\Package\Loader;
  17685. use Composer\Package\BasePackage;
  17686. use Composer\Package\AliasPackage;
  17687. use Composer\Config;
  17688. use Composer\IO\IOInterface;
  17689. use Composer\Package\RootPackageInterface;
  17690. use Composer\Repository\RepositoryFactory;
  17691. use Composer\Package\Version\VersionGuesser;
  17692. use Composer\Package\Version\VersionParser;
  17693. use Composer\Repository\RepositoryManager;
  17694. use Composer\Util\ProcessExecutor;
  17695. class RootPackageLoader extends ArrayLoader
  17696. {
  17697. private $manager;
  17698. private $config;
  17699. private $versionGuesser;
  17700. private $io;
  17701. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null, IOInterface $io = null)
  17702. {
  17703. parent::__construct($parser);
  17704. $this->manager = $manager;
  17705. $this->config = $config;
  17706. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  17707. $this->io = $io;
  17708. }
  17709. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  17710. {
  17711. if (!isset($config['name'])) {
  17712. $config['name'] = '__root__';
  17713. } elseif ($this->io) {
  17714. if ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
  17715. $this->io->writeError('<warning>Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  17716. }
  17717. }
  17718. $autoVersioned = false;
  17719. if (!isset($config['version'])) {
  17720. $commit = null;
  17721. if (getenv('COMPOSER_ROOT_VERSION')) {
  17722. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  17723. } else {
  17724. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  17725. if ($versionData) {
  17726. $config['version'] = $versionData['pretty_version'];
  17727. $config['version_normalized'] = $versionData['version'];
  17728. $commit = $versionData['commit'];
  17729. }
  17730. }
  17731. if (!isset($config['version'])) {
  17732. $config['version'] = '1.0.0';
  17733. $autoVersioned = true;
  17734. }
  17735. if ($commit) {
  17736. $config['source'] = array(
  17737. 'type' => '',
  17738. 'url' => '',
  17739. 'reference' => $commit,
  17740. );
  17741. $config['dist'] = array(
  17742. 'type' => '',
  17743. 'url' => '',
  17744. 'reference' => $commit,
  17745. );
  17746. }
  17747. }
  17748. $realPackage = $package = parent::load($config, $class);
  17749. if ($realPackage instanceof AliasPackage) {
  17750. $realPackage = $package->getAliasOf();
  17751. }
  17752. if ($autoVersioned) {
  17753. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  17754. }
  17755. if (isset($config['minimum-stability'])) {
  17756. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  17757. }
  17758. $aliases = array();
  17759. $stabilityFlags = array();
  17760. $references = array();
  17761. foreach (array('require', 'require-dev') as $linkType) {
  17762. if (isset($config[$linkType])) {
  17763. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  17764. $method = 'get'.ucfirst($linkInfo['method']);
  17765. $links = array();
  17766. foreach ($realPackage->$method() as $link) {
  17767. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  17768. }
  17769. $aliases = $this->extractAliases($links, $aliases);
  17770. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  17771. $references = $this->extractReferences($links, $references);
  17772. }
  17773. }
  17774. if ($this->io) {
  17775. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  17776. if (isset($config[$linkType])) {
  17777. foreach ($config[$linkType] as $linkName => $constraint) {
  17778. if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
  17779. $this->io->writeError('<warning>Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  17780. }
  17781. }
  17782. }
  17783. }
  17784. }
  17785. if (isset($links[$config['name']])) {
  17786. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  17787. 'Did you accidentally name your root package after an external package?', $config['name']));
  17788. }
  17789. $realPackage->setAliases($aliases);
  17790. $realPackage->setStabilityFlags($stabilityFlags);
  17791. $realPackage->setReferences($references);
  17792. if (isset($config['prefer-stable'])) {
  17793. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  17794. }
  17795. if (isset($config['config'])) {
  17796. $realPackage->setConfig($config['config']);
  17797. }
  17798. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  17799. foreach ($repos as $repo) {
  17800. $this->manager->addRepository($repo);
  17801. }
  17802. $realPackage->setRepositories($this->config->getRepositories());
  17803. return $package;
  17804. }
  17805. private function extractAliases(array $requires, array $aliases)
  17806. {
  17807. foreach ($requires as $reqName => $reqVersion) {
  17808. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  17809. $aliases[] = array(
  17810. 'package' => strtolower($reqName),
  17811. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  17812. 'alias' => $match[2],
  17813. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  17814. );
  17815. }
  17816. }
  17817. return $aliases;
  17818. }
  17819. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  17820. {
  17821. $stabilities = BasePackage::$stabilities;
  17822. $minimumStability = $stabilities[$minimumStability];
  17823. foreach ($requires as $reqName => $reqVersion) {
  17824. $constraints = array();
  17825. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  17826. foreach ($orSplit as $orConstraint) {
  17827. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  17828. foreach ($andSplit as $andConstraint) {
  17829. $constraints[] = $andConstraint;
  17830. }
  17831. }
  17832. $match = false;
  17833. foreach ($constraints as $constraint) {
  17834. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  17835. $name = strtolower($reqName);
  17836. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  17837. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  17838. continue;
  17839. }
  17840. $stabilityFlags[$name] = $stability;
  17841. $match = true;
  17842. }
  17843. }
  17844. if ($match) {
  17845. continue;
  17846. }
  17847. foreach ($constraints as $constraint) {
  17848. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  17849. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  17850. $name = strtolower($reqName);
  17851. $stability = $stabilities[$stabilityName];
  17852. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  17853. continue;
  17854. }
  17855. $stabilityFlags[$name] = $stability;
  17856. }
  17857. }
  17858. }
  17859. return $stabilityFlags;
  17860. }
  17861. private function extractReferences(array $requires, array $references)
  17862. {
  17863. foreach ($requires as $reqName => $reqVersion) {
  17864. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  17865. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  17866. $name = strtolower($reqName);
  17867. $references[$name] = $match[1];
  17868. }
  17869. }
  17870. return $references;
  17871. }
  17872. }
  17873. <?php
  17874. namespace Composer\Package\Loader;
  17875. use Composer\Package\BasePackage;
  17876. use Composer\Semver\Constraint\Constraint;
  17877. use Composer\Package\Version\VersionParser;
  17878. use Composer\Repository\PlatformRepository;
  17879. use Composer\Spdx\SpdxLicenses;
  17880. class ValidatingArrayLoader implements LoaderInterface
  17881. {
  17882. const CHECK_ALL = 3;
  17883. const CHECK_UNBOUND_CONSTRAINTS = 1;
  17884. const CHECK_STRICT_CONSTRAINTS = 2;
  17885. private $loader;
  17886. private $versionParser;
  17887. private $errors;
  17888. private $warnings;
  17889. private $config;
  17890. private $strictName;
  17891. private $flags;
  17892. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  17893. {
  17894. $this->loader = $loader;
  17895. $this->versionParser = $parser ?: new VersionParser();
  17896. $this->strictName = $strictName;
  17897. $this->flags = $flags;
  17898. }
  17899. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17900. {
  17901. $this->errors = array();
  17902. $this->warnings = array();
  17903. $this->config = $config;
  17904. if ($this->strictName) {
  17905. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  17906. } else {
  17907. $this->validateString('name', true);
  17908. }
  17909. if (!empty($this->config['version'])) {
  17910. try {
  17911. $this->versionParser->normalize($this->config['version']);
  17912. } catch (\Exception $e) {
  17913. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  17914. unset($this->config['version']);
  17915. }
  17916. }
  17917. if (!empty($this->config['config']['platform'])) {
  17918. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  17919. try {
  17920. $this->versionParser->normalize($platform);
  17921. } catch (\Exception $e) {
  17922. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  17923. }
  17924. }
  17925. }
  17926. $this->validateRegex('type', '[A-Za-z0-9-]+');
  17927. $this->validateString('target-dir');
  17928. $this->validateArray('extra');
  17929. if (isset($this->config['bin'])) {
  17930. if (is_string($this->config['bin'])) {
  17931. $this->validateString('bin');
  17932. } else {
  17933. $this->validateFlatArray('bin');
  17934. }
  17935. }
  17936. $this->validateArray('scripts');
  17937. $this->validateString('description');
  17938. $this->validateUrl('homepage');
  17939. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  17940. $releaseDate = null;
  17941. $this->validateString('time');
  17942. if (!empty($this->config['time'])) {
  17943. try {
  17944. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  17945. } catch (\Exception $e) {
  17946. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  17947. unset($this->config['time']);
  17948. }
  17949. }
  17950. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  17951. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  17952. $licenses = (array) $this->config['license'];
  17953. foreach ($licenses as $key => $license) {
  17954. if ('proprietary' === $license) {
  17955. unset($licenses[$key]);
  17956. }
  17957. }
  17958. $licenseValidator = new SpdxLicenses();
  17959. if (count($licenses) === 1 && !$licenseValidator->validate($licenses) && $licenseValidator->validate(trim($licenses[0]))) {
  17960. $this->warnings[] = sprintf(
  17961. 'License %s must not contain extra spaces, make sure to trim it.',
  17962. json_encode($this->config['license'])
  17963. );
  17964. } elseif (array() !== $licenses && !$licenseValidator->validate($licenses)) {
  17965. $this->warnings[] = sprintf(
  17966. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  17967. 'If the software is closed-source, you may use "proprietary" as license.',
  17968. json_encode($this->config['license'])
  17969. );
  17970. }
  17971. }
  17972. }
  17973. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  17974. foreach ($this->config['authors'] as $key => $author) {
  17975. if (!is_array($author)) {
  17976. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  17977. unset($this->config['authors'][$key]);
  17978. continue;
  17979. }
  17980. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  17981. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  17982. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  17983. unset($this->config['authors'][$key][$authorData]);
  17984. }
  17985. }
  17986. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  17987. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  17988. unset($this->config['authors'][$key]['homepage']);
  17989. }
  17990. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  17991. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  17992. unset($this->config['authors'][$key]['email']);
  17993. }
  17994. if (empty($this->config['authors'][$key])) {
  17995. unset($this->config['authors'][$key]);
  17996. }
  17997. }
  17998. if (empty($this->config['authors'])) {
  17999. unset($this->config['authors']);
  18000. }
  18001. }
  18002. if ($this->validateArray('support') && !empty($this->config['support'])) {
  18003. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat') as $key) {
  18004. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  18005. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  18006. unset($this->config['support'][$key]);
  18007. }
  18008. }
  18009. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  18010. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  18011. unset($this->config['support']['email']);
  18012. }
  18013. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  18014. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  18015. unset($this->config['support']['irc']);
  18016. }
  18017. foreach (array('issues', 'forum', 'wiki', 'source', 'docs', 'chat') as $key) {
  18018. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  18019. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  18020. unset($this->config['support'][$key]);
  18021. }
  18022. }
  18023. if (empty($this->config['support'])) {
  18024. unset($this->config['support']);
  18025. }
  18026. }
  18027. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  18028. $stableConstraint = new Constraint('=', '1.0.0');
  18029. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  18030. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  18031. foreach ($this->config[$linkType] as $package => $constraint) {
  18032. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  18033. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  18034. }
  18035. if (!is_string($constraint)) {
  18036. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  18037. unset($this->config[$linkType][$package]);
  18038. } elseif ('self.version' !== $constraint) {
  18039. try {
  18040. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  18041. } catch (\Exception $e) {
  18042. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  18043. unset($this->config[$linkType][$package]);
  18044. continue;
  18045. }
  18046. if (
  18047. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  18048. && 'require' === $linkType
  18049. && $linkConstraint->matches($unboundConstraint)
  18050. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  18051. ) {
  18052. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  18053. } elseif (
  18054. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  18055. && 'require' === $linkType
  18056. && substr($linkConstraint, 0, 1) === '='
  18057. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  18058. ) {
  18059. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  18060. }
  18061. }
  18062. }
  18063. }
  18064. }
  18065. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  18066. foreach ($this->config['suggest'] as $package => $description) {
  18067. if (!is_string($description)) {
  18068. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  18069. unset($this->config['suggest'][$package]);
  18070. }
  18071. }
  18072. }
  18073. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  18074. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  18075. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  18076. unset($this->config['minimum-stability']);
  18077. }
  18078. }
  18079. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  18080. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  18081. foreach ($this->config['autoload'] as $type => $typeConfig) {
  18082. if (!in_array($type, $types)) {
  18083. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  18084. unset($this->config['autoload'][$type]);
  18085. }
  18086. if ($type === 'psr-4') {
  18087. foreach ($typeConfig as $namespace => $dirs) {
  18088. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  18089. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  18090. }
  18091. }
  18092. }
  18093. }
  18094. }
  18095. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  18096. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  18097. unset($this->config['autoload']['psr-4']);
  18098. }
  18099. $this->validateFlatArray('include-path');
  18100. $this->validateArray('transport-options');
  18101. if (isset($this->config['extra']['branch-alias'])) {
  18102. if (!is_array($this->config['extra']['branch-alias'])) {
  18103. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  18104. } else {
  18105. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  18106. if ('-dev' !== substr($targetBranch, -4)) {
  18107. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  18108. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18109. continue;
  18110. }
  18111. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  18112. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  18113. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  18114. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18115. continue;
  18116. }
  18117. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  18118. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  18119. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  18120. ) {
  18121. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  18122. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18123. }
  18124. }
  18125. }
  18126. }
  18127. if ($this->errors) {
  18128. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  18129. }
  18130. $package = $this->loader->load($this->config, $class);
  18131. $this->config = null;
  18132. return $package;
  18133. }
  18134. public function getWarnings()
  18135. {
  18136. return $this->warnings;
  18137. }
  18138. public function getErrors()
  18139. {
  18140. return $this->errors;
  18141. }
  18142. public static function hasPackageNamingError($name, $isLink = false)
  18143. {
  18144. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  18145. return;
  18146. }
  18147. if (!preg_match('{^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*$}iD', $name)) {
  18148. return $name.' is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*".';
  18149. }
  18150. $reservedNames = array('nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9');
  18151. $bits = explode('/', strtolower($name));
  18152. if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
  18153. return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
  18154. }
  18155. if (preg_match('{\.json$}', $name)) {
  18156. return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
  18157. }
  18158. if (preg_match('{[A-Z]}', $name)) {
  18159. if ($isLink) {
  18160. return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
  18161. }
  18162. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  18163. $suggestName = strtolower($suggestName);
  18164. return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
  18165. }
  18166. }
  18167. private function validateRegex($property, $regex, $mandatory = false)
  18168. {
  18169. if (!$this->validateString($property, $mandatory)) {
  18170. return false;
  18171. }
  18172. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  18173. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  18174. if ($mandatory) {
  18175. $this->errors[] = $message;
  18176. } else {
  18177. $this->warnings[] = $message;
  18178. }
  18179. unset($this->config[$property]);
  18180. return false;
  18181. }
  18182. return true;
  18183. }
  18184. private function validateString($property, $mandatory = false)
  18185. {
  18186. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  18187. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  18188. unset($this->config[$property]);
  18189. return false;
  18190. }
  18191. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  18192. if ($mandatory) {
  18193. $this->errors[] = $property.' : must be present';
  18194. }
  18195. unset($this->config[$property]);
  18196. return false;
  18197. }
  18198. return true;
  18199. }
  18200. private function validateArray($property, $mandatory = false)
  18201. {
  18202. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  18203. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  18204. unset($this->config[$property]);
  18205. return false;
  18206. }
  18207. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  18208. if ($mandatory) {
  18209. $this->errors[] = $property.' : must be present and contain at least one element';
  18210. }
  18211. unset($this->config[$property]);
  18212. return false;
  18213. }
  18214. return true;
  18215. }
  18216. private function validateFlatArray($property, $regex = null, $mandatory = false)
  18217. {
  18218. if (!$this->validateArray($property, $mandatory)) {
  18219. return false;
  18220. }
  18221. $pass = true;
  18222. foreach ($this->config[$property] as $key => $value) {
  18223. if (!is_string($value) && !is_numeric($value)) {
  18224. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  18225. unset($this->config[$property][$key]);
  18226. $pass = false;
  18227. continue;
  18228. }
  18229. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  18230. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  18231. unset($this->config[$property][$key]);
  18232. $pass = false;
  18233. }
  18234. }
  18235. return $pass;
  18236. }
  18237. private function validateUrl($property, $mandatory = false)
  18238. {
  18239. if (!$this->validateString($property, $mandatory)) {
  18240. return false;
  18241. }
  18242. if (!$this->filterUrl($this->config[$property])) {
  18243. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  18244. unset($this->config[$property]);
  18245. return false;
  18246. }
  18247. return true;
  18248. }
  18249. private function filterUrl($value, array $schemes = array('http', 'https'))
  18250. {
  18251. if ($value === '') {
  18252. return true;
  18253. }
  18254. $bits = parse_url($value);
  18255. if (empty($bits['scheme']) || empty($bits['host'])) {
  18256. return false;
  18257. }
  18258. if (!in_array($bits['scheme'], $schemes, true)) {
  18259. return false;
  18260. }
  18261. return true;
  18262. }
  18263. }
  18264. <?php
  18265. namespace Composer\Package;
  18266. use Composer\Json\JsonFile;
  18267. use Composer\Installer\InstallationManager;
  18268. use Composer\Repository\RepositoryManager;
  18269. use Composer\Util\ProcessExecutor;
  18270. use Composer\Repository\ArrayRepository;
  18271. use Composer\Package\Dumper\ArrayDumper;
  18272. use Composer\Package\Loader\ArrayLoader;
  18273. use Composer\Util\Git as GitUtil;
  18274. use Composer\IO\IOInterface;
  18275. use Seld\JsonLint\ParsingException;
  18276. class Locker
  18277. {
  18278. private $lockFile;
  18279. private $repositoryManager;
  18280. private $installationManager;
  18281. private $hash;
  18282. private $contentHash;
  18283. private $loader;
  18284. private $dumper;
  18285. private $process;
  18286. private $lockDataCache;
  18287. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  18288. {
  18289. $this->lockFile = $lockFile;
  18290. $this->repositoryManager = $repositoryManager;
  18291. $this->installationManager = $installationManager;
  18292. $this->hash = md5($composerFileContents);
  18293. $this->contentHash = self::getContentHash($composerFileContents);
  18294. $this->loader = new ArrayLoader(null, true);
  18295. $this->dumper = new ArrayDumper();
  18296. $this->process = new ProcessExecutor($io);
  18297. }
  18298. public static function getContentHash($composerFileContents)
  18299. {
  18300. $content = json_decode($composerFileContents, true);
  18301. $relevantKeys = array(
  18302. 'name',
  18303. 'version',
  18304. 'require',
  18305. 'require-dev',
  18306. 'conflict',
  18307. 'replace',
  18308. 'provide',
  18309. 'minimum-stability',
  18310. 'prefer-stable',
  18311. 'repositories',
  18312. 'extra',
  18313. );
  18314. $relevantContent = array();
  18315. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  18316. $relevantContent[$key] = $content[$key];
  18317. }
  18318. if (isset($content['config']['platform'])) {
  18319. $relevantContent['config']['platform'] = $content['config']['platform'];
  18320. }
  18321. ksort($relevantContent);
  18322. return md5(json_encode($relevantContent));
  18323. }
  18324. public function isLocked()
  18325. {
  18326. if (!$this->lockFile->exists()) {
  18327. return false;
  18328. }
  18329. $data = $this->getLockData();
  18330. return isset($data['packages']);
  18331. }
  18332. public function isFresh()
  18333. {
  18334. $lock = $this->lockFile->read();
  18335. if (!empty($lock['content-hash'])) {
  18336. return $this->contentHash === $lock['content-hash'];
  18337. }
  18338. if (!empty($lock['hash'])) {
  18339. return $this->hash === $lock['hash'];
  18340. }
  18341. return false;
  18342. }
  18343. public function getLockedRepository($withDevReqs = false)
  18344. {
  18345. $lockData = $this->getLockData();
  18346. $packages = new ArrayRepository();
  18347. $lockedPackages = $lockData['packages'];
  18348. if ($withDevReqs) {
  18349. if (isset($lockData['packages-dev'])) {
  18350. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  18351. } else {
  18352. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.');
  18353. }
  18354. }
  18355. if (empty($lockedPackages)) {
  18356. return $packages;
  18357. }
  18358. if (isset($lockedPackages[0]['name'])) {
  18359. foreach ($lockedPackages as $info) {
  18360. $packages->addPackage($this->loader->load($info));
  18361. }
  18362. return $packages;
  18363. }
  18364. throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
  18365. }
  18366. public function getPlatformRequirements($withDevReqs = false)
  18367. {
  18368. $lockData = $this->getLockData();
  18369. $requirements = array();
  18370. if (!empty($lockData['platform'])) {
  18371. $requirements = $this->loader->parseLinks(
  18372. '__ROOT__',
  18373. '1.0.0',
  18374. 'requires',
  18375. isset($lockData['platform']) ? $lockData['platform'] : array()
  18376. );
  18377. }
  18378. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  18379. $devRequirements = $this->loader->parseLinks(
  18380. '__ROOT__',
  18381. '1.0.0',
  18382. 'requires',
  18383. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  18384. );
  18385. $requirements = array_merge($requirements, $devRequirements);
  18386. }
  18387. return $requirements;
  18388. }
  18389. public function getMinimumStability()
  18390. {
  18391. $lockData = $this->getLockData();
  18392. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  18393. }
  18394. public function getStabilityFlags()
  18395. {
  18396. $lockData = $this->getLockData();
  18397. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  18398. }
  18399. public function getPreferStable()
  18400. {
  18401. $lockData = $this->getLockData();
  18402. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  18403. }
  18404. public function getPreferLowest()
  18405. {
  18406. $lockData = $this->getLockData();
  18407. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  18408. }
  18409. public function getPlatformOverrides()
  18410. {
  18411. $lockData = $this->getLockData();
  18412. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  18413. }
  18414. public function getAliases()
  18415. {
  18416. $lockData = $this->getLockData();
  18417. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  18418. }
  18419. public function getLockData()
  18420. {
  18421. if (null !== $this->lockDataCache) {
  18422. return $this->lockDataCache;
  18423. }
  18424. if (!$this->lockFile->exists()) {
  18425. throw new \LogicException('No lockfile found. Unable to read locked packages');
  18426. }
  18427. return $this->lockDataCache = $this->lockFile->read();
  18428. }
  18429. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  18430. {
  18431. $lock = array(
  18432. '_readme' => array('This file locks the dependencies of your project to a known state',
  18433. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  18434. 'This file is @gener'.'ated automatically', ),
  18435. 'content-hash' => $this->contentHash,
  18436. 'packages' => null,
  18437. 'packages-dev' => null,
  18438. 'aliases' => array(),
  18439. 'minimum-stability' => $minimumStability,
  18440. 'stability-flags' => $stabilityFlags,
  18441. 'prefer-stable' => $preferStable,
  18442. 'prefer-lowest' => $preferLowest,
  18443. );
  18444. foreach ($aliases as $package => $versions) {
  18445. foreach ($versions as $version => $alias) {
  18446. $lock['aliases'][] = array(
  18447. 'alias' => $alias['alias'],
  18448. 'alias_normalized' => $alias['alias_normalized'],
  18449. 'version' => $version,
  18450. 'package' => $package,
  18451. );
  18452. }
  18453. }
  18454. $lock['packages'] = $this->lockPackages($packages);
  18455. if (null !== $devPackages) {
  18456. $lock['packages-dev'] = $this->lockPackages($devPackages);
  18457. }
  18458. $lock['platform'] = $platformReqs;
  18459. $lock['platform-dev'] = $platformDevReqs;
  18460. if ($platformOverrides) {
  18461. $lock['platform-overrides'] = $platformOverrides;
  18462. }
  18463. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  18464. if ($this->lockFile->exists()) {
  18465. unlink($this->lockFile->getPath());
  18466. }
  18467. return false;
  18468. }
  18469. try {
  18470. $isLocked = $this->isLocked();
  18471. } catch (ParsingException $e) {
  18472. $isLocked = false;
  18473. }
  18474. if (!$isLocked || $lock !== $this->getLockData()) {
  18475. $this->lockFile->write($lock);
  18476. $this->lockDataCache = null;
  18477. return true;
  18478. }
  18479. return false;
  18480. }
  18481. private function lockPackages(array $packages)
  18482. {
  18483. $locked = array();
  18484. foreach ($packages as $package) {
  18485. if ($package instanceof AliasPackage) {
  18486. continue;
  18487. }
  18488. $name = $package->getPrettyName();
  18489. $version = $package->getPrettyVersion();
  18490. if (!$name || !$version) {
  18491. throw new \LogicException(sprintf(
  18492. 'Package "%s" has no version or name and can not be locked',
  18493. $package
  18494. ));
  18495. }
  18496. $spec = $this->dumper->dump($package);
  18497. unset($spec['version_normalized']);
  18498. $time = isset($spec['time']) ? $spec['time'] : null;
  18499. unset($spec['time']);
  18500. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  18501. $time = $this->getPackageTime($package) ?: $time;
  18502. }
  18503. if (null !== $time) {
  18504. $spec['time'] = $time;
  18505. }
  18506. unset($spec['installation-source']);
  18507. $locked[] = $spec;
  18508. }
  18509. usort($locked, function ($a, $b) {
  18510. $comparison = strcmp($a['name'], $b['name']);
  18511. if (0 !== $comparison) {
  18512. return $comparison;
  18513. }
  18514. return strcmp($a['version'], $b['version']);
  18515. });
  18516. return $locked;
  18517. }
  18518. private function getPackageTime(PackageInterface $package)
  18519. {
  18520. if (!function_exists('proc_open')) {
  18521. return null;
  18522. }
  18523. $path = realpath($this->installationManager->getInstallPath($package));
  18524. $sourceType = $package->getSourceType();
  18525. $datetime = null;
  18526. if ($path && in_array($sourceType, array('git', 'hg'))) {
  18527. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  18528. switch ($sourceType) {
  18529. case 'git':
  18530. GitUtil::cleanEnv();
  18531. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  18532. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  18533. }
  18534. break;
  18535. case 'hg':
  18536. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  18537. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  18538. }
  18539. break;
  18540. }
  18541. }
  18542. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  18543. }
  18544. }
  18545. <?php
  18546. namespace Composer\Package;
  18547. use Composer\Package\Version\VersionParser;
  18548. use Composer\Util\ComposerMirror;
  18549. class Package extends BasePackage
  18550. {
  18551. protected $type;
  18552. protected $targetDir;
  18553. protected $installationSource;
  18554. protected $sourceType;
  18555. protected $sourceUrl;
  18556. protected $sourceReference;
  18557. protected $sourceMirrors;
  18558. protected $distType;
  18559. protected $distUrl;
  18560. protected $distReference;
  18561. protected $distSha1Checksum;
  18562. protected $distMirrors;
  18563. protected $version;
  18564. protected $prettyVersion;
  18565. protected $releaseDate;
  18566. protected $extra = array();
  18567. protected $binaries = array();
  18568. protected $dev;
  18569. protected $stability;
  18570. protected $notificationUrl;
  18571. protected $requires = array();
  18572. protected $conflicts = array();
  18573. protected $provides = array();
  18574. protected $replaces = array();
  18575. protected $devRequires = array();
  18576. protected $suggests = array();
  18577. protected $autoload = array();
  18578. protected $devAutoload = array();
  18579. protected $includePaths = array();
  18580. protected $archiveExcludes = array();
  18581. public function __construct($name, $version, $prettyVersion)
  18582. {
  18583. parent::__construct($name);
  18584. $this->version = $version;
  18585. $this->prettyVersion = $prettyVersion;
  18586. $this->stability = VersionParser::parseStability($version);
  18587. $this->dev = $this->stability === 'dev';
  18588. }
  18589. public function isDev()
  18590. {
  18591. return $this->dev;
  18592. }
  18593. public function setType($type)
  18594. {
  18595. $this->type = $type;
  18596. }
  18597. public function getType()
  18598. {
  18599. return $this->type ?: 'library';
  18600. }
  18601. public function getStability()
  18602. {
  18603. return $this->stability;
  18604. }
  18605. public function setTargetDir($targetDir)
  18606. {
  18607. $this->targetDir = $targetDir;
  18608. }
  18609. public function getTargetDir()
  18610. {
  18611. if (null === $this->targetDir) {
  18612. return;
  18613. }
  18614. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  18615. }
  18616. public function setExtra(array $extra)
  18617. {
  18618. $this->extra = $extra;
  18619. }
  18620. public function getExtra()
  18621. {
  18622. return $this->extra;
  18623. }
  18624. public function setBinaries(array $binaries)
  18625. {
  18626. $this->binaries = $binaries;
  18627. }
  18628. public function getBinaries()
  18629. {
  18630. return $this->binaries;
  18631. }
  18632. public function setInstallationSource($type)
  18633. {
  18634. $this->installationSource = $type;
  18635. }
  18636. public function getInstallationSource()
  18637. {
  18638. return $this->installationSource;
  18639. }
  18640. public function setSourceType($type)
  18641. {
  18642. $this->sourceType = $type;
  18643. }
  18644. public function getSourceType()
  18645. {
  18646. return $this->sourceType;
  18647. }
  18648. public function setSourceUrl($url)
  18649. {
  18650. $this->sourceUrl = $url;
  18651. }
  18652. public function getSourceUrl()
  18653. {
  18654. return $this->sourceUrl;
  18655. }
  18656. public function setSourceReference($reference)
  18657. {
  18658. $this->sourceReference = $reference;
  18659. }
  18660. public function getSourceReference()
  18661. {
  18662. return $this->sourceReference;
  18663. }
  18664. public function setSourceMirrors($mirrors)
  18665. {
  18666. $this->sourceMirrors = $mirrors;
  18667. }
  18668. public function getSourceMirrors()
  18669. {
  18670. return $this->sourceMirrors;
  18671. }
  18672. public function getSourceUrls()
  18673. {
  18674. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  18675. }
  18676. public function setDistType($type)
  18677. {
  18678. $this->distType = $type;
  18679. }
  18680. public function getDistType()
  18681. {
  18682. return $this->distType;
  18683. }
  18684. public function setDistUrl($url)
  18685. {
  18686. $this->distUrl = $url;
  18687. }
  18688. public function getDistUrl()
  18689. {
  18690. return $this->distUrl;
  18691. }
  18692. public function setDistReference($reference)
  18693. {
  18694. $this->distReference = $reference;
  18695. }
  18696. public function getDistReference()
  18697. {
  18698. return $this->distReference;
  18699. }
  18700. public function setDistSha1Checksum($sha1checksum)
  18701. {
  18702. $this->distSha1Checksum = $sha1checksum;
  18703. }
  18704. public function getDistSha1Checksum()
  18705. {
  18706. return $this->distSha1Checksum;
  18707. }
  18708. public function setDistMirrors($mirrors)
  18709. {
  18710. $this->distMirrors = $mirrors;
  18711. }
  18712. public function getDistMirrors()
  18713. {
  18714. return $this->distMirrors;
  18715. }
  18716. public function getDistUrls()
  18717. {
  18718. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  18719. }
  18720. public function getVersion()
  18721. {
  18722. return $this->version;
  18723. }
  18724. public function getPrettyVersion()
  18725. {
  18726. return $this->prettyVersion;
  18727. }
  18728. public function setReleaseDate(\DateTime $releaseDate)
  18729. {
  18730. $this->releaseDate = $releaseDate;
  18731. }
  18732. public function getReleaseDate()
  18733. {
  18734. return $this->releaseDate;
  18735. }
  18736. public function setRequires(array $requires)
  18737. {
  18738. $this->requires = $requires;
  18739. }
  18740. public function getRequires()
  18741. {
  18742. return $this->requires;
  18743. }
  18744. public function setConflicts(array $conflicts)
  18745. {
  18746. $this->conflicts = $conflicts;
  18747. }
  18748. public function getConflicts()
  18749. {
  18750. return $this->conflicts;
  18751. }
  18752. public function setProvides(array $provides)
  18753. {
  18754. $this->provides = $provides;
  18755. }
  18756. public function getProvides()
  18757. {
  18758. return $this->provides;
  18759. }
  18760. public function setReplaces(array $replaces)
  18761. {
  18762. $this->replaces = $replaces;
  18763. }
  18764. public function getReplaces()
  18765. {
  18766. return $this->replaces;
  18767. }
  18768. public function setDevRequires(array $devRequires)
  18769. {
  18770. $this->devRequires = $devRequires;
  18771. }
  18772. public function getDevRequires()
  18773. {
  18774. return $this->devRequires;
  18775. }
  18776. public function setSuggests(array $suggests)
  18777. {
  18778. $this->suggests = $suggests;
  18779. }
  18780. public function getSuggests()
  18781. {
  18782. return $this->suggests;
  18783. }
  18784. public function setAutoload(array $autoload)
  18785. {
  18786. $this->autoload = $autoload;
  18787. }
  18788. public function getAutoload()
  18789. {
  18790. return $this->autoload;
  18791. }
  18792. public function setDevAutoload(array $devAutoload)
  18793. {
  18794. $this->devAutoload = $devAutoload;
  18795. }
  18796. public function getDevAutoload()
  18797. {
  18798. return $this->devAutoload;
  18799. }
  18800. public function setIncludePaths(array $includePaths)
  18801. {
  18802. $this->includePaths = $includePaths;
  18803. }
  18804. public function getIncludePaths()
  18805. {
  18806. return $this->includePaths;
  18807. }
  18808. public function setNotificationUrl($notificationUrl)
  18809. {
  18810. $this->notificationUrl = $notificationUrl;
  18811. }
  18812. public function getNotificationUrl()
  18813. {
  18814. return $this->notificationUrl;
  18815. }
  18816. public function setArchiveExcludes(array $excludes)
  18817. {
  18818. $this->archiveExcludes = $excludes;
  18819. }
  18820. public function getArchiveExcludes()
  18821. {
  18822. return $this->archiveExcludes;
  18823. }
  18824. public function replaceVersion($version, $prettyVersion)
  18825. {
  18826. $this->version = $version;
  18827. $this->prettyVersion = $prettyVersion;
  18828. $this->stability = VersionParser::parseStability($version);
  18829. $this->dev = $this->stability === 'dev';
  18830. }
  18831. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  18832. {
  18833. if (!$url) {
  18834. return array();
  18835. }
  18836. $urls = array($url);
  18837. if ($mirrors) {
  18838. foreach ($mirrors as $mirror) {
  18839. if ($urlType === 'dist') {
  18840. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  18841. } elseif ($urlType === 'source' && $type === 'git') {
  18842. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  18843. } elseif ($urlType === 'source' && $type === 'hg') {
  18844. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  18845. }
  18846. if (!in_array($mirrorUrl, $urls)) {
  18847. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  18848. $func($urls, $mirrorUrl);
  18849. }
  18850. }
  18851. }
  18852. return $urls;
  18853. }
  18854. }
  18855. <?php
  18856. namespace Composer\Package;
  18857. use Composer\Repository\RepositoryInterface;
  18858. interface PackageInterface
  18859. {
  18860. public function getName();
  18861. public function getPrettyName();
  18862. public function getNames();
  18863. public function setId($id);
  18864. public function getId();
  18865. public function isDev();
  18866. public function getType();
  18867. public function getTargetDir();
  18868. public function getExtra();
  18869. public function setInstallationSource($type);
  18870. public function getInstallationSource();
  18871. public function getSourceType();
  18872. public function getSourceUrl();
  18873. public function getSourceUrls();
  18874. public function getSourceReference();
  18875. public function getSourceMirrors();
  18876. public function getDistType();
  18877. public function getDistUrl();
  18878. public function getDistUrls();
  18879. public function getDistReference();
  18880. public function getDistSha1Checksum();
  18881. public function getDistMirrors();
  18882. public function getVersion();
  18883. public function getPrettyVersion();
  18884. public function getFullPrettyVersion($truncate = true);
  18885. public function getReleaseDate();
  18886. public function getStability();
  18887. public function getRequires();
  18888. public function getConflicts();
  18889. public function getProvides();
  18890. public function getReplaces();
  18891. public function getDevRequires();
  18892. public function getSuggests();
  18893. public function getAutoload();
  18894. public function getDevAutoload();
  18895. public function getIncludePaths();
  18896. public function setRepository(RepositoryInterface $repository);
  18897. public function getRepository();
  18898. public function getBinaries();
  18899. public function getUniqueName();
  18900. public function getNotificationUrl();
  18901. public function __toString();
  18902. public function getPrettyString();
  18903. public function getArchiveExcludes();
  18904. public function getTransportOptions();
  18905. }
  18906. <?php
  18907. namespace Composer\Package;
  18908. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  18909. {
  18910. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  18911. {
  18912. parent::__construct($aliasOf, $version, $prettyVersion);
  18913. }
  18914. public function getAliases()
  18915. {
  18916. return $this->aliasOf->getAliases();
  18917. }
  18918. public function getMinimumStability()
  18919. {
  18920. return $this->aliasOf->getMinimumStability();
  18921. }
  18922. public function getStabilityFlags()
  18923. {
  18924. return $this->aliasOf->getStabilityFlags();
  18925. }
  18926. public function getReferences()
  18927. {
  18928. return $this->aliasOf->getReferences();
  18929. }
  18930. public function getPreferStable()
  18931. {
  18932. return $this->aliasOf->getPreferStable();
  18933. }
  18934. public function getConfig()
  18935. {
  18936. return $this->aliasOf->getConfig();
  18937. }
  18938. public function setRequires(array $require)
  18939. {
  18940. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  18941. $this->aliasOf->setRequires($require);
  18942. }
  18943. public function setDevRequires(array $devRequire)
  18944. {
  18945. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  18946. $this->aliasOf->setDevRequires($devRequire);
  18947. }
  18948. public function setConflicts(array $conflicts)
  18949. {
  18950. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  18951. $this->aliasOf->setConflicts($conflicts);
  18952. }
  18953. public function setProvides(array $provides)
  18954. {
  18955. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  18956. $this->aliasOf->setProvides($provides);
  18957. }
  18958. public function setReplaces(array $replaces)
  18959. {
  18960. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  18961. $this->aliasOf->setReplaces($replaces);
  18962. }
  18963. public function setRepositories($repositories)
  18964. {
  18965. $this->aliasOf->setRepositories($repositories);
  18966. }
  18967. public function setAutoload(array $autoload)
  18968. {
  18969. $this->aliasOf->setAutoload($autoload);
  18970. }
  18971. public function setDevAutoload(array $devAutoload)
  18972. {
  18973. $this->aliasOf->setDevAutoload($devAutoload);
  18974. }
  18975. public function setStabilityFlags(array $stabilityFlags)
  18976. {
  18977. $this->aliasOf->setStabilityFlags($stabilityFlags);
  18978. }
  18979. public function setSuggests(array $suggests)
  18980. {
  18981. $this->aliasOf->setSuggests($suggests);
  18982. }
  18983. public function setExtra(array $extra)
  18984. {
  18985. $this->aliasOf->setExtra($extra);
  18986. }
  18987. public function __clone()
  18988. {
  18989. parent::__clone();
  18990. $this->aliasOf = clone $this->aliasOf;
  18991. }
  18992. }
  18993. <?php
  18994. namespace Composer\Package;
  18995. class RootPackage extends CompletePackage implements RootPackageInterface
  18996. {
  18997. protected $minimumStability = 'stable';
  18998. protected $preferStable = false;
  18999. protected $stabilityFlags = array();
  19000. protected $config = array();
  19001. protected $references = array();
  19002. protected $aliases = array();
  19003. public function setMinimumStability($minimumStability)
  19004. {
  19005. $this->minimumStability = $minimumStability;
  19006. }
  19007. public function getMinimumStability()
  19008. {
  19009. return $this->minimumStability;
  19010. }
  19011. public function setStabilityFlags(array $stabilityFlags)
  19012. {
  19013. $this->stabilityFlags = $stabilityFlags;
  19014. }
  19015. public function getStabilityFlags()
  19016. {
  19017. return $this->stabilityFlags;
  19018. }
  19019. public function setPreferStable($preferStable)
  19020. {
  19021. $this->preferStable = $preferStable;
  19022. }
  19023. public function getPreferStable()
  19024. {
  19025. return $this->preferStable;
  19026. }
  19027. public function setConfig(array $config)
  19028. {
  19029. $this->config = $config;
  19030. }
  19031. public function getConfig()
  19032. {
  19033. return $this->config;
  19034. }
  19035. public function setReferences(array $references)
  19036. {
  19037. $this->references = $references;
  19038. }
  19039. public function getReferences()
  19040. {
  19041. return $this->references;
  19042. }
  19043. public function setAliases(array $aliases)
  19044. {
  19045. $this->aliases = $aliases;
  19046. }
  19047. public function getAliases()
  19048. {
  19049. return $this->aliases;
  19050. }
  19051. }
  19052. <?php
  19053. namespace Composer\Package;
  19054. interface RootPackageInterface extends CompletePackageInterface
  19055. {
  19056. public function getAliases();
  19057. public function getMinimumStability();
  19058. public function getStabilityFlags();
  19059. public function getReferences();
  19060. public function getPreferStable();
  19061. public function getConfig();
  19062. public function setRequires(array $requires);
  19063. public function setDevRequires(array $devRequires);
  19064. public function setConflicts(array $conflicts);
  19065. public function setProvides(array $provides);
  19066. public function setReplaces(array $replaces);
  19067. public function setRepositories($repositories);
  19068. public function setAutoload(array $autoload);
  19069. public function setDevAutoload(array $devAutoload);
  19070. public function setStabilityFlags(array $stabilityFlags);
  19071. public function setSuggests(array $suggests);
  19072. public function setExtra(array $extra);
  19073. }
  19074. <?php
  19075. namespace Composer\Package\Version;
  19076. use Composer\Config;
  19077. use Composer\Repository\Vcs\HgDriver;
  19078. use Composer\IO\NullIO;
  19079. use Composer\Semver\VersionParser as SemverVersionParser;
  19080. use Composer\Util\Git as GitUtil;
  19081. use Composer\Util\ProcessExecutor;
  19082. use Composer\Util\Svn as SvnUtil;
  19083. class VersionGuesser
  19084. {
  19085. private $config;
  19086. private $process;
  19087. private $versionParser;
  19088. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  19089. {
  19090. $this->config = $config;
  19091. $this->process = $process;
  19092. $this->versionParser = $versionParser;
  19093. }
  19094. public function guessVersion(array $packageConfig, $path)
  19095. {
  19096. if (function_exists('proc_open')) {
  19097. $versionData = $this->guessGitVersion($packageConfig, $path);
  19098. if (null !== $versionData && null !== $versionData['version']) {
  19099. return $this->postprocess($versionData);
  19100. }
  19101. $versionData = $this->guessHgVersion($packageConfig, $path);
  19102. if (null !== $versionData && null !== $versionData['version']) {
  19103. return $this->postprocess($versionData);
  19104. }
  19105. $versionData = $this->guessFossilVersion($packageConfig, $path);
  19106. if (null !== $versionData && null !== $versionData['version']) {
  19107. return $this->postprocess($versionData);
  19108. }
  19109. $versionData = $this->guessSvnVersion($packageConfig, $path);
  19110. if (null !== $versionData && null !== $versionData['version']) {
  19111. return $this->postprocess($versionData);
  19112. }
  19113. }
  19114. }
  19115. private function postprocess(array $versionData)
  19116. {
  19117. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  19118. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  19119. }
  19120. return $versionData;
  19121. }
  19122. private function guessGitVersion(array $packageConfig, $path)
  19123. {
  19124. GitUtil::cleanEnv();
  19125. $commit = null;
  19126. $version = null;
  19127. $prettyVersion = null;
  19128. $isDetached = false;
  19129. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  19130. $branches = array();
  19131. $isFeatureBranch = false;
  19132. foreach ($this->process->splitLines($output) as $branch) {
  19133. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  19134. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  19135. $version = 'dev-' . $match[2];
  19136. $prettyVersion = $version;
  19137. $isFeatureBranch = true;
  19138. $isDetached = true;
  19139. } else {
  19140. $version = $this->versionParser->normalizeBranch($match[1]);
  19141. $prettyVersion = 'dev-' . $match[1];
  19142. $isFeatureBranch = 0 === strpos($version, 'dev-');
  19143. }
  19144. if ($match[2]) {
  19145. $commit = $match[2];
  19146. }
  19147. }
  19148. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  19149. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  19150. $branches[] = $match[1];
  19151. }
  19152. }
  19153. }
  19154. if ($isFeatureBranch) {
  19155. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  19156. $version = $result['version'];
  19157. $prettyVersion = $result['pretty_version'];
  19158. }
  19159. }
  19160. if (!$version || $isDetached) {
  19161. $result = $this->versionFromGitTags($path);
  19162. if ($result) {
  19163. $version = $result['version'];
  19164. $prettyVersion = $result['pretty_version'];
  19165. }
  19166. }
  19167. if (!$commit) {
  19168. $command = 'git log --pretty="%H" -n1 HEAD';
  19169. if (0 === $this->process->execute($command, $output, $path)) {
  19170. $commit = trim($output) ?: null;
  19171. }
  19172. }
  19173. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  19174. }
  19175. private function versionFromGitTags($path)
  19176. {
  19177. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  19178. try {
  19179. $version = $this->versionParser->normalize(trim($output));
  19180. return array('version' => $version, 'pretty_version' => trim($output));
  19181. } catch (\Exception $e) {
  19182. }
  19183. }
  19184. return null;
  19185. }
  19186. private function guessHgVersion(array $packageConfig, $path)
  19187. {
  19188. if (0 === $this->process->execute('hg branch', $output, $path)) {
  19189. $branch = trim($output);
  19190. $version = $this->versionParser->normalizeBranch($branch);
  19191. $isFeatureBranch = 0 === strpos($version, 'dev-');
  19192. if ('9999999-dev' === $version) {
  19193. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  19194. }
  19195. if (!$isFeatureBranch) {
  19196. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  19197. }
  19198. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  19199. $branches = array_keys($driver->getBranches());
  19200. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  19201. $result['commit'] = '';
  19202. return $result;
  19203. }
  19204. }
  19205. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  19206. {
  19207. $prettyVersion = $version;
  19208. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  19209. || strpos(json_encode($packageConfig), '"self.version"')
  19210. ) {
  19211. $branch = preg_replace('{^dev-}', '', $version);
  19212. $length = PHP_INT_MAX;
  19213. $nonFeatureBranches = '';
  19214. if (!empty($packageConfig['non-feature-branches'])) {
  19215. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  19216. }
  19217. foreach ($branches as $candidate) {
  19218. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  19219. break;
  19220. }
  19221. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  19222. continue;
  19223. }
  19224. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  19225. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  19226. continue;
  19227. }
  19228. if (strlen($output) < $length) {
  19229. $length = strlen($output);
  19230. $version = $this->versionParser->normalizeBranch($candidate);
  19231. $prettyVersion = 'dev-' . $match[1];
  19232. }
  19233. }
  19234. }
  19235. return array('version' => $version, 'pretty_version' => $prettyVersion);
  19236. }
  19237. private function guessFossilVersion(array $packageConfig, $path)
  19238. {
  19239. $version = null;
  19240. $prettyVersion = null;
  19241. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  19242. $branch = trim($output);
  19243. $version = $this->versionParser->normalizeBranch($branch);
  19244. $prettyVersion = 'dev-' . $branch;
  19245. }
  19246. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  19247. try {
  19248. $version = $this->versionParser->normalize(trim($output));
  19249. $prettyVersion = trim($output);
  19250. } catch (\Exception $e) {
  19251. }
  19252. }
  19253. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19254. }
  19255. private function guessSvnVersion(array $packageConfig, $path)
  19256. {
  19257. SvnUtil::cleanEnv();
  19258. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  19259. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  19260. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  19261. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  19262. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  19263. if (preg_match($urlPattern, $output, $matches)) {
  19264. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  19265. $version = $this->versionParser->normalizeBranch($matches[3]);
  19266. $prettyVersion = 'dev-' . $matches[3];
  19267. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19268. }
  19269. $prettyVersion = trim($matches[1]);
  19270. $version = $this->versionParser->normalize($prettyVersion);
  19271. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19272. }
  19273. }
  19274. }
  19275. }
  19276. <?php
  19277. namespace Composer\Package\Version;
  19278. use Composer\Repository\PlatformRepository;
  19279. use Composer\Semver\VersionParser as SemverVersionParser;
  19280. use Composer\Semver\Semver;
  19281. class VersionParser extends SemverVersionParser
  19282. {
  19283. private static $constraints = array();
  19284. public function parseConstraints($constraints)
  19285. {
  19286. if (!isset(self::$constraints[$constraints])) {
  19287. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  19288. }
  19289. return self::$constraints[$constraints];
  19290. }
  19291. public function parseNameVersionPairs(array $pairs)
  19292. {
  19293. $pairs = array_values($pairs);
  19294. $result = array();
  19295. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  19296. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  19297. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  19298. $pair .= ' '.$pairs[$i + 1];
  19299. $i++;
  19300. }
  19301. if (strpos($pair, ' ')) {
  19302. list($name, $version) = explode(' ', $pair, 2);
  19303. $result[] = array('name' => $name, 'version' => $version);
  19304. } else {
  19305. $result[] = array('name' => $pair);
  19306. }
  19307. }
  19308. return $result;
  19309. }
  19310. public static function isUpgrade($normalizedFrom, $normalizedTo)
  19311. {
  19312. if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') {
  19313. return true;
  19314. }
  19315. $sorted = Semver::sort(array($normalizedTo, $normalizedFrom));
  19316. return $sorted[0] === $normalizedFrom;
  19317. }
  19318. }
  19319. <?php
  19320. namespace Composer\Package\Version;
  19321. use Composer\DependencyResolver\Pool;
  19322. use Composer\Package\BasePackage;
  19323. use Composer\Package\PackageInterface;
  19324. use Composer\Package\Loader\ArrayLoader;
  19325. use Composer\Package\Dumper\ArrayDumper;
  19326. use Composer\Semver\Constraint\Constraint;
  19327. class VersionSelector
  19328. {
  19329. private $pool;
  19330. private $parser;
  19331. public function __construct(Pool $pool)
  19332. {
  19333. $this->pool = $pool;
  19334. }
  19335. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  19336. {
  19337. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  19338. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  19339. if ($targetPhpVersion) {
  19340. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  19341. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  19342. $reqs = $pkg->getRequires();
  19343. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  19344. });
  19345. }
  19346. if (!$candidates) {
  19347. return false;
  19348. }
  19349. $package = reset($candidates);
  19350. $minPriority = BasePackage::$stabilities[$preferredStability];
  19351. foreach ($candidates as $candidate) {
  19352. $candidatePriority = $candidate->getStabilityPriority();
  19353. $currentPriority = $package->getStabilityPriority();
  19354. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  19355. continue;
  19356. }
  19357. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  19358. $package = $candidate;
  19359. continue;
  19360. }
  19361. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  19362. $package = $candidate;
  19363. continue;
  19364. }
  19365. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  19366. $package = $candidate;
  19367. }
  19368. }
  19369. return $package;
  19370. }
  19371. public function findRecommendedRequireVersion(PackageInterface $package)
  19372. {
  19373. $version = $package->getVersion();
  19374. if (!$package->isDev()) {
  19375. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  19376. }
  19377. $loader = new ArrayLoader($this->getParser());
  19378. $dumper = new ArrayDumper();
  19379. $extra = $loader->getBranchAlias($dumper->dump($package));
  19380. if ($extra) {
  19381. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  19382. if ($count) {
  19383. $extra = str_replace('.9999999', '.0', $extra);
  19384. return $this->transformVersion($extra, $extra, 'dev');
  19385. }
  19386. }
  19387. return $package->getPrettyVersion();
  19388. }
  19389. private function transformVersion($version, $prettyVersion, $stability)
  19390. {
  19391. $semanticVersionParts = explode('.', $version);
  19392. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  19393. if ($semanticVersionParts[0] === '0') {
  19394. unset($semanticVersionParts[3]);
  19395. } else {
  19396. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  19397. }
  19398. $version = implode('.', $semanticVersionParts);
  19399. } else {
  19400. return $prettyVersion;
  19401. }
  19402. if ($stability != 'stable') {
  19403. $version .= '@'.$stability;
  19404. }
  19405. return '^' . $version;
  19406. }
  19407. private function getParser()
  19408. {
  19409. if ($this->parser === null) {
  19410. $this->parser = new VersionParser();
  19411. }
  19412. return $this->parser;
  19413. }
  19414. }
  19415. <?php
  19416. namespace Composer\Plugin\Capability;
  19417. interface Capability
  19418. {
  19419. }
  19420. <?php
  19421. namespace Composer\Plugin\Capability;
  19422. interface CommandProvider extends Capability
  19423. {
  19424. public function getCommands();
  19425. }
  19426. <?php
  19427. namespace Composer\Plugin;
  19428. interface Capable
  19429. {
  19430. public function getCapabilities();
  19431. }
  19432. <?php
  19433. namespace Composer\Plugin;
  19434. use Composer\EventDispatcher\Event;
  19435. use Symfony\Component\Console\Input\InputInterface;
  19436. use Symfony\Component\Console\Output\OutputInterface;
  19437. class CommandEvent extends Event
  19438. {
  19439. private $commandName;
  19440. private $input;
  19441. private $output;
  19442. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  19443. {
  19444. parent::__construct($name, $args, $flags);
  19445. $this->commandName = $commandName;
  19446. $this->input = $input;
  19447. $this->output = $output;
  19448. }
  19449. public function getInput()
  19450. {
  19451. return $this->input;
  19452. }
  19453. public function getOutput()
  19454. {
  19455. return $this->output;
  19456. }
  19457. public function getCommandName()
  19458. {
  19459. return $this->commandName;
  19460. }
  19461. }
  19462. <?php
  19463. namespace Composer\Plugin;
  19464. class PluginEvents
  19465. {
  19466. const INIT = 'init';
  19467. const COMMAND = 'command';
  19468. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  19469. const PRE_COMMAND_RUN = 'pre-command-run';
  19470. }
  19471. <?php
  19472. namespace Composer\Plugin;
  19473. use Composer\Composer;
  19474. use Composer\IO\IOInterface;
  19475. interface PluginInterface
  19476. {
  19477. const PLUGIN_API_VERSION = '1.1.0';
  19478. public function activate(Composer $composer, IOInterface $io);
  19479. }
  19480. <?php
  19481. namespace Composer\Plugin;
  19482. use Composer\Composer;
  19483. use Composer\EventDispatcher\EventSubscriberInterface;
  19484. use Composer\IO\IOInterface;
  19485. use Composer\Package\Package;
  19486. use Composer\Package\Version\VersionParser;
  19487. use Composer\Repository\RepositoryInterface;
  19488. use Composer\Package\AliasPackage;
  19489. use Composer\Package\PackageInterface;
  19490. use Composer\Package\Link;
  19491. use Composer\Semver\Constraint\Constraint;
  19492. use Composer\DependencyResolver\Pool;
  19493. use Composer\Plugin\Capability\Capability;
  19494. class PluginManager
  19495. {
  19496. protected $composer;
  19497. protected $io;
  19498. protected $globalComposer;
  19499. protected $versionParser;
  19500. protected $disablePlugins = false;
  19501. protected $plugins = array();
  19502. protected $registeredPlugins = array();
  19503. private static $classCounter = 0;
  19504. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  19505. {
  19506. $this->io = $io;
  19507. $this->composer = $composer;
  19508. $this->globalComposer = $globalComposer;
  19509. $this->versionParser = new VersionParser();
  19510. $this->disablePlugins = $disablePlugins;
  19511. }
  19512. public function loadInstalledPlugins()
  19513. {
  19514. if ($this->disablePlugins) {
  19515. return;
  19516. }
  19517. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  19518. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19519. if ($repo) {
  19520. $this->loadRepository($repo);
  19521. }
  19522. if ($globalRepo) {
  19523. $this->loadRepository($globalRepo);
  19524. }
  19525. }
  19526. public function getPlugins()
  19527. {
  19528. return $this->plugins;
  19529. }
  19530. public function getGlobalComposer()
  19531. {
  19532. return $this->globalComposer;
  19533. }
  19534. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  19535. {
  19536. if ($this->disablePlugins) {
  19537. return;
  19538. }
  19539. if ($package->getType() === 'composer-plugin') {
  19540. $requiresComposer = null;
  19541. foreach ($package->getRequires() as $link) {
  19542. if ('composer-plugin-api' === $link->getTarget()) {
  19543. $requiresComposer = $link->getConstraint();
  19544. break;
  19545. }
  19546. }
  19547. if (!$requiresComposer) {
  19548. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  19549. }
  19550. $currentPluginApiVersion = $this->getPluginApiVersion();
  19551. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  19552. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  19553. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example).</warning>');
  19554. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  19555. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
  19556. return;
  19557. }
  19558. }
  19559. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  19560. if (in_array($package->getName(), $this->registeredPlugins)) {
  19561. return;
  19562. }
  19563. $extra = $package->getExtra();
  19564. if (empty($extra['class'])) {
  19565. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  19566. }
  19567. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  19568. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  19569. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19570. $pool = new Pool('dev');
  19571. $pool->addRepository($localRepo);
  19572. if ($globalRepo) {
  19573. $pool->addRepository($globalRepo);
  19574. }
  19575. $autoloadPackages = array($package->getName() => $package);
  19576. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  19577. $generator = $this->composer->getAutoloadGenerator();
  19578. $autoloads = array();
  19579. foreach ($autoloadPackages as $autoloadPackage) {
  19580. $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  19581. $autoloads[] = array($autoloadPackage, $downloadPath);
  19582. }
  19583. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  19584. $classLoader = $generator->createLoader($map);
  19585. $classLoader->register();
  19586. foreach ($classes as $class) {
  19587. if (class_exists($class, false)) {
  19588. $class = trim($class, '\\');
  19589. $path = $classLoader->findFile($class);
  19590. $code = file_get_contents($path);
  19591. $separatorPos = strrpos($class, '\\');
  19592. $className = $class;
  19593. if ($separatorPos) {
  19594. $className = substr($class, $separatorPos + 1);
  19595. }
  19596. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  19597. $code = str_replace('__FILE__', var_export($path, true), $code);
  19598. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  19599. $code = str_replace('__CLASS__', var_export($class, true), $code);
  19600. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  19601. eval($code);
  19602. $class .= '_composer_tmp'.self::$classCounter;
  19603. self::$classCounter++;
  19604. }
  19605. if ($oldInstallerPlugin) {
  19606. $installer = new $class($this->io, $this->composer);
  19607. $this->composer->getInstallationManager()->addInstaller($installer);
  19608. } elseif (class_exists($class)) {
  19609. $plugin = new $class();
  19610. $this->addPlugin($plugin);
  19611. $this->registeredPlugins[] = $package->getName();
  19612. } elseif ($failOnMissingClasses) {
  19613. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  19614. }
  19615. }
  19616. }
  19617. protected function getPluginApiVersion()
  19618. {
  19619. return PluginInterface::PLUGIN_API_VERSION;
  19620. }
  19621. public function addPlugin(PluginInterface $plugin)
  19622. {
  19623. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  19624. $this->plugins[] = $plugin;
  19625. $plugin->activate($this->composer, $this->io);
  19626. if ($plugin instanceof EventSubscriberInterface) {
  19627. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  19628. }
  19629. }
  19630. private function loadRepository(RepositoryInterface $repo)
  19631. {
  19632. foreach ($repo->getPackages() as $package) {
  19633. if ($package instanceof AliasPackage) {
  19634. continue;
  19635. }
  19636. if ('composer-plugin' === $package->getType()) {
  19637. $this->registerPackage($package);
  19638. } elseif ('composer-installer' === $package->getType()) {
  19639. $this->registerPackage($package);
  19640. }
  19641. }
  19642. }
  19643. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  19644. {
  19645. $requires = array_merge(
  19646. $package->getRequires(),
  19647. $package->getDevRequires()
  19648. );
  19649. foreach ($requires as $requireLink) {
  19650. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  19651. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  19652. $collected[$requiredPackage->getName()] = $requiredPackage;
  19653. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  19654. }
  19655. }
  19656. return $collected;
  19657. }
  19658. private function lookupInstalledPackage(Pool $pool, Link $link)
  19659. {
  19660. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  19661. return !empty($packages) ? $packages[0] : null;
  19662. }
  19663. private function getInstallPath(PackageInterface $package, $global = false)
  19664. {
  19665. if (!$global) {
  19666. return $this->composer->getInstallationManager()->getInstallPath($package);
  19667. }
  19668. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  19669. }
  19670. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  19671. {
  19672. if (!($plugin instanceof Capable)) {
  19673. return null;
  19674. }
  19675. $capabilities = (array) $plugin->getCapabilities();
  19676. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  19677. return trim($capabilities[$capability]);
  19678. }
  19679. if (
  19680. array_key_exists($capability, $capabilities)
  19681. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  19682. ) {
  19683. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  19684. }
  19685. }
  19686. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  19687. {
  19688. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  19689. if (!class_exists($capabilityClass)) {
  19690. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  19691. }
  19692. $ctorArgs['plugin'] = $plugin;
  19693. $capabilityObj = new $capabilityClass($ctorArgs);
  19694. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  19695. throw new \RuntimeException(
  19696. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  19697. );
  19698. }
  19699. return $capabilityObj;
  19700. }
  19701. }
  19702. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  19703. {
  19704. $capabilities = array();
  19705. foreach ($this->getPlugins() as $plugin) {
  19706. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  19707. $capabilities[] = $capability;
  19708. }
  19709. }
  19710. return $capabilities;
  19711. }
  19712. }
  19713. <?php
  19714. namespace Composer\Plugin;
  19715. use Composer\EventDispatcher\Event;
  19716. use Symfony\Component\Console\Input\InputInterface;
  19717. class PreCommandRunEvent extends Event
  19718. {
  19719. private $input;
  19720. private $command;
  19721. public function __construct($name, InputInterface $input, $command)
  19722. {
  19723. parent::__construct($name);
  19724. $this->input = $input;
  19725. $this->command = $command;
  19726. }
  19727. public function getInput()
  19728. {
  19729. return $this->input;
  19730. }
  19731. public function getCommand()
  19732. {
  19733. return $this->command;
  19734. }
  19735. }
  19736. <?php
  19737. namespace Composer\Plugin;
  19738. use Composer\EventDispatcher\Event;
  19739. use Composer\Util\RemoteFilesystem;
  19740. class PreFileDownloadEvent extends Event
  19741. {
  19742. private $rfs;
  19743. private $processedUrl;
  19744. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  19745. {
  19746. parent::__construct($name);
  19747. $this->rfs = $rfs;
  19748. $this->processedUrl = $processedUrl;
  19749. }
  19750. public function getRemoteFilesystem()
  19751. {
  19752. return $this->rfs;
  19753. }
  19754. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  19755. {
  19756. $this->rfs = $rfs;
  19757. }
  19758. public function getProcessedUrl()
  19759. {
  19760. return $this->processedUrl;
  19761. }
  19762. }
  19763. <?php
  19764. namespace Composer\Question;
  19765. use Symfony\Component\Console\Exception\InvalidArgumentException;
  19766. use Symfony\Component\Console\Question\Question;
  19767. class StrictConfirmationQuestion extends Question
  19768. {
  19769. private $trueAnswerRegex;
  19770. private $falseAnswerRegex;
  19771. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  19772. {
  19773. parent::__construct($question, (bool) $default);
  19774. $this->trueAnswerRegex = $trueAnswerRegex;
  19775. $this->falseAnswerRegex = $falseAnswerRegex;
  19776. $this->setNormalizer($this->getDefaultNormalizer());
  19777. $this->setValidator($this->getDefaultValidator());
  19778. }
  19779. private function getDefaultNormalizer()
  19780. {
  19781. $default = $this->getDefault();
  19782. $trueRegex = $this->trueAnswerRegex;
  19783. $falseRegex = $this->falseAnswerRegex;
  19784. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  19785. if (is_bool($answer)) {
  19786. return $answer;
  19787. }
  19788. if (empty($answer) && !empty($default)) {
  19789. return $default;
  19790. }
  19791. if (preg_match($trueRegex, $answer)) {
  19792. return true;
  19793. }
  19794. if (preg_match($falseRegex, $answer)) {
  19795. return false;
  19796. }
  19797. return null;
  19798. };
  19799. }
  19800. private function getDefaultValidator()
  19801. {
  19802. return function ($answer) {
  19803. if (!is_bool($answer)) {
  19804. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  19805. }
  19806. return $answer;
  19807. };
  19808. }
  19809. }
  19810. <?php
  19811. namespace Composer\Repository;
  19812. use Composer\Package\AliasPackage;
  19813. use Composer\Package\PackageInterface;
  19814. use Composer\Package\CompletePackageInterface;
  19815. use Composer\Package\Version\VersionParser;
  19816. use Composer\Semver\Constraint\ConstraintInterface;
  19817. use Composer\Semver\Constraint\Constraint;
  19818. class ArrayRepository extends BaseRepository
  19819. {
  19820. protected $packages;
  19821. public function __construct(array $packages = array())
  19822. {
  19823. foreach ($packages as $package) {
  19824. $this->addPackage($package);
  19825. }
  19826. }
  19827. public function findPackage($name, $constraint)
  19828. {
  19829. $name = strtolower($name);
  19830. if (!$constraint instanceof ConstraintInterface) {
  19831. $versionParser = new VersionParser();
  19832. $constraint = $versionParser->parseConstraints($constraint);
  19833. }
  19834. foreach ($this->getPackages() as $package) {
  19835. if ($name === $package->getName()) {
  19836. $pkgConstraint = new Constraint('==', $package->getVersion());
  19837. if ($constraint->matches($pkgConstraint)) {
  19838. return $package;
  19839. }
  19840. }
  19841. }
  19842. return null;
  19843. }
  19844. public function findPackages($name, $constraint = null)
  19845. {
  19846. $name = strtolower($name);
  19847. $packages = array();
  19848. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19849. $versionParser = new VersionParser();
  19850. $constraint = $versionParser->parseConstraints($constraint);
  19851. }
  19852. foreach ($this->getPackages() as $package) {
  19853. if ($name === $package->getName()) {
  19854. $pkgConstraint = new Constraint('==', $package->getVersion());
  19855. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19856. $packages[] = $package;
  19857. }
  19858. }
  19859. }
  19860. return $packages;
  19861. }
  19862. public function search($query, $mode = 0, $type = null)
  19863. {
  19864. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19865. $matches = array();
  19866. foreach ($this->getPackages() as $package) {
  19867. $name = $package->getName();
  19868. if (isset($matches[$name])) {
  19869. continue;
  19870. }
  19871. if (preg_match($regex, $name)
  19872. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  19873. ) {
  19874. if (null !== $type && $package->getType() !== $type) {
  19875. continue;
  19876. }
  19877. $matches[$name] = array(
  19878. 'name' => $package->getPrettyName(),
  19879. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  19880. );
  19881. }
  19882. }
  19883. return array_values($matches);
  19884. }
  19885. public function hasPackage(PackageInterface $package)
  19886. {
  19887. $packageId = $package->getUniqueName();
  19888. foreach ($this->getPackages() as $repoPackage) {
  19889. if ($packageId === $repoPackage->getUniqueName()) {
  19890. return true;
  19891. }
  19892. }
  19893. return false;
  19894. }
  19895. public function addPackage(PackageInterface $package)
  19896. {
  19897. if (null === $this->packages) {
  19898. $this->initialize();
  19899. }
  19900. $package->setRepository($this);
  19901. $this->packages[] = $package;
  19902. if ($package instanceof AliasPackage) {
  19903. $aliasedPackage = $package->getAliasOf();
  19904. if (null === $aliasedPackage->getRepository()) {
  19905. $this->addPackage($aliasedPackage);
  19906. }
  19907. }
  19908. }
  19909. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  19910. {
  19911. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  19912. }
  19913. public function removePackage(PackageInterface $package)
  19914. {
  19915. $packageId = $package->getUniqueName();
  19916. foreach ($this->getPackages() as $key => $repoPackage) {
  19917. if ($packageId === $repoPackage->getUniqueName()) {
  19918. array_splice($this->packages, $key, 1);
  19919. return;
  19920. }
  19921. }
  19922. }
  19923. public function getPackages()
  19924. {
  19925. if (null === $this->packages) {
  19926. $this->initialize();
  19927. }
  19928. return $this->packages;
  19929. }
  19930. public function count()
  19931. {
  19932. return count($this->packages);
  19933. }
  19934. protected function initialize()
  19935. {
  19936. $this->packages = array();
  19937. }
  19938. }
  19939. <?php
  19940. namespace Composer\Repository;
  19941. use Composer\IO\IOInterface;
  19942. use Composer\Json\JsonFile;
  19943. use Composer\Package\Loader\ArrayLoader;
  19944. use Composer\Package\Loader\LoaderInterface;
  19945. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19946. {
  19947. protected $loader;
  19948. protected $lookup;
  19949. protected $repoConfig;
  19950. private $io;
  19951. public function __construct(array $repoConfig, IOInterface $io)
  19952. {
  19953. parent::__construct();
  19954. if (!extension_loaded('zip')) {
  19955. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  19956. }
  19957. $this->loader = new ArrayLoader();
  19958. $this->lookup = $repoConfig['url'];
  19959. $this->io = $io;
  19960. $this->repoConfig = $repoConfig;
  19961. }
  19962. public function getRepoConfig()
  19963. {
  19964. return $this->repoConfig;
  19965. }
  19966. protected function initialize()
  19967. {
  19968. parent::initialize();
  19969. $this->scanDirectory($this->lookup);
  19970. }
  19971. private function scanDirectory($path)
  19972. {
  19973. $io = $this->io;
  19974. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  19975. $iterator = new \RecursiveIteratorIterator($directory);
  19976. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  19977. foreach ($regex as $file) {
  19978. if (!$file->isFile()) {
  19979. continue;
  19980. }
  19981. $package = $this->getComposerInformation($file);
  19982. if (!$package) {
  19983. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  19984. continue;
  19985. }
  19986. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  19987. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  19988. $this->addPackage($package);
  19989. }
  19990. }
  19991. private function locateFile(\ZipArchive $zip, $filename)
  19992. {
  19993. $indexOfShortestMatch = false;
  19994. $lengthOfShortestMatch = -1;
  19995. for ($i = 0; $i < $zip->numFiles; $i++) {
  19996. $stat = $zip->statIndex($i);
  19997. if (strcmp(basename($stat['name']), $filename) === 0) {
  19998. $directoryName = dirname($stat['name']);
  19999. if ($directoryName == '.') {
  20000. return $i;
  20001. }
  20002. if (strpos($directoryName, '\\') !== false ||
  20003. strpos($directoryName, '/') !== false) {
  20004. continue;
  20005. }
  20006. $length = strlen($stat['name']);
  20007. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  20008. $contents = $zip->getFromIndex($i);
  20009. if ($contents !== false) {
  20010. $indexOfShortestMatch = $i;
  20011. $lengthOfShortestMatch = $length;
  20012. }
  20013. }
  20014. }
  20015. }
  20016. return $indexOfShortestMatch;
  20017. }
  20018. private function getComposerInformation(\SplFileInfo $file)
  20019. {
  20020. $zip = new \ZipArchive();
  20021. if ($zip->open($file->getPathname()) !== true) {
  20022. return false;
  20023. }
  20024. if (0 == $zip->numFiles) {
  20025. $zip->close();
  20026. return false;
  20027. }
  20028. $foundFileIndex = $this->locateFile($zip, 'composer.json');
  20029. if (false === $foundFileIndex) {
  20030. $zip->close();
  20031. return false;
  20032. }
  20033. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  20034. $zip->close();
  20035. $composerFile = "zip://{$file->getPathname()}#$configurationFileName";
  20036. $json = file_get_contents($composerFile);
  20037. $package = JsonFile::parseJson($json, $composerFile);
  20038. $package['dist'] = array(
  20039. 'type' => 'zip',
  20040. 'url' => strtr($file->getPathname(), '\\', '/'),
  20041. 'shasum' => sha1_file($file->getRealPath()),
  20042. );
  20043. try {
  20044. $package = $this->loader->load($package);
  20045. } catch (\UnexpectedValueException $e) {
  20046. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  20047. }
  20048. return $package;
  20049. }
  20050. }
  20051. <?php
  20052. namespace Composer\Repository;
  20053. use Composer\Package\RootPackageInterface;
  20054. use Composer\Semver\Constraint\ConstraintInterface;
  20055. use Composer\Semver\Constraint\Constraint;
  20056. use Composer\Package\Link;
  20057. abstract class BaseRepository implements RepositoryInterface
  20058. {
  20059. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  20060. {
  20061. $needles = array_map('strtolower', (array) $needle);
  20062. $results = array();
  20063. if (null === $packagesFound) {
  20064. $packagesFound = $needles;
  20065. }
  20066. $rootPackage = null;
  20067. foreach ($this->getPackages() as $package) {
  20068. if ($package instanceof RootPackageInterface) {
  20069. $rootPackage = $package;
  20070. break;
  20071. }
  20072. }
  20073. foreach ($this->getPackages() as $package) {
  20074. $links = $package->getRequires();
  20075. $packagesInTree = $packagesFound;
  20076. if (!$invert) {
  20077. $links += $package->getReplaces();
  20078. }
  20079. if ($package instanceof RootPackageInterface) {
  20080. $links += $package->getDevRequires();
  20081. }
  20082. foreach ($links as $link) {
  20083. foreach ($needles as $needle) {
  20084. if ($link->getTarget() === $needle) {
  20085. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20086. if (in_array($link->getSource(), $packagesInTree)) {
  20087. $results[$link->getSource()] = array($package, $link, false);
  20088. continue;
  20089. }
  20090. $packagesInTree[] = $link->getSource();
  20091. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  20092. $results[$link->getSource()] = array($package, $link, $dependents);
  20093. }
  20094. }
  20095. }
  20096. }
  20097. if ($invert && in_array($package->getName(), $needles)) {
  20098. foreach ($package->getConflicts() as $link) {
  20099. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  20100. $version = new Constraint('=', $pkg->getVersion());
  20101. if ($link->getConstraint()->matches($version) === $invert) {
  20102. $results[] = array($package, $link, false);
  20103. }
  20104. }
  20105. }
  20106. }
  20107. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  20108. foreach ($package->getRequires() as $link) {
  20109. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  20110. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  20111. continue;
  20112. }
  20113. $platformPkg = $this->findPackage($link->getTarget(), '*');
  20114. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  20115. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  20116. continue;
  20117. }
  20118. foreach ($this->getPackages() as $pkg) {
  20119. if (!in_array($link->getTarget(), $pkg->getNames())) {
  20120. continue;
  20121. }
  20122. $version = new Constraint('=', $pkg->getVersion());
  20123. if (!$link->getConstraint()->matches($version)) {
  20124. if ($rootPackage) {
  20125. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  20126. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  20127. $results[] = array($package, $link, false);
  20128. $results[] = array($rootPackage, $rootReq, false);
  20129. continue 3;
  20130. }
  20131. }
  20132. $results[] = array($package, $link, false);
  20133. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  20134. } else {
  20135. $results[] = array($package, $link, false);
  20136. }
  20137. }
  20138. continue 2;
  20139. }
  20140. }
  20141. }
  20142. }
  20143. ksort($results);
  20144. return $results;
  20145. }
  20146. }
  20147. <?php
  20148. namespace Composer\Repository;
  20149. use Composer\Package\Loader\ArrayLoader;
  20150. use Composer\Package\PackageInterface;
  20151. use Composer\Package\AliasPackage;
  20152. use Composer\Package\Version\VersionParser;
  20153. use Composer\DependencyResolver\Pool;
  20154. use Composer\Json\JsonFile;
  20155. use Composer\Cache;
  20156. use Composer\Config;
  20157. use Composer\Composer;
  20158. use Composer\Factory;
  20159. use Composer\IO\IOInterface;
  20160. use Composer\Util\RemoteFilesystem;
  20161. use Composer\Plugin\PluginEvents;
  20162. use Composer\Plugin\PreFileDownloadEvent;
  20163. use Composer\EventDispatcher\EventDispatcher;
  20164. use Composer\Downloader\TransportException;
  20165. use Composer\Semver\Constraint\ConstraintInterface;
  20166. use Composer\Semver\Constraint\Constraint;
  20167. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20168. {
  20169. protected $config;
  20170. protected $repoConfig;
  20171. protected $options;
  20172. protected $url;
  20173. protected $baseUrl;
  20174. protected $io;
  20175. protected $rfs;
  20176. protected $cache;
  20177. protected $notifyUrl;
  20178. protected $searchUrl;
  20179. protected $hasProviders = false;
  20180. protected $providersUrl;
  20181. protected $lazyProvidersUrl;
  20182. protected $providerListing;
  20183. protected $providers = array();
  20184. protected $providersByUid = array();
  20185. protected $loader;
  20186. protected $rootAliases;
  20187. protected $allowSslDowngrade = false;
  20188. protected $eventDispatcher;
  20189. protected $sourceMirrors;
  20190. protected $distMirrors;
  20191. private $degradedMode = false;
  20192. private $rootData;
  20193. private $hasPartialPackages;
  20194. private $partialPackagesByName;
  20195. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  20196. {
  20197. parent::__construct();
  20198. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  20199. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  20200. }
  20201. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  20202. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  20203. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  20204. }
  20205. $urlBits = parse_url($repoConfig['url']);
  20206. if ($urlBits === false || empty($urlBits['scheme'])) {
  20207. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  20208. }
  20209. if (!isset($repoConfig['options'])) {
  20210. $repoConfig['options'] = array();
  20211. }
  20212. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  20213. $this->allowSslDowngrade = true;
  20214. }
  20215. $this->config = $config;
  20216. $this->options = $repoConfig['options'];
  20217. $this->url = $repoConfig['url'];
  20218. if (preg_match('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  20219. $this->url = $match['proto'].'://repo.packagist.org';
  20220. }
  20221. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  20222. $this->io = $io;
  20223. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  20224. $this->loader = new ArrayLoader();
  20225. if ($rfs && $this->options) {
  20226. $rfs = clone $rfs;
  20227. $rfs->setOptions($this->options);
  20228. }
  20229. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  20230. $this->eventDispatcher = $eventDispatcher;
  20231. $this->repoConfig = $repoConfig;
  20232. }
  20233. public function getRepoConfig()
  20234. {
  20235. return $this->repoConfig;
  20236. }
  20237. public function setRootAliases(array $rootAliases)
  20238. {
  20239. $this->rootAliases = $rootAliases;
  20240. }
  20241. public function findPackage($name, $constraint)
  20242. {
  20243. if (!$this->hasProviders()) {
  20244. return parent::findPackage($name, $constraint);
  20245. }
  20246. $name = strtolower($name);
  20247. if (!$constraint instanceof ConstraintInterface) {
  20248. $versionParser = new VersionParser();
  20249. $constraint = $versionParser->parseConstraints($constraint);
  20250. }
  20251. foreach ($this->getProviderNames() as $providerName) {
  20252. if ($name === $providerName) {
  20253. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  20254. foreach ($packages as $package) {
  20255. if ($name === $package->getName()) {
  20256. $pkgConstraint = new Constraint('==', $package->getVersion());
  20257. if ($constraint->matches($pkgConstraint)) {
  20258. return $package;
  20259. }
  20260. }
  20261. }
  20262. break;
  20263. }
  20264. }
  20265. }
  20266. public function findPackages($name, $constraint = null)
  20267. {
  20268. if (!$this->hasProviders()) {
  20269. return parent::findPackages($name, $constraint);
  20270. }
  20271. $name = strtolower($name);
  20272. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  20273. $versionParser = new VersionParser();
  20274. $constraint = $versionParser->parseConstraints($constraint);
  20275. }
  20276. $packages = array();
  20277. foreach ($this->getProviderNames() as $providerName) {
  20278. if ($name === $providerName) {
  20279. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  20280. foreach ($candidates as $package) {
  20281. if ($name === $package->getName()) {
  20282. $pkgConstraint = new Constraint('==', $package->getVersion());
  20283. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  20284. $packages[] = $package;
  20285. }
  20286. }
  20287. }
  20288. break;
  20289. }
  20290. }
  20291. return $packages;
  20292. }
  20293. public function getPackages()
  20294. {
  20295. if ($this->hasProviders()) {
  20296. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  20297. }
  20298. return parent::getPackages();
  20299. }
  20300. public function search($query, $mode = 0, $type = null)
  20301. {
  20302. $this->loadRootServerFile();
  20303. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  20304. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  20305. $hostname = parse_url($url, PHP_URL_HOST) ?: $url;
  20306. $json = $this->rfs->getContents($hostname, $url, false);
  20307. $search = JsonFile::parseJson($json, $url);
  20308. if (empty($search['results'])) {
  20309. return array();
  20310. }
  20311. $results = array();
  20312. foreach ($search['results'] as $result) {
  20313. if (empty($result['virtual'])) {
  20314. $results[] = $result;
  20315. }
  20316. }
  20317. return $results;
  20318. }
  20319. if ($this->hasProviders()) {
  20320. $results = array();
  20321. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  20322. foreach ($this->getProviderNames() as $name) {
  20323. if (preg_match($regex, $name)) {
  20324. $results[] = array('name' => $name);
  20325. }
  20326. }
  20327. return $results;
  20328. }
  20329. return parent::search($query, $mode);
  20330. }
  20331. public function getProviderNames()
  20332. {
  20333. $this->loadRootServerFile();
  20334. if (null === $this->providerListing) {
  20335. $this->loadProviderListings($this->loadRootServerFile());
  20336. }
  20337. if ($this->lazyProvidersUrl) {
  20338. return array();
  20339. }
  20340. if ($this->providersUrl) {
  20341. return array_keys($this->providerListing);
  20342. }
  20343. return array();
  20344. }
  20345. protected function configurePackageTransportOptions(PackageInterface $package)
  20346. {
  20347. foreach ($package->getDistUrls() as $url) {
  20348. if (strpos($url, $this->baseUrl) === 0) {
  20349. $package->setTransportOptions($this->options);
  20350. return;
  20351. }
  20352. }
  20353. }
  20354. public function hasProviders()
  20355. {
  20356. $this->loadRootServerFile();
  20357. return $this->hasProviders;
  20358. }
  20359. public function resetPackageIds()
  20360. {
  20361. foreach ($this->providersByUid as $package) {
  20362. if ($package instanceof AliasPackage) {
  20363. $package->getAliasOf()->setId(-1);
  20364. }
  20365. $package->setId(-1);
  20366. }
  20367. }
  20368. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  20369. {
  20370. if (isset($this->providers[$name]) && !$bypassFilters) {
  20371. return $this->providers[$name];
  20372. }
  20373. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  20374. $this->initializePartialPackages();
  20375. }
  20376. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  20377. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  20378. return array();
  20379. }
  20380. if (null === $this->providerListing) {
  20381. $this->loadProviderListings($this->loadRootServerFile());
  20382. }
  20383. $useLastModifiedCheck = false;
  20384. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  20385. $hash = null;
  20386. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  20387. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20388. $useLastModifiedCheck = true;
  20389. } elseif ($this->providersUrl) {
  20390. if (!isset($this->providerListing[$name])) {
  20391. return array();
  20392. }
  20393. $hash = $this->providerListing[$name]['sha256'];
  20394. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  20395. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20396. } else {
  20397. return array();
  20398. }
  20399. $packages = null;
  20400. if ($cacheKey) {
  20401. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  20402. $packages = json_decode($this->cache->read($cacheKey), true);
  20403. } elseif ($useLastModifiedCheck) {
  20404. if ($contents = $this->cache->read($cacheKey)) {
  20405. $contents = json_decode($contents, true);
  20406. if (isset($contents['last-modified'])) {
  20407. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  20408. if (true === $response) {
  20409. $packages = $contents;
  20410. } elseif ($response) {
  20411. $packages = $response;
  20412. }
  20413. }
  20414. }
  20415. }
  20416. }
  20417. if (!$packages) {
  20418. try {
  20419. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  20420. } catch (TransportException $e) {
  20421. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  20422. $packages = array('packages' => array());
  20423. } else {
  20424. throw $e;
  20425. }
  20426. }
  20427. }
  20428. $loadingPartialPackage = false;
  20429. } else {
  20430. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  20431. $loadingPartialPackage = true;
  20432. }
  20433. $this->providers[$name] = array();
  20434. foreach ($packages['packages'] as $versions) {
  20435. foreach ($versions as $version) {
  20436. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  20437. continue;
  20438. }
  20439. if (isset($this->providersByUid[$version['uid']])) {
  20440. if (!isset($this->providers[$name][$version['uid']])) {
  20441. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  20442. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  20443. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  20444. } else {
  20445. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  20446. }
  20447. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  20448. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  20449. }
  20450. }
  20451. } else {
  20452. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  20453. continue;
  20454. }
  20455. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  20456. $package->setRepository($this);
  20457. if ($package instanceof AliasPackage) {
  20458. $aliased = $package->getAliasOf();
  20459. $aliased->setRepository($this);
  20460. $this->providers[$name][$version['uid']] = $aliased;
  20461. $this->providers[$name][$version['uid'].'-alias'] = $package;
  20462. $this->providersByUid[$version['uid']] = $package;
  20463. } else {
  20464. $this->providers[$name][$version['uid']] = $package;
  20465. $this->providersByUid[$version['uid']] = $package;
  20466. }
  20467. unset($rootAliasData);
  20468. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  20469. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  20470. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  20471. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  20472. }
  20473. if (isset($rootAliasData)) {
  20474. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  20475. $alias->setRepository($this);
  20476. $this->providers[$name][$version['uid'].'-root'] = $alias;
  20477. $this->providersByUid[$version['uid'].'-root'] = $alias;
  20478. }
  20479. }
  20480. }
  20481. }
  20482. $result = $this->providers[$name];
  20483. if ($bypassFilters) {
  20484. foreach ($this->providers[$name] as $uid => $provider) {
  20485. unset($this->providersByUid[$uid]);
  20486. }
  20487. unset($this->providers[$name]);
  20488. }
  20489. return $result;
  20490. }
  20491. protected function initialize()
  20492. {
  20493. parent::initialize();
  20494. $repoData = $this->loadDataFromServer();
  20495. foreach ($repoData as $package) {
  20496. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  20497. }
  20498. }
  20499. public function addPackage(PackageInterface $package)
  20500. {
  20501. parent::addPackage($package);
  20502. $this->configurePackageTransportOptions($package);
  20503. }
  20504. protected function loadRootServerFile()
  20505. {
  20506. if (null !== $this->rootData) {
  20507. return $this->rootData;
  20508. }
  20509. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  20510. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  20511. }
  20512. $jsonUrlParts = parse_url($this->url);
  20513. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  20514. $jsonUrl = $this->url;
  20515. } else {
  20516. $jsonUrl = $this->url . '/packages.json';
  20517. }
  20518. $data = $this->fetchFile($jsonUrl, 'packages.json');
  20519. if (!empty($data['notify-batch'])) {
  20520. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  20521. } elseif (!empty($data['notify'])) {
  20522. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  20523. }
  20524. if (!empty($data['search'])) {
  20525. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  20526. }
  20527. if (!empty($data['mirrors'])) {
  20528. foreach ($data['mirrors'] as $mirror) {
  20529. if (!empty($mirror['git-url'])) {
  20530. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  20531. }
  20532. if (!empty($mirror['hg-url'])) {
  20533. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  20534. }
  20535. if (!empty($mirror['dist-url'])) {
  20536. $this->distMirrors[] = array(
  20537. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  20538. 'preferred' => !empty($mirror['preferred']),
  20539. );
  20540. }
  20541. }
  20542. }
  20543. if (!empty($data['providers-lazy-url'])) {
  20544. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  20545. $this->hasProviders = true;
  20546. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  20547. }
  20548. if ($this->allowSslDowngrade) {
  20549. $this->url = str_replace('https://', 'http://', $this->url);
  20550. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  20551. }
  20552. if (!empty($data['providers-url'])) {
  20553. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  20554. $this->hasProviders = true;
  20555. }
  20556. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  20557. $this->hasProviders = true;
  20558. }
  20559. if (preg_match('{^https?://repo\.packagist\.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  20560. $this->url = 'https://repo.packagist.org';
  20561. $this->baseUrl = 'https://repo.packagist.org';
  20562. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://repo.packagist.org/p/%package%.json');
  20563. $this->providersUrl = null;
  20564. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  20565. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  20566. $this->providersUrl = null;
  20567. }
  20568. return $this->rootData = $data;
  20569. }
  20570. protected function canonicalizeUrl($url)
  20571. {
  20572. if ('/' === $url[0]) {
  20573. return preg_replace('{(https?://[^/]+).*}i', '$1' . $url, $this->url);
  20574. }
  20575. return $url;
  20576. }
  20577. protected function loadDataFromServer()
  20578. {
  20579. $data = $this->loadRootServerFile();
  20580. return $this->loadIncludes($data);
  20581. }
  20582. protected function loadProviderListings($data)
  20583. {
  20584. if (isset($data['providers'])) {
  20585. if (!is_array($this->providerListing)) {
  20586. $this->providerListing = array();
  20587. }
  20588. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  20589. }
  20590. if ($this->providersUrl && isset($data['provider-includes'])) {
  20591. $includes = $data['provider-includes'];
  20592. foreach ($includes as $include => $metadata) {
  20593. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  20594. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  20595. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  20596. $includedData = json_decode($this->cache->read($cacheKey), true);
  20597. } else {
  20598. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  20599. }
  20600. $this->loadProviderListings($includedData);
  20601. }
  20602. }
  20603. }
  20604. protected function loadIncludes($data)
  20605. {
  20606. $packages = array();
  20607. if (!isset($data['packages']) && !isset($data['includes'])) {
  20608. foreach ($data as $pkg) {
  20609. foreach ($pkg['versions'] as $metadata) {
  20610. $packages[] = $metadata;
  20611. }
  20612. }
  20613. return $packages;
  20614. }
  20615. if (isset($data['packages'])) {
  20616. foreach ($data['packages'] as $package => $versions) {
  20617. foreach ($versions as $version => $metadata) {
  20618. $packages[] = $metadata;
  20619. }
  20620. }
  20621. }
  20622. if (isset($data['includes'])) {
  20623. foreach ($data['includes'] as $include => $metadata) {
  20624. if ($this->cache->sha1($include) === $metadata['sha1']) {
  20625. $includedData = json_decode($this->cache->read($include), true);
  20626. } else {
  20627. $includedData = $this->fetchFile($include);
  20628. }
  20629. $packages = array_merge($packages, $this->loadIncludes($includedData));
  20630. }
  20631. }
  20632. return $packages;
  20633. }
  20634. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  20635. {
  20636. try {
  20637. if (!isset($data['notification-url'])) {
  20638. $data['notification-url'] = $this->notifyUrl;
  20639. }
  20640. $package = $this->loader->load($data, $class);
  20641. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  20642. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  20643. }
  20644. $package->setDistMirrors($this->distMirrors);
  20645. $this->configurePackageTransportOptions($package);
  20646. return $package;
  20647. } catch (\Exception $e) {
  20648. throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  20649. }
  20650. }
  20651. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  20652. {
  20653. if (null === $cacheKey) {
  20654. $cacheKey = $filename;
  20655. $filename = $this->baseUrl.'/'.$filename;
  20656. }
  20657. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  20658. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  20659. }
  20660. $retries = 3;
  20661. while ($retries--) {
  20662. try {
  20663. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20664. if ($this->eventDispatcher) {
  20665. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20666. }
  20667. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  20668. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20669. $json = $rfs->getContents($hostname, $filename, false);
  20670. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  20671. if ($this->allowSslDowngrade) {
  20672. $this->url = str_replace('http://', 'https://', $this->url);
  20673. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  20674. $filename = str_replace('http://', 'https://', $filename);
  20675. }
  20676. if ($retries) {
  20677. usleep(100000);
  20678. continue;
  20679. }
  20680. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This could indicate a man-in-the-middle attack or e.g. antivirus software corrupting files. Try running composer again and report this if you think it is a mistake.');
  20681. }
  20682. $data = JsonFile::parseJson($json, $filename);
  20683. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  20684. if ($cacheKey) {
  20685. if ($storeLastModifiedTime) {
  20686. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20687. if ($lastModifiedDate) {
  20688. $data['last-modified'] = $lastModifiedDate;
  20689. $json = json_encode($data);
  20690. }
  20691. }
  20692. $this->cache->write($cacheKey, $json);
  20693. }
  20694. break;
  20695. } catch (\Exception $e) {
  20696. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20697. throw $e;
  20698. }
  20699. if ($retries) {
  20700. usleep(100000);
  20701. continue;
  20702. }
  20703. if ($e instanceof RepositorySecurityException) {
  20704. throw $e;
  20705. }
  20706. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  20707. if (!$this->degradedMode) {
  20708. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20709. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  20710. }
  20711. $this->degradedMode = true;
  20712. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  20713. break;
  20714. }
  20715. throw $e;
  20716. }
  20717. }
  20718. return $data;
  20719. }
  20720. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  20721. {
  20722. $retries = 3;
  20723. while ($retries--) {
  20724. try {
  20725. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20726. if ($this->eventDispatcher) {
  20727. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20728. }
  20729. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  20730. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20731. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  20732. $json = $rfs->getContents($hostname, $filename, false, $options);
  20733. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  20734. return true;
  20735. }
  20736. $data = JsonFile::parseJson($json, $filename);
  20737. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  20738. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20739. if ($lastModifiedDate) {
  20740. $data['last-modified'] = $lastModifiedDate;
  20741. $json = json_encode($data);
  20742. }
  20743. $this->cache->write($cacheKey, $json);
  20744. return $data;
  20745. } catch (\Exception $e) {
  20746. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20747. throw $e;
  20748. }
  20749. if ($retries) {
  20750. usleep(100000);
  20751. continue;
  20752. }
  20753. if (!$this->degradedMode) {
  20754. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20755. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  20756. }
  20757. $this->degradedMode = true;
  20758. return true;
  20759. }
  20760. }
  20761. }
  20762. private function initializePartialPackages()
  20763. {
  20764. $rootData = $this->loadRootServerFile();
  20765. $this->partialPackagesByName = array();
  20766. foreach ($rootData['packages'] as $package => $versions) {
  20767. $package = strtolower($package);
  20768. foreach ($versions as $version) {
  20769. $this->partialPackagesByName[$package][] = $version;
  20770. if (!empty($version['provide']) && is_array($version['provide'])) {
  20771. foreach ($version['provide'] as $provided => $providedVersion) {
  20772. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20773. }
  20774. }
  20775. if (!empty($version['replace']) && is_array($version['replace'])) {
  20776. foreach ($version['replace'] as $provided => $providedVersion) {
  20777. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20778. }
  20779. }
  20780. }
  20781. }
  20782. $this->rootData = true;
  20783. }
  20784. }
  20785. <?php
  20786. namespace Composer\Repository;
  20787. use Composer\Package\PackageInterface;
  20788. class CompositeRepository extends BaseRepository
  20789. {
  20790. private $repositories;
  20791. public function __construct(array $repositories)
  20792. {
  20793. $this->repositories = array();
  20794. foreach ($repositories as $repo) {
  20795. $this->addRepository($repo);
  20796. }
  20797. }
  20798. public function getRepositories()
  20799. {
  20800. return $this->repositories;
  20801. }
  20802. public function hasPackage(PackageInterface $package)
  20803. {
  20804. foreach ($this->repositories as $repository) {
  20805. if ($repository->hasPackage($package)) {
  20806. return true;
  20807. }
  20808. }
  20809. return false;
  20810. }
  20811. public function findPackage($name, $constraint)
  20812. {
  20813. foreach ($this->repositories as $repository) {
  20814. $package = $repository->findPackage($name, $constraint);
  20815. if (null !== $package) {
  20816. return $package;
  20817. }
  20818. }
  20819. return null;
  20820. }
  20821. public function findPackages($name, $constraint = null)
  20822. {
  20823. $packages = array();
  20824. foreach ($this->repositories as $repository) {
  20825. $packages[] = $repository->findPackages($name, $constraint);
  20826. }
  20827. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20828. }
  20829. public function search($query, $mode = 0, $type = null)
  20830. {
  20831. $matches = array();
  20832. foreach ($this->repositories as $repository) {
  20833. $matches[] = $repository->search($query, $mode, $type);
  20834. }
  20835. return $matches ? call_user_func_array('array_merge', $matches) : array();
  20836. }
  20837. public function getPackages()
  20838. {
  20839. $packages = array();
  20840. foreach ($this->repositories as $repository) {
  20841. $packages[] = $repository->getPackages();
  20842. }
  20843. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20844. }
  20845. public function removePackage(PackageInterface $package)
  20846. {
  20847. foreach ($this->repositories as $repository) {
  20848. $repository->removePackage($package);
  20849. }
  20850. }
  20851. public function count()
  20852. {
  20853. $total = 0;
  20854. foreach ($this->repositories as $repository) {
  20855. $total += $repository->count();
  20856. }
  20857. return $total;
  20858. }
  20859. public function addRepository(RepositoryInterface $repository)
  20860. {
  20861. if ($repository instanceof self) {
  20862. foreach ($repository->getRepositories() as $repo) {
  20863. $this->addRepository($repo);
  20864. }
  20865. } else {
  20866. $this->repositories[] = $repository;
  20867. }
  20868. }
  20869. }
  20870. <?php
  20871. namespace Composer\Repository;
  20872. interface ConfigurableRepositoryInterface
  20873. {
  20874. public function getRepoConfig();
  20875. }
  20876. <?php
  20877. namespace Composer\Repository;
  20878. use Composer\Json\JsonFile;
  20879. use Composer\Package\Loader\ArrayLoader;
  20880. use Composer\Package\Dumper\ArrayDumper;
  20881. class FilesystemRepository extends WritableArrayRepository
  20882. {
  20883. private $file;
  20884. public function __construct(JsonFile $repositoryFile)
  20885. {
  20886. parent::__construct();
  20887. $this->file = $repositoryFile;
  20888. }
  20889. protected function initialize()
  20890. {
  20891. parent::initialize();
  20892. if (!$this->file->exists()) {
  20893. return;
  20894. }
  20895. try {
  20896. $packages = $this->file->read();
  20897. if (isset($packages['packages'])) {
  20898. $packages = $packages['packages'];
  20899. }
  20900. if (!is_array($packages)) {
  20901. throw new \UnexpectedValueException('Could not parse package list from the repository');
  20902. }
  20903. } catch (\Exception $e) {
  20904. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  20905. }
  20906. $loader = new ArrayLoader(null, true);
  20907. foreach ($packages as $packageData) {
  20908. $package = $loader->load($packageData);
  20909. $this->addPackage($package);
  20910. }
  20911. }
  20912. public function reload()
  20913. {
  20914. $this->packages = null;
  20915. $this->initialize();
  20916. }
  20917. public function write()
  20918. {
  20919. $data = array();
  20920. $dumper = new ArrayDumper();
  20921. foreach ($this->getCanonicalPackages() as $package) {
  20922. $data[] = $dumper->dump($package);
  20923. }
  20924. usort($data, function ($a, $b) {
  20925. return strcmp($a['name'], $b['name']);
  20926. });
  20927. $this->file->write($data);
  20928. }
  20929. }
  20930. <?php
  20931. namespace Composer\Repository;
  20932. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  20933. {
  20934. }
  20935. <?php
  20936. namespace Composer\Repository;
  20937. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  20938. {
  20939. }
  20940. <?php
  20941. namespace Composer\Repository;
  20942. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  20943. {
  20944. }
  20945. <?php
  20946. namespace Composer\Repository;
  20947. class InvalidRepositoryException extends \Exception
  20948. {
  20949. }
  20950. <?php
  20951. namespace Composer\Repository;
  20952. use Composer\Package\Loader\ArrayLoader;
  20953. use Composer\Package\Loader\ValidatingArrayLoader;
  20954. class PackageRepository extends ArrayRepository
  20955. {
  20956. private $config;
  20957. public function __construct(array $config)
  20958. {
  20959. parent::__construct();
  20960. $this->config = $config['package'];
  20961. if (!is_numeric(key($this->config))) {
  20962. $this->config = array($this->config);
  20963. }
  20964. }
  20965. protected function initialize()
  20966. {
  20967. parent::initialize();
  20968. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  20969. foreach ($this->config as $package) {
  20970. try {
  20971. $package = $loader->load($package);
  20972. } catch (\Exception $e) {
  20973. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  20974. }
  20975. $this->addPackage($package);
  20976. }
  20977. }
  20978. }
  20979. <?php
  20980. namespace Composer\Repository;
  20981. use Composer\Config;
  20982. use Composer\IO\IOInterface;
  20983. use Composer\Json\JsonFile;
  20984. use Composer\Package\Loader\ArrayLoader;
  20985. use Composer\Package\Version\VersionGuesser;
  20986. use Composer\Package\Version\VersionParser;
  20987. use Composer\Util\Platform;
  20988. use Composer\Util\ProcessExecutor;
  20989. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20990. {
  20991. private $loader;
  20992. private $versionGuesser;
  20993. private $url;
  20994. private $repoConfig;
  20995. private $process;
  20996. private $options;
  20997. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  20998. {
  20999. if (!isset($repoConfig['url'])) {
  21000. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  21001. }
  21002. $this->loader = new ArrayLoader(null, true);
  21003. $this->url = Platform::expandPath($repoConfig['url']);
  21004. $this->process = new ProcessExecutor($io);
  21005. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  21006. $this->repoConfig = $repoConfig;
  21007. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  21008. parent::__construct();
  21009. }
  21010. public function getRepoConfig()
  21011. {
  21012. return $this->repoConfig;
  21013. }
  21014. protected function initialize()
  21015. {
  21016. parent::initialize();
  21017. foreach ($this->getUrlMatches() as $url) {
  21018. $path = realpath($url) . DIRECTORY_SEPARATOR;
  21019. $composerFilePath = $path.'composer.json';
  21020. if (!file_exists($composerFilePath)) {
  21021. continue;
  21022. }
  21023. $json = file_get_contents($composerFilePath);
  21024. $package = JsonFile::parseJson($json, $composerFilePath);
  21025. $package['dist'] = array(
  21026. 'type' => 'path',
  21027. 'url' => $url,
  21028. 'reference' => sha1($json . serialize($this->options)),
  21029. );
  21030. $package['transport-options'] = $this->options;
  21031. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  21032. if (
  21033. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  21034. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  21035. && $ref1 === $ref2
  21036. ) {
  21037. $package['version'] = $rootVersion;
  21038. }
  21039. }
  21040. if (!isset($package['version'])) {
  21041. $versionData = $this->versionGuesser->guessVersion($package, $path);
  21042. $package['version'] = $versionData['pretty_version'] ?: 'dev-master';
  21043. }
  21044. $output = '';
  21045. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  21046. $package['dist']['reference'] = trim($output);
  21047. }
  21048. $package = $this->loader->load($package);
  21049. $this->addPackage($package);
  21050. }
  21051. }
  21052. private function getUrlMatches()
  21053. {
  21054. $flags = GLOB_MARK | GLOB_ONLYDIR;
  21055. if (defined('GLOB_BRACE')) {
  21056. $flags |= GLOB_BRACE;
  21057. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  21058. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  21059. }
  21060. return array_map(function ($val) {
  21061. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  21062. }, glob($this->url, $flags));
  21063. }
  21064. }
  21065. <?php
  21066. namespace Composer\Repository\Pear;
  21067. use Composer\Util\RemoteFilesystem;
  21068. abstract class BaseChannelReader
  21069. {
  21070. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  21071. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  21072. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  21073. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  21074. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  21075. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  21076. private $rfs;
  21077. protected function __construct(RemoteFilesystem $rfs)
  21078. {
  21079. $this->rfs = $rfs;
  21080. }
  21081. protected function requestContent($origin, $path)
  21082. {
  21083. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  21084. $content = $this->rfs->getContents($origin, $url, false);
  21085. if (!$content) {
  21086. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  21087. }
  21088. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  21089. }
  21090. protected function requestXml($origin, $path)
  21091. {
  21092. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  21093. if (false === $xml) {
  21094. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  21095. }
  21096. return $xml;
  21097. }
  21098. }
  21099. <?php
  21100. namespace Composer\Repository\Pear;
  21101. class ChannelInfo
  21102. {
  21103. private $name;
  21104. private $alias;
  21105. private $packages;
  21106. public function __construct($name, $alias, array $packages)
  21107. {
  21108. $this->name = $name;
  21109. $this->alias = $alias;
  21110. $this->packages = $packages;
  21111. }
  21112. public function getName()
  21113. {
  21114. return $this->name;
  21115. }
  21116. public function getAlias()
  21117. {
  21118. return $this->alias;
  21119. }
  21120. public function getPackages()
  21121. {
  21122. return $this->packages;
  21123. }
  21124. }
  21125. <?php
  21126. namespace Composer\Repository\Pear;
  21127. use Composer\Util\RemoteFilesystem;
  21128. class ChannelReader extends BaseChannelReader
  21129. {
  21130. private $readerMap;
  21131. public function __construct(RemoteFilesystem $rfs)
  21132. {
  21133. parent::__construct($rfs);
  21134. $rest10reader = new ChannelRest10Reader($rfs);
  21135. $rest11reader = new ChannelRest11Reader($rfs);
  21136. $this->readerMap = array(
  21137. 'REST1.3' => $rest11reader,
  21138. 'REST1.2' => $rest11reader,
  21139. 'REST1.1' => $rest11reader,
  21140. 'REST1.0' => $rest10reader,
  21141. );
  21142. }
  21143. public function read($url)
  21144. {
  21145. $xml = $this->requestXml($url, "/channel.xml");
  21146. $channelName = (string) $xml->name;
  21147. $channelAlias = (string) $xml->suggestedalias;
  21148. $supportedVersions = array_keys($this->readerMap);
  21149. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  21150. if (!$selectedRestVersion) {
  21151. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  21152. }
  21153. $reader = $this->readerMap[$selectedRestVersion['version']];
  21154. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  21155. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  21156. }
  21157. private function selectRestVersion($channelXml, $supportedVersions)
  21158. {
  21159. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  21160. foreach ($supportedVersions as $version) {
  21161. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  21162. $testResult = $channelXml->xpath($xpathTest);
  21163. foreach ($testResult as $result) {
  21164. $result = (string) $result;
  21165. if (preg_match('{^https://}i', $result)) {
  21166. return array('version' => $version, 'baseUrl' => $result);
  21167. }
  21168. }
  21169. if (count($testResult) > 0) {
  21170. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  21171. }
  21172. }
  21173. return null;
  21174. }
  21175. }
  21176. <?php
  21177. namespace Composer\Repository\Pear;
  21178. use Composer\Downloader\TransportException;
  21179. class ChannelRest10Reader extends BaseChannelReader
  21180. {
  21181. private $dependencyReader;
  21182. public function __construct($rfs)
  21183. {
  21184. parent::__construct($rfs);
  21185. $this->dependencyReader = new PackageDependencyParser();
  21186. }
  21187. public function read($baseUrl)
  21188. {
  21189. return $this->readPackages($baseUrl);
  21190. }
  21191. private function readPackages($baseUrl)
  21192. {
  21193. $result = array();
  21194. $xmlPath = '/p/packages.xml';
  21195. $xml = $this->requestXml($baseUrl, $xmlPath);
  21196. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  21197. foreach ($xml->xpath('ns:p') as $node) {
  21198. $packageName = (string) $node;
  21199. $packageInfo = $this->readPackage($baseUrl, $packageName);
  21200. $result[] = $packageInfo;
  21201. }
  21202. return $result;
  21203. }
  21204. private function readPackage($baseUrl, $packageName)
  21205. {
  21206. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  21207. $xml = $this->requestXml($baseUrl, $xmlPath);
  21208. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  21209. $channelName = (string) $xml->c;
  21210. $packageName = (string) $xml->n;
  21211. $license = (string) $xml->l;
  21212. $shortDescription = (string) $xml->s;
  21213. $description = (string) $xml->d;
  21214. return new PackageInfo(
  21215. $channelName,
  21216. $packageName,
  21217. $license,
  21218. $shortDescription,
  21219. $description,
  21220. $this->readPackageReleases($baseUrl, $packageName)
  21221. );
  21222. }
  21223. private function readPackageReleases($baseUrl, $packageName)
  21224. {
  21225. $result = array();
  21226. try {
  21227. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  21228. $xml = $this->requestXml($baseUrl, $xmlPath);
  21229. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  21230. foreach ($xml->xpath('ns:r') as $node) {
  21231. $releaseVersion = (string) $node->v;
  21232. $releaseStability = (string) $node->s;
  21233. try {
  21234. $result[$releaseVersion] = new ReleaseInfo(
  21235. $releaseStability,
  21236. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  21237. );
  21238. } catch (TransportException $exception) {
  21239. if ($exception->getCode() != 404) {
  21240. throw $exception;
  21241. }
  21242. }
  21243. }
  21244. } catch (TransportException $exception) {
  21245. if ($exception->getCode() != 404) {
  21246. throw $exception;
  21247. }
  21248. }
  21249. return $result;
  21250. }
  21251. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  21252. {
  21253. $dependencyReader = new PackageDependencyParser();
  21254. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  21255. $content = $this->requestContent($baseUrl, $depthPath);
  21256. $dependencyArray = unserialize($content);
  21257. return $dependencyReader->buildDependencyInfo($dependencyArray);
  21258. }
  21259. }
  21260. <?php
  21261. namespace Composer\Repository\Pear;
  21262. class ChannelRest11Reader extends BaseChannelReader
  21263. {
  21264. private $dependencyReader;
  21265. public function __construct($rfs)
  21266. {
  21267. parent::__construct($rfs);
  21268. $this->dependencyReader = new PackageDependencyParser();
  21269. }
  21270. public function read($baseUrl)
  21271. {
  21272. return $this->readChannelPackages($baseUrl);
  21273. }
  21274. private function readChannelPackages($baseUrl)
  21275. {
  21276. $result = array();
  21277. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  21278. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  21279. foreach ($xml->xpath('ns:c') as $node) {
  21280. $categoryName = (string) $node;
  21281. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  21282. $result = array_merge($result, $categoryPackages);
  21283. }
  21284. return $result;
  21285. }
  21286. private function readCategoryPackages($baseUrl, $categoryName)
  21287. {
  21288. $result = array();
  21289. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  21290. $xml = $this->requestXml($baseUrl, $categoryPath);
  21291. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  21292. foreach ($xml->xpath('ns:pi') as $node) {
  21293. $packageInfo = $this->parsePackage($node);
  21294. $result[] = $packageInfo;
  21295. }
  21296. return $result;
  21297. }
  21298. private function parsePackage($packageInfo)
  21299. {
  21300. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  21301. $channelName = (string) $packageInfo->p->c;
  21302. $packageName = (string) $packageInfo->p->n;
  21303. $license = (string) $packageInfo->p->l;
  21304. $shortDescription = (string) $packageInfo->p->s;
  21305. $description = (string) $packageInfo->p->d;
  21306. $dependencies = array();
  21307. foreach ($packageInfo->xpath('ns:deps') as $node) {
  21308. $dependencyVersion = (string) $node->v;
  21309. $dependencyArray = unserialize((string) $node->d);
  21310. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  21311. $dependencies[$dependencyVersion] = $dependencyInfo;
  21312. }
  21313. $releases = array();
  21314. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  21315. if ($releasesInfo) {
  21316. foreach ($releasesInfo as $node) {
  21317. $releaseVersion = (string) $node->v;
  21318. $releaseStability = (string) $node->s;
  21319. $releases[$releaseVersion] = new ReleaseInfo(
  21320. $releaseStability,
  21321. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  21322. );
  21323. }
  21324. }
  21325. return new PackageInfo(
  21326. $channelName,
  21327. $packageName,
  21328. $license,
  21329. $shortDescription,
  21330. $description,
  21331. $releases
  21332. );
  21333. }
  21334. }
  21335. <?php
  21336. namespace Composer\Repository\Pear;
  21337. class DependencyConstraint
  21338. {
  21339. private $type;
  21340. private $constraint;
  21341. private $channelName;
  21342. private $packageName;
  21343. public function __construct($type, $constraint, $channelName, $packageName)
  21344. {
  21345. $this->type = $type;
  21346. $this->constraint = $constraint;
  21347. $this->channelName = $channelName;
  21348. $this->packageName = $packageName;
  21349. }
  21350. public function getChannelName()
  21351. {
  21352. return $this->channelName;
  21353. }
  21354. public function getConstraint()
  21355. {
  21356. return $this->constraint;
  21357. }
  21358. public function getPackageName()
  21359. {
  21360. return $this->packageName;
  21361. }
  21362. public function getType()
  21363. {
  21364. return $this->type;
  21365. }
  21366. }
  21367. <?php
  21368. namespace Composer\Repository\Pear;
  21369. class DependencyInfo
  21370. {
  21371. private $requires;
  21372. private $optionals;
  21373. public function __construct($requires, $optionals)
  21374. {
  21375. $this->requires = $requires;
  21376. $this->optionals = $optionals;
  21377. }
  21378. public function getRequires()
  21379. {
  21380. return $this->requires;
  21381. }
  21382. public function getOptionals()
  21383. {
  21384. return $this->optionals;
  21385. }
  21386. }
  21387. <?php
  21388. namespace Composer\Repository\Pear;
  21389. class PackageDependencyParser
  21390. {
  21391. public function buildDependencyInfo($depArray)
  21392. {
  21393. if (!is_array($depArray)) {
  21394. return new DependencyInfo(array(), array());
  21395. }
  21396. if (!$this->isHash($depArray)) {
  21397. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  21398. }
  21399. return $this->buildDependency20Info($depArray);
  21400. }
  21401. private function buildDependency10Info($depArray)
  21402. {
  21403. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  21404. $result = array();
  21405. foreach ($depArray as $depItem) {
  21406. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  21407. continue;
  21408. }
  21409. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  21410. ? 'optional'
  21411. : 'required';
  21412. $depType = 'not' == $depItem['rel']
  21413. ? 'conflicts'
  21414. : $depType;
  21415. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  21416. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  21417. ? '*'
  21418. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  21419. switch ($depItem['type']) {
  21420. case 'php':
  21421. $depChannelName = 'php';
  21422. $depPackageName = '';
  21423. break;
  21424. case 'pkg':
  21425. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  21426. $depPackageName = $depItem['name'];
  21427. break;
  21428. case 'ext':
  21429. $depChannelName = 'ext';
  21430. $depPackageName = $depItem['name'];
  21431. break;
  21432. case 'os':
  21433. case 'sapi':
  21434. $depChannelName = '';
  21435. $depPackageName = '';
  21436. break;
  21437. default:
  21438. $depChannelName = '';
  21439. $depPackageName = '';
  21440. break;
  21441. }
  21442. if ('' != $depChannelName) {
  21443. $result[] = new DependencyConstraint(
  21444. $depType,
  21445. $depVersionConstraint,
  21446. $depChannelName,
  21447. $depPackageName
  21448. );
  21449. }
  21450. }
  21451. return $result;
  21452. }
  21453. private function buildDependency20Info($depArray)
  21454. {
  21455. $result = array();
  21456. $optionals = array();
  21457. $defaultOptionals = array();
  21458. foreach ($depArray as $depType => $depTypeGroup) {
  21459. if (!is_array($depTypeGroup)) {
  21460. continue;
  21461. }
  21462. if ('required' == $depType || 'optional' == $depType) {
  21463. foreach ($depTypeGroup as $depItemType => $depItem) {
  21464. switch ($depItemType) {
  21465. case 'php':
  21466. $result[] = new DependencyConstraint(
  21467. $depType,
  21468. $this->parse20VersionConstraint($depItem),
  21469. 'php',
  21470. ''
  21471. );
  21472. break;
  21473. case 'package':
  21474. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  21475. $result = array_merge($result, $deps);
  21476. break;
  21477. case 'extension':
  21478. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  21479. $result = array_merge($result, $deps);
  21480. break;
  21481. case 'subpackage':
  21482. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  21483. $defaultOptionals += $deps;
  21484. break;
  21485. case 'os':
  21486. case 'pearinstaller':
  21487. break;
  21488. default:
  21489. break;
  21490. }
  21491. }
  21492. } elseif ('group' == $depType) {
  21493. if ($this->isHash($depTypeGroup)) {
  21494. $depTypeGroup = array($depTypeGroup);
  21495. }
  21496. foreach ($depTypeGroup as $depItem) {
  21497. $groupName = $depItem['attribs']['name'];
  21498. if (!isset($optionals[$groupName])) {
  21499. $optionals[$groupName] = array();
  21500. }
  21501. if (isset($depItem['subpackage'])) {
  21502. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  21503. } else {
  21504. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  21505. }
  21506. }
  21507. }
  21508. }
  21509. if (count($defaultOptionals) > 0) {
  21510. $optionals['*'] = $defaultOptionals;
  21511. }
  21512. return new DependencyInfo($result, $optionals);
  21513. }
  21514. private function buildDepExtensionConstraints($depItem, $depType)
  21515. {
  21516. if ($this->isHash($depItem)) {
  21517. $depItem = array($depItem);
  21518. }
  21519. $result = array();
  21520. foreach ($depItem as $subDepItem) {
  21521. $depChannelName = 'ext';
  21522. $depPackageName = $subDepItem['name'];
  21523. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21524. $result[] = new DependencyConstraint(
  21525. $depType,
  21526. $depVersionConstraint,
  21527. $depChannelName,
  21528. $depPackageName
  21529. );
  21530. }
  21531. return $result;
  21532. }
  21533. private function buildDepPackageConstraints($depItem, $depType)
  21534. {
  21535. if ($this->isHash($depItem)) {
  21536. $depItem = array($depItem);
  21537. }
  21538. $result = array();
  21539. foreach ($depItem as $subDepItem) {
  21540. if (!array_key_exists('channel', $subDepItem)) {
  21541. $subDepItem['channel'] = $subDepItem['uri'];
  21542. }
  21543. $depChannelName = $subDepItem['channel'];
  21544. $depPackageName = $subDepItem['name'];
  21545. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21546. if (isset($subDepItem['conflicts'])) {
  21547. $depType = 'conflicts';
  21548. }
  21549. $result[] = new DependencyConstraint(
  21550. $depType,
  21551. $depVersionConstraint,
  21552. $depChannelName,
  21553. $depPackageName
  21554. );
  21555. }
  21556. return $result;
  21557. }
  21558. private function parse20VersionConstraint(array $data)
  21559. {
  21560. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  21561. $versions = array();
  21562. $values = array_intersect_key($data, $dep20toOperatorMap);
  21563. if (0 == count($values)) {
  21564. return '*';
  21565. }
  21566. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  21567. $versions[] = '>' . $this->parseVersion($values['min']);
  21568. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  21569. $versions[] = '<' . $this->parseVersion($values['max']);
  21570. } else {
  21571. foreach ($values as $op => $version) {
  21572. if ('exclude' == $op && is_array($version)) {
  21573. foreach ($version as $versionPart) {
  21574. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  21575. }
  21576. } else {
  21577. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  21578. }
  21579. }
  21580. }
  21581. return implode(',', $versions);
  21582. }
  21583. private function parseVersion($version)
  21584. {
  21585. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  21586. $version = $matches[1]
  21587. .(!empty($matches[2]) ? $matches[2] : '.0')
  21588. .(!empty($matches[3]) ? $matches[3] : '.0')
  21589. .(!empty($matches[4]) ? $matches[4] : '.0');
  21590. return $version;
  21591. }
  21592. return null;
  21593. }
  21594. private function isHash(array $array)
  21595. {
  21596. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  21597. }
  21598. }
  21599. <?php
  21600. namespace Composer\Repository\Pear;
  21601. class PackageInfo
  21602. {
  21603. private $channelName;
  21604. private $packageName;
  21605. private $license;
  21606. private $shortDescription;
  21607. private $description;
  21608. private $releases;
  21609. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  21610. {
  21611. $this->channelName = $channelName;
  21612. $this->packageName = $packageName;
  21613. $this->license = $license;
  21614. $this->shortDescription = $shortDescription;
  21615. $this->description = $description;
  21616. $this->releases = $releases;
  21617. }
  21618. public function getChannelName()
  21619. {
  21620. return $this->channelName;
  21621. }
  21622. public function getPackageName()
  21623. {
  21624. return $this->packageName;
  21625. }
  21626. public function getDescription()
  21627. {
  21628. return $this->description;
  21629. }
  21630. public function getShortDescription()
  21631. {
  21632. return $this->shortDescription;
  21633. }
  21634. public function getLicense()
  21635. {
  21636. return $this->license;
  21637. }
  21638. public function getReleases()
  21639. {
  21640. return $this->releases;
  21641. }
  21642. }
  21643. <?php
  21644. namespace Composer\Repository\Pear;
  21645. class ReleaseInfo
  21646. {
  21647. private $stability;
  21648. private $dependencyInfo;
  21649. public function __construct($stability, $dependencyInfo)
  21650. {
  21651. $this->stability = $stability;
  21652. $this->dependencyInfo = $dependencyInfo;
  21653. }
  21654. public function getDependencyInfo()
  21655. {
  21656. return $this->dependencyInfo;
  21657. }
  21658. public function getStability()
  21659. {
  21660. return $this->stability;
  21661. }
  21662. }
  21663. <?php
  21664. namespace Composer\Repository;
  21665. use Composer\IO\IOInterface;
  21666. use Composer\Semver\VersionParser as SemverVersionParser;
  21667. use Composer\Package\Version\VersionParser;
  21668. use Composer\Repository\Pear\ChannelReader;
  21669. use Composer\Package\CompletePackage;
  21670. use Composer\Repository\Pear\ChannelInfo;
  21671. use Composer\EventDispatcher\EventDispatcher;
  21672. use Composer\Package\Link;
  21673. use Composer\Semver\Constraint\Constraint;
  21674. use Composer\Util\RemoteFilesystem;
  21675. use Composer\Config;
  21676. use Composer\Factory;
  21677. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21678. {
  21679. private $url;
  21680. private $io;
  21681. private $rfs;
  21682. private $versionParser;
  21683. private $repoConfig;
  21684. private $vendorAlias;
  21685. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  21686. {
  21687. parent::__construct();
  21688. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  21689. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  21690. }
  21691. $urlBits = parse_url($repoConfig['url']);
  21692. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  21693. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  21694. }
  21695. $this->url = rtrim($repoConfig['url'], '/');
  21696. $this->io = $io;
  21697. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  21698. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  21699. $this->versionParser = new VersionParser();
  21700. $this->repoConfig = $repoConfig;
  21701. }
  21702. public function getRepoConfig()
  21703. {
  21704. return $this->repoConfig;
  21705. }
  21706. protected function initialize()
  21707. {
  21708. parent::initialize();
  21709. $this->io->writeError('Initializing PEAR repository '.$this->url);
  21710. $reader = new ChannelReader($this->rfs);
  21711. try {
  21712. $channelInfo = $reader->read($this->url);
  21713. } catch (\Exception $e) {
  21714. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  21715. return;
  21716. }
  21717. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  21718. foreach ($packages as $package) {
  21719. $this->addPackage($package);
  21720. }
  21721. }
  21722. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  21723. {
  21724. $result = array();
  21725. foreach ($channelInfo->getPackages() as $packageDefinition) {
  21726. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  21727. try {
  21728. $normalizedVersion = $versionParser->normalize($version);
  21729. } catch (\UnexpectedValueException $e) {
  21730. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  21731. continue;
  21732. }
  21733. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  21734. $urlBits = parse_url($this->url);
  21735. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  21736. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  21737. $requires = array();
  21738. $suggests = array();
  21739. $conflicts = array();
  21740. $replaces = array();
  21741. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  21742. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  21743. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21744. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21745. }
  21746. if (!empty($this->vendorAlias)
  21747. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  21748. ) {
  21749. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  21750. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21751. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21752. }
  21753. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  21754. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21755. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  21756. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  21757. switch ($dependencyConstraint->getType()) {
  21758. case 'required':
  21759. $requires[] = $link;
  21760. break;
  21761. case 'conflicts':
  21762. $conflicts[] = $link;
  21763. break;
  21764. case 'replaces':
  21765. $replaces[] = $link;
  21766. break;
  21767. }
  21768. }
  21769. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  21770. foreach ($dependencyConstraints as $dependencyConstraint) {
  21771. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21772. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  21773. }
  21774. }
  21775. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  21776. $package->setType('pear-library');
  21777. $package->setDescription($packageDefinition->getDescription());
  21778. $package->setLicense(array($packageDefinition->getLicense()));
  21779. $package->setDistType('file');
  21780. $package->setDistUrl($distUrl);
  21781. $package->setAutoload(array('classmap' => array('')));
  21782. $package->setIncludePaths(array('/'));
  21783. $package->setRequires($requires);
  21784. $package->setConflicts($conflicts);
  21785. $package->setSuggests($suggests);
  21786. $package->setReplaces($replaces);
  21787. $result[] = $package;
  21788. }
  21789. }
  21790. return $result;
  21791. }
  21792. private function buildComposerPackageName($channelName, $packageName)
  21793. {
  21794. if ('php' === $channelName) {
  21795. return "php";
  21796. }
  21797. if ('ext' === $channelName) {
  21798. return "ext-{$packageName}";
  21799. }
  21800. return "pear-{$channelName}/{$packageName}";
  21801. }
  21802. }
  21803. <?php
  21804. namespace Composer\Repository;
  21805. use Composer\Package\CompletePackage;
  21806. use Composer\Package\PackageInterface;
  21807. use Composer\Package\Version\VersionParser;
  21808. use Composer\Plugin\PluginInterface;
  21809. use Composer\Util\ProcessExecutor;
  21810. use Composer\Util\Silencer;
  21811. use Composer\Util\Platform;
  21812. use Composer\XdebugHandler\XdebugHandler;
  21813. use Symfony\Component\Process\ExecutableFinder;
  21814. class PlatformRepository extends ArrayRepository
  21815. {
  21816. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-plugin-api)$}iD';
  21817. private $versionParser;
  21818. private $overrides = array();
  21819. private $process;
  21820. public function __construct(array $packages = array(), array $overrides = array(), ProcessExecutor $process = null)
  21821. {
  21822. $this->process = $process === null ? (new ProcessExecutor()) : $process;
  21823. foreach ($overrides as $name => $version) {
  21824. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  21825. }
  21826. parent::__construct($packages);
  21827. }
  21828. protected function initialize()
  21829. {
  21830. parent::initialize();
  21831. $this->versionParser = new VersionParser();
  21832. foreach ($this->overrides as $override) {
  21833. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  21834. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  21835. }
  21836. $this->addOverriddenPackage($override);
  21837. }
  21838. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  21839. $version = $this->versionParser->normalize($prettyVersion);
  21840. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  21841. $composerPluginApi->setDescription('The Composer Plugin API');
  21842. $this->addPackage($composerPluginApi);
  21843. try {
  21844. $prettyVersion = PHP_VERSION;
  21845. $version = $this->versionParser->normalize($prettyVersion);
  21846. } catch (\UnexpectedValueException $e) {
  21847. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  21848. $version = $this->versionParser->normalize($prettyVersion);
  21849. }
  21850. $php = new CompletePackage('php', $version, $prettyVersion);
  21851. $php->setDescription('The PHP interpreter');
  21852. $this->addPackage($php);
  21853. if (PHP_DEBUG) {
  21854. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  21855. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  21856. $this->addPackage($phpdebug);
  21857. }
  21858. if (defined('PHP_ZTS') && PHP_ZTS) {
  21859. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  21860. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  21861. $this->addPackage($phpzts);
  21862. }
  21863. if (PHP_INT_SIZE === 8) {
  21864. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  21865. $php64->setDescription('The PHP interpreter, 64bit');
  21866. $this->addPackage($php64);
  21867. }
  21868. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  21869. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  21870. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  21871. $this->addPackage($phpIpv6);
  21872. }
  21873. $loadedExtensions = get_loaded_extensions();
  21874. foreach ($loadedExtensions as $name) {
  21875. if (in_array($name, array('standard', 'Core'))) {
  21876. continue;
  21877. }
  21878. $reflExt = new \ReflectionExtension($name);
  21879. $prettyVersion = $reflExt->getVersion();
  21880. $this->addExtension($name, $prettyVersion);
  21881. }
  21882. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  21883. $this->addExtension('xdebug', $prettyVersion);
  21884. }
  21885. foreach ($loadedExtensions as $name) {
  21886. $prettyVersion = null;
  21887. $description = 'The '.$name.' PHP library';
  21888. switch ($name) {
  21889. case 'curl':
  21890. $curlVersion = curl_version();
  21891. $prettyVersion = $curlVersion['version'];
  21892. break;
  21893. case 'iconv':
  21894. $prettyVersion = ICONV_VERSION;
  21895. break;
  21896. case 'intl':
  21897. $name = 'ICU';
  21898. if (defined('INTL_ICU_VERSION')) {
  21899. $prettyVersion = INTL_ICU_VERSION;
  21900. } else {
  21901. $reflector = new \ReflectionExtension('intl');
  21902. ob_start();
  21903. $reflector->info();
  21904. $output = ob_get_clean();
  21905. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  21906. $prettyVersion = $matches[1];
  21907. }
  21908. break;
  21909. case 'imagick':
  21910. $imagick = new \Imagick();
  21911. $imageMagickVersion = $imagick->getVersion();
  21912. preg_match('/^ImageMagick ([\d.]+)(?:-(\d+))?/', $imageMagickVersion['versionString'], $matches);
  21913. if (isset($matches[2])) {
  21914. $prettyVersion = "{$matches[1]}.{$matches[2]}";
  21915. } else {
  21916. $prettyVersion = $matches[1];
  21917. }
  21918. break;
  21919. case 'libxml':
  21920. $prettyVersion = LIBXML_DOTTED_VERSION;
  21921. break;
  21922. case 'openssl':
  21923. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  21924. if (empty($match[2])) {
  21925. return $match[1];
  21926. }
  21927. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  21928. return 0;
  21929. }
  21930. $len = strlen($match[2]);
  21931. $patchVersion = ($len - 1) * 26;
  21932. $patchVersion += ord($match[2][$len - 1]) - 96;
  21933. return $match[1].'.'.$patchVersion;
  21934. }, OPENSSL_VERSION_TEXT);
  21935. $description = OPENSSL_VERSION_TEXT;
  21936. break;
  21937. case 'pcre':
  21938. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  21939. break;
  21940. case 'uuid':
  21941. $prettyVersion = phpversion('uuid');
  21942. break;
  21943. case 'xsl':
  21944. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  21945. break;
  21946. default:
  21947. continue 2;
  21948. }
  21949. try {
  21950. $version = $this->versionParser->normalize($prettyVersion);
  21951. } catch (\UnexpectedValueException $e) {
  21952. continue;
  21953. }
  21954. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  21955. $lib->setDescription($description);
  21956. $this->addPackage($lib);
  21957. }
  21958. $hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
  21959. if ($hhvmVersion === null && !Platform::isWindows()) {
  21960. $finder = new ExecutableFinder();
  21961. $hhvm = $finder->find('hhvm');
  21962. if ($hhvm !== null) {
  21963. $exitCode = $this->process->execute(
  21964. ProcessExecutor::escape($hhvm).
  21965. ' --php -d hhvm.jit=0 -r "echo HHVM_VERSION;" 2>/dev/null',
  21966. $hhvmVersion
  21967. );
  21968. if ($exitCode !== 0) {
  21969. $hhvmVersion = null;
  21970. }
  21971. }
  21972. }
  21973. if ($hhvmVersion) {
  21974. try {
  21975. $prettyVersion = $hhvmVersion;
  21976. $version = $this->versionParser->normalize($prettyVersion);
  21977. } catch (\UnexpectedValueException $e) {
  21978. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
  21979. $version = $this->versionParser->normalize($prettyVersion);
  21980. }
  21981. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  21982. $hhvm->setDescription('The HHVM Runtime (64bit)');
  21983. $this->addPackage($hhvm);
  21984. }
  21985. }
  21986. public function addPackage(PackageInterface $package)
  21987. {
  21988. if (isset($this->overrides[$package->getName()])) {
  21989. $overrider = $this->findPackage($package->getName(), '*');
  21990. if ($package->getVersion() === $overrider->getVersion()) {
  21991. $actualText = 'same as actual';
  21992. } else {
  21993. $actualText = 'actual: '.$package->getPrettyVersion();
  21994. }
  21995. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  21996. return;
  21997. }
  21998. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  21999. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  22000. if ($package->getVersion() === $overrider->getVersion()) {
  22001. $actualText = 'same as actual';
  22002. } else {
  22003. $actualText = 'actual: '.$package->getPrettyVersion();
  22004. }
  22005. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22006. return;
  22007. }
  22008. parent::addPackage($package);
  22009. }
  22010. private function addOverriddenPackage(array $override, $name = null)
  22011. {
  22012. $version = $this->versionParser->normalize($override['version']);
  22013. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  22014. $package->setDescription('Package overridden via config.platform');
  22015. $package->setExtra(array('config.platform' => true));
  22016. parent::addPackage($package);
  22017. return $package;
  22018. }
  22019. private function addExtension($name, $prettyVersion)
  22020. {
  22021. $extraDescription = null;
  22022. try {
  22023. $version = $this->versionParser->normalize($prettyVersion);
  22024. } catch (\UnexpectedValueException $e) {
  22025. $extraDescription = ' (actual version: '.$prettyVersion.')';
  22026. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  22027. $prettyVersion = $match[1];
  22028. } else {
  22029. $prettyVersion = '0';
  22030. }
  22031. $version = $this->versionParser->normalize($prettyVersion);
  22032. }
  22033. $packageName = $this->buildPackageName($name);
  22034. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  22035. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  22036. $this->addPackage($ext);
  22037. }
  22038. private function buildPackageName($name)
  22039. {
  22040. return 'ext-' . str_replace(' ', '-', $name);
  22041. }
  22042. }
  22043. <?php
  22044. namespace Composer\Repository;
  22045. use Composer\Factory;
  22046. use Composer\IO\IOInterface;
  22047. use Composer\Config;
  22048. use Composer\EventDispatcher\EventDispatcher;
  22049. use Composer\Util\RemoteFilesystem;
  22050. use Composer\Json\JsonFile;
  22051. class RepositoryFactory
  22052. {
  22053. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  22054. {
  22055. if (0 === strpos($repository, 'http')) {
  22056. $repoConfig = array('type' => 'composer', 'url' => $repository);
  22057. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  22058. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  22059. $data = $json->read();
  22060. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  22061. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  22062. } elseif ($allowFilesystem) {
  22063. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  22064. } else {
  22065. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  22066. }
  22067. } elseif ('{' === substr($repository, 0, 1)) {
  22068. $repoConfig = JsonFile::parseJson($repository);
  22069. } else {
  22070. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  22071. }
  22072. return $repoConfig;
  22073. }
  22074. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  22075. {
  22076. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  22077. return static::createRepo($io, $config, $repoConfig);
  22078. }
  22079. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  22080. {
  22081. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  22082. $repos = static::createRepos($rm, array($repoConfig));
  22083. return reset($repos);
  22084. }
  22085. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  22086. {
  22087. if (!$config) {
  22088. $config = Factory::createConfig($io);
  22089. }
  22090. if ($io) {
  22091. $io->loadConfiguration($config);
  22092. }
  22093. if (!$rm) {
  22094. if (!$io) {
  22095. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  22096. }
  22097. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  22098. }
  22099. return static::createRepos($rm, $config->getRepositories());
  22100. }
  22101. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  22102. {
  22103. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  22104. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  22105. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  22106. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  22107. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  22108. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  22109. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  22110. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  22111. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  22112. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  22113. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  22114. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  22115. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  22116. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  22117. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  22118. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  22119. return $rm;
  22120. }
  22121. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  22122. {
  22123. $repos = array();
  22124. foreach ($repoConfigs as $index => $repo) {
  22125. if (is_string($repo)) {
  22126. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  22127. }
  22128. if (!is_array($repo)) {
  22129. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  22130. }
  22131. if (!isset($repo['type'])) {
  22132. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  22133. }
  22134. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  22135. while (isset($repos[$name])) {
  22136. $name .= '2';
  22137. }
  22138. if ($repo['type'] === 'filesystem') {
  22139. $repos[$name] = new FilesystemRepository($repo['json']);
  22140. } else {
  22141. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  22142. }
  22143. }
  22144. return $repos;
  22145. }
  22146. }
  22147. <?php
  22148. namespace Composer\Repository;
  22149. use Composer\Package\PackageInterface;
  22150. interface RepositoryInterface extends \Countable
  22151. {
  22152. const SEARCH_FULLTEXT = 0;
  22153. const SEARCH_NAME = 1;
  22154. public function hasPackage(PackageInterface $package);
  22155. public function findPackage($name, $constraint);
  22156. public function findPackages($name, $constraint = null);
  22157. public function getPackages();
  22158. public function search($query, $mode = 0);
  22159. }
  22160. <?php
  22161. namespace Composer\Repository;
  22162. use Composer\IO\IOInterface;
  22163. use Composer\Config;
  22164. use Composer\EventDispatcher\EventDispatcher;
  22165. use Composer\Package\PackageInterface;
  22166. use Composer\Util\RemoteFilesystem;
  22167. class RepositoryManager
  22168. {
  22169. private $localRepository;
  22170. private $repositories = array();
  22171. private $repositoryClasses = array();
  22172. private $io;
  22173. private $config;
  22174. private $eventDispatcher;
  22175. private $rfs;
  22176. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  22177. {
  22178. $this->io = $io;
  22179. $this->config = $config;
  22180. $this->eventDispatcher = $eventDispatcher;
  22181. $this->rfs = $rfs;
  22182. }
  22183. public function findPackage($name, $constraint)
  22184. {
  22185. foreach ($this->repositories as $repository) {
  22186. if ($package = $repository->findPackage($name, $constraint)) {
  22187. return $package;
  22188. }
  22189. }
  22190. return null;
  22191. }
  22192. public function findPackages($name, $constraint)
  22193. {
  22194. $packages = array();
  22195. foreach ($this->getRepositories() as $repository) {
  22196. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  22197. }
  22198. return $packages;
  22199. }
  22200. public function addRepository(RepositoryInterface $repository)
  22201. {
  22202. $this->repositories[] = $repository;
  22203. }
  22204. public function prependRepository(RepositoryInterface $repository)
  22205. {
  22206. array_unshift($this->repositories, $repository);
  22207. }
  22208. public function createRepository($type, $config, $name = null)
  22209. {
  22210. if (!isset($this->repositoryClasses[$type])) {
  22211. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  22212. }
  22213. if (isset($config['packagist']) && false === $config['packagist']) {
  22214. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  22215. }
  22216. $class = $this->repositoryClasses[$type];
  22217. $reflMethod = new \ReflectionMethod($class, '__construct');
  22218. $params = $reflMethod->getParameters();
  22219. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  22220. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  22221. }
  22222. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  22223. }
  22224. public function setRepositoryClass($type, $class)
  22225. {
  22226. $this->repositoryClasses[$type] = $class;
  22227. }
  22228. public function getRepositories()
  22229. {
  22230. return $this->repositories;
  22231. }
  22232. public function setLocalRepository(WritableRepositoryInterface $repository)
  22233. {
  22234. $this->localRepository = $repository;
  22235. }
  22236. public function getLocalRepository()
  22237. {
  22238. return $this->localRepository;
  22239. }
  22240. }
  22241. <?php
  22242. namespace Composer\Repository;
  22243. class RepositorySecurityException extends \Exception
  22244. {
  22245. }
  22246. <?php
  22247. namespace Composer\Repository\Vcs;
  22248. use Composer\Cache;
  22249. use Composer\Downloader\TransportException;
  22250. use Composer\Json\JsonFile;
  22251. use Composer\Util\Bitbucket;
  22252. abstract class BitbucketDriver extends VcsDriver
  22253. {
  22254. protected $cache;
  22255. protected $owner;
  22256. protected $repository;
  22257. protected $hasIssues;
  22258. protected $rootIdentifier;
  22259. protected $tags;
  22260. protected $branches;
  22261. protected $infoCache = array();
  22262. protected $branchesUrl = '';
  22263. protected $tagsUrl = '';
  22264. protected $homeUrl = '';
  22265. protected $website = '';
  22266. protected $cloneHttpsUrl = '';
  22267. protected $fallbackDriver;
  22268. protected $vcsType;
  22269. public function initialize()
  22270. {
  22271. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#', $this->url, $match);
  22272. $this->owner = $match[1];
  22273. $this->repository = $match[2];
  22274. $this->originUrl = 'bitbucket.org';
  22275. $this->cache = new Cache(
  22276. $this->io,
  22277. implode('/', array(
  22278. $this->config->get('cache-repo-dir'),
  22279. $this->originUrl,
  22280. $this->owner,
  22281. $this->repository,
  22282. ))
  22283. );
  22284. }
  22285. public function getUrl()
  22286. {
  22287. if ($this->fallbackDriver) {
  22288. return $this->fallbackDriver->getUrl();
  22289. }
  22290. return $this->cloneHttpsUrl;
  22291. }
  22292. protected function getRepoData()
  22293. {
  22294. $resource = sprintf(
  22295. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  22296. $this->owner,
  22297. $this->repository,
  22298. http_build_query(
  22299. array('fields' => '-project,-owner'),
  22300. null,
  22301. '&'
  22302. )
  22303. );
  22304. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  22305. if ($this->fallbackDriver) {
  22306. return false;
  22307. }
  22308. $this->parseCloneUrls($repoData['links']['clone']);
  22309. $this->hasIssues = !empty($repoData['has_issues']);
  22310. $this->branchesUrl = $repoData['links']['branches']['href'];
  22311. $this->tagsUrl = $repoData['links']['tags']['href'];
  22312. $this->homeUrl = $repoData['links']['html']['href'];
  22313. $this->website = $repoData['website'];
  22314. $this->vcsType = $repoData['scm'];
  22315. return true;
  22316. }
  22317. public function getComposerInformation($identifier)
  22318. {
  22319. if ($this->fallbackDriver) {
  22320. return $this->fallbackDriver->getComposerInformation($identifier);
  22321. }
  22322. if (!isset($this->infoCache[$identifier])) {
  22323. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22324. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22325. }
  22326. $composer = $this->getBaseComposerInformation($identifier);
  22327. if ($composer) {
  22328. if (!isset($composer['support']['source'])) {
  22329. $label = array_search(
  22330. $identifier,
  22331. $this->getTags()
  22332. ) ?: array_search(
  22333. $identifier,
  22334. $this->getBranches()
  22335. ) ?: $identifier;
  22336. if (array_key_exists($label, $tags = $this->getTags())) {
  22337. $hash = $tags[$label];
  22338. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  22339. $hash = $branches[$label];
  22340. }
  22341. if (! isset($hash)) {
  22342. $composer['support']['source'] = sprintf(
  22343. 'https://%s/%s/%s/src',
  22344. $this->originUrl,
  22345. $this->owner,
  22346. $this->repository
  22347. );
  22348. } else {
  22349. $composer['support']['source'] = sprintf(
  22350. 'https://%s/%s/%s/src/%s/?at=%s',
  22351. $this->originUrl,
  22352. $this->owner,
  22353. $this->repository,
  22354. $hash,
  22355. $label
  22356. );
  22357. }
  22358. }
  22359. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22360. $composer['support']['issues'] = sprintf(
  22361. 'https://%s/%s/%s/issues',
  22362. $this->originUrl,
  22363. $this->owner,
  22364. $this->repository
  22365. );
  22366. }
  22367. if (!isset($composer['homepage'])) {
  22368. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  22369. }
  22370. }
  22371. $this->infoCache[$identifier] = $composer;
  22372. if ($this->shouldCache($identifier)) {
  22373. $this->cache->write($identifier, json_encode($composer));
  22374. }
  22375. }
  22376. return $this->infoCache[$identifier];
  22377. }
  22378. public function getFileContent($file, $identifier)
  22379. {
  22380. if ($this->fallbackDriver) {
  22381. return $this->fallbackDriver->getFileContent($file, $identifier);
  22382. }
  22383. if (strpos($identifier, '/') !== false) {
  22384. $branches = $this->getBranches();
  22385. if (isset($branches[$identifier])) {
  22386. $identifier = $branches[$identifier];
  22387. }
  22388. }
  22389. $resource = sprintf(
  22390. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  22391. $this->owner,
  22392. $this->repository,
  22393. $identifier,
  22394. $file
  22395. );
  22396. return $this->getContentsWithOAuthCredentials($resource);
  22397. }
  22398. public function getChangeDate($identifier)
  22399. {
  22400. if ($this->fallbackDriver) {
  22401. return $this->fallbackDriver->getChangeDate($identifier);
  22402. }
  22403. $resource = sprintf(
  22404. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  22405. $this->owner,
  22406. $this->repository,
  22407. $identifier
  22408. );
  22409. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22410. return new \DateTime($commit['date']);
  22411. }
  22412. public function getSource($identifier)
  22413. {
  22414. if ($this->fallbackDriver) {
  22415. return $this->fallbackDriver->getSource($identifier);
  22416. }
  22417. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  22418. }
  22419. public function getDist($identifier)
  22420. {
  22421. if ($this->fallbackDriver) {
  22422. return $this->fallbackDriver->getDist($identifier);
  22423. }
  22424. $url = sprintf(
  22425. 'https://bitbucket.org/%s/%s/get/%s.zip',
  22426. $this->owner,
  22427. $this->repository,
  22428. $identifier
  22429. );
  22430. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22431. }
  22432. public function getTags()
  22433. {
  22434. if ($this->fallbackDriver) {
  22435. return $this->fallbackDriver->getTags();
  22436. }
  22437. if (null === $this->tags) {
  22438. $this->tags = array();
  22439. $resource = sprintf(
  22440. '%s?%s',
  22441. $this->tagsUrl,
  22442. http_build_query(
  22443. array(
  22444. 'pagelen' => 100,
  22445. 'fields' => 'values.name,values.target.hash,next',
  22446. 'sort' => '-target.date',
  22447. ),
  22448. null,
  22449. '&'
  22450. )
  22451. );
  22452. $hasNext = true;
  22453. while ($hasNext) {
  22454. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22455. foreach ($tagsData['values'] as $data) {
  22456. $this->tags[$data['name']] = $data['target']['hash'];
  22457. }
  22458. if (empty($tagsData['next'])) {
  22459. $hasNext = false;
  22460. } else {
  22461. $resource = $tagsData['next'];
  22462. }
  22463. }
  22464. if ($this->vcsType === 'hg') {
  22465. unset($this->tags['tip']);
  22466. }
  22467. }
  22468. return $this->tags;
  22469. }
  22470. public function getBranches()
  22471. {
  22472. if ($this->fallbackDriver) {
  22473. return $this->fallbackDriver->getBranches();
  22474. }
  22475. if (null === $this->branches) {
  22476. $this->branches = array();
  22477. $resource = sprintf(
  22478. '%s?%s',
  22479. $this->branchesUrl,
  22480. http_build_query(
  22481. array(
  22482. 'pagelen' => 100,
  22483. 'fields' => 'values.name,values.target.hash,values.heads,next',
  22484. 'sort' => '-target.date',
  22485. ),
  22486. null,
  22487. '&'
  22488. )
  22489. );
  22490. $hasNext = true;
  22491. while ($hasNext) {
  22492. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22493. foreach ($branchData['values'] as $data) {
  22494. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  22495. continue;
  22496. }
  22497. $this->branches[$data['name']] = $data['target']['hash'];
  22498. }
  22499. if (empty($branchData['next'])) {
  22500. $hasNext = false;
  22501. } else {
  22502. $resource = $branchData['next'];
  22503. }
  22504. }
  22505. }
  22506. return $this->branches;
  22507. }
  22508. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  22509. {
  22510. try {
  22511. return parent::getContents($url);
  22512. } catch (TransportException $e) {
  22513. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22514. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  22515. if (!$this->io->hasAuthentication($this->originUrl)
  22516. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  22517. ) {
  22518. return parent::getContents($url);
  22519. }
  22520. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22521. return $this->attemptCloneFallback();
  22522. }
  22523. }
  22524. throw $e;
  22525. }
  22526. }
  22527. abstract protected function generateSshUrl();
  22528. protected function attemptCloneFallback()
  22529. {
  22530. try {
  22531. $this->setupFallbackDriver($this->generateSshUrl());
  22532. } catch (\RuntimeException $e) {
  22533. $this->fallbackDriver = null;
  22534. $this->io->writeError(
  22535. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  22536. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  22537. );
  22538. throw $e;
  22539. }
  22540. }
  22541. abstract protected function setupFallbackDriver($url);
  22542. protected function parseCloneUrls(array $cloneLinks)
  22543. {
  22544. foreach ($cloneLinks as $cloneLink) {
  22545. if ($cloneLink['name'] === 'https') {
  22546. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  22547. }
  22548. }
  22549. }
  22550. protected function getMainBranchData()
  22551. {
  22552. $resource = sprintf(
  22553. 'https://api.bitbucket.org/2.0/repositories/%s/%s?fields=mainbranch',
  22554. $this->owner,
  22555. $this->repository
  22556. );
  22557. $data = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22558. if (isset($data['mainbranch'])) {
  22559. return $data['mainbranch'];
  22560. }
  22561. return null;
  22562. }
  22563. }
  22564. <?php
  22565. namespace Composer\Repository\Vcs;
  22566. use Composer\Config;
  22567. use Composer\Util\ProcessExecutor;
  22568. use Composer\Util\Filesystem;
  22569. use Composer\IO\IOInterface;
  22570. class FossilDriver extends VcsDriver
  22571. {
  22572. protected $tags;
  22573. protected $branches;
  22574. protected $rootIdentifier;
  22575. protected $repoFile;
  22576. protected $checkoutDir;
  22577. protected $infoCache = array();
  22578. public function initialize()
  22579. {
  22580. $this->checkFossil();
  22581. $this->config->prohibitUrlByConfig($this->url, $this->io);
  22582. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  22583. $this->checkoutDir = $this->url;
  22584. } else {
  22585. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  22586. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  22587. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  22588. $this->updateLocalRepo();
  22589. }
  22590. $this->getTags();
  22591. $this->getBranches();
  22592. }
  22593. protected function checkFossil()
  22594. {
  22595. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  22596. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  22597. }
  22598. }
  22599. protected function updateLocalRepo()
  22600. {
  22601. $fs = new Filesystem();
  22602. $fs->ensureDirectoryExists($this->checkoutDir);
  22603. if (!is_writable(dirname($this->checkoutDir))) {
  22604. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  22605. }
  22606. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  22607. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  22608. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  22609. }
  22610. } else {
  22611. $fs->removeDirectory($this->checkoutDir);
  22612. $fs->remove($this->repoFile);
  22613. $fs->ensureDirectoryExists($this->checkoutDir);
  22614. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  22615. $output = $this->process->getErrorOutput();
  22616. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  22617. }
  22618. if (0 !== $this->process->execute(sprintf('fossil open %s --nested', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  22619. $output = $this->process->getErrorOutput();
  22620. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  22621. }
  22622. }
  22623. }
  22624. public function getRootIdentifier()
  22625. {
  22626. if (null === $this->rootIdentifier) {
  22627. $this->rootIdentifier = 'trunk';
  22628. }
  22629. return $this->rootIdentifier;
  22630. }
  22631. public function getUrl()
  22632. {
  22633. return $this->url;
  22634. }
  22635. public function getSource($identifier)
  22636. {
  22637. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  22638. }
  22639. public function getDist($identifier)
  22640. {
  22641. return null;
  22642. }
  22643. public function getFileContent($file, $identifier)
  22644. {
  22645. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22646. $this->process->execute($command, $content, $this->checkoutDir);
  22647. if (!trim($content)) {
  22648. return null;
  22649. }
  22650. return $content;
  22651. }
  22652. public function getChangeDate($identifier)
  22653. {
  22654. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  22655. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  22656. return new \DateTime($date, new \DateTimeZone('UTC'));
  22657. }
  22658. public function getTags()
  22659. {
  22660. if (null === $this->tags) {
  22661. $tags = array();
  22662. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  22663. foreach ($this->process->splitLines($output) as $tag) {
  22664. $tags[$tag] = $tag;
  22665. }
  22666. $this->tags = $tags;
  22667. }
  22668. return $this->tags;
  22669. }
  22670. public function getBranches()
  22671. {
  22672. if (null === $this->branches) {
  22673. $branches = array();
  22674. $bookmarks = array();
  22675. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  22676. foreach ($this->process->splitLines($output) as $branch) {
  22677. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  22678. $branches[$branch] = $branch;
  22679. }
  22680. $this->branches = $branches;
  22681. }
  22682. return $this->branches;
  22683. }
  22684. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22685. {
  22686. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  22687. return true;
  22688. }
  22689. if (preg_match('!/fossil/|\.fossil!', $url)) {
  22690. return true;
  22691. }
  22692. if (Filesystem::isLocalPath($url)) {
  22693. $url = Filesystem::getPlatformPath($url);
  22694. if (!is_dir($url)) {
  22695. return false;
  22696. }
  22697. $process = new ProcessExecutor($io);
  22698. if ($process->execute('fossil info', $output, $url) === 0) {
  22699. return true;
  22700. }
  22701. }
  22702. return false;
  22703. }
  22704. }
  22705. <?php
  22706. namespace Composer\Repository\Vcs;
  22707. use Composer\Config;
  22708. use Composer\IO\IOInterface;
  22709. class GitBitbucketDriver extends BitbucketDriver
  22710. {
  22711. public function getRootIdentifier()
  22712. {
  22713. if ($this->fallbackDriver) {
  22714. return $this->fallbackDriver->getRootIdentifier();
  22715. }
  22716. if (null === $this->rootIdentifier) {
  22717. if (! $this->getRepoData()) {
  22718. return $this->fallbackDriver->getRootIdentifier();
  22719. }
  22720. if ($this->vcsType !== 'git') {
  22721. throw new \RuntimeException(
  22722. $this->url.' does not appear to be a git repository, use '.
  22723. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  22724. );
  22725. }
  22726. $mainBranchData = $this->getMainBranchData();
  22727. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  22728. }
  22729. return $this->rootIdentifier;
  22730. }
  22731. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22732. {
  22733. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
  22734. return false;
  22735. }
  22736. if (!extension_loaded('openssl')) {
  22737. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22738. return false;
  22739. }
  22740. return true;
  22741. }
  22742. protected function setupFallbackDriver($url)
  22743. {
  22744. $this->fallbackDriver = new GitDriver(
  22745. array('url' => $url),
  22746. $this->io,
  22747. $this->config,
  22748. $this->process,
  22749. $this->remoteFilesystem
  22750. );
  22751. $this->fallbackDriver->initialize();
  22752. }
  22753. protected function generateSshUrl()
  22754. {
  22755. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  22756. }
  22757. }
  22758. <?php
  22759. namespace Composer\Repository\Vcs;
  22760. use Composer\Util\ProcessExecutor;
  22761. use Composer\Util\Filesystem;
  22762. use Composer\Util\Git as GitUtil;
  22763. use Composer\IO\IOInterface;
  22764. use Composer\Cache;
  22765. use Composer\Config;
  22766. class GitDriver extends VcsDriver
  22767. {
  22768. protected $cache;
  22769. protected $tags;
  22770. protected $branches;
  22771. protected $rootIdentifier;
  22772. protected $repoDir;
  22773. protected $infoCache = array();
  22774. public function initialize()
  22775. {
  22776. if (Filesystem::isLocalPath($this->url)) {
  22777. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  22778. $this->repoDir = $this->url;
  22779. $cacheUrl = realpath($this->url);
  22780. } else {
  22781. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  22782. GitUtil::cleanEnv();
  22783. $fs = new Filesystem();
  22784. $fs->ensureDirectoryExists(dirname($this->repoDir));
  22785. if (!is_writable(dirname($this->repoDir))) {
  22786. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  22787. }
  22788. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  22789. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  22790. }
  22791. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  22792. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  22793. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  22794. }
  22795. $cacheUrl = $this->url;
  22796. }
  22797. $this->getTags();
  22798. $this->getBranches();
  22799. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  22800. }
  22801. public function getRootIdentifier()
  22802. {
  22803. if (null === $this->rootIdentifier) {
  22804. $this->rootIdentifier = 'master';
  22805. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  22806. $branches = $this->process->splitLines($output);
  22807. if (!in_array('* master', $branches)) {
  22808. foreach ($branches as $branch) {
  22809. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  22810. $this->rootIdentifier = $match[1];
  22811. break;
  22812. }
  22813. }
  22814. }
  22815. }
  22816. return $this->rootIdentifier;
  22817. }
  22818. public function getUrl()
  22819. {
  22820. return $this->url;
  22821. }
  22822. public function getSource($identifier)
  22823. {
  22824. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  22825. }
  22826. public function getDist($identifier)
  22827. {
  22828. return null;
  22829. }
  22830. public function getFileContent($file, $identifier)
  22831. {
  22832. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22833. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  22834. if (!trim($content)) {
  22835. return null;
  22836. }
  22837. return $content;
  22838. }
  22839. public function getChangeDate($identifier)
  22840. {
  22841. $this->process->execute(sprintf(
  22842. 'git log -1 --format=%%at %s',
  22843. ProcessExecutor::escape($identifier)
  22844. ), $output, $this->repoDir);
  22845. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  22846. }
  22847. public function getTags()
  22848. {
  22849. if (null === $this->tags) {
  22850. $this->tags = array();
  22851. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  22852. foreach ($output = $this->process->splitLines($output) as $tag) {
  22853. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  22854. $this->tags[$match[2]] = $match[1];
  22855. }
  22856. }
  22857. }
  22858. return $this->tags;
  22859. }
  22860. public function getBranches()
  22861. {
  22862. if (null === $this->branches) {
  22863. $branches = array();
  22864. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  22865. foreach ($this->process->splitLines($output) as $branch) {
  22866. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  22867. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  22868. $branches[$match[1]] = $match[2];
  22869. }
  22870. }
  22871. }
  22872. $this->branches = $branches;
  22873. }
  22874. return $this->branches;
  22875. }
  22876. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22877. {
  22878. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  22879. return true;
  22880. }
  22881. if (Filesystem::isLocalPath($url)) {
  22882. $url = Filesystem::getPlatformPath($url);
  22883. if (!is_dir($url)) {
  22884. return false;
  22885. }
  22886. $process = new ProcessExecutor($io);
  22887. if ($process->execute('git tag', $output, $url) === 0) {
  22888. return true;
  22889. }
  22890. }
  22891. if (!$deep) {
  22892. return false;
  22893. }
  22894. $process = new ProcessExecutor($io);
  22895. return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
  22896. }
  22897. }
  22898. <?php
  22899. namespace Composer\Repository\Vcs;
  22900. use Composer\Config;
  22901. use Composer\Downloader\TransportException;
  22902. use Composer\Json\JsonFile;
  22903. use Composer\Cache;
  22904. use Composer\IO\IOInterface;
  22905. use Composer\Util\GitHub;
  22906. class GitHubDriver extends VcsDriver
  22907. {
  22908. protected $cache;
  22909. protected $owner;
  22910. protected $repository;
  22911. protected $tags;
  22912. protected $branches;
  22913. protected $rootIdentifier;
  22914. protected $repoData;
  22915. protected $hasIssues;
  22916. protected $infoCache = array();
  22917. protected $isPrivate = false;
  22918. protected $gitDriver;
  22919. public function initialize()
  22920. {
  22921. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  22922. $this->owner = $match[3];
  22923. $this->repository = $match[4];
  22924. $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
  22925. if ($this->originUrl === 'www.github.com') {
  22926. $this->originUrl = 'github.com';
  22927. }
  22928. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  22929. if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
  22930. $this->setupGitDriver($this->url);
  22931. return;
  22932. }
  22933. $this->fetchRootIdentifier();
  22934. }
  22935. public function getRepositoryUrl()
  22936. {
  22937. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  22938. }
  22939. public function getRootIdentifier()
  22940. {
  22941. if ($this->gitDriver) {
  22942. return $this->gitDriver->getRootIdentifier();
  22943. }
  22944. return $this->rootIdentifier;
  22945. }
  22946. public function getUrl()
  22947. {
  22948. if ($this->gitDriver) {
  22949. return $this->gitDriver->getUrl();
  22950. }
  22951. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  22952. }
  22953. protected function getApiUrl()
  22954. {
  22955. if ('github.com' === $this->originUrl) {
  22956. $apiUrl = 'api.github.com';
  22957. } else {
  22958. $apiUrl = $this->originUrl . '/api/v3';
  22959. }
  22960. return 'https://' . $apiUrl;
  22961. }
  22962. public function getSource($identifier)
  22963. {
  22964. if ($this->gitDriver) {
  22965. return $this->gitDriver->getSource($identifier);
  22966. }
  22967. if ($this->isPrivate) {
  22968. $url = $this->generateSshUrl();
  22969. } else {
  22970. $url = $this->getUrl();
  22971. }
  22972. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  22973. }
  22974. public function getDist($identifier)
  22975. {
  22976. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  22977. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22978. }
  22979. public function getComposerInformation($identifier)
  22980. {
  22981. if ($this->gitDriver) {
  22982. return $this->gitDriver->getComposerInformation($identifier);
  22983. }
  22984. if (!isset($this->infoCache[$identifier])) {
  22985. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22986. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22987. }
  22988. $composer = $this->getBaseComposerInformation($identifier);
  22989. if ($composer) {
  22990. if (!isset($composer['support']['source'])) {
  22991. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  22992. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  22993. }
  22994. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22995. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  22996. }
  22997. }
  22998. if ($this->shouldCache($identifier)) {
  22999. $this->cache->write($identifier, json_encode($composer));
  23000. }
  23001. $this->infoCache[$identifier] = $composer;
  23002. }
  23003. return $this->infoCache[$identifier];
  23004. }
  23005. public function getFileContent($file, $identifier)
  23006. {
  23007. if ($this->gitDriver) {
  23008. return $this->gitDriver->getFileContent($file, $identifier);
  23009. }
  23010. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  23011. $resource = JsonFile::parseJson($this->getContents($resource));
  23012. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  23013. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  23014. }
  23015. return $content;
  23016. }
  23017. public function getChangeDate($identifier)
  23018. {
  23019. if ($this->gitDriver) {
  23020. return $this->gitDriver->getChangeDate($identifier);
  23021. }
  23022. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  23023. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  23024. return new \DateTime($commit['commit']['committer']['date']);
  23025. }
  23026. public function getTags()
  23027. {
  23028. if ($this->gitDriver) {
  23029. return $this->gitDriver->getTags();
  23030. }
  23031. if (null === $this->tags) {
  23032. $this->tags = array();
  23033. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  23034. do {
  23035. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  23036. foreach ($tagsData as $tag) {
  23037. $this->tags[$tag['name']] = $tag['commit']['sha'];
  23038. }
  23039. $resource = $this->getNextPage();
  23040. } while ($resource);
  23041. }
  23042. return $this->tags;
  23043. }
  23044. public function getBranches()
  23045. {
  23046. if ($this->gitDriver) {
  23047. return $this->gitDriver->getBranches();
  23048. }
  23049. if (null === $this->branches) {
  23050. $this->branches = array();
  23051. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  23052. $branchBlacklist = array('gh-pages');
  23053. do {
  23054. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  23055. foreach ($branchData as $branch) {
  23056. $name = substr($branch['ref'], 11);
  23057. if (!in_array($name, $branchBlacklist)) {
  23058. $this->branches[$name] = $branch['object']['sha'];
  23059. }
  23060. }
  23061. $resource = $this->getNextPage();
  23062. } while ($resource);
  23063. }
  23064. return $this->branches;
  23065. }
  23066. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23067. {
  23068. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  23069. return false;
  23070. }
  23071. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  23072. if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
  23073. return false;
  23074. }
  23075. if (!extension_loaded('openssl')) {
  23076. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23077. return false;
  23078. }
  23079. return true;
  23080. }
  23081. public function getRepoData()
  23082. {
  23083. $this->fetchRootIdentifier();
  23084. return $this->repoData;
  23085. }
  23086. protected function generateSshUrl()
  23087. {
  23088. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  23089. }
  23090. protected function getContents($url, $fetchingRepoData = false)
  23091. {
  23092. try {
  23093. return parent::getContents($url);
  23094. } catch (TransportException $e) {
  23095. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23096. switch ($e->getCode()) {
  23097. case 401:
  23098. case 404:
  23099. if (!$fetchingRepoData) {
  23100. throw $e;
  23101. }
  23102. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  23103. return parent::getContents($url);
  23104. }
  23105. if (!$this->io->isInteractive()) {
  23106. return $this->attemptCloneFallback();
  23107. }
  23108. $scopesIssued = array();
  23109. $scopesNeeded = array();
  23110. if ($headers = $e->getHeaders()) {
  23111. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  23112. $scopesIssued = explode(' ', $scopes);
  23113. }
  23114. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  23115. $scopesNeeded = explode(' ', $scopes);
  23116. }
  23117. }
  23118. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  23119. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  23120. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  23121. }
  23122. return parent::getContents($url);
  23123. case 403:
  23124. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  23125. return parent::getContents($url);
  23126. }
  23127. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23128. return $this->attemptCloneFallback();
  23129. }
  23130. $rateLimited = $gitHubUtil->isRateLimited($e->getHeaders());
  23131. if (!$this->io->hasAuthentication($this->originUrl)) {
  23132. if (!$this->io->isInteractive()) {
  23133. $this->io->writeError('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
  23134. throw $e;
  23135. }
  23136. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  23137. return parent::getContents($url);
  23138. }
  23139. if ($rateLimited) {
  23140. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  23141. $this->io->writeError(sprintf(
  23142. '<error>GitHub API limit (%d calls/hr) is exhausted. You are already authorized so you have to wait until %s before doing more requests</error>',
  23143. $rateLimit['limit'],
  23144. $rateLimit['reset']
  23145. ));
  23146. }
  23147. throw $e;
  23148. default:
  23149. throw $e;
  23150. }
  23151. }
  23152. }
  23153. protected function fetchRootIdentifier()
  23154. {
  23155. if ($this->repoData) {
  23156. return;
  23157. }
  23158. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  23159. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  23160. if (null === $this->repoData && null !== $this->gitDriver) {
  23161. return;
  23162. }
  23163. $this->owner = $this->repoData['owner']['login'];
  23164. $this->repository = $this->repoData['name'];
  23165. $this->isPrivate = !empty($this->repoData['private']);
  23166. if (isset($this->repoData['default_branch'])) {
  23167. $this->rootIdentifier = $this->repoData['default_branch'];
  23168. } elseif (isset($this->repoData['master_branch'])) {
  23169. $this->rootIdentifier = $this->repoData['master_branch'];
  23170. } else {
  23171. $this->rootIdentifier = 'master';
  23172. }
  23173. $this->hasIssues = !empty($this->repoData['has_issues']);
  23174. }
  23175. protected function attemptCloneFallback()
  23176. {
  23177. $this->isPrivate = true;
  23178. try {
  23179. $this->setupGitDriver($this->generateSshUrl());
  23180. return;
  23181. } catch (\RuntimeException $e) {
  23182. $this->gitDriver = null;
  23183. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
  23184. throw $e;
  23185. }
  23186. }
  23187. protected function setupGitDriver($url)
  23188. {
  23189. $this->gitDriver = new GitDriver(
  23190. array('url' => $url),
  23191. $this->io,
  23192. $this->config,
  23193. $this->process,
  23194. $this->remoteFilesystem
  23195. );
  23196. $this->gitDriver->initialize();
  23197. }
  23198. protected function getNextPage()
  23199. {
  23200. $headers = $this->remoteFilesystem->getLastHeaders();
  23201. foreach ($headers as $header) {
  23202. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  23203. $links = explode(',', $match[1]);
  23204. foreach ($links as $link) {
  23205. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  23206. return $match[1];
  23207. }
  23208. }
  23209. }
  23210. }
  23211. }
  23212. }
  23213. <?php
  23214. namespace Composer\Repository\Vcs;
  23215. use Composer\Config;
  23216. use Composer\Cache;
  23217. use Composer\IO\IOInterface;
  23218. use Composer\Json\JsonFile;
  23219. use Composer\Downloader\TransportException;
  23220. use Composer\Util\RemoteFilesystem;
  23221. use Composer\Util\GitLab;
  23222. class GitLabDriver extends VcsDriver
  23223. {
  23224. private $scheme;
  23225. private $namespace;
  23226. private $repository;
  23227. private $project;
  23228. private $commits = array();
  23229. private $tags;
  23230. private $branches;
  23231. protected $gitDriver;
  23232. private $isPrivate = true;
  23233. protected $portNumber;
  23234. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  23235. public function initialize()
  23236. {
  23237. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  23238. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  23239. }
  23240. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  23241. $configuredDomains = $this->config->get('gitlab-domains');
  23242. $urlParts = explode('/', $match['parts']);
  23243. $this->scheme = !empty($match['scheme'])
  23244. ? $match['scheme']
  23245. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  23246. ;
  23247. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts);
  23248. if (!empty($match['port']) && true === is_numeric($match['port'])) {
  23249. $this->portNumber = (int) $match['port'];
  23250. }
  23251. $this->namespace = implode('/', $urlParts);
  23252. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  23253. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  23254. $this->fetchProject();
  23255. }
  23256. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  23257. {
  23258. $this->remoteFilesystem = $remoteFilesystem;
  23259. }
  23260. public function getFileContent($file, $identifier)
  23261. {
  23262. if ($this->gitDriver) {
  23263. return $this->gitDriver->getFileContent($file, $identifier);
  23264. }
  23265. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  23266. $branches = $this->getBranches();
  23267. if (isset($branches[$identifier])) {
  23268. $identifier = $branches[$identifier];
  23269. }
  23270. }
  23271. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  23272. try {
  23273. $content = $this->getContents($resource);
  23274. } catch (TransportException $e) {
  23275. if ($e->getCode() !== 404) {
  23276. throw $e;
  23277. }
  23278. return null;
  23279. }
  23280. return $content;
  23281. }
  23282. public function getChangeDate($identifier)
  23283. {
  23284. if ($this->gitDriver) {
  23285. return $this->gitDriver->getChangeDate($identifier);
  23286. }
  23287. if (isset($this->commits[$identifier])) {
  23288. return new \DateTime($this->commits[$identifier]['committed_date']);
  23289. }
  23290. return new \DateTime();
  23291. }
  23292. public function getRepositoryUrl()
  23293. {
  23294. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  23295. }
  23296. public function getUrl()
  23297. {
  23298. if ($this->gitDriver) {
  23299. return $this->gitDriver->getUrl();
  23300. }
  23301. return $this->project['web_url'];
  23302. }
  23303. public function getDist($identifier)
  23304. {
  23305. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  23306. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23307. }
  23308. public function getSource($identifier)
  23309. {
  23310. if ($this->gitDriver) {
  23311. return $this->gitDriver->getSource($identifier);
  23312. }
  23313. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  23314. }
  23315. public function getRootIdentifier()
  23316. {
  23317. if ($this->gitDriver) {
  23318. return $this->gitDriver->getRootIdentifier();
  23319. }
  23320. return $this->project['default_branch'];
  23321. }
  23322. public function getBranches()
  23323. {
  23324. if ($this->gitDriver) {
  23325. return $this->gitDriver->getBranches();
  23326. }
  23327. if (!$this->branches) {
  23328. $this->branches = $this->getReferences('branches');
  23329. }
  23330. return $this->branches;
  23331. }
  23332. public function getTags()
  23333. {
  23334. if ($this->gitDriver) {
  23335. return $this->gitDriver->getTags();
  23336. }
  23337. if (!$this->tags) {
  23338. $this->tags = $this->getReferences('tags');
  23339. }
  23340. return $this->tags;
  23341. }
  23342. public function getApiUrl()
  23343. {
  23344. $domainName = $this->originUrl;
  23345. $portNumber = (true === is_numeric($this->portNumber)) ? sprintf(':%s', $this->portNumber) : '';
  23346. return $this->scheme.'://'.$domainName.$portNumber.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  23347. }
  23348. private function urlEncodeAll($string)
  23349. {
  23350. $encoded = '';
  23351. for ($i = 0; isset($string[$i]); $i++) {
  23352. $character = $string[$i];
  23353. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  23354. $character = '%' . sprintf('%02X', ord($character));
  23355. }
  23356. $encoded .= $character;
  23357. }
  23358. return $encoded;
  23359. }
  23360. protected function getReferences($type)
  23361. {
  23362. $perPage = 100;
  23363. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  23364. $references = array();
  23365. do {
  23366. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  23367. foreach ($data as $datum) {
  23368. $references[$datum['name']] = $datum['commit']['id'];
  23369. $this->commits[$datum['commit']['id']] = $datum['commit'];
  23370. }
  23371. if (count($data) >= $perPage) {
  23372. $resource = $this->getNextPage();
  23373. } else {
  23374. $resource = false;
  23375. }
  23376. } while ($resource);
  23377. return $references;
  23378. }
  23379. protected function fetchProject()
  23380. {
  23381. $resource = $this->getApiUrl();
  23382. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  23383. if (isset($this->project['visibility'])) {
  23384. $this->isPrivate = $this->project['visibility'] !== 'public';
  23385. } else {
  23386. $this->isPrivate = false;
  23387. }
  23388. }
  23389. protected function attemptCloneFallback()
  23390. {
  23391. try {
  23392. if ($this->isPrivate === false) {
  23393. $url = $this->generatePublicUrl();
  23394. } else {
  23395. $url = $this->generateSshUrl();
  23396. }
  23397. $this->setupGitDriver($url);
  23398. return;
  23399. } catch (\RuntimeException $e) {
  23400. $this->gitDriver = null;
  23401. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  23402. throw $e;
  23403. }
  23404. }
  23405. protected function generateSshUrl()
  23406. {
  23407. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  23408. }
  23409. protected function generatePublicUrl()
  23410. {
  23411. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  23412. }
  23413. protected function setupGitDriver($url)
  23414. {
  23415. $this->gitDriver = new GitDriver(
  23416. array('url' => $url),
  23417. $this->io,
  23418. $this->config,
  23419. $this->process,
  23420. $this->remoteFilesystem
  23421. );
  23422. $this->gitDriver->initialize();
  23423. }
  23424. protected function getContents($url, $fetchingRepoData = false)
  23425. {
  23426. try {
  23427. $res = parent::getContents($url);
  23428. if ($fetchingRepoData) {
  23429. $json = JsonFile::parseJson($res, $url);
  23430. if (!isset($json['default_branch'])) {
  23431. if (!empty($json['id'])) {
  23432. $this->isPrivate = false;
  23433. }
  23434. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  23435. }
  23436. }
  23437. return $res;
  23438. } catch (TransportException $e) {
  23439. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23440. switch ($e->getCode()) {
  23441. case 401:
  23442. case 404:
  23443. if (!$fetchingRepoData) {
  23444. throw $e;
  23445. }
  23446. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  23447. return parent::getContents($url);
  23448. }
  23449. if (!$this->io->isInteractive()) {
  23450. return $this->attemptCloneFallback();
  23451. }
  23452. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  23453. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  23454. return parent::getContents($url);
  23455. case 403:
  23456. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  23457. return parent::getContents($url);
  23458. }
  23459. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23460. return $this->attemptCloneFallback();
  23461. }
  23462. throw $e;
  23463. default:
  23464. throw $e;
  23465. }
  23466. }
  23467. }
  23468. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23469. {
  23470. if (!preg_match(self::URL_REGEX, $url, $match)) {
  23471. return false;
  23472. }
  23473. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  23474. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  23475. $urlParts = explode('/', $match['parts']);
  23476. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts)) {
  23477. return false;
  23478. }
  23479. if ('https' === $scheme && !extension_loaded('openssl')) {
  23480. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23481. return false;
  23482. }
  23483. return true;
  23484. }
  23485. private function getNextPage()
  23486. {
  23487. $headers = $this->remoteFilesystem->getLastHeaders();
  23488. foreach ($headers as $header) {
  23489. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  23490. $links = explode(',', $match[1]);
  23491. foreach ($links as $link) {
  23492. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  23493. return $match[1];
  23494. }
  23495. }
  23496. }
  23497. }
  23498. }
  23499. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts)
  23500. {
  23501. if (in_array($guessedDomain, $configuredDomains)) {
  23502. return $guessedDomain;
  23503. }
  23504. while (null !== ($part = array_shift($urlParts))) {
  23505. $guessedDomain .= '/' . $part;
  23506. if (in_array($guessedDomain, $configuredDomains)) {
  23507. return $guessedDomain;
  23508. }
  23509. }
  23510. return false;
  23511. }
  23512. }
  23513. <?php
  23514. namespace Composer\Repository\Vcs;
  23515. use Composer\Config;
  23516. use Composer\IO\IOInterface;
  23517. class HgBitbucketDriver extends BitbucketDriver
  23518. {
  23519. public function getRootIdentifier()
  23520. {
  23521. if ($this->fallbackDriver) {
  23522. return $this->fallbackDriver->getRootIdentifier();
  23523. }
  23524. if (null === $this->rootIdentifier) {
  23525. if (! $this->getRepoData()) {
  23526. return $this->fallbackDriver->getRootIdentifier();
  23527. }
  23528. if ($this->vcsType !== 'hg') {
  23529. throw new \RuntimeException(
  23530. $this->url.' does not appear to be a mercurial repository, use '.
  23531. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  23532. );
  23533. }
  23534. $mainBranchData = $this->getMainBranchData();
  23535. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  23536. }
  23537. return $this->rootIdentifier;
  23538. }
  23539. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23540. {
  23541. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
  23542. return false;
  23543. }
  23544. if (!extension_loaded('openssl')) {
  23545. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23546. return false;
  23547. }
  23548. return true;
  23549. }
  23550. protected function setupFallbackDriver($url)
  23551. {
  23552. $this->fallbackDriver = new HgDriver(
  23553. array('url' => $url),
  23554. $this->io,
  23555. $this->config,
  23556. $this->process,
  23557. $this->remoteFilesystem
  23558. );
  23559. $this->fallbackDriver->initialize();
  23560. }
  23561. protected function generateSshUrl()
  23562. {
  23563. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  23564. }
  23565. }
  23566. <?php
  23567. namespace Composer\Repository\Vcs;
  23568. use Composer\Config;
  23569. use Composer\Util\Hg as HgUtils;
  23570. use Composer\Util\ProcessExecutor;
  23571. use Composer\Util\Filesystem;
  23572. use Composer\IO\IOInterface;
  23573. class HgDriver extends VcsDriver
  23574. {
  23575. protected $tags;
  23576. protected $branches;
  23577. protected $rootIdentifier;
  23578. protected $repoDir;
  23579. protected $infoCache = array();
  23580. public function initialize()
  23581. {
  23582. if (Filesystem::isLocalPath($this->url)) {
  23583. $this->repoDir = $this->url;
  23584. } else {
  23585. $cacheDir = $this->config->get('cache-vcs-dir');
  23586. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  23587. $fs = new Filesystem();
  23588. $fs->ensureDirectoryExists($cacheDir);
  23589. if (!is_writable(dirname($this->repoDir))) {
  23590. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  23591. }
  23592. $this->config->prohibitUrlByConfig($this->url, $this->io);
  23593. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  23594. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  23595. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  23596. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  23597. }
  23598. } else {
  23599. $fs->removeDirectory($this->repoDir);
  23600. $command = function ($url) {
  23601. return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($this->repoDir));
  23602. };
  23603. $hgUtils->runCommand($command, $this->url, $this->repoDir);
  23604. }
  23605. }
  23606. $this->getTags();
  23607. $this->getBranches();
  23608. }
  23609. public function getRootIdentifier()
  23610. {
  23611. if (null === $this->rootIdentifier) {
  23612. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  23613. $output = $this->process->splitLines($output);
  23614. $this->rootIdentifier = $output[0];
  23615. }
  23616. return $this->rootIdentifier;
  23617. }
  23618. public function getUrl()
  23619. {
  23620. return $this->url;
  23621. }
  23622. public function getSource($identifier)
  23623. {
  23624. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  23625. }
  23626. public function getDist($identifier)
  23627. {
  23628. return null;
  23629. }
  23630. public function getFileContent($file, $identifier)
  23631. {
  23632. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23633. $this->process->execute($resource, $content, $this->repoDir);
  23634. if (!trim($content)) {
  23635. return;
  23636. }
  23637. return $content;
  23638. }
  23639. public function getChangeDate($identifier)
  23640. {
  23641. $this->process->execute(
  23642. sprintf(
  23643. 'hg log --template "{date|rfc3339date}" -r %s',
  23644. ProcessExecutor::escape($identifier)
  23645. ),
  23646. $output,
  23647. $this->repoDir
  23648. );
  23649. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  23650. }
  23651. public function getTags()
  23652. {
  23653. if (null === $this->tags) {
  23654. $tags = array();
  23655. $this->process->execute('hg tags', $output, $this->repoDir);
  23656. foreach ($this->process->splitLines($output) as $tag) {
  23657. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  23658. $tags[$match[1]] = $match[2];
  23659. }
  23660. }
  23661. unset($tags['tip']);
  23662. $this->tags = $tags;
  23663. }
  23664. return $this->tags;
  23665. }
  23666. public function getBranches()
  23667. {
  23668. if (null === $this->branches) {
  23669. $branches = array();
  23670. $bookmarks = array();
  23671. $this->process->execute('hg branches', $output, $this->repoDir);
  23672. foreach ($this->process->splitLines($output) as $branch) {
  23673. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  23674. $branches[$match[1]] = $match[2];
  23675. }
  23676. }
  23677. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  23678. foreach ($this->process->splitLines($output) as $branch) {
  23679. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  23680. $bookmarks[$match[1]] = $match[2];
  23681. }
  23682. }
  23683. $this->branches = array_merge($bookmarks, $branches);
  23684. }
  23685. return $this->branches;
  23686. }
  23687. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23688. {
  23689. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  23690. return true;
  23691. }
  23692. if (Filesystem::isLocalPath($url)) {
  23693. $url = Filesystem::getPlatformPath($url);
  23694. if (!is_dir($url)) {
  23695. return false;
  23696. }
  23697. $process = new ProcessExecutor($io);
  23698. if ($process->execute('hg summary', $output, $url) === 0) {
  23699. return true;
  23700. }
  23701. }
  23702. if (!$deep) {
  23703. return false;
  23704. }
  23705. $processExecutor = new ProcessExecutor($io);
  23706. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  23707. return $exit === 0;
  23708. }
  23709. }
  23710. <?php
  23711. namespace Composer\Repository\Vcs;
  23712. use Composer\Config;
  23713. use Composer\IO\IOInterface;
  23714. use Composer\Util\ProcessExecutor;
  23715. use Composer\Util\Perforce;
  23716. class PerforceDriver extends VcsDriver
  23717. {
  23718. protected $depot;
  23719. protected $branch;
  23720. protected $perforce;
  23721. public function initialize()
  23722. {
  23723. $this->depot = $this->repoConfig['depot'];
  23724. $this->branch = '';
  23725. if (!empty($this->repoConfig['branch'])) {
  23726. $this->branch = $this->repoConfig['branch'];
  23727. }
  23728. $this->initPerforce($this->repoConfig);
  23729. $this->perforce->p4Login();
  23730. $this->perforce->checkStream();
  23731. $this->perforce->writeP4ClientSpec();
  23732. $this->perforce->connectClient();
  23733. return true;
  23734. }
  23735. private function initPerforce($repoConfig)
  23736. {
  23737. if (!empty($this->perforce)) {
  23738. return;
  23739. }
  23740. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  23741. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  23742. }
  23743. public function getFileContent($file, $identifier)
  23744. {
  23745. return $this->perforce->getFileContent($file, $identifier);
  23746. }
  23747. public function getChangeDate($identifier)
  23748. {
  23749. return null;
  23750. }
  23751. public function getRootIdentifier()
  23752. {
  23753. return $this->branch;
  23754. }
  23755. public function getBranches()
  23756. {
  23757. return $this->perforce->getBranches();
  23758. }
  23759. public function getTags()
  23760. {
  23761. return $this->perforce->getTags();
  23762. }
  23763. public function getDist($identifier)
  23764. {
  23765. return null;
  23766. }
  23767. public function getSource($identifier)
  23768. {
  23769. $source = array(
  23770. 'type' => 'perforce',
  23771. 'url' => $this->repoConfig['url'],
  23772. 'reference' => $identifier,
  23773. 'p4user' => $this->perforce->getUser(),
  23774. );
  23775. return $source;
  23776. }
  23777. public function getUrl()
  23778. {
  23779. return $this->url;
  23780. }
  23781. public function hasComposerFile($identifier)
  23782. {
  23783. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  23784. $composerInfoIdentifier = $identifier;
  23785. return !empty($composerInfo);
  23786. }
  23787. public function getContents($url)
  23788. {
  23789. return false;
  23790. }
  23791. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23792. {
  23793. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  23794. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  23795. }
  23796. return false;
  23797. }
  23798. public function cleanup()
  23799. {
  23800. $this->perforce->cleanupClientSpec();
  23801. $this->perforce = null;
  23802. }
  23803. public function getDepot()
  23804. {
  23805. return $this->depot;
  23806. }
  23807. public function getBranch()
  23808. {
  23809. return $this->branch;
  23810. }
  23811. }
  23812. <?php
  23813. namespace Composer\Repository\Vcs;
  23814. use Composer\Cache;
  23815. use Composer\Config;
  23816. use Composer\Json\JsonFile;
  23817. use Composer\Util\ProcessExecutor;
  23818. use Composer\Util\Filesystem;
  23819. use Composer\Util\Svn as SvnUtil;
  23820. use Composer\IO\IOInterface;
  23821. use Composer\Downloader\TransportException;
  23822. class SvnDriver extends VcsDriver
  23823. {
  23824. protected $cache;
  23825. protected $baseUrl;
  23826. protected $tags;
  23827. protected $branches;
  23828. protected $rootIdentifier;
  23829. protected $infoCache = array();
  23830. protected $trunkPath = 'trunk';
  23831. protected $branchesPath = 'branches';
  23832. protected $tagsPath = 'tags';
  23833. protected $packagePath = '';
  23834. protected $cacheCredentials = true;
  23835. private $util;
  23836. public function initialize()
  23837. {
  23838. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  23839. SvnUtil::cleanEnv();
  23840. if (isset($this->repoConfig['trunk-path'])) {
  23841. $this->trunkPath = $this->repoConfig['trunk-path'];
  23842. }
  23843. if (isset($this->repoConfig['branches-path'])) {
  23844. $this->branchesPath = $this->repoConfig['branches-path'];
  23845. }
  23846. if (isset($this->repoConfig['tags-path'])) {
  23847. $this->tagsPath = $this->repoConfig['tags-path'];
  23848. }
  23849. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  23850. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  23851. }
  23852. if (isset($this->repoConfig['package-path'])) {
  23853. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  23854. }
  23855. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  23856. $this->baseUrl = substr($this->url, 0, $pos);
  23857. }
  23858. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  23859. $this->getBranches();
  23860. $this->getTags();
  23861. }
  23862. public function getRootIdentifier()
  23863. {
  23864. return $this->rootIdentifier ?: $this->trunkPath;
  23865. }
  23866. public function getUrl()
  23867. {
  23868. return $this->url;
  23869. }
  23870. public function getSource($identifier)
  23871. {
  23872. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  23873. }
  23874. public function getDist($identifier)
  23875. {
  23876. return null;
  23877. }
  23878. protected function shouldCache($identifier)
  23879. {
  23880. return $this->cache && preg_match('{@\d+$}', $identifier);
  23881. }
  23882. public function getComposerInformation($identifier)
  23883. {
  23884. if (!isset($this->infoCache[$identifier])) {
  23885. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  23886. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23887. }
  23888. try {
  23889. $composer = $this->getBaseComposerInformation($identifier);
  23890. } catch (TransportException $e) {
  23891. $message = $e->getMessage();
  23892. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  23893. throw $e;
  23894. }
  23895. $composer = '';
  23896. }
  23897. if ($this->shouldCache($identifier)) {
  23898. $this->cache->write($identifier.'.json', json_encode($composer));
  23899. }
  23900. $this->infoCache[$identifier] = $composer;
  23901. }
  23902. return $this->infoCache[$identifier];
  23903. }
  23904. public function getFileContent($file, $identifier)
  23905. {
  23906. $identifier = '/' . trim($identifier, '/') . '/';
  23907. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23908. if (!empty($match[2])) {
  23909. $path = $match[1];
  23910. $rev = $match[2];
  23911. } else {
  23912. $path = $identifier;
  23913. $rev = '';
  23914. }
  23915. try {
  23916. $resource = $path.$file;
  23917. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  23918. if (!trim($output)) {
  23919. return null;
  23920. }
  23921. } catch (\RuntimeException $e) {
  23922. throw new TransportException($e->getMessage());
  23923. }
  23924. return $output;
  23925. }
  23926. public function getChangeDate($identifier)
  23927. {
  23928. $identifier = '/' . trim($identifier, '/') . '/';
  23929. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23930. if (!empty($match[2])) {
  23931. $path = $match[1];
  23932. $rev = $match[2];
  23933. } else {
  23934. $path = $identifier;
  23935. $rev = '';
  23936. }
  23937. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  23938. foreach ($this->process->splitLines($output) as $line) {
  23939. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  23940. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  23941. }
  23942. }
  23943. return null;
  23944. }
  23945. public function getTags()
  23946. {
  23947. if (null === $this->tags) {
  23948. $this->tags = array();
  23949. if ($this->tagsPath !== false) {
  23950. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  23951. if ($output) {
  23952. foreach ($this->process->splitLines($output) as $line) {
  23953. $line = trim($line);
  23954. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23955. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23956. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  23957. '/' . $this->tagsPath . '/' . $match[2],
  23958. $match[1]
  23959. );
  23960. }
  23961. }
  23962. }
  23963. }
  23964. }
  23965. }
  23966. return $this->tags;
  23967. }
  23968. public function getBranches()
  23969. {
  23970. if (null === $this->branches) {
  23971. $this->branches = array();
  23972. if (false === $this->trunkPath) {
  23973. $trunkParent = $this->baseUrl . '/';
  23974. } else {
  23975. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  23976. }
  23977. $output = $this->execute('svn ls --verbose', $trunkParent);
  23978. if ($output) {
  23979. foreach ($this->process->splitLines($output) as $line) {
  23980. $line = trim($line);
  23981. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23982. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  23983. $this->branches['trunk'] = $this->buildIdentifier(
  23984. '/' . $this->trunkPath,
  23985. $match[1]
  23986. );
  23987. $this->rootIdentifier = $this->branches['trunk'];
  23988. break;
  23989. }
  23990. }
  23991. }
  23992. }
  23993. unset($output);
  23994. if ($this->branchesPath !== false) {
  23995. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  23996. if ($output) {
  23997. foreach ($this->process->splitLines(trim($output)) as $line) {
  23998. $line = trim($line);
  23999. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  24000. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  24001. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  24002. '/' . $this->branchesPath . '/' . $match[2],
  24003. $match[1]
  24004. );
  24005. }
  24006. }
  24007. }
  24008. }
  24009. }
  24010. }
  24011. return $this->branches;
  24012. }
  24013. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24014. {
  24015. $url = self::normalizeUrl($url);
  24016. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  24017. return true;
  24018. }
  24019. if (!$deep && !Filesystem::isLocalPath($url)) {
  24020. return false;
  24021. }
  24022. $processExecutor = new ProcessExecutor($io);
  24023. $exit = $processExecutor->execute(
  24024. "svn info --non-interactive ".ProcessExecutor::escape($url),
  24025. $ignoredOutput
  24026. );
  24027. if ($exit === 0) {
  24028. return true;
  24029. }
  24030. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  24031. return true;
  24032. }
  24033. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  24034. return true;
  24035. }
  24036. return false;
  24037. }
  24038. protected static function normalizeUrl($url)
  24039. {
  24040. $fs = new Filesystem();
  24041. if ($fs->isAbsolutePath($url)) {
  24042. return 'file://' . strtr($url, '\\', '/');
  24043. }
  24044. return $url;
  24045. }
  24046. protected function execute($command, $url)
  24047. {
  24048. if (null === $this->util) {
  24049. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  24050. $this->util->setCacheCredentials($this->cacheCredentials);
  24051. }
  24052. try {
  24053. return $this->util->execute($command, $url);
  24054. } catch (\RuntimeException $e) {
  24055. if (null === $this->util->binaryVersion()) {
  24056. throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  24057. }
  24058. throw new \RuntimeException(
  24059. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  24060. );
  24061. }
  24062. }
  24063. protected function buildIdentifier($baseDir, $revision)
  24064. {
  24065. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  24066. }
  24067. }
  24068. <?php
  24069. namespace Composer\Repository\Vcs;
  24070. use Composer\Cache;
  24071. use Composer\Downloader\TransportException;
  24072. use Composer\Config;
  24073. use Composer\Factory;
  24074. use Composer\IO\IOInterface;
  24075. use Composer\Json\JsonFile;
  24076. use Composer\Util\ProcessExecutor;
  24077. use Composer\Util\RemoteFilesystem;
  24078. use Composer\Util\Filesystem;
  24079. abstract class VcsDriver implements VcsDriverInterface
  24080. {
  24081. protected $url;
  24082. protected $originUrl;
  24083. protected $repoConfig;
  24084. protected $io;
  24085. protected $config;
  24086. protected $process;
  24087. protected $remoteFilesystem;
  24088. protected $infoCache = array();
  24089. protected $cache;
  24090. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24091. {
  24092. if (Filesystem::isLocalPath($repoConfig['url'])) {
  24093. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  24094. }
  24095. $this->url = $repoConfig['url'];
  24096. $this->originUrl = $repoConfig['url'];
  24097. $this->repoConfig = $repoConfig;
  24098. $this->io = $io;
  24099. $this->config = $config;
  24100. $this->process = $process ?: new ProcessExecutor($io);
  24101. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24102. }
  24103. protected function shouldCache($identifier)
  24104. {
  24105. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  24106. }
  24107. public function getComposerInformation($identifier)
  24108. {
  24109. if (!isset($this->infoCache[$identifier])) {
  24110. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  24111. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  24112. }
  24113. $composer = $this->getBaseComposerInformation($identifier);
  24114. if ($this->shouldCache($identifier)) {
  24115. $this->cache->write($identifier, json_encode($composer));
  24116. }
  24117. $this->infoCache[$identifier] = $composer;
  24118. }
  24119. return $this->infoCache[$identifier];
  24120. }
  24121. protected function getBaseComposerInformation($identifier)
  24122. {
  24123. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  24124. if (!$composerFileContent) {
  24125. return null;
  24126. }
  24127. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  24128. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  24129. $composer['time'] = $changeDate->format(DATE_RFC3339);
  24130. }
  24131. return $composer;
  24132. }
  24133. public function hasComposerFile($identifier)
  24134. {
  24135. try {
  24136. return (bool) $this->getComposerInformation($identifier);
  24137. } catch (TransportException $e) {
  24138. }
  24139. return false;
  24140. }
  24141. protected function getScheme()
  24142. {
  24143. if (extension_loaded('openssl')) {
  24144. return 'https';
  24145. }
  24146. return 'http';
  24147. }
  24148. protected function getContents($url)
  24149. {
  24150. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  24151. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  24152. }
  24153. public function cleanup()
  24154. {
  24155. return;
  24156. }
  24157. }
  24158. <?php
  24159. namespace Composer\Repository\Vcs;
  24160. use Composer\Config;
  24161. use Composer\IO\IOInterface;
  24162. interface VcsDriverInterface
  24163. {
  24164. public function initialize();
  24165. public function getComposerInformation($identifier);
  24166. public function getFileContent($file, $identifier);
  24167. public function getChangeDate($identifier);
  24168. public function getRootIdentifier();
  24169. public function getBranches();
  24170. public function getTags();
  24171. public function getDist($identifier);
  24172. public function getSource($identifier);
  24173. public function getUrl();
  24174. public function hasComposerFile($identifier);
  24175. public function cleanup();
  24176. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  24177. }
  24178. <?php
  24179. namespace Composer\Repository;
  24180. use Composer\Downloader\TransportException;
  24181. use Composer\Repository\Vcs\VcsDriverInterface;
  24182. use Composer\Package\Version\VersionParser;
  24183. use Composer\Package\Loader\ArrayLoader;
  24184. use Composer\Package\Loader\ValidatingArrayLoader;
  24185. use Composer\Package\Loader\InvalidPackageException;
  24186. use Composer\Package\Loader\LoaderInterface;
  24187. use Composer\EventDispatcher\EventDispatcher;
  24188. use Composer\IO\IOInterface;
  24189. use Composer\Config;
  24190. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  24191. {
  24192. protected $url;
  24193. protected $packageName;
  24194. protected $verbose;
  24195. protected $io;
  24196. protected $config;
  24197. protected $versionParser;
  24198. protected $type;
  24199. protected $loader;
  24200. protected $repoConfig;
  24201. protected $branchErrorOccurred = false;
  24202. private $drivers;
  24203. private $driver;
  24204. private $versionCache;
  24205. private $emptyReferences = array();
  24206. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
  24207. {
  24208. parent::__construct();
  24209. $this->drivers = $drivers ?: array(
  24210. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  24211. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  24212. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  24213. 'git' => 'Composer\Repository\Vcs\GitDriver',
  24214. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  24215. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  24216. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  24217. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  24218. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  24219. );
  24220. $this->url = $repoConfig['url'];
  24221. $this->io = $io;
  24222. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  24223. $this->verbose = $io->isVeryVerbose();
  24224. $this->config = $config;
  24225. $this->repoConfig = $repoConfig;
  24226. $this->versionCache = $versionCache;
  24227. }
  24228. public function getRepoConfig()
  24229. {
  24230. return $this->repoConfig;
  24231. }
  24232. public function setLoader(LoaderInterface $loader)
  24233. {
  24234. $this->loader = $loader;
  24235. }
  24236. public function getDriver()
  24237. {
  24238. if ($this->driver) {
  24239. return $this->driver;
  24240. }
  24241. if (isset($this->drivers[$this->type])) {
  24242. $class = $this->drivers[$this->type];
  24243. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  24244. $this->driver->initialize();
  24245. return $this->driver;
  24246. }
  24247. foreach ($this->drivers as $driver) {
  24248. if ($driver::supports($this->io, $this->config, $this->url)) {
  24249. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  24250. $this->driver->initialize();
  24251. return $this->driver;
  24252. }
  24253. }
  24254. foreach ($this->drivers as $driver) {
  24255. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  24256. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  24257. $this->driver->initialize();
  24258. return $this->driver;
  24259. }
  24260. }
  24261. }
  24262. public function hadInvalidBranches()
  24263. {
  24264. return $this->branchErrorOccurred;
  24265. }
  24266. public function getEmptyReferences()
  24267. {
  24268. return $this->emptyReferences;
  24269. }
  24270. protected function initialize()
  24271. {
  24272. parent::initialize();
  24273. $verbose = $this->verbose;
  24274. $driver = $this->getDriver();
  24275. if (!$driver) {
  24276. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  24277. }
  24278. $this->versionParser = new VersionParser;
  24279. if (!$this->loader) {
  24280. $this->loader = new ArrayLoader($this->versionParser);
  24281. }
  24282. try {
  24283. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  24284. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  24285. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  24286. }
  24287. } catch (\Exception $e) {
  24288. if ($verbose) {
  24289. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  24290. }
  24291. }
  24292. foreach ($driver->getTags() as $tag => $identifier) {
  24293. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  24294. if ($verbose) {
  24295. $this->io->writeError($msg);
  24296. } else {
  24297. $this->io->overwriteError($msg, false);
  24298. }
  24299. $tag = str_replace('release-', '', $tag);
  24300. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $verbose);
  24301. if ($cachedPackage) {
  24302. $this->addPackage($cachedPackage);
  24303. continue;
  24304. } elseif ($cachedPackage === false) {
  24305. $this->emptyReferences[] = $identifier;
  24306. continue;
  24307. }
  24308. if (!$parsedTag = $this->validateTag($tag)) {
  24309. if ($verbose) {
  24310. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  24311. }
  24312. continue;
  24313. }
  24314. try {
  24315. if (!$data = $driver->getComposerInformation($identifier)) {
  24316. if ($verbose) {
  24317. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  24318. }
  24319. $this->emptyReferences[] = $identifier;
  24320. continue;
  24321. }
  24322. if (isset($data['version'])) {
  24323. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  24324. } else {
  24325. $data['version'] = $tag;
  24326. $data['version_normalized'] = $parsedTag;
  24327. }
  24328. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  24329. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  24330. if ($data['version_normalized'] !== $parsedTag) {
  24331. if ($verbose) {
  24332. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  24333. }
  24334. continue;
  24335. }
  24336. $tagPackageName = isset($data['name']) ? $data['name'] : $this->packageName;
  24337. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  24338. if ($verbose) {
  24339. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  24340. }
  24341. continue;
  24342. }
  24343. if ($verbose) {
  24344. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  24345. }
  24346. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  24347. } catch (\Exception $e) {
  24348. if ($e instanceof TransportException && $e->getCode() === 404) {
  24349. $this->emptyReferences[] = $identifier;
  24350. }
  24351. if ($verbose) {
  24352. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  24353. }
  24354. continue;
  24355. }
  24356. }
  24357. if (!$verbose) {
  24358. $this->io->overwriteError('', false);
  24359. }
  24360. $branches = $driver->getBranches();
  24361. foreach ($branches as $branch => $identifier) {
  24362. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  24363. if ($verbose) {
  24364. $this->io->writeError($msg);
  24365. } else {
  24366. $this->io->overwriteError($msg, false);
  24367. }
  24368. if ($branch === 'trunk' && isset($branches['master'])) {
  24369. if ($verbose) {
  24370. $this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
  24371. }
  24372. continue;
  24373. }
  24374. if (!$parsedBranch = $this->validateBranch($branch)) {
  24375. if ($verbose) {
  24376. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  24377. }
  24378. continue;
  24379. }
  24380. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  24381. $version = 'dev-' . $branch;
  24382. } else {
  24383. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  24384. $version = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  24385. }
  24386. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $verbose);
  24387. if ($cachedPackage) {
  24388. $this->addPackage($cachedPackage);
  24389. continue;
  24390. } elseif ($cachedPackage === false) {
  24391. $this->emptyReferences[] = $identifier;
  24392. continue;
  24393. }
  24394. try {
  24395. if (!$data = $driver->getComposerInformation($identifier)) {
  24396. if ($verbose) {
  24397. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  24398. }
  24399. $this->emptyReferences[] = $identifier;
  24400. continue;
  24401. }
  24402. $data['version'] = $version;
  24403. $data['version_normalized'] = $parsedBranch;
  24404. if ($verbose) {
  24405. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  24406. }
  24407. $packageData = $this->preProcess($driver, $data, $identifier);
  24408. $package = $this->loader->load($packageData);
  24409. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  24410. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  24411. }
  24412. $this->addPackage($package);
  24413. } catch (TransportException $e) {
  24414. if ($e->getCode() === 404) {
  24415. $this->emptyReferences[] = $identifier;
  24416. }
  24417. if ($verbose) {
  24418. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  24419. }
  24420. continue;
  24421. } catch (\Exception $e) {
  24422. if (!$verbose) {
  24423. $this->io->writeError('');
  24424. }
  24425. $this->branchErrorOccurred = true;
  24426. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  24427. $this->io->writeError('');
  24428. continue;
  24429. }
  24430. }
  24431. $driver->cleanup();
  24432. if (!$verbose) {
  24433. $this->io->overwriteError('', false);
  24434. }
  24435. if (!$this->getPackages()) {
  24436. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  24437. }
  24438. }
  24439. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  24440. {
  24441. $dataPackageName = isset($data['name']) ? $data['name'] : null;
  24442. $data['name'] = $this->packageName ?: $dataPackageName;
  24443. if (!isset($data['dist'])) {
  24444. $data['dist'] = $driver->getDist($identifier);
  24445. }
  24446. if (!isset($data['source'])) {
  24447. $data['source'] = $driver->getSource($identifier);
  24448. }
  24449. return $data;
  24450. }
  24451. private function validateBranch($branch)
  24452. {
  24453. try {
  24454. return $this->versionParser->normalizeBranch($branch);
  24455. } catch (\Exception $e) {
  24456. }
  24457. return false;
  24458. }
  24459. private function validateTag($version)
  24460. {
  24461. try {
  24462. return $this->versionParser->normalize($version);
  24463. } catch (\Exception $e) {
  24464. }
  24465. return false;
  24466. }
  24467. private function getCachedPackageVersion($version, $identifier, $verbose)
  24468. {
  24469. if (!$this->versionCache) {
  24470. return;
  24471. }
  24472. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  24473. if ($cachedPackage === false) {
  24474. if ($verbose) {
  24475. $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
  24476. }
  24477. return false;
  24478. }
  24479. if ($cachedPackage) {
  24480. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  24481. if ($verbose) {
  24482. $this->io->writeError($msg);
  24483. } else {
  24484. $this->io->overwriteError($msg, false);
  24485. }
  24486. if ($existingPackage = $this->findPackage($cachedPackage['name'], $cachedPackage['version_normalized'])) {
  24487. if ($verbose) {
  24488. $this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>');
  24489. }
  24490. $cachedPackage = null;
  24491. }
  24492. }
  24493. if ($cachedPackage) {
  24494. return $this->loader->load($cachedPackage);
  24495. }
  24496. return null;
  24497. }
  24498. }
  24499. <?php
  24500. namespace Composer\Repository;
  24501. interface VersionCacheInterface
  24502. {
  24503. public function getVersionPackage($version, $identifier);
  24504. }
  24505. <?php
  24506. namespace Composer\Repository;
  24507. use Composer\Package\AliasPackage;
  24508. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  24509. {
  24510. public function write()
  24511. {
  24512. }
  24513. public function reload()
  24514. {
  24515. }
  24516. public function getCanonicalPackages()
  24517. {
  24518. $packages = $this->getPackages();
  24519. $packagesByName = array();
  24520. foreach ($packages as $package) {
  24521. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  24522. $packagesByName[$package->getName()] = $package;
  24523. }
  24524. }
  24525. $canonicalPackages = array();
  24526. foreach ($packagesByName as $package) {
  24527. while ($package instanceof AliasPackage) {
  24528. $package = $package->getAliasOf();
  24529. }
  24530. $canonicalPackages[] = $package;
  24531. }
  24532. return $canonicalPackages;
  24533. }
  24534. }
  24535. <?php
  24536. namespace Composer\Repository;
  24537. use Composer\Package\PackageInterface;
  24538. interface WritableRepositoryInterface extends RepositoryInterface
  24539. {
  24540. public function write();
  24541. public function addPackage(PackageInterface $package);
  24542. public function removePackage(PackageInterface $package);
  24543. public function getCanonicalPackages();
  24544. public function reload();
  24545. }
  24546. <?php
  24547. namespace Composer\Script;
  24548. class CommandEvent extends Event
  24549. {
  24550. }
  24551. <?php
  24552. namespace Composer\Script;
  24553. use Composer\Composer;
  24554. use Composer\IO\IOInterface;
  24555. use Composer\EventDispatcher\Event as BaseEvent;
  24556. class Event extends BaseEvent
  24557. {
  24558. private $composer;
  24559. private $io;
  24560. private $devMode;
  24561. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  24562. {
  24563. parent::__construct($name, $args, $flags);
  24564. $this->composer = $composer;
  24565. $this->io = $io;
  24566. $this->devMode = $devMode;
  24567. }
  24568. public function getComposer()
  24569. {
  24570. return $this->composer;
  24571. }
  24572. public function getIO()
  24573. {
  24574. return $this->io;
  24575. }
  24576. public function isDevMode()
  24577. {
  24578. return $this->devMode;
  24579. }
  24580. }
  24581. <?php
  24582. namespace Composer\Script;
  24583. use Composer\Installer\PackageEvent as BasePackageEvent;
  24584. class PackageEvent extends BasePackageEvent
  24585. {
  24586. }
  24587. <?php
  24588. namespace Composer\Script;
  24589. class ScriptEvents
  24590. {
  24591. const PRE_INSTALL_CMD = 'pre-install-cmd';
  24592. const POST_INSTALL_CMD = 'post-install-cmd';
  24593. const PRE_UPDATE_CMD = 'pre-update-cmd';
  24594. const POST_UPDATE_CMD = 'post-update-cmd';
  24595. const PRE_STATUS_CMD = 'pre-status-cmd';
  24596. const POST_STATUS_CMD = 'post-status-cmd';
  24597. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  24598. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  24599. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  24600. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  24601. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  24602. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  24603. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  24604. const POST_PACKAGE_INSTALL = 'post-package-install';
  24605. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  24606. const POST_PACKAGE_UPDATE = 'post-package-update';
  24607. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  24608. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  24609. }
  24610. <?php
  24611. namespace Composer\SelfUpdate;
  24612. class Keys
  24613. {
  24614. public static function fingerprint($path)
  24615. {
  24616. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  24617. return implode(' ', array(
  24618. substr($hash, 0, 8),
  24619. substr($hash, 8, 8),
  24620. substr($hash, 16, 8),
  24621. substr($hash, 24, 8),
  24622. '',
  24623. substr($hash, 32, 8),
  24624. substr($hash, 40, 8),
  24625. substr($hash, 48, 8),
  24626. substr($hash, 56, 8),
  24627. ));
  24628. }
  24629. }
  24630. <?php
  24631. namespace Composer\SelfUpdate;
  24632. use Composer\Util\RemoteFilesystem;
  24633. use Composer\Config;
  24634. use Composer\Json\JsonFile;
  24635. class Versions
  24636. {
  24637. private $rfs;
  24638. private $config;
  24639. private $channel;
  24640. public function __construct(Config $config, RemoteFilesystem $rfs)
  24641. {
  24642. $this->rfs = $rfs;
  24643. $this->config = $config;
  24644. }
  24645. public function getChannel()
  24646. {
  24647. if ($this->channel) {
  24648. return $this->channel;
  24649. }
  24650. $channelFile = $this->config->get('home').'/update-channel';
  24651. if (file_exists($channelFile)) {
  24652. $channel = trim(file_get_contents($channelFile));
  24653. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24654. return $this->channel = $channel;
  24655. }
  24656. }
  24657. return $this->channel = 'stable';
  24658. }
  24659. public function setChannel($channel)
  24660. {
  24661. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24662. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  24663. }
  24664. $channelFile = $this->config->get('home').'/update-channel';
  24665. $this->channel = $channel;
  24666. file_put_contents($channelFile, $channel.PHP_EOL);
  24667. }
  24668. public function getLatest()
  24669. {
  24670. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  24671. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  24672. foreach ($versions[$this->getChannel()] as $version) {
  24673. if ($version['min-php'] <= PHP_VERSION_ID) {
  24674. return $version;
  24675. }
  24676. }
  24677. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  24678. }
  24679. }
  24680. <?php
  24681. namespace Composer\Util;
  24682. use Composer\Config;
  24683. use Composer\IO\IOInterface;
  24684. class AuthHelper
  24685. {
  24686. protected $io;
  24687. protected $config;
  24688. public function __construct(IOInterface $io, Config $config)
  24689. {
  24690. $this->io = $io;
  24691. $this->config = $config;
  24692. }
  24693. public function storeAuth($originUrl, $storeAuth)
  24694. {
  24695. $store = false;
  24696. $configSource = $this->config->getAuthConfigSource();
  24697. if ($storeAuth === true) {
  24698. $store = $configSource;
  24699. } elseif ($storeAuth === 'prompt') {
  24700. $answer = $this->io->askAndValidate(
  24701. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  24702. function ($value) {
  24703. $input = strtolower(substr(trim($value), 0, 1));
  24704. if (in_array($input, array('y','n'))) {
  24705. return $input;
  24706. }
  24707. throw new \RuntimeException('Please answer (y)es or (n)o');
  24708. },
  24709. null,
  24710. 'y'
  24711. );
  24712. if ($answer === 'y') {
  24713. $store = $configSource;
  24714. }
  24715. }
  24716. if ($store) {
  24717. $store->addConfigSetting(
  24718. 'http-basic.'.$originUrl,
  24719. $this->io->getAuthentication($originUrl)
  24720. );
  24721. }
  24722. }
  24723. }
  24724. <?php
  24725. namespace Composer\Util;
  24726. use Composer\Factory;
  24727. use Composer\IO\IOInterface;
  24728. use Composer\Config;
  24729. use Composer\Downloader\TransportException;
  24730. class Bitbucket
  24731. {
  24732. private $io;
  24733. private $config;
  24734. private $process;
  24735. private $remoteFilesystem;
  24736. private $token = array();
  24737. private $time;
  24738. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  24739. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  24740. {
  24741. $this->io = $io;
  24742. $this->config = $config;
  24743. $this->process = $process ?: new ProcessExecutor($io);
  24744. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24745. $this->time = $time;
  24746. }
  24747. public function getToken()
  24748. {
  24749. if (!isset($this->token['access_token'])) {
  24750. return '';
  24751. }
  24752. return $this->token['access_token'];
  24753. }
  24754. public function authorizeOAuth($originUrl)
  24755. {
  24756. if ($originUrl !== 'bitbucket.org') {
  24757. return false;
  24758. }
  24759. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  24760. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  24761. return true;
  24762. }
  24763. return false;
  24764. }
  24765. private function requestAccessToken($originUrl)
  24766. {
  24767. try {
  24768. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  24769. 'retry-auth-failure' => false,
  24770. 'http' => array(
  24771. 'method' => 'POST',
  24772. 'content' => 'grant_type=client_credentials',
  24773. ),
  24774. ));
  24775. $this->token = json_decode($json, true);
  24776. } catch (TransportException $e) {
  24777. if ($e->getCode() === 400) {
  24778. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  24779. $this->io->writeError('This can have two reasons:');
  24780. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  24781. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  24782. return false;
  24783. } elseif (in_array($e->getCode(), array(403, 401))) {
  24784. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  24785. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24786. return false;
  24787. }
  24788. throw $e;
  24789. }
  24790. return true;
  24791. }
  24792. public function authorizeOAuthInteractively($originUrl, $message = null)
  24793. {
  24794. if ($message) {
  24795. $this->io->writeError($message);
  24796. }
  24797. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  24798. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  24799. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  24800. $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  24801. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  24802. if (!$consumerKey) {
  24803. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  24804. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24805. return false;
  24806. }
  24807. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  24808. if (!$consumerSecret) {
  24809. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  24810. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24811. return false;
  24812. }
  24813. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  24814. if (!$this->requestAccessToken($originUrl)) {
  24815. return false;
  24816. }
  24817. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  24818. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  24819. $this->io->writeError('<info>Consumer stored successfully.</info>');
  24820. return true;
  24821. }
  24822. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  24823. {
  24824. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  24825. return $this->token['access_token'];
  24826. }
  24827. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  24828. if (!$this->requestAccessToken($originUrl)) {
  24829. return '';
  24830. }
  24831. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  24832. return $this->token['access_token'];
  24833. }
  24834. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  24835. {
  24836. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  24837. $time = null === $this->time ? time() : $this->time;
  24838. $consumer = array(
  24839. "consumer-key" => $consumerKey,
  24840. "consumer-secret" => $consumerSecret,
  24841. "access-token" => $this->token['access_token'],
  24842. "access-token-expiration" => $time + $this->token['expires_in'],
  24843. );
  24844. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  24845. }
  24846. private function getTokenFromConfig($originUrl)
  24847. {
  24848. $authConfig = $this->config->get('bitbucket-oauth');
  24849. if (
  24850. !isset($authConfig[$originUrl]['access-token'])
  24851. || !isset($authConfig[$originUrl]['access-token-expiration'])
  24852. || time() > $authConfig[$originUrl]['access-token-expiration']
  24853. ) {
  24854. return false;
  24855. }
  24856. $this->token = array(
  24857. 'access_token' => $authConfig[$originUrl]['access-token'],
  24858. );
  24859. return true;
  24860. }
  24861. }
  24862. <?php
  24863. namespace Composer\Util;
  24864. class ComposerMirror
  24865. {
  24866. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  24867. {
  24868. if ($reference) {
  24869. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  24870. }
  24871. $version = strpos($version, '/') === false ? $version : md5($version);
  24872. return str_replace(
  24873. array('%package%', '%version%', '%reference%', '%type%'),
  24874. array($packageName, $version, $reference, $type),
  24875. $mirrorUrl
  24876. );
  24877. }
  24878. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  24879. {
  24880. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  24881. $url = 'gh-'.$match[1].'/'.$match[2];
  24882. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  24883. $url = 'bb-'.$match[1].'/'.$match[2];
  24884. } else {
  24885. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  24886. }
  24887. return str_replace(
  24888. array('%package%', '%normalizedUrl%', '%type%'),
  24889. array($packageName, $url, $type),
  24890. $mirrorUrl
  24891. );
  24892. }
  24893. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  24894. {
  24895. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  24896. }
  24897. }
  24898. <?php
  24899. namespace Composer\Util;
  24900. use Composer\Package\Loader\ArrayLoader;
  24901. use Composer\Package\Loader\ValidatingArrayLoader;
  24902. use Composer\Package\Loader\InvalidPackageException;
  24903. use Composer\Json\JsonValidationException;
  24904. use Composer\IO\IOInterface;
  24905. use Composer\Json\JsonFile;
  24906. use Composer\Spdx\SpdxLicenses;
  24907. class ConfigValidator
  24908. {
  24909. private $io;
  24910. public function __construct(IOInterface $io)
  24911. {
  24912. $this->io = $io;
  24913. }
  24914. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  24915. {
  24916. $errors = array();
  24917. $publishErrors = array();
  24918. $warnings = array();
  24919. $laxValid = false;
  24920. try {
  24921. $json = new JsonFile($file, null, $this->io);
  24922. $manifest = $json->read();
  24923. $json->validateSchema(JsonFile::LAX_SCHEMA);
  24924. $laxValid = true;
  24925. $json->validateSchema();
  24926. } catch (JsonValidationException $e) {
  24927. foreach ($e->getErrors() as $message) {
  24928. if ($laxValid) {
  24929. $publishErrors[] = $message;
  24930. } else {
  24931. $errors[] = $message;
  24932. }
  24933. }
  24934. } catch (\Exception $e) {
  24935. $errors[] = $e->getMessage();
  24936. return array($errors, $publishErrors, $warnings);
  24937. }
  24938. if (empty($manifest['license'])) {
  24939. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  24940. } else {
  24941. $licenses = (array) $manifest['license'];
  24942. foreach ($licenses as $key => $license) {
  24943. if ('proprietary' === $license) {
  24944. unset($licenses[$key]);
  24945. }
  24946. }
  24947. $licenseValidator = new SpdxLicenses();
  24948. foreach ($licenses as $license) {
  24949. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  24950. if ($spdxLicense && $spdxLicense[3]) {
  24951. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  24952. $warnings[] = sprintf(
  24953. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  24954. $license
  24955. );
  24956. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  24957. $warnings[] = sprintf(
  24958. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  24959. $license
  24960. );
  24961. } else {
  24962. $warnings[] = sprintf(
  24963. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  24964. $license
  24965. );
  24966. }
  24967. }
  24968. }
  24969. }
  24970. if (isset($manifest['version'])) {
  24971. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  24972. }
  24973. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  24974. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  24975. $suggestName = strtolower($suggestName);
  24976. $publishErrors[] = sprintf(
  24977. 'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
  24978. $manifest['name'],
  24979. $suggestName
  24980. );
  24981. }
  24982. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  24983. $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See https://getcomposer.org/doc/articles/plugins.md for plugin documentation.";
  24984. }
  24985. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  24986. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  24987. if (!empty($requireOverrides)) {
  24988. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  24989. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  24990. }
  24991. }
  24992. $require = isset($manifest['require']) ? $manifest['require'] : array();
  24993. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  24994. $packages = array_merge($require, $requireDev);
  24995. foreach ($packages as $package => $version) {
  24996. if (preg_match('/#/', $version) === 1) {
  24997. $warnings[] = sprintf(
  24998. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  24999. $package
  25000. );
  25001. }
  25002. }
  25003. $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();
  25004. $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();
  25005. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  25006. if (!array_key_exists($scriptName, $scripts)) {
  25007. $warnings[] = sprintf(
  25008. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  25009. $scriptName
  25010. );
  25011. }
  25012. }
  25013. if (isset($manifest['autoload']['psr-0'][''])) {
  25014. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  25015. }
  25016. if (isset($manifest['autoload']['psr-4'][''])) {
  25017. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  25018. }
  25019. try {
  25020. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  25021. if (!isset($manifest['version'])) {
  25022. $manifest['version'] = '1.0.0';
  25023. }
  25024. if (!isset($manifest['name'])) {
  25025. $manifest['name'] = 'dummy/dummy';
  25026. }
  25027. $loader->load($manifest);
  25028. } catch (InvalidPackageException $e) {
  25029. $errors = array_merge($errors, $e->getErrors());
  25030. }
  25031. $warnings = array_merge($warnings, $loader->getWarnings());
  25032. return array($errors, $publishErrors, $warnings);
  25033. }
  25034. }
  25035. <?php
  25036. namespace Composer\Util;
  25037. use Composer\IO\IOInterface;
  25038. class ErrorHandler
  25039. {
  25040. private static $io;
  25041. public static function handle($level, $message, $file, $line)
  25042. {
  25043. if (!(error_reporting() & $level)) {
  25044. return;
  25045. }
  25046. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  25047. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  25048. "\na legitimately suppressed error that you were not supposed to see.";
  25049. }
  25050. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  25051. throw new \ErrorException($message, 0, $level, $file, $line);
  25052. }
  25053. if (self::$io) {
  25054. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  25055. if (self::$io->isVerbose()) {
  25056. self::$io->writeError('<warning>Stack trace:</warning>');
  25057. self::$io->writeError(array_filter(array_map(function ($a) {
  25058. if (isset($a['line'], $a['file'])) {
  25059. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  25060. }
  25061. return null;
  25062. }, array_slice(debug_backtrace(), 2))));
  25063. }
  25064. }
  25065. }
  25066. public static function register(IOInterface $io = null)
  25067. {
  25068. set_error_handler(array(__CLASS__, 'handle'));
  25069. error_reporting(E_ALL | E_STRICT);
  25070. self::$io = $io;
  25071. }
  25072. }
  25073. <?php
  25074. namespace Composer\Util;
  25075. use RecursiveDirectoryIterator;
  25076. use RecursiveIteratorIterator;
  25077. use Symfony\Component\Filesystem\Exception\IOException;
  25078. use Symfony\Component\Finder\Finder;
  25079. class Filesystem
  25080. {
  25081. private $processExecutor;
  25082. public function __construct(ProcessExecutor $executor = null)
  25083. {
  25084. $this->processExecutor = $executor ?: new ProcessExecutor();
  25085. }
  25086. public function remove($file)
  25087. {
  25088. if (is_dir($file)) {
  25089. return $this->removeDirectory($file);
  25090. }
  25091. if (file_exists($file)) {
  25092. return $this->unlink($file);
  25093. }
  25094. return false;
  25095. }
  25096. public function isDirEmpty($dir)
  25097. {
  25098. $finder = Finder::create()
  25099. ->ignoreVCS(false)
  25100. ->ignoreDotFiles(false)
  25101. ->depth(0)
  25102. ->in($dir);
  25103. return count($finder) === 0;
  25104. }
  25105. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  25106. {
  25107. if (file_exists($dir) && is_link($dir)) {
  25108. $this->unlink($dir);
  25109. }
  25110. if ($ensureDirectoryExists) {
  25111. $this->ensureDirectoryExists($dir);
  25112. }
  25113. if (is_dir($dir)) {
  25114. $finder = Finder::create()
  25115. ->ignoreVCS(false)
  25116. ->ignoreDotFiles(false)
  25117. ->depth(0)
  25118. ->in($dir);
  25119. foreach ($finder as $path) {
  25120. $this->remove((string) $path);
  25121. }
  25122. }
  25123. }
  25124. public function removeDirectory($directory)
  25125. {
  25126. if ($this->isSymlinkedDirectory($directory)) {
  25127. return $this->unlinkSymlinkedDirectory($directory);
  25128. }
  25129. if ($this->isJunction($directory)) {
  25130. return $this->removeJunction($directory);
  25131. }
  25132. if (is_link($directory)) {
  25133. return unlink($directory);
  25134. }
  25135. if (!file_exists($directory) || !is_dir($directory)) {
  25136. return true;
  25137. }
  25138. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  25139. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  25140. }
  25141. if (!function_exists('proc_open')) {
  25142. return $this->removeDirectoryPhp($directory);
  25143. }
  25144. if (Platform::isWindows()) {
  25145. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  25146. } else {
  25147. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  25148. }
  25149. $result = $this->getProcess()->execute($cmd, $output) === 0;
  25150. clearstatcache();
  25151. if ($result && !file_exists($directory)) {
  25152. return true;
  25153. }
  25154. return $this->removeDirectoryPhp($directory);
  25155. }
  25156. public function removeDirectoryPhp($directory)
  25157. {
  25158. try {
  25159. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25160. } catch (\UnexpectedValueException $e) {
  25161. clearstatcache();
  25162. usleep(100000);
  25163. if (!is_dir($directory)) {
  25164. return true;
  25165. }
  25166. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25167. }
  25168. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  25169. foreach ($ri as $file) {
  25170. if ($file->isDir()) {
  25171. $this->rmdir($file->getPathname());
  25172. } else {
  25173. $this->unlink($file->getPathname());
  25174. }
  25175. }
  25176. return $this->rmdir($directory);
  25177. }
  25178. public function ensureDirectoryExists($directory)
  25179. {
  25180. if (!is_dir($directory)) {
  25181. if (file_exists($directory)) {
  25182. throw new \RuntimeException(
  25183. $directory.' exists and is not a directory.'
  25184. );
  25185. }
  25186. if (!@mkdir($directory, 0777, true)) {
  25187. throw new \RuntimeException(
  25188. $directory.' does not exist and could not be created.'
  25189. );
  25190. }
  25191. }
  25192. }
  25193. public function unlink($path)
  25194. {
  25195. $unlinked = @$this->unlinkImplementation($path);
  25196. if (!$unlinked) {
  25197. if (Platform::isWindows()) {
  25198. usleep(350000);
  25199. $unlinked = @$this->unlinkImplementation($path);
  25200. }
  25201. if (!$unlinked) {
  25202. $error = error_get_last();
  25203. $message = 'Could not delete '.$path.': ' . @$error['message'];
  25204. if (Platform::isWindows()) {
  25205. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  25206. }
  25207. throw new \RuntimeException($message);
  25208. }
  25209. }
  25210. return true;
  25211. }
  25212. public function rmdir($path)
  25213. {
  25214. $deleted = @rmdir($path);
  25215. if (!$deleted) {
  25216. if (Platform::isWindows()) {
  25217. usleep(350000);
  25218. $deleted = @rmdir($path);
  25219. }
  25220. if (!$deleted) {
  25221. $error = error_get_last();
  25222. $message = 'Could not delete '.$path.': ' . @$error['message'];
  25223. if (Platform::isWindows()) {
  25224. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  25225. }
  25226. throw new \RuntimeException($message);
  25227. }
  25228. }
  25229. return true;
  25230. }
  25231. public function copyThenRemove($source, $target)
  25232. {
  25233. $this->copy($source, $target);
  25234. if (!is_dir($source)) {
  25235. $this->unlink($source);
  25236. return;
  25237. }
  25238. $this->removeDirectoryPhp($source);
  25239. }
  25240. public function copy($source, $target)
  25241. {
  25242. if (!is_dir($source)) {
  25243. return copy($source, $target);
  25244. }
  25245. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  25246. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  25247. $this->ensureDirectoryExists($target);
  25248. $result = true;
  25249. foreach ($ri as $file) {
  25250. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  25251. if ($file->isDir()) {
  25252. $this->ensureDirectoryExists($targetPath);
  25253. } else {
  25254. $result = $result && copy($file->getPathname(), $targetPath);
  25255. }
  25256. }
  25257. return $result;
  25258. }
  25259. public function rename($source, $target)
  25260. {
  25261. if (true === @rename($source, $target)) {
  25262. return;
  25263. }
  25264. if (!function_exists('proc_open')) {
  25265. return $this->copyThenRemove($source, $target);
  25266. }
  25267. if (Platform::isWindows()) {
  25268. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  25269. $result = $this->processExecutor->execute($command, $output);
  25270. clearstatcache();
  25271. if (0 === $result) {
  25272. $this->remove($source);
  25273. return;
  25274. }
  25275. } else {
  25276. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  25277. $result = $this->processExecutor->execute($command, $output);
  25278. clearstatcache();
  25279. if (0 === $result) {
  25280. return;
  25281. }
  25282. }
  25283. return $this->copyThenRemove($source, $target);
  25284. }
  25285. public function findShortestPath($from, $to, $directories = false)
  25286. {
  25287. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  25288. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  25289. }
  25290. $from = lcfirst($this->normalizePath($from));
  25291. $to = lcfirst($this->normalizePath($to));
  25292. if ($directories) {
  25293. $from = rtrim($from, '/') . '/dummy_file';
  25294. }
  25295. if (dirname($from) === dirname($to)) {
  25296. return './'.basename($to);
  25297. }
  25298. $commonPath = $to;
  25299. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  25300. $commonPath = strtr(dirname($commonPath), '\\', '/');
  25301. }
  25302. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  25303. return $to;
  25304. }
  25305. $commonPath = rtrim($commonPath, '/') . '/';
  25306. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  25307. $commonPathCode = str_repeat('../', $sourcePathDepth);
  25308. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  25309. }
  25310. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  25311. {
  25312. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  25313. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  25314. }
  25315. $from = lcfirst($this->normalizePath($from));
  25316. $to = lcfirst($this->normalizePath($to));
  25317. if ($from === $to) {
  25318. return $directories ? '__DIR__' : '__FILE__';
  25319. }
  25320. $commonPath = $to;
  25321. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  25322. $commonPath = strtr(dirname($commonPath), '\\', '/');
  25323. }
  25324. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  25325. return var_export($to, true);
  25326. }
  25327. $commonPath = rtrim($commonPath, '/') . '/';
  25328. if (strpos($to, $from.'/') === 0) {
  25329. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  25330. }
  25331. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  25332. if ($staticCode) {
  25333. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  25334. } else {
  25335. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  25336. }
  25337. $relTarget = substr($to, strlen($commonPath));
  25338. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  25339. }
  25340. public function isAbsolutePath($path)
  25341. {
  25342. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
  25343. }
  25344. public function size($path)
  25345. {
  25346. if (!file_exists($path)) {
  25347. throw new \RuntimeException("$path does not exist.");
  25348. }
  25349. if (is_dir($path)) {
  25350. return $this->directorySize($path);
  25351. }
  25352. return filesize($path);
  25353. }
  25354. public function normalizePath($path)
  25355. {
  25356. $parts = array();
  25357. $path = strtr($path, '\\', '/');
  25358. $prefix = '';
  25359. $absolute = false;
  25360. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  25361. $prefix = $match[1];
  25362. $path = substr($path, strlen($prefix));
  25363. }
  25364. if (substr($path, 0, 1) === '/') {
  25365. $absolute = true;
  25366. $path = substr($path, 1);
  25367. }
  25368. $up = false;
  25369. foreach (explode('/', $path) as $chunk) {
  25370. if ('..' === $chunk && ($absolute || $up)) {
  25371. array_pop($parts);
  25372. $up = !(empty($parts) || '..' === end($parts));
  25373. } elseif ('.' !== $chunk && '' !== $chunk) {
  25374. $parts[] = $chunk;
  25375. $up = '..' !== $chunk;
  25376. }
  25377. }
  25378. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  25379. }
  25380. public static function isLocalPath($path)
  25381. {
  25382. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  25383. }
  25384. public static function getPlatformPath($path)
  25385. {
  25386. if (Platform::isWindows()) {
  25387. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  25388. }
  25389. return preg_replace('{^file://}i', '', $path);
  25390. }
  25391. protected function directorySize($directory)
  25392. {
  25393. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25394. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  25395. $size = 0;
  25396. foreach ($ri as $file) {
  25397. if ($file->isFile()) {
  25398. $size += $file->getSize();
  25399. }
  25400. }
  25401. return $size;
  25402. }
  25403. protected function getProcess()
  25404. {
  25405. return $this->processExecutor;
  25406. }
  25407. private function unlinkImplementation($path)
  25408. {
  25409. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  25410. return rmdir($path);
  25411. }
  25412. return unlink($path);
  25413. }
  25414. public function relativeSymlink($target, $link)
  25415. {
  25416. $cwd = getcwd();
  25417. $relativePath = $this->findShortestPath($link, $target);
  25418. chdir(dirname($link));
  25419. $result = @symlink($relativePath, $link);
  25420. chdir($cwd);
  25421. return $result;
  25422. }
  25423. public function isSymlinkedDirectory($directory)
  25424. {
  25425. if (!is_dir($directory)) {
  25426. return false;
  25427. }
  25428. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  25429. return is_link($resolved);
  25430. }
  25431. private function unlinkSymlinkedDirectory($directory)
  25432. {
  25433. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  25434. return $this->unlink($resolved);
  25435. }
  25436. private function resolveSymlinkedDirectorySymlink($pathname)
  25437. {
  25438. if (!is_dir($pathname)) {
  25439. return $pathname;
  25440. }
  25441. $resolved = rtrim($pathname, '/');
  25442. if (!strlen($resolved)) {
  25443. return $pathname;
  25444. }
  25445. return $resolved;
  25446. }
  25447. public function junction($target, $junction)
  25448. {
  25449. if (!Platform::isWindows()) {
  25450. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  25451. }
  25452. if (!is_dir($target)) {
  25453. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  25454. }
  25455. $cmd = sprintf(
  25456. 'mklink /J %s %s',
  25457. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  25458. ProcessExecutor::escape(realpath($target))
  25459. );
  25460. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  25461. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  25462. }
  25463. clearstatcache(true, $junction);
  25464. }
  25465. public function isJunction($junction)
  25466. {
  25467. if (!Platform::isWindows()) {
  25468. return false;
  25469. }
  25470. if (!is_dir($junction) || is_link($junction)) {
  25471. return false;
  25472. }
  25473. clearstatcache(true, $junction);
  25474. $stat = lstat($junction);
  25475. return $stat ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
  25476. }
  25477. public function removeJunction($junction)
  25478. {
  25479. if (!Platform::isWindows()) {
  25480. return false;
  25481. }
  25482. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  25483. if (!$this->isJunction($junction)) {
  25484. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  25485. }
  25486. return $this->rmdir($junction);
  25487. }
  25488. }
  25489. <?php
  25490. namespace Composer\Util;
  25491. use Composer\Config;
  25492. use Composer\IO\IOInterface;
  25493. class Git
  25494. {
  25495. private static $version;
  25496. protected $io;
  25497. protected $config;
  25498. protected $process;
  25499. protected $filesystem;
  25500. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  25501. {
  25502. $this->io = $io;
  25503. $this->config = $config;
  25504. $this->process = $process;
  25505. $this->filesystem = $fs;
  25506. }
  25507. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  25508. {
  25509. $this->config->prohibitUrlByConfig($url, $this->io);
  25510. if ($initialClone) {
  25511. $origCwd = $cwd;
  25512. $cwd = null;
  25513. }
  25514. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  25515. throw new \InvalidArgumentException('The source URL ' . $url . ' is invalid, ssh URLs should have a port number after ":".' . "\n" . 'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  25516. }
  25517. if (!$initialClone) {
  25518. $this->process->execute('git remote -v', $output, $cwd);
  25519. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
  25520. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  25521. }
  25522. }
  25523. $protocols = $this->config->get('github-protocols');
  25524. if (!is_array($protocols)) {
  25525. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  25526. }
  25527. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  25528. $messages = array();
  25529. foreach ($protocols as $protocol) {
  25530. if ('ssh' === $protocol) {
  25531. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  25532. } else {
  25533. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  25534. }
  25535. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  25536. return;
  25537. }
  25538. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  25539. if ($initialClone) {
  25540. $this->filesystem->removeDirectory($origCwd);
  25541. }
  25542. }
  25543. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  25544. }
  25545. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  25546. $command = call_user_func($commandCallable, $url);
  25547. $auth = null;
  25548. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  25549. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)) {
  25550. if (!$this->io->hasAuthentication($match[1])) {
  25551. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  25552. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  25553. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25554. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  25555. }
  25556. }
  25557. if ($this->io->hasAuthentication($match[1])) {
  25558. $auth = $this->io->getAuthentication($match[1]);
  25559. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25560. $command = call_user_func($commandCallable, $authUrl);
  25561. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25562. return;
  25563. }
  25564. }
  25565. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  25566. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  25567. if (!$this->io->hasAuthentication($match[1])) {
  25568. $message = 'Enter your Bitbucket credentials to access private repos';
  25569. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25570. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  25571. $accessToken = $bitbucketUtil->getToken();
  25572. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25573. }
  25574. } else {
  25575. $auth = $this->io->getAuthentication($match[1]);
  25576. if ($auth['username'] !== 'x-token-auth') {
  25577. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  25578. if (! empty($accessToken)) {
  25579. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25580. }
  25581. }
  25582. }
  25583. if ($this->io->hasAuthentication($match[1])) {
  25584. $auth = $this->io->getAuthentication($match[1]);
  25585. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25586. $command = call_user_func($commandCallable, $authUrl);
  25587. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25588. return;
  25589. }
  25590. } else {
  25591. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  25592. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  25593. $command = call_user_func($commandCallable, $sshUrl);
  25594. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25595. return;
  25596. }
  25597. }
  25598. } elseif (preg_match('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  25599. if (!$this->io->hasAuthentication($match[2])) {
  25600. $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
  25601. $message = 'Cloning failed, enter your GitLab credentials to access private repos';
  25602. if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
  25603. $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
  25604. }
  25605. }
  25606. if ($this->io->hasAuthentication($match[2])) {
  25607. $auth = $this->io->getAuthentication($match[2]);
  25608. if($auth['password'] === 'private-token' || $auth['password'] === 'oauth2') {
  25609. $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3];
  25610. } else {
  25611. $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3];
  25612. }
  25613. $command = call_user_func($commandCallable, $authUrl);
  25614. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25615. return;
  25616. }
  25617. }
  25618. } elseif ($this->isAuthenticationFailure($url, $match)) {
  25619. if (strpos($match[2], '@')) {
  25620. list($authParts, $match[2]) = explode('@', $match[2], 2);
  25621. }
  25622. $storeAuth = false;
  25623. if ($this->io->hasAuthentication($match[2])) {
  25624. $auth = $this->io->getAuthentication($match[2]);
  25625. } elseif ($this->io->isInteractive()) {
  25626. $defaultUsername = null;
  25627. if (isset($authParts) && $authParts) {
  25628. if (false !== strpos($authParts, ':')) {
  25629. list($defaultUsername, ) = explode(':', $authParts, 2);
  25630. } else {
  25631. $defaultUsername = $authParts;
  25632. }
  25633. }
  25634. $this->io->writeError(' Authentication required (<info>' . parse_url($url, PHP_URL_HOST) . '</info>):');
  25635. $auth = array(
  25636. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  25637. 'password' => $this->io->askAndHideAnswer(' Password: '),
  25638. );
  25639. $storeAuth = $this->config->get('store-auths');
  25640. }
  25641. if ($auth) {
  25642. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  25643. $command = call_user_func($commandCallable, $authUrl);
  25644. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25645. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  25646. $authHelper = new AuthHelper($this->io, $this->config);
  25647. $authHelper->storeAuth($match[2], $storeAuth);
  25648. return;
  25649. }
  25650. }
  25651. }
  25652. if ($initialClone) {
  25653. $this->filesystem->removeDirectory($origCwd);
  25654. }
  25655. $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url);
  25656. }
  25657. }
  25658. public function syncMirror($url, $dir)
  25659. {
  25660. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25661. try {
  25662. $commandCallable = function ($url) {
  25663. return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
  25664. };
  25665. $this->runCommand($commandCallable, $url, $dir);
  25666. } catch (\Exception $e) {
  25667. return false;
  25668. }
  25669. return true;
  25670. }
  25671. $this->filesystem->removeDirectory($dir);
  25672. $commandCallable = function ($url) use ($dir) {
  25673. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  25674. };
  25675. $this->runCommand($commandCallable, $url, $dir, true);
  25676. return true;
  25677. }
  25678. public function fetchRefOrSyncMirror($url, $dir, $ref)
  25679. {
  25680. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25681. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  25682. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $output, $dir);
  25683. if ($exitCode === 0) {
  25684. return true;
  25685. }
  25686. }
  25687. $this->syncMirror($url, $dir);
  25688. return false;
  25689. }
  25690. private function isAuthenticationFailure($url, &$match)
  25691. {
  25692. if (!preg_match('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  25693. return false;
  25694. }
  25695. $authFailures = array(
  25696. 'fatal: Authentication failed',
  25697. 'remote error: Invalid username or password.',
  25698. 'error: 401 Unauthorized',
  25699. 'fatal: unable to access',
  25700. 'fatal: could not read Username',
  25701. );
  25702. $errorOutput = $this->process->getErrorOutput();
  25703. foreach ($authFailures as $authFailure) {
  25704. if (strpos($errorOutput, $authFailure) !== false) {
  25705. return true;
  25706. }
  25707. }
  25708. return false;
  25709. }
  25710. public static function cleanEnv()
  25711. {
  25712. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  25713. throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
  25714. }
  25715. if (getenv('GIT_ASKPASS') !== 'echo') {
  25716. putenv('GIT_ASKPASS=echo');
  25717. unset($_SERVER['GIT_ASKPASS']);
  25718. }
  25719. if (getenv('GIT_DIR')) {
  25720. putenv('GIT_DIR');
  25721. unset($_SERVER['GIT_DIR']);
  25722. }
  25723. if (getenv('GIT_WORK_TREE')) {
  25724. putenv('GIT_WORK_TREE');
  25725. unset($_SERVER['GIT_WORK_TREE']);
  25726. }
  25727. if (getenv('LANGUAGE') !== 'C') {
  25728. putenv('LANGUAGE=C');
  25729. }
  25730. putenv("DYLD_LIBRARY_PATH");
  25731. unset($_SERVER['DYLD_LIBRARY_PATH']);
  25732. }
  25733. public static function getGitHubDomainsRegex(Config $config)
  25734. {
  25735. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  25736. }
  25737. public static function getGitLabDomainsRegex(Config $config)
  25738. {
  25739. return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
  25740. }
  25741. public static function sanitizeUrl($message)
  25742. {
  25743. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  25744. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  25745. return '://***:***@';
  25746. }
  25747. return '://' . $m[1] . ':***@';
  25748. }, $message);
  25749. }
  25750. private function throwException($message, $url)
  25751. {
  25752. clearstatcache();
  25753. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  25754. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  25755. }
  25756. throw new \RuntimeException(self::sanitizeUrl($message));
  25757. }
  25758. public function getVersion()
  25759. {
  25760. if (isset(self::$version)) {
  25761. return self::$version;
  25762. }
  25763. if (0 !== $this->process->execute('git --version', $output)) {
  25764. return;
  25765. }
  25766. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  25767. return self::$version = $matches[1];
  25768. }
  25769. }
  25770. }
  25771. <?php
  25772. namespace Composer\Util;
  25773. use Composer\Factory;
  25774. use Composer\IO\IOInterface;
  25775. use Composer\Config;
  25776. use Composer\Downloader\TransportException;
  25777. class GitHub
  25778. {
  25779. protected $io;
  25780. protected $config;
  25781. protected $process;
  25782. protected $remoteFilesystem;
  25783. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25784. {
  25785. $this->io = $io;
  25786. $this->config = $config;
  25787. $this->process = $process ?: new ProcessExecutor($io);
  25788. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25789. }
  25790. public function authorizeOAuth($originUrl)
  25791. {
  25792. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  25793. return false;
  25794. }
  25795. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  25796. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  25797. return true;
  25798. }
  25799. return false;
  25800. }
  25801. public function authorizeOAuthInteractively($originUrl, $message = null)
  25802. {
  25803. if ($message) {
  25804. $this->io->writeError($message);
  25805. }
  25806. $note = 'Composer';
  25807. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  25808. $note .= ' on ' . trim($output);
  25809. }
  25810. $note .= ' ' . date('Y-m-d Hi');
  25811. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  25812. $this->io->writeError(sprintf('Head to %s', $url));
  25813. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  25814. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  25815. if (!$token) {
  25816. $this->io->writeError('<warning>No token given, aborting.</warning>');
  25817. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  25818. return false;
  25819. }
  25820. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  25821. try {
  25822. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  25823. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  25824. 'retry-auth-failure' => false,
  25825. ));
  25826. } catch (TransportException $e) {
  25827. if (in_array($e->getCode(), array(403, 401))) {
  25828. $this->io->writeError('<error>Invalid token provided.</error>');
  25829. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  25830. return false;
  25831. }
  25832. throw $e;
  25833. }
  25834. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  25835. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  25836. $this->io->writeError('<info>Token stored successfully.</info>');
  25837. return true;
  25838. }
  25839. public function getRateLimit(array $headers)
  25840. {
  25841. $rateLimit = array(
  25842. 'limit' => '?',
  25843. 'reset' => '?',
  25844. );
  25845. foreach ($headers as $header) {
  25846. $header = trim($header);
  25847. if (false === strpos($header, 'X-RateLimit-')) {
  25848. continue;
  25849. }
  25850. list($type, $value) = explode(':', $header, 2);
  25851. switch ($type) {
  25852. case 'X-RateLimit-Limit':
  25853. $rateLimit['limit'] = (int) trim($value);
  25854. break;
  25855. case 'X-RateLimit-Reset':
  25856. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  25857. break;
  25858. }
  25859. }
  25860. return $rateLimit;
  25861. }
  25862. public function isRateLimited(array $headers)
  25863. {
  25864. foreach ($headers as $header) {
  25865. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  25866. return true;
  25867. }
  25868. }
  25869. return false;
  25870. }
  25871. }
  25872. <?php
  25873. namespace Composer\Util;
  25874. use Composer\IO\IOInterface;
  25875. use Composer\Config;
  25876. use Composer\Factory;
  25877. use Composer\Downloader\TransportException;
  25878. use Composer\Json\JsonFile;
  25879. class GitLab
  25880. {
  25881. protected $io;
  25882. protected $config;
  25883. protected $process;
  25884. protected $remoteFilesystem;
  25885. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25886. {
  25887. $this->io = $io;
  25888. $this->config = $config;
  25889. $this->process = $process ?: new ProcessExecutor($io);
  25890. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25891. }
  25892. public function authorizeOAuth($originUrl)
  25893. {
  25894. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  25895. return false;
  25896. }
  25897. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  25898. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  25899. return true;
  25900. }
  25901. $authTokens = $this->config->get('gitlab-token');
  25902. if (isset($authTokens[$originUrl])) {
  25903. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  25904. return true;
  25905. }
  25906. return false;
  25907. }
  25908. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  25909. {
  25910. if ($message) {
  25911. $this->io->writeError($message);
  25912. }
  25913. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  25914. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  25915. $attemptCounter = 0;
  25916. while ($attemptCounter++ < 5) {
  25917. try {
  25918. $response = $this->createToken($scheme, $originUrl);
  25919. } catch (TransportException $e) {
  25920. if (in_array($e->getCode(), array(403, 401))) {
  25921. if (401 === $e->getCode()) {
  25922. $this->io->writeError('Bad credentials.');
  25923. } else {
  25924. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  25925. }
  25926. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  25927. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  25928. continue;
  25929. }
  25930. throw $e;
  25931. }
  25932. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  25933. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  25934. return true;
  25935. }
  25936. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  25937. }
  25938. private function createToken($scheme, $originUrl)
  25939. {
  25940. $username = $this->io->ask('Username: ');
  25941. $password = $this->io->askAndHideAnswer('Password: ');
  25942. $headers = array('Content-Type: application/x-www-form-urlencoded');
  25943. $apiUrl = $originUrl;
  25944. $data = http_build_query(array(
  25945. 'username' => $username,
  25946. 'password' => $password,
  25947. 'grant_type' => 'password',
  25948. ), null, '&');
  25949. $options = array(
  25950. 'retry-auth-failure' => false,
  25951. 'http' => array(
  25952. 'method' => 'POST',
  25953. 'header' => $headers,
  25954. 'content' => $data,
  25955. ),
  25956. );
  25957. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  25958. $this->io->writeError('Token successfully created');
  25959. return JsonFile::parseJson($json);
  25960. }
  25961. }
  25962. <?php
  25963. namespace Composer\Util;
  25964. use Composer\Config;
  25965. use Composer\IO\IOInterface;
  25966. class Hg
  25967. {
  25968. private $io;
  25969. private $config;
  25970. private $process;
  25971. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  25972. {
  25973. $this->io = $io;
  25974. $this->config = $config;
  25975. $this->process = $process;
  25976. }
  25977. public function runCommand($commandCallable, $url, $cwd)
  25978. {
  25979. $this->config->prohibitUrlByConfig($url, $this->io);
  25980. $command = call_user_func($commandCallable, $url);
  25981. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25982. return;
  25983. }
  25984. if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
  25985. $auth = $this->io->getAuthentication($match[5]);
  25986. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
  25987. $command = call_user_func($commandCallable, $authenticatedUrl);
  25988. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25989. return;
  25990. }
  25991. $error = $this->process->getErrorOutput();
  25992. } else {
  25993. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  25994. }
  25995. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  25996. }
  25997. public static function sanitizeUrl($message)
  25998. {
  25999. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  26000. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  26001. return '://***:***@';
  26002. }
  26003. return '://' . $m[1] . ':***@';
  26004. }, $message);
  26005. }
  26006. private function throwException($message, $url)
  26007. {
  26008. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  26009. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  26010. }
  26011. throw new \RuntimeException(self::sanitizeUrl($message));
  26012. }
  26013. }
  26014. <?php
  26015. namespace Composer\Util;
  26016. use Composer\XdebugHandler\XdebugHandler;
  26017. class IniHelper
  26018. {
  26019. public static function getAll()
  26020. {
  26021. return XdebugHandler::getAllIniFiles();
  26022. }
  26023. public static function getMessage()
  26024. {
  26025. $paths = self::getAll();
  26026. if (empty($paths[0])) {
  26027. array_shift($paths);
  26028. }
  26029. $ini = array_shift($paths);
  26030. if (empty($ini)) {
  26031. return 'A php.ini file does not exist. You will have to create one.';
  26032. }
  26033. if (!empty($paths)) {
  26034. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  26035. }
  26036. return 'The php.ini used by your command-line PHP is: '.$ini;
  26037. }
  26038. }
  26039. <?php
  26040. namespace Composer\Util;
  26041. class NoProxyPattern
  26042. {
  26043. protected $rules = array();
  26044. public function __construct($pattern)
  26045. {
  26046. $this->rules = preg_split("/[\s,]+/", $pattern);
  26047. }
  26048. public function test($url)
  26049. {
  26050. $host = parse_url($url, PHP_URL_HOST);
  26051. $port = parse_url($url, PHP_URL_PORT);
  26052. if (empty($port)) {
  26053. switch (parse_url($url, PHP_URL_SCHEME)) {
  26054. case 'http':
  26055. $port = 80;
  26056. break;
  26057. case 'https':
  26058. $port = 443;
  26059. break;
  26060. }
  26061. }
  26062. foreach ($this->rules as $rule) {
  26063. if ($rule == '*') {
  26064. return true;
  26065. }
  26066. $match = false;
  26067. list($ruleHost) = explode(':', $rule);
  26068. list($base) = explode('/', $ruleHost);
  26069. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  26070. if (!isset($ip)) {
  26071. $ip = gethostbyname($host);
  26072. }
  26073. if (strpos($ruleHost, '/') === false) {
  26074. $match = $ip === $ruleHost;
  26075. } else {
  26076. if ($ip === $host) {
  26077. $match = false;
  26078. } else {
  26079. $match = self::inCIDRBlock($ruleHost, $ip);
  26080. }
  26081. }
  26082. } else {
  26083. $haystack = '.' . trim($host, '.') . '.';
  26084. $needle = '.'. trim($ruleHost, '.') .'.';
  26085. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  26086. }
  26087. if ($match && strpos($rule, ':') !== false) {
  26088. list(, $rulePort) = explode(':', $rule);
  26089. if (!empty($rulePort) && $port != $rulePort) {
  26090. $match = false;
  26091. }
  26092. }
  26093. if ($match) {
  26094. return true;
  26095. }
  26096. }
  26097. return false;
  26098. }
  26099. private static function inCIDRBlock($cidr, $ip)
  26100. {
  26101. list($base, $bits) = explode('/', $cidr);
  26102. list($a, $b, $c, $d) = explode('.', $base);
  26103. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  26104. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  26105. $low = $i & $mask;
  26106. $high = $i | (~$mask & 0xFFFFFFFF);
  26107. list($a, $b, $c, $d) = explode('.', $ip);
  26108. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  26109. return $check >= $low && $check <= $high;
  26110. }
  26111. }
  26112. <?php
  26113. namespace Composer\Util;
  26114. use Composer\IO\IOInterface;
  26115. use Symfony\Component\Process\Process;
  26116. class Perforce
  26117. {
  26118. protected $path;
  26119. protected $p4Depot;
  26120. protected $p4Client;
  26121. protected $p4User;
  26122. protected $p4Password;
  26123. protected $p4Port;
  26124. protected $p4Stream;
  26125. protected $p4ClientSpec;
  26126. protected $p4DepotType;
  26127. protected $p4Branch;
  26128. protected $process;
  26129. protected $uniquePerforceClientName;
  26130. protected $windowsFlag;
  26131. protected $commandResult;
  26132. protected $io;
  26133. protected $filesystem;
  26134. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  26135. {
  26136. $this->windowsFlag = $isWindows;
  26137. $this->p4Port = $port;
  26138. $this->initializePath($path);
  26139. $this->process = $process;
  26140. $this->initialize($repoConfig);
  26141. $this->io = $io;
  26142. }
  26143. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  26144. {
  26145. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  26146. }
  26147. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  26148. {
  26149. $output = null;
  26150. return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $output);
  26151. }
  26152. public function initialize($repoConfig)
  26153. {
  26154. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  26155. if (!$repoConfig) {
  26156. return;
  26157. }
  26158. if (isset($repoConfig['unique_perforce_client_name'])) {
  26159. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  26160. }
  26161. if (isset($repoConfig['depot'])) {
  26162. $this->p4Depot = $repoConfig['depot'];
  26163. }
  26164. if (isset($repoConfig['branch'])) {
  26165. $this->p4Branch = $repoConfig['branch'];
  26166. }
  26167. if (isset($repoConfig['p4user'])) {
  26168. $this->p4User = $repoConfig['p4user'];
  26169. } else {
  26170. $this->p4User = $this->getP4variable('P4USER');
  26171. }
  26172. if (isset($repoConfig['p4password'])) {
  26173. $this->p4Password = $repoConfig['p4password'];
  26174. }
  26175. }
  26176. public function initializeDepotAndBranch($depot, $branch)
  26177. {
  26178. if (isset($depot)) {
  26179. $this->p4Depot = $depot;
  26180. }
  26181. if (isset($branch)) {
  26182. $this->p4Branch = $branch;
  26183. }
  26184. }
  26185. public function generateUniquePerforceClientName()
  26186. {
  26187. return gethostname() . "_" . time();
  26188. }
  26189. public function cleanupClientSpec()
  26190. {
  26191. $client = $this->getClient();
  26192. $task = 'client -d ' . ProcessExecutor::escape($client);
  26193. $useP4Client = false;
  26194. $command = $this->generateP4Command($task, $useP4Client);
  26195. $this->executeCommand($command);
  26196. $clientSpec = $this->getP4ClientSpec();
  26197. $fileSystem = $this->getFilesystem();
  26198. $fileSystem->remove($clientSpec);
  26199. }
  26200. protected function executeCommand($command)
  26201. {
  26202. $this->commandResult = '';
  26203. return $this->process->execute($command, $this->commandResult);
  26204. }
  26205. public function getClient()
  26206. {
  26207. if (!isset($this->p4Client)) {
  26208. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  26209. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  26210. }
  26211. return $this->p4Client;
  26212. }
  26213. protected function getPath()
  26214. {
  26215. return $this->path;
  26216. }
  26217. public function initializePath($path)
  26218. {
  26219. $this->path = $path;
  26220. $fs = $this->getFilesystem();
  26221. $fs->ensureDirectoryExists($path);
  26222. }
  26223. protected function getPort()
  26224. {
  26225. return $this->p4Port;
  26226. }
  26227. public function setStream($stream)
  26228. {
  26229. $this->p4Stream = $stream;
  26230. $index = strrpos($stream, '/');
  26231. if ($index > 2) {
  26232. $this->p4DepotType = 'stream';
  26233. }
  26234. }
  26235. public function isStream()
  26236. {
  26237. return (strcmp($this->p4DepotType, 'stream') === 0);
  26238. }
  26239. public function getStream()
  26240. {
  26241. if (!isset($this->p4Stream)) {
  26242. if ($this->isStream()) {
  26243. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  26244. } else {
  26245. $this->p4Stream = '//' . $this->p4Depot;
  26246. }
  26247. }
  26248. return $this->p4Stream;
  26249. }
  26250. public function getStreamWithoutLabel($stream)
  26251. {
  26252. $index = strpos($stream, '@');
  26253. if ($index === false) {
  26254. return $stream;
  26255. }
  26256. return substr($stream, 0, $index);
  26257. }
  26258. public function getP4ClientSpec()
  26259. {
  26260. return $this->path . '/' . $this->getClient() . '.p4.spec';
  26261. }
  26262. public function getUser()
  26263. {
  26264. return $this->p4User;
  26265. }
  26266. public function setUser($user)
  26267. {
  26268. $this->p4User = $user;
  26269. }
  26270. public function queryP4User()
  26271. {
  26272. $this->getUser();
  26273. if (strlen($this->p4User) > 0) {
  26274. return;
  26275. }
  26276. $this->p4User = $this->getP4variable('P4USER');
  26277. if (strlen($this->p4User) > 0) {
  26278. return;
  26279. }
  26280. $this->p4User = $this->io->ask('Enter P4 User:');
  26281. if ($this->windowsFlag) {
  26282. $command = 'p4 set P4USER=' . $this->p4User;
  26283. } else {
  26284. $command = 'export P4USER=' . $this->p4User;
  26285. }
  26286. $this->executeCommand($command);
  26287. }
  26288. protected function getP4variable($name)
  26289. {
  26290. if ($this->windowsFlag) {
  26291. $command = 'p4 set';
  26292. $this->executeCommand($command);
  26293. $result = trim($this->commandResult);
  26294. $resArray = explode(PHP_EOL, $result);
  26295. foreach ($resArray as $line) {
  26296. $fields = explode('=', $line);
  26297. if (strcmp($name, $fields[0]) == 0) {
  26298. $index = strpos($fields[1], ' ');
  26299. if ($index === false) {
  26300. $value = $fields[1];
  26301. } else {
  26302. $value = substr($fields[1], 0, $index);
  26303. }
  26304. $value = trim($value);
  26305. return $value;
  26306. }
  26307. }
  26308. return null;
  26309. }
  26310. $command = 'echo $' . $name;
  26311. $this->executeCommand($command);
  26312. $result = trim($this->commandResult);
  26313. return $result;
  26314. }
  26315. public function queryP4Password()
  26316. {
  26317. if (isset($this->p4Password)) {
  26318. return $this->p4Password;
  26319. }
  26320. $password = $this->getP4variable('P4PASSWD');
  26321. if (strlen($password) <= 0) {
  26322. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  26323. }
  26324. $this->p4Password = $password;
  26325. return $password;
  26326. }
  26327. public function generateP4Command($command, $useClient = true)
  26328. {
  26329. $p4Command = 'p4 ';
  26330. $p4Command .= '-u ' . $this->getUser() . ' ';
  26331. if ($useClient) {
  26332. $p4Command .= '-c ' . $this->getClient() . ' ';
  26333. }
  26334. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  26335. return $p4Command;
  26336. }
  26337. public function isLoggedIn()
  26338. {
  26339. $command = $this->generateP4Command('login -s', false);
  26340. $exitCode = $this->executeCommand($command);
  26341. if ($exitCode) {
  26342. $errorOutput = $this->process->getErrorOutput();
  26343. $index = strpos($errorOutput, $this->getUser());
  26344. if ($index === false) {
  26345. $index = strpos($errorOutput, 'p4');
  26346. if ($index === false) {
  26347. return false;
  26348. }
  26349. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  26350. }
  26351. throw new \Exception('Invalid user name: ' . $this->getUser());
  26352. }
  26353. return true;
  26354. }
  26355. public function connectClient()
  26356. {
  26357. $p4CreateClientCommand = $this->generateP4Command(
  26358. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  26359. );
  26360. $this->executeCommand($p4CreateClientCommand);
  26361. }
  26362. public function syncCodeBase($sourceReference)
  26363. {
  26364. $prevDir = getcwd();
  26365. chdir($this->path);
  26366. $p4SyncCommand = $this->generateP4Command('sync -f ');
  26367. if (null !== $sourceReference) {
  26368. $p4SyncCommand .= '@' . $sourceReference;
  26369. }
  26370. $this->executeCommand($p4SyncCommand);
  26371. chdir($prevDir);
  26372. }
  26373. public function writeClientSpecToFile($spec)
  26374. {
  26375. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  26376. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  26377. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  26378. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  26379. fwrite($spec, 'Description:' . PHP_EOL);
  26380. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  26381. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  26382. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  26383. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  26384. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  26385. if ($this->isStream()) {
  26386. fwrite($spec, 'Stream:' . PHP_EOL);
  26387. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  26388. } else {
  26389. fwrite(
  26390. $spec,
  26391. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  26392. );
  26393. }
  26394. }
  26395. public function writeP4ClientSpec()
  26396. {
  26397. $clientSpec = $this->getP4ClientSpec();
  26398. $spec = fopen($clientSpec, 'w');
  26399. try {
  26400. $this->writeClientSpecToFile($spec);
  26401. } catch (\Exception $e) {
  26402. fclose($spec);
  26403. throw $e;
  26404. }
  26405. fclose($spec);
  26406. }
  26407. protected function read($pipe, $name)
  26408. {
  26409. if (feof($pipe)) {
  26410. return;
  26411. }
  26412. $line = fgets($pipe);
  26413. while ($line !== false) {
  26414. $line = fgets($pipe);
  26415. }
  26416. return;
  26417. }
  26418. public function windowsLogin($password)
  26419. {
  26420. $command = $this->generateP4Command(' login -a');
  26421. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  26422. $process = Process::fromShellCommandline($command, null, null, $password);
  26423. } else {
  26424. $process = new Process($command, null, null, $password);
  26425. }
  26426. return $process->run();
  26427. }
  26428. public function p4Login()
  26429. {
  26430. $this->queryP4User();
  26431. if (!$this->isLoggedIn()) {
  26432. $password = $this->queryP4Password();
  26433. if ($this->windowsFlag) {
  26434. $this->windowsLogin($password);
  26435. } else {
  26436. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  26437. $exitCode = $this->executeCommand($command);
  26438. $result = trim($this->commandResult);
  26439. if ($exitCode) {
  26440. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  26441. }
  26442. }
  26443. }
  26444. }
  26445. public function getComposerInformation($identifier)
  26446. {
  26447. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  26448. if (!$composerFileContent) {
  26449. return;
  26450. }
  26451. return json_decode($composerFileContent, true);
  26452. }
  26453. public function getFileContent($file, $identifier)
  26454. {
  26455. $path = $this->getFilePath($file, $identifier);
  26456. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  26457. $this->executeCommand($command);
  26458. $result = $this->commandResult;
  26459. if (!trim($result)) {
  26460. return null;
  26461. }
  26462. return $result;
  26463. }
  26464. public function getFilePath($file, $identifier)
  26465. {
  26466. $index = strpos($identifier, '@');
  26467. if ($index === false) {
  26468. $path = $identifier. '/' . $file;
  26469. return $path;
  26470. }
  26471. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  26472. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  26473. $this->executeCommand($command);
  26474. $result = $this->commandResult;
  26475. $index2 = strpos($result, 'no such file(s).');
  26476. if ($index2 === false) {
  26477. $index3 = strpos($result, 'change');
  26478. if ($index3 !== false) {
  26479. $phrase = trim(substr($result, $index3));
  26480. $fields = explode(' ', $phrase);
  26481. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  26482. }
  26483. }
  26484. return null;
  26485. }
  26486. public function getBranches()
  26487. {
  26488. $possibleBranches = array();
  26489. if (!$this->isStream()) {
  26490. $possibleBranches[$this->p4Branch] = $this->getStream();
  26491. } else {
  26492. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  26493. $this->executeCommand($command);
  26494. $result = $this->commandResult;
  26495. $resArray = explode(PHP_EOL, $result);
  26496. foreach ($resArray as $line) {
  26497. $resBits = explode(' ', $line);
  26498. if (count($resBits) > 4) {
  26499. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  26500. $possibleBranches[$branch] = $resBits[1];
  26501. }
  26502. }
  26503. }
  26504. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  26505. $this->executeCommand($command);
  26506. $result = $this->commandResult;
  26507. $resArray = explode(PHP_EOL, $result);
  26508. $lastCommit = $resArray[0];
  26509. $lastCommitArr = explode(' ', $lastCommit);
  26510. $lastCommitNum = $lastCommitArr[1];
  26511. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  26512. return $branches;
  26513. }
  26514. public function getTags()
  26515. {
  26516. $command = $this->generateP4Command('labels');
  26517. $this->executeCommand($command);
  26518. $result = $this->commandResult;
  26519. $resArray = explode(PHP_EOL, $result);
  26520. $tags = array();
  26521. foreach ($resArray as $line) {
  26522. if (strpos($line, 'Label') !== false) {
  26523. $fields = explode(' ', $line);
  26524. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  26525. }
  26526. }
  26527. return $tags;
  26528. }
  26529. public function checkStream()
  26530. {
  26531. $command = $this->generateP4Command('depots', false);
  26532. $this->executeCommand($command);
  26533. $result = $this->commandResult;
  26534. $resArray = explode(PHP_EOL, $result);
  26535. foreach ($resArray as $line) {
  26536. if (strpos($line, 'Depot') !== false) {
  26537. $fields = explode(' ', $line);
  26538. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  26539. $this->p4DepotType = $fields[3];
  26540. return $this->isStream();
  26541. }
  26542. }
  26543. }
  26544. return false;
  26545. }
  26546. protected function getChangeList($reference)
  26547. {
  26548. $index = strpos($reference, '@');
  26549. if ($index === false) {
  26550. return null;
  26551. }
  26552. $label = substr($reference, $index);
  26553. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  26554. $this->executeCommand($command);
  26555. $changes = $this->commandResult;
  26556. if (strpos($changes, 'Change') !== 0) {
  26557. return null;
  26558. }
  26559. $fields = explode(' ', $changes);
  26560. return $fields[1];
  26561. }
  26562. public function getCommitLogs($fromReference, $toReference)
  26563. {
  26564. $fromChangeList = $this->getChangeList($fromReference);
  26565. if ($fromChangeList === null) {
  26566. return null;
  26567. }
  26568. $toChangeList = $this->getChangeList($toReference);
  26569. if ($toChangeList === null) {
  26570. return null;
  26571. }
  26572. $index = strpos($fromReference, '@');
  26573. $main = substr($fromReference, 0, $index) . '/...';
  26574. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  26575. $this->executeCommand($command);
  26576. return $this->commandResult;
  26577. }
  26578. public function getFilesystem()
  26579. {
  26580. if (empty($this->filesystem)) {
  26581. $this->filesystem = new Filesystem($this->process);
  26582. }
  26583. return $this->filesystem;
  26584. }
  26585. public function setFilesystem(Filesystem $fs)
  26586. {
  26587. $this->filesystem = $fs;
  26588. }
  26589. }
  26590. <?php
  26591. namespace Composer\Util;
  26592. class Platform
  26593. {
  26594. public static function expandPath($path)
  26595. {
  26596. if (preg_match('#^~[\\/]#', $path)) {
  26597. return self::getUserDirectory() . substr($path, 1);
  26598. }
  26599. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  26600. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  26601. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  26602. }
  26603. return getenv($matches['var']) . $matches['path'];
  26604. }, $path);
  26605. }
  26606. public static function getUserDirectory()
  26607. {
  26608. if (false !== ($home = getenv('HOME'))) {
  26609. return $home;
  26610. }
  26611. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  26612. return $home;
  26613. }
  26614. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  26615. $info = posix_getpwuid(posix_getuid());
  26616. return $info['dir'];
  26617. }
  26618. throw new \RuntimeException('Could not determine user directory');
  26619. }
  26620. public static function isWindows()
  26621. {
  26622. return defined('PHP_WINDOWS_VERSION_BUILD');
  26623. }
  26624. public static function strlen($str)
  26625. {
  26626. static $useMbString = null;
  26627. if (null === $useMbString) {
  26628. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  26629. }
  26630. if ($useMbString) {
  26631. return mb_strlen($str, '8bit');
  26632. }
  26633. return strlen($str);
  26634. }
  26635. }
  26636. <?php
  26637. namespace Composer\Util;
  26638. use Composer\IO\IOInterface;
  26639. use Symfony\Component\Process\Process;
  26640. use Symfony\Component\Process\ProcessUtils;
  26641. class ProcessExecutor
  26642. {
  26643. protected static $timeout = 300;
  26644. protected $captureOutput;
  26645. protected $errorOutput;
  26646. protected $io;
  26647. public function __construct(IOInterface $io = null)
  26648. {
  26649. $this->io = $io;
  26650. }
  26651. public function execute($command, &$output = null, $cwd = null)
  26652. {
  26653. if ($this->io && $this->io->isDebug()) {
  26654. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  26655. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  26656. return '://***:***@';
  26657. }
  26658. return '://'.$m['user'].':***@';
  26659. }, $command);
  26660. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  26661. }
  26662. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  26663. $cwd = realpath(getcwd());
  26664. }
  26665. $this->captureOutput = func_num_args() > 1;
  26666. $this->errorOutput = null;
  26667. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  26668. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  26669. } else {
  26670. $process = new Process($command, $cwd, null, null, static::getTimeout());
  26671. }
  26672. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  26673. $process->run($callback);
  26674. if ($this->captureOutput && !is_callable($output)) {
  26675. $output = $process->getOutput();
  26676. }
  26677. $this->errorOutput = $process->getErrorOutput();
  26678. return $process->getExitCode();
  26679. }
  26680. public function splitLines($output)
  26681. {
  26682. $output = trim($output);
  26683. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  26684. }
  26685. public function getErrorOutput()
  26686. {
  26687. return $this->errorOutput;
  26688. }
  26689. public function outputHandler($type, $buffer)
  26690. {
  26691. if ($this->captureOutput) {
  26692. return;
  26693. }
  26694. if (null === $this->io) {
  26695. echo $buffer;
  26696. return;
  26697. }
  26698. if (Process::ERR === $type) {
  26699. $this->io->writeError($buffer, false);
  26700. } else {
  26701. $this->io->write($buffer, false);
  26702. }
  26703. }
  26704. public static function getTimeout()
  26705. {
  26706. return static::$timeout;
  26707. }
  26708. public static function setTimeout($timeout)
  26709. {
  26710. static::$timeout = $timeout;
  26711. }
  26712. public static function escape($argument)
  26713. {
  26714. return self::escapeArgument($argument);
  26715. }
  26716. private static function escapeArgument($argument)
  26717. {
  26718. if ('\\' === DIRECTORY_SEPARATOR) {
  26719. if ('' === $argument) {
  26720. return escapeshellarg($argument);
  26721. }
  26722. $escapedArgument = '';
  26723. $quote = false;
  26724. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  26725. if ('"' === $part) {
  26726. $escapedArgument .= '\\"';
  26727. } elseif (self::isSurroundedBy($part, '%')) {
  26728. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  26729. } else {
  26730. if ('\\' === substr($part, -1)) {
  26731. $part .= '\\';
  26732. }
  26733. $quote = true;
  26734. $escapedArgument .= $part;
  26735. }
  26736. }
  26737. if ($quote) {
  26738. $escapedArgument = '"'.$escapedArgument.'"';
  26739. }
  26740. return $escapedArgument;
  26741. }
  26742. return "'".str_replace("'", "'\\''", $argument)."'";
  26743. }
  26744. private static function isSurroundedBy($arg, $char)
  26745. {
  26746. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  26747. }
  26748. }
  26749. <?php
  26750. namespace Composer\Util;
  26751. use Composer\Config;
  26752. use Composer\Composer;
  26753. use Composer\Semver\Constraint\Constraint;
  26754. use Composer\Package\Version\VersionParser;
  26755. use Composer\IO\IOInterface;
  26756. use Composer\Downloader\TransportException;
  26757. use Composer\CaBundle\CaBundle;
  26758. use Psr\Log\LoggerInterface;
  26759. class RemoteFilesystem
  26760. {
  26761. private $io;
  26762. private $config;
  26763. private $scheme;
  26764. private $bytesMax;
  26765. private $originUrl;
  26766. private $fileUrl;
  26767. private $fileName;
  26768. private $retry;
  26769. private $progress;
  26770. private $lastProgress;
  26771. private $options = array();
  26772. private $peerCertificateMap = array();
  26773. private $disableTls = false;
  26774. private $retryAuthFailure;
  26775. private $lastHeaders;
  26776. private $storeAuth;
  26777. private $degradedMode = false;
  26778. private $redirects;
  26779. private $maxRedirects = 20;
  26780. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  26781. {
  26782. $this->io = $io;
  26783. if ($disableTls === false) {
  26784. $this->options = $this->getTlsDefaults($options);
  26785. } else {
  26786. $this->disableTls = true;
  26787. }
  26788. $this->options = array_replace_recursive($this->options, $options);
  26789. $this->config = $config;
  26790. }
  26791. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  26792. {
  26793. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  26794. }
  26795. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  26796. {
  26797. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  26798. }
  26799. public function getOptions()
  26800. {
  26801. return $this->options;
  26802. }
  26803. public function setOptions(array $options)
  26804. {
  26805. $this->options = array_replace_recursive($this->options, $options);
  26806. }
  26807. public function isTlsDisabled()
  26808. {
  26809. return $this->disableTls === true;
  26810. }
  26811. public function getLastHeaders()
  26812. {
  26813. return $this->lastHeaders;
  26814. }
  26815. public function findHeaderValue(array $headers, $name)
  26816. {
  26817. $value = null;
  26818. foreach ($headers as $header) {
  26819. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  26820. $value = $match[1];
  26821. } elseif (preg_match('{^HTTP/}i', $header)) {
  26822. $value = null;
  26823. }
  26824. }
  26825. return $value;
  26826. }
  26827. public function findStatusCode(array $headers)
  26828. {
  26829. $value = null;
  26830. foreach ($headers as $header) {
  26831. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  26832. $value = (int) $match[1];
  26833. }
  26834. }
  26835. return $value;
  26836. }
  26837. public function findStatusMessage(array $headers)
  26838. {
  26839. $value = null;
  26840. foreach ($headers as $header) {
  26841. if (preg_match('{^HTTP/\S+ \d+}i', $header)) {
  26842. $value = $header;
  26843. }
  26844. }
  26845. return $value;
  26846. }
  26847. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  26848. {
  26849. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  26850. $originUrl = 'github.com';
  26851. }
  26852. if (
  26853. $this->config
  26854. && is_array($this->config->get('gitlab-domains'))
  26855. && false === strpos($originUrl, '/')
  26856. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  26857. ) {
  26858. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  26859. if (0 === strpos($gitlabDomain, $originUrl)) {
  26860. $originUrl = $gitlabDomain;
  26861. break;
  26862. }
  26863. }
  26864. unset($gitlabDomain);
  26865. }
  26866. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  26867. $this->bytesMax = 0;
  26868. $this->originUrl = $originUrl;
  26869. $this->fileUrl = $fileUrl;
  26870. $this->fileName = $fileName;
  26871. $this->progress = $progress;
  26872. $this->lastProgress = null;
  26873. $this->retryAuthFailure = true;
  26874. $this->lastHeaders = array();
  26875. $this->redirects = 1;
  26876. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  26877. $this->io->setAuthentication($originUrl, rawurldecode($match[1]), rawurldecode($match[2]));
  26878. }
  26879. $tempAdditionalOptions = $additionalOptions;
  26880. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  26881. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  26882. unset($tempAdditionalOptions['retry-auth-failure']);
  26883. }
  26884. $isRedirect = false;
  26885. if (isset($tempAdditionalOptions['redirects'])) {
  26886. $this->redirects = $tempAdditionalOptions['redirects'];
  26887. $isRedirect = true;
  26888. unset($tempAdditionalOptions['redirects']);
  26889. }
  26890. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  26891. unset($tempAdditionalOptions);
  26892. $origFileUrl = $fileUrl;
  26893. if (isset($options['github-token'])) {
  26894. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  26895. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  26896. }
  26897. unset($options['github-token']);
  26898. }
  26899. if (isset($options['gitlab-token'])) {
  26900. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  26901. unset($options['gitlab-token']);
  26902. }
  26903. if (isset($options['http'])) {
  26904. $options['http']['ignore_errors'] = true;
  26905. }
  26906. if ($this->degradedMode && substr($fileUrl, 0, 26) === 'http://repo.packagist.org/') {
  26907. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  26908. $degradedPackagist = true;
  26909. }
  26910. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  26911. $actualContextOptions = stream_context_get_options($ctx);
  26912. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  26913. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $origFileUrl . $usingProxy, true, IOInterface::DEBUG);
  26914. unset($origFileUrl, $actualContextOptions);
  26915. if ((!preg_match('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  26916. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  26917. }
  26918. if ($this->progress && !$isRedirect) {
  26919. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  26920. }
  26921. $errorMessage = '';
  26922. $errorCode = 0;
  26923. $result = false;
  26924. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  26925. if ($errorMessage) {
  26926. $errorMessage .= "\n";
  26927. }
  26928. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  26929. });
  26930. try {
  26931. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header);
  26932. if (!empty($http_response_header[0])) {
  26933. $statusCode = $this->findStatusCode($http_response_header);
  26934. if ($statusCode >= 400 && $this->findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  26935. self::outputWarnings($this->io, $originUrl, json_decode($result, true));
  26936. }
  26937. if (in_array($statusCode, array(401, 403)) && $this->retryAuthFailure) {
  26938. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), null, $http_response_header);
  26939. }
  26940. }
  26941. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  26942. if ($contentLength && Platform::strlen($result) < $contentLength) {
  26943. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  26944. $e->setHeaders($http_response_header);
  26945. $e->setStatusCode($this->findStatusCode($http_response_header));
  26946. $e->setResponse($result);
  26947. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  26948. throw $e;
  26949. }
  26950. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  26951. $params = stream_context_get_params($ctx);
  26952. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  26953. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  26954. if ($expectedPeerFingerprint !== $peerFingerprint) {
  26955. throw new TransportException('Peer fingerprint did not match');
  26956. }
  26957. }
  26958. } catch (\Exception $e) {
  26959. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  26960. $e->setHeaders($http_response_header);
  26961. $e->setStatusCode($this->findStatusCode($http_response_header));
  26962. }
  26963. if ($e instanceof TransportException && $result !== false) {
  26964. $e->setResponse($result);
  26965. }
  26966. $result = false;
  26967. }
  26968. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  26969. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  26970. }
  26971. restore_error_handler();
  26972. if (isset($e) && !$this->retry) {
  26973. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  26974. $this->degradedMode = true;
  26975. $this->io->writeError('');
  26976. $this->io->writeError(array(
  26977. '<error>'.$e->getMessage().'</error>',
  26978. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26979. ));
  26980. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26981. }
  26982. throw $e;
  26983. }
  26984. $statusCode = null;
  26985. $contentType = null;
  26986. $locationHeader = null;
  26987. if (!empty($http_response_header[0])) {
  26988. $statusCode = $this->findStatusCode($http_response_header);
  26989. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  26990. $locationHeader = $this->findHeaderValue($http_response_header, 'location');
  26991. }
  26992. if ($originUrl === 'bitbucket.org'
  26993. && !$this->isPublicBitBucketDownload($fileUrl)
  26994. && substr($fileUrl, -4) === '.zip'
  26995. && (!$locationHeader || substr($locationHeader, -4) !== '.zip')
  26996. && $contentType && preg_match('{^text/html\b}i', $contentType)
  26997. ) {
  26998. $result = false;
  26999. if ($this->retryAuthFailure) {
  27000. $this->promptAuthAndRetry(401);
  27001. }
  27002. }
  27003. if ($statusCode === 404
  27004. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  27005. && false !== strpos($fileUrl, 'archive.zip')
  27006. ) {
  27007. $result = false;
  27008. if ($this->retryAuthFailure) {
  27009. $this->promptAuthAndRetry(401);
  27010. }
  27011. }
  27012. $hasFollowedRedirect = false;
  27013. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  27014. $hasFollowedRedirect = true;
  27015. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  27016. }
  27017. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  27018. if (!$this->retry) {
  27019. if ($this->progress && !$this->retry && !$isRedirect) {
  27020. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  27021. }
  27022. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  27023. $e->setHeaders($http_response_header);
  27024. $e->setResponse($result);
  27025. $e->setStatusCode($statusCode);
  27026. throw $e;
  27027. }
  27028. $result = false;
  27029. }
  27030. if ($this->progress && !$this->retry && !$isRedirect) {
  27031. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  27032. }
  27033. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  27034. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  27035. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  27036. if ($decode) {
  27037. try {
  27038. if (PHP_VERSION_ID >= 50400) {
  27039. $result = zlib_decode($result);
  27040. } else {
  27041. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  27042. }
  27043. if (!$result) {
  27044. throw new TransportException('Failed to decode zlib stream');
  27045. }
  27046. } catch (\Exception $e) {
  27047. if ($this->degradedMode) {
  27048. throw $e;
  27049. }
  27050. $this->degradedMode = true;
  27051. $this->io->writeError(array(
  27052. '',
  27053. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  27054. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  27055. ));
  27056. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27057. }
  27058. }
  27059. }
  27060. if (false !== $result && null !== $fileName && !$isRedirect) {
  27061. if ('' === $result) {
  27062. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  27063. }
  27064. $errorMessage = '';
  27065. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  27066. if ($errorMessage) {
  27067. $errorMessage .= "\n";
  27068. }
  27069. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  27070. });
  27071. $result = (bool) file_put_contents($fileName, $result);
  27072. restore_error_handler();
  27073. if (false === $result) {
  27074. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  27075. }
  27076. }
  27077. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  27078. if (CaBundle::isOpensslParseSafe()) {
  27079. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  27080. if ($certDetails) {
  27081. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  27082. $this->retry = true;
  27083. }
  27084. } else {
  27085. $this->io->writeError('');
  27086. $this->io->writeError(sprintf(
  27087. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  27088. PHP_VERSION
  27089. ));
  27090. }
  27091. }
  27092. if ($this->retry) {
  27093. $this->retry = false;
  27094. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27095. if ($this->storeAuth && $this->config) {
  27096. $authHelper = new AuthHelper($this->io, $this->config);
  27097. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  27098. $this->storeAuth = false;
  27099. }
  27100. return $result;
  27101. }
  27102. if (false === $result) {
  27103. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  27104. if (!empty($http_response_header[0])) {
  27105. $e->setHeaders($http_response_header);
  27106. }
  27107. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  27108. $this->degradedMode = true;
  27109. $this->io->writeError('');
  27110. $this->io->writeError(array(
  27111. '<error>'.$e->getMessage().'</error>',
  27112. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  27113. ));
  27114. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27115. }
  27116. throw $e;
  27117. }
  27118. if (!empty($http_response_header[0])) {
  27119. $this->lastHeaders = $http_response_header;
  27120. }
  27121. return $result;
  27122. }
  27123. protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null)
  27124. {
  27125. try {
  27126. $e = null;
  27127. $result = file_get_contents($fileUrl, false, $context);
  27128. } catch (\Throwable $e) {
  27129. } catch (\Exception $e) {
  27130. }
  27131. $responseHeaders = isset($http_response_header) ? $http_response_header : array();
  27132. if (null !== $e) {
  27133. throw $e;
  27134. }
  27135. return $result;
  27136. }
  27137. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  27138. {
  27139. switch ($notificationCode) {
  27140. case STREAM_NOTIFY_FAILURE:
  27141. if (400 === $messageCode) {
  27142. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  27143. }
  27144. break;
  27145. case STREAM_NOTIFY_FILE_SIZE_IS:
  27146. $this->bytesMax = $bytesMax;
  27147. break;
  27148. case STREAM_NOTIFY_PROGRESS:
  27149. if ($this->bytesMax > 0 && $this->progress) {
  27150. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  27151. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  27152. $this->lastProgress = $progression;
  27153. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  27154. }
  27155. }
  27156. break;
  27157. default:
  27158. break;
  27159. }
  27160. }
  27161. protected function promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())
  27162. {
  27163. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  27164. $gitHubUtil = new GitHub($this->io, $this->config, null);
  27165. $message = "\n";
  27166. $rateLimited = $gitHubUtil->isRateLimited($headers);
  27167. if ($rateLimited) {
  27168. $rateLimit = $gitHubUtil->getRateLimit($headers);
  27169. if ($this->io->hasAuthentication($this->originUrl)) {
  27170. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  27171. } else {
  27172. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  27173. }
  27174. $message = sprintf(
  27175. 'GitHub API limit (%d calls/hr) is exhausted, could not fetch '.$this->fileUrl.'. '.$message.' You can also wait until %s for the rate limit to reset.',
  27176. $rateLimit['limit'],
  27177. $rateLimit['reset']
  27178. )."\n";
  27179. } else {
  27180. $message .= 'Could not fetch '.$this->fileUrl.', please ';
  27181. if ($this->io->hasAuthentication($this->originUrl)) {
  27182. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  27183. } else {
  27184. $message .= 'create a GitHub OAuth token to access private repos';
  27185. }
  27186. }
  27187. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  27188. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  27189. ) {
  27190. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  27191. }
  27192. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  27193. $message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  27194. $gitLabUtil = new GitLab($this->io, $this->config, null);
  27195. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && $auth['password'] === 'private-token') {
  27196. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  27197. }
  27198. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  27199. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  27200. ) {
  27201. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  27202. }
  27203. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  27204. $askForOAuthToken = true;
  27205. if ($this->io->hasAuthentication($this->originUrl)) {
  27206. $auth = $this->io->getAuthentication($this->originUrl);
  27207. if ($auth['username'] !== 'x-token-auth') {
  27208. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  27209. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  27210. if (!empty($accessToken)) {
  27211. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  27212. $askForOAuthToken = false;
  27213. }
  27214. } else {
  27215. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  27216. }
  27217. }
  27218. if ($askForOAuthToken) {
  27219. $message = "\n".'Could not fetch ' . $this->fileUrl . ', please create a bitbucket OAuth token to ' . (($httpStatus === 401 || $httpStatus === 403) ? 'access private repos' : 'go over the API rate limit');
  27220. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  27221. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  27222. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  27223. ) {
  27224. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  27225. }
  27226. }
  27227. } else {
  27228. if ($httpStatus === 404) {
  27229. return;
  27230. }
  27231. if (!$this->io->isInteractive()) {
  27232. if ($httpStatus === 401) {
  27233. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  27234. }
  27235. if ($httpStatus === 403) {
  27236. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  27237. }
  27238. throw new TransportException($message, $httpStatus);
  27239. }
  27240. if ($this->io->hasAuthentication($this->originUrl)) {
  27241. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  27242. }
  27243. $this->io->writeError(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
  27244. $username = $this->io->ask(' Username: ');
  27245. $password = $this->io->askAndHideAnswer(' Password: ');
  27246. $this->io->setAuthentication($this->originUrl, $username, $password);
  27247. $this->storeAuth = $this->config->get('store-auths');
  27248. }
  27249. $this->retry = true;
  27250. throw new TransportException('RETRY');
  27251. }
  27252. protected function getOptionsForUrl($originUrl, $additionalOptions)
  27253. {
  27254. $tlsOptions = array();
  27255. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  27256. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  27257. if (PHP_VERSION_ID < 50304) {
  27258. if ($host === 'github.com' || $host === 'api.github.com') {
  27259. $host = '*.github.com';
  27260. }
  27261. }
  27262. $tlsOptions['ssl']['CN_match'] = $host;
  27263. $tlsOptions['ssl']['SNI_server_name'] = $host;
  27264. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  27265. if (isset($this->peerCertificateMap[$urlAuthority])) {
  27266. $certMap = $this->peerCertificateMap[$urlAuthority];
  27267. $this->io->writeError('', true, IOInterface::DEBUG);
  27268. $this->io->writeError(sprintf(
  27269. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  27270. $certMap['cn'],
  27271. $urlAuthority
  27272. ), true, IOInterface::DEBUG);
  27273. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  27274. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  27275. } elseif (!CaBundle::isOpensslParseSafe() && $host === 'repo.packagist.org') {
  27276. $tlsOptions['ssl']['CN_match'] = 'packagist.org';
  27277. }
  27278. }
  27279. $headers = array();
  27280. if (extension_loaded('zlib')) {
  27281. $headers[] = 'Accept-Encoding: gzip';
  27282. }
  27283. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  27284. if (!$this->degradedMode) {
  27285. $options['http']['protocol_version'] = 1.1;
  27286. $headers[] = 'Connection: close';
  27287. }
  27288. if ($this->io->hasAuthentication($originUrl)) {
  27289. $auth = $this->io->getAuthentication($originUrl);
  27290. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  27291. $options['github-token'] = $auth['username'];
  27292. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  27293. if ($auth['password'] === 'oauth2') {
  27294. $headers[] = 'Authorization: Bearer '.$auth['username'];
  27295. } elseif ($auth['password'] === 'private-token') {
  27296. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  27297. }
  27298. } elseif ('bitbucket.org' === $originUrl
  27299. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  27300. ) {
  27301. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  27302. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  27303. }
  27304. } else {
  27305. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  27306. $headers[] = 'Authorization: Basic '.$authStr;
  27307. }
  27308. }
  27309. $options['http']['follow_location'] = 0;
  27310. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  27311. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  27312. }
  27313. foreach ($headers as $header) {
  27314. $options['http']['header'][] = $header;
  27315. }
  27316. return $options;
  27317. }
  27318. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  27319. {
  27320. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  27321. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  27322. $targetUrl = $locationHeader;
  27323. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  27324. $targetUrl = $this->scheme.':'.$locationHeader;
  27325. } elseif ('/' === $locationHeader[0]) {
  27326. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  27327. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  27328. } else {
  27329. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  27330. }
  27331. }
  27332. if (!empty($targetUrl)) {
  27333. $this->redirects++;
  27334. $this->io->writeError('', true, IOInterface::DEBUG);
  27335. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $targetUrl), true, IOInterface::DEBUG);
  27336. $additionalOptions['redirects'] = $this->redirects;
  27337. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  27338. }
  27339. if (!$this->retry) {
  27340. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  27341. $e->setHeaders($http_response_header);
  27342. $e->setResponse($result);
  27343. throw $e;
  27344. }
  27345. return false;
  27346. }
  27347. private function getTlsDefaults(array $options)
  27348. {
  27349. $ciphers = implode(':', array(
  27350. 'ECDHE-RSA-AES128-GCM-SHA256',
  27351. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  27352. 'ECDHE-RSA-AES256-GCM-SHA384',
  27353. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  27354. 'DHE-RSA-AES128-GCM-SHA256',
  27355. 'DHE-DSS-AES128-GCM-SHA256',
  27356. 'kEDH+AESGCM',
  27357. 'ECDHE-RSA-AES128-SHA256',
  27358. 'ECDHE-ECDSA-AES128-SHA256',
  27359. 'ECDHE-RSA-AES128-SHA',
  27360. 'ECDHE-ECDSA-AES128-SHA',
  27361. 'ECDHE-RSA-AES256-SHA384',
  27362. 'ECDHE-ECDSA-AES256-SHA384',
  27363. 'ECDHE-RSA-AES256-SHA',
  27364. 'ECDHE-ECDSA-AES256-SHA',
  27365. 'DHE-RSA-AES128-SHA256',
  27366. 'DHE-RSA-AES128-SHA',
  27367. 'DHE-DSS-AES128-SHA256',
  27368. 'DHE-RSA-AES256-SHA256',
  27369. 'DHE-DSS-AES256-SHA',
  27370. 'DHE-RSA-AES256-SHA',
  27371. 'AES128-GCM-SHA256',
  27372. 'AES256-GCM-SHA384',
  27373. 'AES128-SHA256',
  27374. 'AES256-SHA256',
  27375. 'AES128-SHA',
  27376. 'AES256-SHA',
  27377. 'AES',
  27378. 'CAMELLIA',
  27379. 'DES-CBC3-SHA',
  27380. '!aNULL',
  27381. '!eNULL',
  27382. '!EXPORT',
  27383. '!DES',
  27384. '!RC4',
  27385. '!MD5',
  27386. '!PSK',
  27387. '!aECDH',
  27388. '!EDH-DSS-DES-CBC3-SHA',
  27389. '!EDH-RSA-DES-CBC3-SHA',
  27390. '!KRB5-DES-CBC3-SHA',
  27391. ));
  27392. $defaults = array(
  27393. 'ssl' => array(
  27394. 'ciphers' => $ciphers,
  27395. 'verify_peer' => true,
  27396. 'verify_depth' => 7,
  27397. 'SNI_enabled' => true,
  27398. 'capture_peer_cert' => true,
  27399. ),
  27400. );
  27401. if (isset($options['ssl'])) {
  27402. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  27403. }
  27404. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  27405. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  27406. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  27407. if (is_dir($result)) {
  27408. $defaults['ssl']['capath'] = $result;
  27409. } else {
  27410. $defaults['ssl']['cafile'] = $result;
  27411. }
  27412. }
  27413. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  27414. throw new TransportException('The configured cafile was not valid or could not be read.');
  27415. }
  27416. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  27417. throw new TransportException('The configured capath was not valid or could not be read.');
  27418. }
  27419. if (PHP_VERSION_ID >= 50413) {
  27420. $defaults['ssl']['disable_compression'] = true;
  27421. }
  27422. return $defaults;
  27423. }
  27424. private function getCertificateCnAndFp($url, $options)
  27425. {
  27426. if (PHP_VERSION_ID >= 50600) {
  27427. throw new \BadMethodCallException(sprintf(
  27428. '%s must not be used on PHP >= 5.6',
  27429. __METHOD__
  27430. ));
  27431. }
  27432. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  27433. 'ssl' => array(
  27434. 'capture_peer_cert' => true,
  27435. 'verify_peer' => false,
  27436. ), ),
  27437. ));
  27438. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  27439. return;
  27440. }
  27441. fclose($handle);
  27442. $handle = null;
  27443. $params = stream_context_get_params($context);
  27444. if (!empty($params['options']['ssl']['peer_certificate'])) {
  27445. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  27446. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  27447. return array(
  27448. 'cn' => $commonName,
  27449. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  27450. );
  27451. }
  27452. }
  27453. }
  27454. private function getUrlAuthority($url)
  27455. {
  27456. $defaultPorts = array(
  27457. 'ftp' => 21,
  27458. 'http' => 80,
  27459. 'https' => 443,
  27460. 'ssh2.sftp' => 22,
  27461. 'ssh2.scp' => 22,
  27462. );
  27463. $scheme = parse_url($url, PHP_URL_SCHEME);
  27464. if (!isset($defaultPorts[$scheme])) {
  27465. throw new \InvalidArgumentException(sprintf(
  27466. 'Could not get default port for unknown scheme: %s',
  27467. $scheme
  27468. ));
  27469. }
  27470. $defaultPort = $defaultPorts[$scheme];
  27471. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  27472. return parse_url($url, PHP_URL_HOST).':'.$port;
  27473. }
  27474. private function isPublicBitBucketDownload($urlToBitBucketFile)
  27475. {
  27476. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  27477. if (strpos($domain, 'bitbucket.org') === false) {
  27478. return true;
  27479. }
  27480. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  27481. $pathParts = explode('/', $path);
  27482. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  27483. }
  27484. public static function outputWarnings(IOInterface $io, $url, $data)
  27485. {
  27486. foreach (array('warning', 'info') as $type) {
  27487. if (empty($data[$type])) {
  27488. continue;
  27489. }
  27490. if (!empty($data[$type . '-versions'])) {
  27491. $versionParser = new VersionParser();
  27492. $constraint = $versionParser->parseConstraints($data[$type . '-versions']);
  27493. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  27494. if (!$constraint->matches($composer)) {
  27495. continue;
  27496. }
  27497. }
  27498. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.$url.': '.$data[$type].'</'.$type.'>');
  27499. }
  27500. }
  27501. }
  27502. <?php
  27503. namespace Composer\Util;
  27504. class Silencer
  27505. {
  27506. private static $stack = array();
  27507. public static function suppress($mask = null)
  27508. {
  27509. if (!isset($mask)) {
  27510. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  27511. }
  27512. $old = error_reporting();
  27513. self::$stack[] = $old;
  27514. error_reporting($old & ~$mask);
  27515. return $old;
  27516. }
  27517. public static function restore()
  27518. {
  27519. if (!empty(self::$stack)) {
  27520. error_reporting(array_pop(self::$stack));
  27521. }
  27522. }
  27523. public static function call($callable )
  27524. {
  27525. try {
  27526. self::suppress();
  27527. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  27528. self::restore();
  27529. return $result;
  27530. } catch (\Exception $e) {
  27531. self::restore();
  27532. throw $e;
  27533. }
  27534. }
  27535. }
  27536. <?php
  27537. namespace Composer\Util;
  27538. use Composer\Spdx\SpdxLicenses;
  27539. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  27540. class SpdxLicense extends SpdxLicenses
  27541. {
  27542. }
  27543. <?php
  27544. namespace Composer\Util;
  27545. use Composer\Composer;
  27546. final class StreamContextFactory
  27547. {
  27548. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  27549. {
  27550. $options = array('http' => array(
  27551. 'follow_location' => 1,
  27552. 'max_redirects' => 20,
  27553. ));
  27554. if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  27555. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  27556. }
  27557. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  27558. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  27559. }
  27560. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  27561. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  27562. }
  27563. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  27564. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  27565. if ($pattern->test($url)) {
  27566. unset($proxy);
  27567. }
  27568. }
  27569. if (!empty($proxy)) {
  27570. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  27571. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  27572. if (isset($proxy['port'])) {
  27573. $proxyURL .= ":" . $proxy['port'];
  27574. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  27575. $proxyURL .= ":80";
  27576. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  27577. $proxyURL .= ":443";
  27578. }
  27579. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  27580. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  27581. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  27582. }
  27583. $options['http']['proxy'] = $proxyURL;
  27584. switch (parse_url($url, PHP_URL_SCHEME)) {
  27585. case 'http':
  27586. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  27587. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27588. $options['http']['request_fulluri'] = true;
  27589. }
  27590. break;
  27591. case 'https':
  27592. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  27593. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27594. $options['http']['request_fulluri'] = true;
  27595. }
  27596. break;
  27597. }
  27598. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  27599. $options['ssl']['SNI_enabled'] = true;
  27600. if (PHP_VERSION_ID < 50600) {
  27601. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  27602. }
  27603. }
  27604. if (isset($proxy['user'])) {
  27605. $auth = rawurldecode($proxy['user']);
  27606. if (isset($proxy['pass'])) {
  27607. $auth .= ':' . rawurldecode($proxy['pass']);
  27608. }
  27609. $auth = base64_encode($auth);
  27610. if (isset($defaultOptions['http']['header'])) {
  27611. if (is_string($defaultOptions['http']['header'])) {
  27612. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  27613. }
  27614. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  27615. } else {
  27616. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  27617. }
  27618. }
  27619. }
  27620. $options = array_replace_recursive($options, $defaultOptions);
  27621. if (isset($options['http']['header'])) {
  27622. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  27623. }
  27624. if (defined('HHVM_VERSION')) {
  27625. $phpVersion = 'HHVM ' . HHVM_VERSION;
  27626. } else {
  27627. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  27628. }
  27629. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  27630. $options['http']['header'][] = sprintf(
  27631. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  27632. Composer::getVersion(),
  27633. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  27634. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  27635. $phpVersion,
  27636. getenv('CI') ? '; CI' : ''
  27637. );
  27638. }
  27639. return stream_context_create($options, $defaultParams);
  27640. }
  27641. private static function fixHttpHeaderField($header)
  27642. {
  27643. if (!is_array($header)) {
  27644. $header = explode("\r\n", $header);
  27645. }
  27646. uasort($header, function ($el) {
  27647. return stripos($el, 'content-type') === 0 ? 1 : -1;
  27648. });
  27649. return $header;
  27650. }
  27651. }
  27652. <?php
  27653. namespace Composer\Util;
  27654. use Composer\Config;
  27655. use Composer\IO\IOInterface;
  27656. class Svn
  27657. {
  27658. const MAX_QTY_AUTH_TRIES = 5;
  27659. protected $credentials;
  27660. protected $hasAuth;
  27661. protected $io;
  27662. protected $url;
  27663. protected $cacheCredentials = true;
  27664. protected $process;
  27665. protected $qtyAuthTries = 0;
  27666. protected $config;
  27667. private static $version;
  27668. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  27669. {
  27670. $this->url = $url;
  27671. $this->io = $io;
  27672. $this->config = $config;
  27673. $this->process = $process ?: new ProcessExecutor($io);
  27674. }
  27675. public static function cleanEnv()
  27676. {
  27677. putenv("DYLD_LIBRARY_PATH");
  27678. unset($_SERVER['DYLD_LIBRARY_PATH']);
  27679. }
  27680. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  27681. {
  27682. $this->config->prohibitUrlByConfig($url, $this->io);
  27683. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  27684. }
  27685. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  27686. {
  27687. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  27688. }
  27689. private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose)
  27690. {
  27691. $command = $this->getCommand($svnCommand, $url, $path);
  27692. $output = null;
  27693. $io = $this->io;
  27694. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  27695. if ($type !== 'out') {
  27696. return;
  27697. }
  27698. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  27699. return;
  27700. }
  27701. $output .= $buffer;
  27702. if ($verbose) {
  27703. $io->writeError($buffer, false);
  27704. }
  27705. };
  27706. $status = $this->process->execute($command, $handler, $cwd);
  27707. if (0 === $status) {
  27708. return $output;
  27709. }
  27710. $errorOutput = $this->process->getErrorOutput();
  27711. $fullOutput = implode("\n", array($output, $errorOutput));
  27712. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  27713. && false === stripos($fullOutput, 'authorization failed')
  27714. && false === stripos($fullOutput, 'svn: E170001:')
  27715. && false === stripos($fullOutput, 'svn: E215004:')) {
  27716. throw new \RuntimeException($fullOutput);
  27717. }
  27718. if (!$this->hasAuth()) {
  27719. $this->doAuthDance();
  27720. }
  27721. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  27722. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  27723. }
  27724. throw new \RuntimeException(
  27725. 'wrong credentials provided ('.$fullOutput.')'
  27726. );
  27727. }
  27728. public function setCacheCredentials($cacheCredentials)
  27729. {
  27730. $this->cacheCredentials = $cacheCredentials;
  27731. }
  27732. protected function doAuthDance()
  27733. {
  27734. if (!$this->io->isInteractive()) {
  27735. throw new \RuntimeException(
  27736. 'can not ask for authentication in non interactive mode'
  27737. );
  27738. }
  27739. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  27740. $this->hasAuth = true;
  27741. $this->credentials['username'] = $this->io->ask("Username: ");
  27742. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  27743. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  27744. return $this;
  27745. }
  27746. protected function getCommand($cmd, $url, $path = null)
  27747. {
  27748. $cmd = sprintf(
  27749. '%s %s%s %s',
  27750. $cmd,
  27751. '--non-interactive ',
  27752. $this->getCredentialString(),
  27753. ProcessExecutor::escape($url)
  27754. );
  27755. if ($path) {
  27756. $cmd .= ' ' . ProcessExecutor::escape($path);
  27757. }
  27758. return $cmd;
  27759. }
  27760. protected function getCredentialString()
  27761. {
  27762. if (!$this->hasAuth()) {
  27763. return '';
  27764. }
  27765. return sprintf(
  27766. ' %s--username %s --password %s ',
  27767. $this->getAuthCache(),
  27768. ProcessExecutor::escape($this->getUsername()),
  27769. ProcessExecutor::escape($this->getPassword())
  27770. );
  27771. }
  27772. protected function getPassword()
  27773. {
  27774. if ($this->credentials === null) {
  27775. throw new \LogicException("No svn auth detected.");
  27776. }
  27777. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  27778. }
  27779. protected function getUsername()
  27780. {
  27781. if ($this->credentials === null) {
  27782. throw new \LogicException("No svn auth detected.");
  27783. }
  27784. return $this->credentials['username'];
  27785. }
  27786. protected function hasAuth()
  27787. {
  27788. if (null !== $this->hasAuth) {
  27789. return $this->hasAuth;
  27790. }
  27791. if (false === $this->createAuthFromConfig()) {
  27792. $this->createAuthFromUrl();
  27793. }
  27794. return $this->hasAuth;
  27795. }
  27796. protected function getAuthCache()
  27797. {
  27798. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  27799. }
  27800. private function createAuthFromConfig()
  27801. {
  27802. if (!$this->config->has('http-basic')) {
  27803. return $this->hasAuth = false;
  27804. }
  27805. $authConfig = $this->config->get('http-basic');
  27806. $host = parse_url($this->url, PHP_URL_HOST);
  27807. if (isset($authConfig[$host])) {
  27808. $this->credentials['username'] = $authConfig[$host]['username'];
  27809. $this->credentials['password'] = $authConfig[$host]['password'];
  27810. return $this->hasAuth = true;
  27811. }
  27812. return $this->hasAuth = false;
  27813. }
  27814. private function createAuthFromUrl()
  27815. {
  27816. $uri = parse_url($this->url);
  27817. if (empty($uri['user'])) {
  27818. return $this->hasAuth = false;
  27819. }
  27820. $this->credentials['username'] = $uri['user'];
  27821. if (!empty($uri['pass'])) {
  27822. $this->credentials['password'] = $uri['pass'];
  27823. }
  27824. return $this->hasAuth = true;
  27825. }
  27826. public function binaryVersion()
  27827. {
  27828. if (!self::$version) {
  27829. if (0 === $this->process->execute('svn --version', $output)) {
  27830. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
  27831. self::$version = $match[1];
  27832. }
  27833. }
  27834. }
  27835. return self::$version;
  27836. }
  27837. }
  27838. <?php
  27839. namespace Composer\Util;
  27840. use Composer\CaBundle\CaBundle;
  27841. final class TlsHelper
  27842. {
  27843. private static $useOpensslParse;
  27844. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  27845. {
  27846. $names = self::getCertificateNames($certificate);
  27847. if (empty($names)) {
  27848. return false;
  27849. }
  27850. $combinedNames = array_merge($names['san'], array($names['cn']));
  27851. $hostname = strtolower($hostname);
  27852. foreach ($combinedNames as $certName) {
  27853. $matcher = self::certNameMatcher($certName);
  27854. if ($matcher && $matcher($hostname)) {
  27855. $cn = $names['cn'];
  27856. return true;
  27857. }
  27858. }
  27859. return false;
  27860. }
  27861. public static function getCertificateNames($certificate)
  27862. {
  27863. if (is_array($certificate)) {
  27864. $info = $certificate;
  27865. } elseif (CaBundle::isOpensslParseSafe()) {
  27866. $info = openssl_x509_parse($certificate, false);
  27867. }
  27868. if (!isset($info['subject']['commonName'])) {
  27869. return null;
  27870. }
  27871. $commonName = strtolower($info['subject']['commonName']);
  27872. $subjectAltNames = array();
  27873. if (isset($info['extensions']['subjectAltName'])) {
  27874. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  27875. $subjectAltNames = array_filter(array_map(function ($name) {
  27876. if (0 === strpos($name, 'DNS:')) {
  27877. return strtolower(ltrim(substr($name, 4)));
  27878. }
  27879. return null;
  27880. }, $subjectAltNames));
  27881. $subjectAltNames = array_values($subjectAltNames);
  27882. }
  27883. return array(
  27884. 'cn' => $commonName,
  27885. 'san' => $subjectAltNames,
  27886. );
  27887. }
  27888. public static function getCertificateFingerprint($certificate)
  27889. {
  27890. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  27891. $pubkeypem = $pubkeydetails['key'];
  27892. $start = '-----BEGIN PUBLIC KEY-----';
  27893. $end = '-----END PUBLIC KEY-----';
  27894. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  27895. $der = base64_decode($pemtrim);
  27896. return sha1($der);
  27897. }
  27898. public static function isOpensslParseSafe()
  27899. {
  27900. return CaBundle::isOpensslParseSafe();
  27901. }
  27902. private static function certNameMatcher($certName)
  27903. {
  27904. $wildcards = substr_count($certName, '*');
  27905. if (0 === $wildcards) {
  27906. return function ($hostname) use ($certName) {
  27907. return $hostname === $certName;
  27908. };
  27909. }
  27910. if (1 === $wildcards) {
  27911. $components = explode('.', $certName);
  27912. if (3 > count($components)) {
  27913. return;
  27914. }
  27915. $firstComponent = $components[0];
  27916. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  27917. return;
  27918. }
  27919. $wildcardRegex = preg_quote($certName);
  27920. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  27921. $wildcardRegex = "{^{$wildcardRegex}$}";
  27922. return function ($hostname) use ($wildcardRegex) {
  27923. return 1 === preg_match($wildcardRegex, $hostname);
  27924. };
  27925. }
  27926. }
  27927. }
  27928. <?php
  27929. namespace Composer\Util;
  27930. use Composer\Config;
  27931. class Url
  27932. {
  27933. public static function updateDistReference(Config $config, $url, $ref)
  27934. {
  27935. $host = parse_url($url, PHP_URL_HOST);
  27936. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  27937. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  27938. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  27939. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  27940. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  27941. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  27942. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  27943. }
  27944. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  27945. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  27946. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  27947. }
  27948. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  27949. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  27950. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  27951. }
  27952. } elseif (in_array($host, $config->get('github-domains'), true)) {
  27953. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  27954. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  27955. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  27956. }
  27957. return $url;
  27958. }
  27959. }
  27960. <?php
  27961. namespace Composer;
  27962. use Symfony\Component\Console\Output\OutputInterface;
  27963. trigger_error('The ' . __NAMESPACE__ . '\XdebugHandler class is deprecated, use Composer\XdebugHandler\XdebugHandler instead,', E_USER_DEPRECATED);
  27964. class XdebugHandler extends XdebugHandler\XdebugHandler
  27965. {
  27966. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  27967. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  27968. public function __construct(OutputInterface $output)
  27969. {
  27970. parent::__construct('composer', '--ansi');
  27971. }
  27972. }
  27973. <?php
  27974. function includeIfExists($file)
  27975. {
  27976. return file_exists($file) ? include $file : false;
  27977. }
  27978. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  27979. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  27980. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  27981. exit(1);
  27982. }
  27983. return $loader;
  27984. <?php
  27985. /*
  27986. * This file is part of Composer.
  27987. *
  27988. * (c) Nils Adermann <naderman@naderman.de>
  27989. * Jordi Boggiano <j.boggiano@seld.be>
  27990. *
  27991. * For the full copyright and license information, please view the LICENSE
  27992. * file that was distributed with this source code.
  27993. */
  27994. namespace Composer\Autoload;
  27995. /**
  27996. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  27997. *
  27998. * $loader = new \Composer\Autoload\ClassLoader();
  27999. *
  28000. * // register classes with namespaces
  28001. * $loader->add('Symfony\Component', __DIR__.'/component');
  28002. * $loader->add('Symfony', __DIR__.'/framework');
  28003. *
  28004. * // activate the autoloader
  28005. * $loader->register();
  28006. *
  28007. * // to enable searching the include path (eg. for PEAR packages)
  28008. * $loader->setUseIncludePath(true);
  28009. *
  28010. * In this example, if you try to use a class in the Symfony\Component
  28011. * namespace or one of its children (Symfony\Component\Console for instance),
  28012. * the autoloader will first look for the class under the component/
  28013. * directory, and it will then fallback to the framework/ directory if not
  28014. * found before giving up.
  28015. *
  28016. * This class is loosely based on the Symfony UniversalClassLoader.
  28017. *
  28018. * @author Fabien Potencier <fabien@symfony.com>
  28019. * @author Jordi Boggiano <j.boggiano@seld.be>
  28020. * @see http://www.php-fig.org/psr/psr-0/
  28021. * @see http://www.php-fig.org/psr/psr-4/
  28022. */
  28023. class ClassLoader
  28024. {
  28025. // PSR-4
  28026. private $prefixLengthsPsr4 = array();
  28027. private $prefixDirsPsr4 = array();
  28028. private $fallbackDirsPsr4 = array();
  28029. // PSR-0
  28030. private $prefixesPsr0 = array();
  28031. private $fallbackDirsPsr0 = array();
  28032. private $useIncludePath = false;
  28033. private $classMap = array();
  28034. private $classMapAuthoritative = false;
  28035. private $missingClasses = array();
  28036. private $apcuPrefix;
  28037. public function getPrefixes()
  28038. {
  28039. if (!empty($this->prefixesPsr0)) {
  28040. return call_user_func_array('array_merge', $this->prefixesPsr0);
  28041. }
  28042. return array();
  28043. }
  28044. public function getPrefixesPsr4()
  28045. {
  28046. return $this->prefixDirsPsr4;
  28047. }
  28048. public function getFallbackDirs()
  28049. {
  28050. return $this->fallbackDirsPsr0;
  28051. }
  28052. public function getFallbackDirsPsr4()
  28053. {
  28054. return $this->fallbackDirsPsr4;
  28055. }
  28056. public function getClassMap()
  28057. {
  28058. return $this->classMap;
  28059. }
  28060. /**
  28061. * @param array $classMap Class to filename map
  28062. */
  28063. public function addClassMap(array $classMap)
  28064. {
  28065. if ($this->classMap) {
  28066. $this->classMap = array_merge($this->classMap, $classMap);
  28067. } else {
  28068. $this->classMap = $classMap;
  28069. }
  28070. }
  28071. /**
  28072. * Registers a set of PSR-0 directories for a given prefix, either
  28073. * appending or prepending to the ones previously set for this prefix.
  28074. *
  28075. * @param string $prefix The prefix
  28076. * @param array|string $paths The PSR-0 root directories
  28077. * @param bool $prepend Whether to prepend the directories
  28078. */
  28079. public function add($prefix, $paths, $prepend = false)
  28080. {
  28081. if (!$prefix) {
  28082. if ($prepend) {
  28083. $this->fallbackDirsPsr0 = array_merge(
  28084. (array) $paths,
  28085. $this->fallbackDirsPsr0
  28086. );
  28087. } else {
  28088. $this->fallbackDirsPsr0 = array_merge(
  28089. $this->fallbackDirsPsr0,
  28090. (array) $paths
  28091. );
  28092. }
  28093. return;
  28094. }
  28095. $first = $prefix[0];
  28096. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  28097. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  28098. return;
  28099. }
  28100. if ($prepend) {
  28101. $this->prefixesPsr0[$first][$prefix] = array_merge(
  28102. (array) $paths,
  28103. $this->prefixesPsr0[$first][$prefix]
  28104. );
  28105. } else {
  28106. $this->prefixesPsr0[$first][$prefix] = array_merge(
  28107. $this->prefixesPsr0[$first][$prefix],
  28108. (array) $paths
  28109. );
  28110. }
  28111. }
  28112. /**
  28113. * Registers a set of PSR-4 directories for a given namespace, either
  28114. * appending or prepending to the ones previously set for this namespace.
  28115. *
  28116. * @param string $prefix The prefix/namespace, with trailing '\\'
  28117. * @param array|string $paths The PSR-4 base directories
  28118. * @param bool $prepend Whether to prepend the directories
  28119. *
  28120. * @throws \InvalidArgumentException
  28121. */
  28122. public function addPsr4($prefix, $paths, $prepend = false)
  28123. {
  28124. if (!$prefix) {
  28125. // Register directories for the root namespace.
  28126. if ($prepend) {
  28127. $this->fallbackDirsPsr4 = array_merge(
  28128. (array) $paths,
  28129. $this->fallbackDirsPsr4
  28130. );
  28131. } else {
  28132. $this->fallbackDirsPsr4 = array_merge(
  28133. $this->fallbackDirsPsr4,
  28134. (array) $paths
  28135. );
  28136. }
  28137. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  28138. // Register directories for a new namespace.
  28139. $length = strlen($prefix);
  28140. if ('\\' !== $prefix[$length - 1]) {
  28141. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  28142. }
  28143. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  28144. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  28145. } elseif ($prepend) {
  28146. // Prepend directories for an already registered namespace.
  28147. $this->prefixDirsPsr4[$prefix] = array_merge(
  28148. (array) $paths,
  28149. $this->prefixDirsPsr4[$prefix]
  28150. );
  28151. } else {
  28152. // Append directories for an already registered namespace.
  28153. $this->prefixDirsPsr4[$prefix] = array_merge(
  28154. $this->prefixDirsPsr4[$prefix],
  28155. (array) $paths
  28156. );
  28157. }
  28158. }
  28159. /**
  28160. * Registers a set of PSR-0 directories for a given prefix,
  28161. * replacing any others previously set for this prefix.
  28162. *
  28163. * @param string $prefix The prefix
  28164. * @param array|string $paths The PSR-0 base directories
  28165. */
  28166. public function set($prefix, $paths)
  28167. {
  28168. if (!$prefix) {
  28169. $this->fallbackDirsPsr0 = (array) $paths;
  28170. } else {
  28171. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  28172. }
  28173. }
  28174. /**
  28175. * Registers a set of PSR-4 directories for a given namespace,
  28176. * replacing any others previously set for this namespace.
  28177. *
  28178. * @param string $prefix The prefix/namespace, with trailing '\\'
  28179. * @param array|string $paths The PSR-4 base directories
  28180. *
  28181. * @throws \InvalidArgumentException
  28182. */
  28183. public function setPsr4($prefix, $paths)
  28184. {
  28185. if (!$prefix) {
  28186. $this->fallbackDirsPsr4 = (array) $paths;
  28187. } else {
  28188. $length = strlen($prefix);
  28189. if ('\\' !== $prefix[$length - 1]) {
  28190. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  28191. }
  28192. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  28193. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  28194. }
  28195. }
  28196. /**
  28197. * Turns on searching the include path for class files.
  28198. *
  28199. * @param bool $useIncludePath
  28200. */
  28201. public function setUseIncludePath($useIncludePath)
  28202. {
  28203. $this->useIncludePath = $useIncludePath;
  28204. }
  28205. /**
  28206. * Can be used to check if the autoloader uses the include path to check
  28207. * for classes.
  28208. *
  28209. * @return bool
  28210. */
  28211. public function getUseIncludePath()
  28212. {
  28213. return $this->useIncludePath;
  28214. }
  28215. /**
  28216. * Turns off searching the prefix and fallback directories for classes
  28217. * that have not been registered with the class map.
  28218. *
  28219. * @param bool $classMapAuthoritative
  28220. */
  28221. public function setClassMapAuthoritative($classMapAuthoritative)
  28222. {
  28223. $this->classMapAuthoritative = $classMapAuthoritative;
  28224. }
  28225. /**
  28226. * Should class lookup fail if not found in the current class map?
  28227. *
  28228. * @return bool
  28229. */
  28230. public function isClassMapAuthoritative()
  28231. {
  28232. return $this->classMapAuthoritative;
  28233. }
  28234. /**
  28235. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  28236. *
  28237. * @param string|null $apcuPrefix
  28238. */
  28239. public function setApcuPrefix($apcuPrefix)
  28240. {
  28241. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  28242. }
  28243. /**
  28244. * The APCu prefix in use, or null if APCu caching is not enabled.
  28245. *
  28246. * @return string|null
  28247. */
  28248. public function getApcuPrefix()
  28249. {
  28250. return $this->apcuPrefix;
  28251. }
  28252. /**
  28253. * Registers this instance as an autoloader.
  28254. *
  28255. * @param bool $prepend Whether to prepend the autoloader or not
  28256. */
  28257. public function register($prepend = false)
  28258. {
  28259. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  28260. }
  28261. /**
  28262. * Unregisters this instance as an autoloader.
  28263. */
  28264. public function unregister()
  28265. {
  28266. spl_autoload_unregister(array($this, 'loadClass'));
  28267. }
  28268. /**
  28269. * Loads the given class or interface.
  28270. *
  28271. * @param string $class The name of the class
  28272. * @return bool|null True if loaded, null otherwise
  28273. */
  28274. public function loadClass($class)
  28275. {
  28276. if ($file = $this->findFile($class)) {
  28277. includeFile($file);
  28278. return true;
  28279. }
  28280. }
  28281. /**
  28282. * Finds the path to the file where the class is defined.
  28283. *
  28284. * @param string $class The name of the class
  28285. *
  28286. * @return string|false The path if found, false otherwise
  28287. */
  28288. public function findFile($class)
  28289. {
  28290. // class map lookup
  28291. if (isset($this->classMap[$class])) {
  28292. return $this->classMap[$class];
  28293. }
  28294. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  28295. return false;
  28296. }
  28297. if (null !== $this->apcuPrefix) {
  28298. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  28299. if ($hit) {
  28300. return $file;
  28301. }
  28302. }
  28303. $file = $this->findFileWithExtension($class, '.php');
  28304. // Search for Hack files if we are running on HHVM
  28305. if (false === $file && defined('HHVM_VERSION')) {
  28306. $file = $this->findFileWithExtension($class, '.hh');
  28307. }
  28308. if (null !== $this->apcuPrefix) {
  28309. apcu_add($this->apcuPrefix.$class, $file);
  28310. }
  28311. if (false === $file) {
  28312. // Remember that this class does not exist.
  28313. $this->missingClasses[$class] = true;
  28314. }
  28315. return $file;
  28316. }
  28317. private function findFileWithExtension($class, $ext)
  28318. {
  28319. // PSR-4 lookup
  28320. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  28321. $first = $class[0];
  28322. if (isset($this->prefixLengthsPsr4[$first])) {
  28323. $subPath = $class;
  28324. while (false !== $lastPos = strrpos($subPath, '\\')) {
  28325. $subPath = substr($subPath, 0, $lastPos);
  28326. $search = $subPath . '\\';
  28327. if (isset($this->prefixDirsPsr4[$search])) {
  28328. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  28329. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  28330. if (file_exists($file = $dir . $pathEnd)) {
  28331. return $file;
  28332. }
  28333. }
  28334. }
  28335. }
  28336. }
  28337. // PSR-4 fallback dirs
  28338. foreach ($this->fallbackDirsPsr4 as $dir) {
  28339. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  28340. return $file;
  28341. }
  28342. }
  28343. // PSR-0 lookup
  28344. if (false !== $pos = strrpos($class, '\\')) {
  28345. // namespaced class name
  28346. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  28347. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  28348. } else {
  28349. // PEAR-like class name
  28350. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  28351. }
  28352. if (isset($this->prefixesPsr0[$first])) {
  28353. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  28354. if (0 === strpos($class, $prefix)) {
  28355. foreach ($dirs as $dir) {
  28356. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  28357. return $file;
  28358. }
  28359. }
  28360. }
  28361. }
  28362. }
  28363. // PSR-0 fallback dirs
  28364. foreach ($this->fallbackDirsPsr0 as $dir) {
  28365. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  28366. return $file;
  28367. }
  28368. }
  28369. // PSR-0 include paths.
  28370. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  28371. return $file;
  28372. }
  28373. return false;
  28374. }
  28375. }
  28376. /**
  28377. * Scope isolated include.
  28378. *
  28379. * Prevents access to $this/self from included files.
  28380. */
  28381. function includeFile($file)
  28382. {
  28383. include $file;
  28384. }
  28385. {
  28386. "$schema": "http://json-schema.org/draft-04/schema#",
  28387. "description": "A representation of packages metadata.",
  28388. "type": "object",
  28389. "oneOf": [
  28390. { "required": [ "packages" ] },
  28391. { "required": [ "providers" ] },
  28392. { "required": [ "provider-includes", "providers-url" ] }
  28393. ],
  28394. "properties": {
  28395. "packages": {
  28396. "type": ["object", "array"],
  28397. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  28398. "additionalProperties": { "$ref": "#/definitions/versions" }
  28399. },
  28400. "providers-url": {
  28401. "type": "string",
  28402. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  28403. },
  28404. "provider-includes": {
  28405. "type": "object",
  28406. "description": "A hashmap of provider listings.",
  28407. "additionalProperties": { "$ref": "#/definitions/provider" }
  28408. },
  28409. "providers": {
  28410. "type": "object",
  28411. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  28412. "additionalProperties": { "$ref": "#/definitions/provider" }
  28413. },
  28414. "notify-batch": {
  28415. "type": "string",
  28416. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  28417. },
  28418. "search": {
  28419. "type": "string",
  28420. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  28421. },
  28422. "warning": {
  28423. "type": "string",
  28424. "description": "A message that will be output by Composer as a warning when this source is consulted."
  28425. }
  28426. },
  28427. "definitions": {
  28428. "versions": {
  28429. "type": "object",
  28430. "description": "A hashmap of versions and their metadata.",
  28431. "additionalProperties": { "$ref": "#/definitions/version" }
  28432. },
  28433. "version": {
  28434. "type": "object",
  28435. "oneOf": [
  28436. { "$ref": "#/definitions/package" },
  28437. { "$ref": "#/definitions/metapackage" }
  28438. ]
  28439. },
  28440. "package-base": {
  28441. "properties": {
  28442. "name": { "type": "string" },
  28443. "type": { "type": "string" },
  28444. "version": { "type": "string" },
  28445. "version_normalized": {
  28446. "type": "string",
  28447. "description": "Normalized version, optional but can save computational time on client side."
  28448. },
  28449. "autoload": { "type": "object" },
  28450. "require": { "type": "object" },
  28451. "replace": { "type": "object" },
  28452. "conflict": { "type": "object" },
  28453. "provide": { "type": "object" },
  28454. "time": { "type": "string" }
  28455. },
  28456. "additionalProperties": true
  28457. },
  28458. "package": {
  28459. "allOf": [
  28460. { "$ref": "#/definitions/package-base" },
  28461. {
  28462. "properties": {
  28463. "dist": { "type": "object" },
  28464. "source": { "type": "object" }
  28465. }
  28466. },
  28467. { "oneOf": [
  28468. { "required": [ "name", "version", "source" ] },
  28469. { "required": [ "name", "version", "dist" ] }
  28470. ] }
  28471. ]
  28472. },
  28473. "metapackage": {
  28474. "allOf": [
  28475. { "$ref": "#/definitions/package-base" },
  28476. {
  28477. "properties": {
  28478. "type": { "type": "string", "enum": [ "metapackage" ] }
  28479. },
  28480. "required": [ "name", "version", "type" ]
  28481. }
  28482. ]
  28483. },
  28484. "provider": {
  28485. "type": "object",
  28486. "properties": {
  28487. "sha256": {
  28488. "type": "string",
  28489. "description": "Hash value that can be used to validate the resource."
  28490. }
  28491. }
  28492. }
  28493. }
  28494. }
  28495. {
  28496. "$schema": "http://json-schema.org/draft-04/schema#",
  28497. "name": "Package",
  28498. "type": "object",
  28499. "additionalProperties": false,
  28500. "required": [ "name", "description" ],
  28501. "properties": {
  28502. "name": {
  28503. "type": "string",
  28504. "description": "Package name, including 'vendor-name/' prefix."
  28505. },
  28506. "type": {
  28507. "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
  28508. "type": "string"
  28509. },
  28510. "target-dir": {
  28511. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  28512. "type": "string"
  28513. },
  28514. "description": {
  28515. "type": "string",
  28516. "description": "Short package description."
  28517. },
  28518. "keywords": {
  28519. "type": "array",
  28520. "items": {
  28521. "type": "string",
  28522. "description": "A tag/keyword that this package relates to."
  28523. }
  28524. },
  28525. "homepage": {
  28526. "type": "string",
  28527. "description": "Homepage URL for the project.",
  28528. "format": "uri"
  28529. },
  28530. "readme": {
  28531. "type": "string",
  28532. "description": "Relative path to the readme document."
  28533. },
  28534. "version": {
  28535. "type": "string",
  28536. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
  28537. },
  28538. "time": {
  28539. "type": "string",
  28540. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  28541. },
  28542. "license": {
  28543. "type": ["string", "array"],
  28544. "description": "License name. Or an array of license names."
  28545. },
  28546. "authors": {
  28547. "$ref": "#/definitions/authors"
  28548. },
  28549. "require": {
  28550. "type": "object",
  28551. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  28552. "additionalProperties": {
  28553. "type": "string"
  28554. }
  28555. },
  28556. "replace": {
  28557. "type": "object",
  28558. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  28559. "additionalProperties": {
  28560. "type": "string"
  28561. }
  28562. },
  28563. "conflict": {
  28564. "type": "object",
  28565. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  28566. "additionalProperties": {
  28567. "type": "string"
  28568. }
  28569. },
  28570. "provide": {
  28571. "type": "object",
  28572. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  28573. "additionalProperties": {
  28574. "type": "string"
  28575. }
  28576. },
  28577. "require-dev": {
  28578. "type": "object",
  28579. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  28580. "additionalProperties": {
  28581. "type": "string"
  28582. }
  28583. },
  28584. "suggest": {
  28585. "type": "object",
  28586. "description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  28587. "additionalProperties": {
  28588. "type": "string"
  28589. }
  28590. },
  28591. "config": {
  28592. "type": "object",
  28593. "description": "Composer options.",
  28594. "properties": {
  28595. "process-timeout": {
  28596. "type": "integer",
  28597. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  28598. },
  28599. "use-include-path": {
  28600. "type": "boolean",
  28601. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  28602. },
  28603. "preferred-install": {
  28604. "type": ["string", "object"],
  28605. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or a hash of {\"pattern\": \"preference\"}."
  28606. },
  28607. "notify-on-install": {
  28608. "type": "boolean",
  28609. "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
  28610. },
  28611. "github-protocols": {
  28612. "type": "array",
  28613. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  28614. "items": {
  28615. "type": "string"
  28616. }
  28617. },
  28618. "github-oauth": {
  28619. "type": "object",
  28620. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  28621. "additionalProperties": {
  28622. "type": "string"
  28623. }
  28624. },
  28625. "gitlab-oauth": {
  28626. "type": "object",
  28627. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  28628. "additionalProperties": {
  28629. "type": "string"
  28630. }
  28631. },
  28632. "gitlab-token": {
  28633. "type": "object",
  28634. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  28635. "additionalProperties": true
  28636. },
  28637. "disable-tls": {
  28638. "type": "boolean",
  28639. "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini."
  28640. },
  28641. "secure-http": {
  28642. "type": "boolean",
  28643. "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative."
  28644. },
  28645. "cafile": {
  28646. "type": "string",
  28647. "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically."
  28648. },
  28649. "capath": {
  28650. "type": "string",
  28651. "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory."
  28652. },
  28653. "http-basic": {
  28654. "type": "object",
  28655. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  28656. "additionalProperties": {
  28657. "type": "object",
  28658. "required": ["username", "password"],
  28659. "properties": {
  28660. "username": {
  28661. "type": "string",
  28662. "description": "The username used for HTTP Basic authentication"
  28663. },
  28664. "password": {
  28665. "type": "string",
  28666. "description": "The password used for HTTP Basic authentication"
  28667. }
  28668. }
  28669. }
  28670. },
  28671. "store-auths": {
  28672. "type": ["string", "boolean"],
  28673. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  28674. },
  28675. "platform": {
  28676. "type": "object",
  28677. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  28678. "additionalProperties": {
  28679. "type": "string"
  28680. }
  28681. },
  28682. "vendor-dir": {
  28683. "type": "string",
  28684. "description": "The location where all packages are installed, defaults to \"vendor\"."
  28685. },
  28686. "bin-dir": {
  28687. "type": "string",
  28688. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  28689. },
  28690. "data-dir": {
  28691. "type": "string",
  28692. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  28693. },
  28694. "cache-dir": {
  28695. "type": "string",
  28696. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  28697. },
  28698. "cache-files-dir": {
  28699. "type": "string",
  28700. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  28701. },
  28702. "cache-repo-dir": {
  28703. "type": "string",
  28704. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  28705. },
  28706. "cache-vcs-dir": {
  28707. "type": "string",
  28708. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  28709. },
  28710. "cache-ttl": {
  28711. "type": "integer",
  28712. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  28713. },
  28714. "cache-files-ttl": {
  28715. "type": "integer",
  28716. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  28717. },
  28718. "cache-files-maxsize": {
  28719. "type": ["string", "integer"],
  28720. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  28721. },
  28722. "bin-compat": {
  28723. "enum": ["auto", "full"],
  28724. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  28725. },
  28726. "discard-changes": {
  28727. "type": ["string", "boolean"],
  28728. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  28729. },
  28730. "autoloader-suffix": {
  28731. "type": "string",
  28732. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  28733. },
  28734. "optimize-autoloader": {
  28735. "type": "boolean",
  28736. "description": "Always optimize when dumping the autoloader."
  28737. },
  28738. "prepend-autoloader": {
  28739. "type": "boolean",
  28740. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  28741. },
  28742. "classmap-authoritative": {
  28743. "type": "boolean",
  28744. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  28745. },
  28746. "apcu-autoloader": {
  28747. "type": "boolean",
  28748. "description": "If true, the Composer autoloader will check for APCu and use it to cache found/not-found classes when the extension is enabled, defaults to false."
  28749. },
  28750. "github-domains": {
  28751. "type": "array",
  28752. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  28753. "items": {
  28754. "type": "string"
  28755. }
  28756. },
  28757. "github-expose-hostname": {
  28758. "type": "boolean",
  28759. "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname."
  28760. },
  28761. "gitlab-domains": {
  28762. "type": "array",
  28763. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  28764. "items": {
  28765. "type": "string"
  28766. }
  28767. },
  28768. "archive-format": {
  28769. "type": "string",
  28770. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  28771. },
  28772. "archive-dir": {
  28773. "type": "string",
  28774. "description": "The default archive path when not provided on cli, defaults to \".\"."
  28775. },
  28776. "htaccess-protect": {
  28777. "type": "boolean",
  28778. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  28779. },
  28780. "sort-packages": {
  28781. "type": "boolean",
  28782. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  28783. }
  28784. }
  28785. },
  28786. "extra": {
  28787. "type": ["object", "array"],
  28788. "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.",
  28789. "additionalProperties": true
  28790. },
  28791. "autoload": {
  28792. "$ref": "#/definitions/autoload"
  28793. },
  28794. "autoload-dev": {
  28795. "type": "object",
  28796. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  28797. "properties": {
  28798. "psr-0": {
  28799. "type": "object",
  28800. "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  28801. "additionalProperties": {
  28802. "type": ["string", "array"],
  28803. "items": {
  28804. "type": "string"
  28805. }
  28806. }
  28807. },
  28808. "psr-4": {
  28809. "type": "object",
  28810. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  28811. "additionalProperties": {
  28812. "type": ["string", "array"],
  28813. "items": {
  28814. "type": "string"
  28815. }
  28816. }
  28817. },
  28818. "classmap": {
  28819. "type": "array",
  28820. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  28821. },
  28822. "files": {
  28823. "type": "array",
  28824. "description": "This is an array of files that are always required on every request."
  28825. }
  28826. }
  28827. },
  28828. "archive": {
  28829. "type": ["object"],
  28830. "description": "Options for creating package archives for distribution.",
  28831. "properties": {
  28832. "exclude": {
  28833. "type": "array",
  28834. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  28835. }
  28836. }
  28837. },
  28838. "repositories": {
  28839. "type": ["object", "array"],
  28840. "description": "A set of additional repositories where packages can be found.",
  28841. "additionalProperties": {
  28842. "oneOf": [
  28843. { "$ref": "#/definitions/repository" },
  28844. { "type": "boolean", "enum": [false] }
  28845. ]
  28846. },
  28847. "items": {
  28848. "oneOf": [
  28849. { "$ref": "#/definitions/repository" },
  28850. {
  28851. "type": "object",
  28852. "additionalProperties": { "type": "boolean", "enum": [false] },
  28853. "minProperties": 1,
  28854. "maxProperties": 1
  28855. }
  28856. ]
  28857. }
  28858. },
  28859. "minimum-stability": {
  28860. "type": ["string"],
  28861. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  28862. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  28863. },
  28864. "prefer-stable": {
  28865. "type": ["boolean"],
  28866. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  28867. },
  28868. "bin": {
  28869. "type": ["string", "array"],
  28870. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  28871. "items": {
  28872. "type": "string"
  28873. }
  28874. },
  28875. "include-path": {
  28876. "type": ["array"],
  28877. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  28878. "items": {
  28879. "type": "string"
  28880. }
  28881. },
  28882. "scripts": {
  28883. "type": ["object"],
  28884. "description": "Script listeners that will be executed before/after some events.",
  28885. "properties": {
  28886. "pre-install-cmd": {
  28887. "type": ["array", "string"],
  28888. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  28889. },
  28890. "post-install-cmd": {
  28891. "type": ["array", "string"],
  28892. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  28893. },
  28894. "pre-update-cmd": {
  28895. "type": ["array", "string"],
  28896. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  28897. },
  28898. "post-update-cmd": {
  28899. "type": ["array", "string"],
  28900. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  28901. },
  28902. "pre-status-cmd": {
  28903. "type": ["array", "string"],
  28904. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  28905. },
  28906. "post-status-cmd": {
  28907. "type": ["array", "string"],
  28908. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  28909. },
  28910. "pre-package-install": {
  28911. "type": ["array", "string"],
  28912. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  28913. },
  28914. "post-package-install": {
  28915. "type": ["array", "string"],
  28916. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  28917. },
  28918. "pre-package-update": {
  28919. "type": ["array", "string"],
  28920. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  28921. },
  28922. "post-package-update": {
  28923. "type": ["array", "string"],
  28924. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  28925. },
  28926. "pre-package-uninstall": {
  28927. "type": ["array", "string"],
  28928. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  28929. },
  28930. "post-package-uninstall": {
  28931. "type": ["array", "string"],
  28932. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  28933. },
  28934. "pre-autoload-dump": {
  28935. "type": ["array", "string"],
  28936. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  28937. },
  28938. "post-autoload-dump": {
  28939. "type": ["array", "string"],
  28940. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  28941. },
  28942. "post-root-package-install": {
  28943. "type": ["array", "string"],
  28944. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  28945. },
  28946. "post-create-project-cmd": {
  28947. "type": ["array", "string"],
  28948. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  28949. }
  28950. }
  28951. },
  28952. "scripts-descriptions": {
  28953. "type": ["object"],
  28954. "description": "Descriptions for custom commands, shown in console help.",
  28955. "additionalProperties": {
  28956. "type": "string"
  28957. }
  28958. },
  28959. "support": {
  28960. "type": "object",
  28961. "properties": {
  28962. "email": {
  28963. "type": "string",
  28964. "description": "Email address for support.",
  28965. "format": "email"
  28966. },
  28967. "issues": {
  28968. "type": "string",
  28969. "description": "URL to the issue tracker.",
  28970. "format": "uri"
  28971. },
  28972. "forum": {
  28973. "type": "string",
  28974. "description": "URL to the forum.",
  28975. "format": "uri"
  28976. },
  28977. "wiki": {
  28978. "type": "string",
  28979. "description": "URL to the wiki.",
  28980. "format": "uri"
  28981. },
  28982. "irc": {
  28983. "type": "string",
  28984. "description": "IRC channel for support, as irc://server/channel.",
  28985. "format": "uri"
  28986. },
  28987. "chat": {
  28988. "type": "string",
  28989. "description": "URL to the support chat.",
  28990. "format": "uri"
  28991. },
  28992. "source": {
  28993. "type": "string",
  28994. "description": "URL to browse or download the sources.",
  28995. "format": "uri"
  28996. },
  28997. "docs": {
  28998. "type": "string",
  28999. "description": "URL to the documentation.",
  29000. "format": "uri"
  29001. },
  29002. "rss": {
  29003. "type": "string",
  29004. "description": "URL to the RSS feed.",
  29005. "format": "uri"
  29006. }
  29007. }
  29008. },
  29009. "non-feature-branches": {
  29010. "type": ["array"],
  29011. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  29012. "items": {
  29013. "type": "string"
  29014. }
  29015. },
  29016. "abandoned": {
  29017. "type": ["boolean", "string"],
  29018. "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
  29019. },
  29020. "_comment": {
  29021. "type": ["array", "string"],
  29022. "description": "A key to store comments in"
  29023. }
  29024. },
  29025. "definitions": {
  29026. "authors": {
  29027. "type": "array",
  29028. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  29029. "items": {
  29030. "type": "object",
  29031. "additionalProperties": false,
  29032. "required": [ "name"],
  29033. "properties": {
  29034. "name": {
  29035. "type": "string",
  29036. "description": "Full name of the author."
  29037. },
  29038. "email": {
  29039. "type": "string",
  29040. "description": "Email address of the author.",
  29041. "format": "email"
  29042. },
  29043. "homepage": {
  29044. "type": "string",
  29045. "description": "Homepage URL for the author.",
  29046. "format": "uri"
  29047. },
  29048. "role": {
  29049. "type": "string",
  29050. "description": "Author's role in the project."
  29051. }
  29052. }
  29053. }
  29054. },
  29055. "autoload": {
  29056. "type": "object",
  29057. "description": "Description of how the package can be autoloaded.",
  29058. "properties": {
  29059. "psr-0": {
  29060. "type": "object",
  29061. "description": "This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  29062. "additionalProperties": {
  29063. "type": ["string", "array"],
  29064. "items": {
  29065. "type": "string"
  29066. }
  29067. }
  29068. },
  29069. "psr-4": {
  29070. "type": "object",
  29071. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  29072. "additionalProperties": {
  29073. "type": ["string", "array"],
  29074. "items": {
  29075. "type": "string"
  29076. }
  29077. }
  29078. },
  29079. "classmap": {
  29080. "type": "array",
  29081. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  29082. },
  29083. "files": {
  29084. "type": "array",
  29085. "description": "This is an array of files that are always required on every request."
  29086. },
  29087. "exclude-from-classmap": {
  29088. "type": "array",
  29089. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  29090. }
  29091. }
  29092. },
  29093. "repository": {
  29094. "type": "object",
  29095. "oneOf": [
  29096. { "$ref": "#/definitions/composer-repository" },
  29097. { "$ref": "#/definitions/vcs-repository" },
  29098. { "$ref": "#/definitions/path-repository" },
  29099. { "$ref": "#/definitions/artifact-repository" },
  29100. { "$ref": "#/definitions/pear-repository" },
  29101. { "$ref": "#/definitions/package-repository" }
  29102. ]
  29103. },
  29104. "composer-repository": {
  29105. "type": "object",
  29106. "required": ["type", "url"],
  29107. "properties": {
  29108. "type": { "type": "string", "enum": ["composer"] },
  29109. "url": { "type": "string" },
  29110. "options": {
  29111. "type": "object",
  29112. "additionalProperties": true
  29113. },
  29114. "allow_ssl_downgrade": { "type": "boolean" },
  29115. "force-lazy-providers": { "type": "boolean" }
  29116. }
  29117. },
  29118. "vcs-repository": {
  29119. "type": "object",
  29120. "required": ["type", "url"],
  29121. "properties": {
  29122. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  29123. "url": { "type": "string" },
  29124. "no-api": { "type": "boolean" },
  29125. "secure-http": { "type": "boolean" },
  29126. "svn-cache-credentials": { "type": "boolean" },
  29127. "trunk-path": { "type": ["string", "boolean"] },
  29128. "branches-path": { "type": ["string", "boolean"] },
  29129. "tags-path": { "type": ["string", "boolean"] },
  29130. "package-path": { "type": "string" },
  29131. "depot": { "type": "string" },
  29132. "branch": { "type": "string" },
  29133. "unique_perforce_client_name": { "type": "string" },
  29134. "p4user": { "type": "string" },
  29135. "p4password": { "type": "string" }
  29136. }
  29137. },
  29138. "path-repository": {
  29139. "type": "object",
  29140. "required": ["type", "url"],
  29141. "properties": {
  29142. "type": { "type": "string", "enum": ["path"] },
  29143. "url": { "type": "string" },
  29144. "options": {
  29145. "type": "object",
  29146. "properties": {
  29147. "symlink": { "type": ["boolean", "null"] }
  29148. },
  29149. "additionalProperties": true
  29150. }
  29151. }
  29152. },
  29153. "artifact-repository": {
  29154. "type": "object",
  29155. "required": ["type", "url"],
  29156. "properties": {
  29157. "type": { "type": "string", "enum": ["artifact"] },
  29158. "url": { "type": "string" }
  29159. }
  29160. },
  29161. "pear-repository": {
  29162. "type": "object",
  29163. "required": ["type", "url"],
  29164. "properties": {
  29165. "type": { "type": "string", "enum": ["pear"] },
  29166. "url": { "type": "string" },
  29167. "vendor-alias": { "type": "string" }
  29168. }
  29169. },
  29170. "package-repository": {
  29171. "type": "object",
  29172. "required": ["type", "package"],
  29173. "properties": {
  29174. "type": { "type": "string", "enum": ["package"] },
  29175. "package": {
  29176. "oneOf": [
  29177. { "$ref": "#/definitions/inline-package" },
  29178. {
  29179. "type": "array",
  29180. "items": { "$ref": "#/definitions/inline-package" }
  29181. }
  29182. ]
  29183. }
  29184. }
  29185. },
  29186. "inline-package": {
  29187. "type": "object",
  29188. "required": ["name", "version"],
  29189. "properties": {
  29190. "name": {
  29191. "type": "string",
  29192. "description": "Package name, including 'vendor-name/' prefix."
  29193. },
  29194. "type": {
  29195. "type": "string"
  29196. },
  29197. "target-dir": {
  29198. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  29199. "type": "string"
  29200. },
  29201. "description": {
  29202. "type": "string"
  29203. },
  29204. "keywords": {
  29205. "type": "array",
  29206. "items": {
  29207. "type": "string"
  29208. }
  29209. },
  29210. "homepage": {
  29211. "type": "string",
  29212. "format": "uri"
  29213. },
  29214. "version": {
  29215. "type": "string"
  29216. },
  29217. "time": {
  29218. "type": "string"
  29219. },
  29220. "license": {
  29221. "type": [
  29222. "string",
  29223. "array"
  29224. ]
  29225. },
  29226. "authors": {
  29227. "$ref": "#/definitions/authors"
  29228. },
  29229. "require": {
  29230. "type": "object",
  29231. "additionalProperties": {
  29232. "type": "string"
  29233. }
  29234. },
  29235. "replace": {
  29236. "type": "object",
  29237. "additionalProperties": {
  29238. "type": "string"
  29239. }
  29240. },
  29241. "conflict": {
  29242. "type": "object",
  29243. "additionalProperties": {
  29244. "type": "string"
  29245. }
  29246. },
  29247. "provide": {
  29248. "type": "object",
  29249. "additionalProperties": {
  29250. "type": "string"
  29251. }
  29252. },
  29253. "require-dev": {
  29254. "type": "object",
  29255. "additionalProperties": {
  29256. "type": "string"
  29257. }
  29258. },
  29259. "suggest": {
  29260. "type": "object",
  29261. "additionalProperties": {
  29262. "type": "string"
  29263. }
  29264. },
  29265. "extra": {
  29266. "type": ["object", "array"],
  29267. "additionalProperties": true
  29268. },
  29269. "autoload": {
  29270. "$ref": "#/definitions/autoload"
  29271. },
  29272. "archive": {
  29273. "type": ["object"],
  29274. "properties": {
  29275. "exclude": {
  29276. "type": "array"
  29277. }
  29278. }
  29279. },
  29280. "bin": {
  29281. "type": ["string", "array"],
  29282. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  29283. "items": {
  29284. "type": "string"
  29285. }
  29286. },
  29287. "include-path": {
  29288. "type": ["array"],
  29289. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  29290. "items": {
  29291. "type": "string"
  29292. }
  29293. },
  29294. "source": {
  29295. "type": "object",
  29296. "required": ["type", "url", "reference"],
  29297. "properties": {
  29298. "type": {
  29299. "type": "string"
  29300. },
  29301. "url": {
  29302. "type": "string"
  29303. },
  29304. "reference": {
  29305. "type": "string"
  29306. },
  29307. "mirrors": {
  29308. "type": "array"
  29309. }
  29310. }
  29311. },
  29312. "dist": {
  29313. "type": "object",
  29314. "required": ["type", "url"],
  29315. "properties": {
  29316. "type": {
  29317. "type": "string"
  29318. },
  29319. "url": {
  29320. "type": "string"
  29321. },
  29322. "reference": {
  29323. "type": "string"
  29324. },
  29325. "shasum": {
  29326. "type": "string"
  29327. },
  29328. "mirrors": {
  29329. "type": "array"
  29330. }
  29331. }
  29332. }
  29333. },
  29334. "additionalProperties": true
  29335. }
  29336. }
  29337. }
  29338. {
  29339. "389-exception": [
  29340. "389 Directory Server Exception"
  29341. ],
  29342. "Autoconf-exception-2.0": [
  29343. "Autoconf exception 2.0"
  29344. ],
  29345. "Autoconf-exception-3.0": [
  29346. "Autoconf exception 3.0"
  29347. ],
  29348. "Bison-exception-2.2": [
  29349. "Bison exception 2.2"
  29350. ],
  29351. "Bootloader-exception": [
  29352. "Bootloader Distribution Exception"
  29353. ],
  29354. "Classpath-exception-2.0": [
  29355. "Classpath exception 2.0"
  29356. ],
  29357. "CLISP-exception-2.0": [
  29358. "CLISP exception 2.0"
  29359. ],
  29360. "DigiRule-FOSS-exception": [
  29361. "DigiRule FOSS License Exception"
  29362. ],
  29363. "eCos-exception-2.0": [
  29364. "eCos exception 2.0"
  29365. ],
  29366. "Fawkes-Runtime-exception": [
  29367. "Fawkes Runtime Exception"
  29368. ],
  29369. "FLTK-exception": [
  29370. "FLTK exception"
  29371. ],
  29372. "Font-exception-2.0": [
  29373. "Font exception 2.0"
  29374. ],
  29375. "freertos-exception-2.0": [
  29376. "FreeRTOS Exception 2.0"
  29377. ],
  29378. "GCC-exception-2.0": [
  29379. "GCC Runtime Library exception 2.0"
  29380. ],
  29381. "GCC-exception-3.1": [
  29382. "GCC Runtime Library exception 3.1"
  29383. ],
  29384. "gnu-javamail-exception": [
  29385. "GNU JavaMail exception"
  29386. ],
  29387. "i2p-gpl-java-exception": [
  29388. "i2p GPL+Java Exception"
  29389. ],
  29390. "Libtool-exception": [
  29391. "Libtool Exception"
  29392. ],
  29393. "Linux-syscall-note": [
  29394. "Linux Syscall Note"
  29395. ],
  29396. "LLVM-exception": [
  29397. "LLVM Exception"
  29398. ],
  29399. "LZMA-exception": [
  29400. "LZMA exception"
  29401. ],
  29402. "mif-exception": [
  29403. "Macros and Inline Functions Exception"
  29404. ],
  29405. "Nokia-Qt-exception-1.1": [
  29406. "Nokia Qt LGPL exception 1.1"
  29407. ],
  29408. "OCaml-LGPL-linking-exception": [
  29409. "OCaml LGPL Linking Exception"
  29410. ],
  29411. "OCCT-exception-1.0": [
  29412. "Open CASCADE Exception 1.0"
  29413. ],
  29414. "OpenJDK-assembly-exception-1.0": [
  29415. "OpenJDK Assembly exception 1.0"
  29416. ],
  29417. "openvpn-openssl-exception": [
  29418. "OpenVPN OpenSSL Exception"
  29419. ],
  29420. "PS-or-PDF-font-exception-20170817": [
  29421. "PS/PDF font exception (2017-08-17)"
  29422. ],
  29423. "Qt-GPL-exception-1.0": [
  29424. "Qt GPL exception 1.0"
  29425. ],
  29426. "Qt-LGPL-exception-1.1": [
  29427. "Qt LGPL exception 1.1"
  29428. ],
  29429. "Qwt-exception-1.0": [
  29430. "Qwt exception 1.0"
  29431. ],
  29432. "u-boot-exception-2.0": [
  29433. "U-Boot exception 2.0"
  29434. ],
  29435. "WxWindows-exception-3.1": [
  29436. "WxWindows Library Exception 3.1"
  29437. ]
  29438. }{
  29439. "0BSD": [
  29440. "BSD Zero Clause License",
  29441. true,
  29442. false
  29443. ],
  29444. "AAL": [
  29445. "Attribution Assurance License",
  29446. true,
  29447. false
  29448. ],
  29449. "Abstyles": [
  29450. "Abstyles License",
  29451. false,
  29452. false
  29453. ],
  29454. "Adobe-2006": [
  29455. "Adobe Systems Incorporated Source Code License Agreement",
  29456. false,
  29457. false
  29458. ],
  29459. "Adobe-Glyph": [
  29460. "Adobe Glyph List License",
  29461. false,
  29462. false
  29463. ],
  29464. "ADSL": [
  29465. "Amazon Digital Services License",
  29466. false,
  29467. false
  29468. ],
  29469. "AFL-1.1": [
  29470. "Academic Free License v1.1",
  29471. true,
  29472. false
  29473. ],
  29474. "AFL-1.2": [
  29475. "Academic Free License v1.2",
  29476. true,
  29477. false
  29478. ],
  29479. "AFL-2.0": [
  29480. "Academic Free License v2.0",
  29481. true,
  29482. false
  29483. ],
  29484. "AFL-2.1": [
  29485. "Academic Free License v2.1",
  29486. true,
  29487. false
  29488. ],
  29489. "AFL-3.0": [
  29490. "Academic Free License v3.0",
  29491. true,
  29492. false
  29493. ],
  29494. "Afmparse": [
  29495. "Afmparse License",
  29496. false,
  29497. false
  29498. ],
  29499. "AGPL-1.0": [
  29500. "Affero General Public License v1.0",
  29501. false,
  29502. true
  29503. ],
  29504. "AGPL-1.0-only": [
  29505. "Affero General Public License v1.0 only",
  29506. false,
  29507. false
  29508. ],
  29509. "AGPL-1.0-or-later": [
  29510. "Affero General Public License v1.0 or later",
  29511. false,
  29512. false
  29513. ],
  29514. "AGPL-3.0": [
  29515. "GNU Affero General Public License v3.0",
  29516. true,
  29517. true
  29518. ],
  29519. "AGPL-3.0-only": [
  29520. "GNU Affero General Public License v3.0 only",
  29521. true,
  29522. false
  29523. ],
  29524. "AGPL-3.0-or-later": [
  29525. "GNU Affero General Public License v3.0 or later",
  29526. true,
  29527. false
  29528. ],
  29529. "Aladdin": [
  29530. "Aladdin Free Public License",
  29531. false,
  29532. false
  29533. ],
  29534. "AMDPLPA": [
  29535. "AMD's plpa_map.c License",
  29536. false,
  29537. false
  29538. ],
  29539. "AML": [
  29540. "Apple MIT License",
  29541. false,
  29542. false
  29543. ],
  29544. "AMPAS": [
  29545. "Academy of Motion Picture Arts and Sciences BSD",
  29546. false,
  29547. false
  29548. ],
  29549. "ANTLR-PD": [
  29550. "ANTLR Software Rights Notice",
  29551. false,
  29552. false
  29553. ],
  29554. "Apache-1.0": [
  29555. "Apache License 1.0",
  29556. false,
  29557. false
  29558. ],
  29559. "Apache-1.1": [
  29560. "Apache License 1.1",
  29561. true,
  29562. false
  29563. ],
  29564. "Apache-2.0": [
  29565. "Apache License 2.0",
  29566. true,
  29567. false
  29568. ],
  29569. "APAFML": [
  29570. "Adobe Postscript AFM License",
  29571. false,
  29572. false
  29573. ],
  29574. "APL-1.0": [
  29575. "Adaptive Public License 1.0",
  29576. true,
  29577. false
  29578. ],
  29579. "APSL-1.0": [
  29580. "Apple Public Source License 1.0",
  29581. true,
  29582. false
  29583. ],
  29584. "APSL-1.1": [
  29585. "Apple Public Source License 1.1",
  29586. true,
  29587. false
  29588. ],
  29589. "APSL-1.2": [
  29590. "Apple Public Source License 1.2",
  29591. true,
  29592. false
  29593. ],
  29594. "APSL-2.0": [
  29595. "Apple Public Source License 2.0",
  29596. true,
  29597. false
  29598. ],
  29599. "Artistic-1.0": [
  29600. "Artistic License 1.0",
  29601. true,
  29602. false
  29603. ],
  29604. "Artistic-1.0-cl8": [
  29605. "Artistic License 1.0 w/clause 8",
  29606. true,
  29607. false
  29608. ],
  29609. "Artistic-1.0-Perl": [
  29610. "Artistic License 1.0 (Perl)",
  29611. true,
  29612. false
  29613. ],
  29614. "Artistic-2.0": [
  29615. "Artistic License 2.0",
  29616. true,
  29617. false
  29618. ],
  29619. "Bahyph": [
  29620. "Bahyph License",
  29621. false,
  29622. false
  29623. ],
  29624. "Barr": [
  29625. "Barr License",
  29626. false,
  29627. false
  29628. ],
  29629. "Beerware": [
  29630. "Beerware License",
  29631. false,
  29632. false
  29633. ],
  29634. "BitTorrent-1.0": [
  29635. "BitTorrent Open Source License v1.0",
  29636. false,
  29637. false
  29638. ],
  29639. "BitTorrent-1.1": [
  29640. "BitTorrent Open Source License v1.1",
  29641. false,
  29642. false
  29643. ],
  29644. "Borceux": [
  29645. "Borceux license",
  29646. false,
  29647. false
  29648. ],
  29649. "BSD-1-Clause": [
  29650. "BSD 1-Clause License",
  29651. false,
  29652. false
  29653. ],
  29654. "BSD-2-Clause": [
  29655. "BSD 2-Clause \"Simplified\" License",
  29656. true,
  29657. false
  29658. ],
  29659. "BSD-2-Clause-FreeBSD": [
  29660. "BSD 2-Clause FreeBSD License",
  29661. false,
  29662. false
  29663. ],
  29664. "BSD-2-Clause-NetBSD": [
  29665. "BSD 2-Clause NetBSD License",
  29666. false,
  29667. false
  29668. ],
  29669. "BSD-2-Clause-Patent": [
  29670. "BSD-2-Clause Plus Patent License",
  29671. true,
  29672. false
  29673. ],
  29674. "BSD-3-Clause": [
  29675. "BSD 3-Clause \"New\" or \"Revised\" License",
  29676. true,
  29677. false
  29678. ],
  29679. "BSD-3-Clause-Attribution": [
  29680. "BSD with attribution",
  29681. false,
  29682. false
  29683. ],
  29684. "BSD-3-Clause-Clear": [
  29685. "BSD 3-Clause Clear License",
  29686. false,
  29687. false
  29688. ],
  29689. "BSD-3-Clause-LBNL": [
  29690. "Lawrence Berkeley National Labs BSD variant license",
  29691. false,
  29692. false
  29693. ],
  29694. "BSD-3-Clause-No-Nuclear-License": [
  29695. "BSD 3-Clause No Nuclear License",
  29696. false,
  29697. false
  29698. ],
  29699. "BSD-3-Clause-No-Nuclear-License-2014": [
  29700. "BSD 3-Clause No Nuclear License 2014",
  29701. false,
  29702. false
  29703. ],
  29704. "BSD-3-Clause-No-Nuclear-Warranty": [
  29705. "BSD 3-Clause No Nuclear Warranty",
  29706. false,
  29707. false
  29708. ],
  29709. "BSD-4-Clause": [
  29710. "BSD 4-Clause \"Original\" or \"Old\" License",
  29711. false,
  29712. false
  29713. ],
  29714. "BSD-4-Clause-UC": [
  29715. "BSD-4-Clause (University of California-Specific)",
  29716. false,
  29717. false
  29718. ],
  29719. "BSD-Protection": [
  29720. "BSD Protection License",
  29721. false,
  29722. false
  29723. ],
  29724. "BSD-Source-Code": [
  29725. "BSD Source Code Attribution",
  29726. false,
  29727. false
  29728. ],
  29729. "BSL-1.0": [
  29730. "Boost Software License 1.0",
  29731. true,
  29732. false
  29733. ],
  29734. "bzip2-1.0.5": [
  29735. "bzip2 and libbzip2 License v1.0.5",
  29736. false,
  29737. false
  29738. ],
  29739. "bzip2-1.0.6": [
  29740. "bzip2 and libbzip2 License v1.0.6",
  29741. false,
  29742. false
  29743. ],
  29744. "Caldera": [
  29745. "Caldera License",
  29746. false,
  29747. false
  29748. ],
  29749. "CATOSL-1.1": [
  29750. "Computer Associates Trusted Open Source License 1.1",
  29751. true,
  29752. false
  29753. ],
  29754. "CC-BY-1.0": [
  29755. "Creative Commons Attribution 1.0 Generic",
  29756. false,
  29757. false
  29758. ],
  29759. "CC-BY-2.0": [
  29760. "Creative Commons Attribution 2.0 Generic",
  29761. false,
  29762. false
  29763. ],
  29764. "CC-BY-2.5": [
  29765. "Creative Commons Attribution 2.5 Generic",
  29766. false,
  29767. false
  29768. ],
  29769. "CC-BY-3.0": [
  29770. "Creative Commons Attribution 3.0 Unported",
  29771. false,
  29772. false
  29773. ],
  29774. "CC-BY-4.0": [
  29775. "Creative Commons Attribution 4.0 International",
  29776. false,
  29777. false
  29778. ],
  29779. "CC-BY-NC-1.0": [
  29780. "Creative Commons Attribution Non Commercial 1.0 Generic",
  29781. false,
  29782. false
  29783. ],
  29784. "CC-BY-NC-2.0": [
  29785. "Creative Commons Attribution Non Commercial 2.0 Generic",
  29786. false,
  29787. false
  29788. ],
  29789. "CC-BY-NC-2.5": [
  29790. "Creative Commons Attribution Non Commercial 2.5 Generic",
  29791. false,
  29792. false
  29793. ],
  29794. "CC-BY-NC-3.0": [
  29795. "Creative Commons Attribution Non Commercial 3.0 Unported",
  29796. false,
  29797. false
  29798. ],
  29799. "CC-BY-NC-4.0": [
  29800. "Creative Commons Attribution Non Commercial 4.0 International",
  29801. false,
  29802. false
  29803. ],
  29804. "CC-BY-NC-ND-1.0": [
  29805. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  29806. false,
  29807. false
  29808. ],
  29809. "CC-BY-NC-ND-2.0": [
  29810. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  29811. false,
  29812. false
  29813. ],
  29814. "CC-BY-NC-ND-2.5": [
  29815. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  29816. false,
  29817. false
  29818. ],
  29819. "CC-BY-NC-ND-3.0": [
  29820. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  29821. false,
  29822. false
  29823. ],
  29824. "CC-BY-NC-ND-4.0": [
  29825. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  29826. false,
  29827. false
  29828. ],
  29829. "CC-BY-NC-SA-1.0": [
  29830. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  29831. false,
  29832. false
  29833. ],
  29834. "CC-BY-NC-SA-2.0": [
  29835. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  29836. false,
  29837. false
  29838. ],
  29839. "CC-BY-NC-SA-2.5": [
  29840. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  29841. false,
  29842. false
  29843. ],
  29844. "CC-BY-NC-SA-3.0": [
  29845. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  29846. false,
  29847. false
  29848. ],
  29849. "CC-BY-NC-SA-4.0": [
  29850. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  29851. false,
  29852. false
  29853. ],
  29854. "CC-BY-ND-1.0": [
  29855. "Creative Commons Attribution No Derivatives 1.0 Generic",
  29856. false,
  29857. false
  29858. ],
  29859. "CC-BY-ND-2.0": [
  29860. "Creative Commons Attribution No Derivatives 2.0 Generic",
  29861. false,
  29862. false
  29863. ],
  29864. "CC-BY-ND-2.5": [
  29865. "Creative Commons Attribution No Derivatives 2.5 Generic",
  29866. false,
  29867. false
  29868. ],
  29869. "CC-BY-ND-3.0": [
  29870. "Creative Commons Attribution No Derivatives 3.0 Unported",
  29871. false,
  29872. false
  29873. ],
  29874. "CC-BY-ND-4.0": [
  29875. "Creative Commons Attribution No Derivatives 4.0 International",
  29876. false,
  29877. false
  29878. ],
  29879. "CC-BY-SA-1.0": [
  29880. "Creative Commons Attribution Share Alike 1.0 Generic",
  29881. false,
  29882. false
  29883. ],
  29884. "CC-BY-SA-2.0": [
  29885. "Creative Commons Attribution Share Alike 2.0 Generic",
  29886. false,
  29887. false
  29888. ],
  29889. "CC-BY-SA-2.5": [
  29890. "Creative Commons Attribution Share Alike 2.5 Generic",
  29891. false,
  29892. false
  29893. ],
  29894. "CC-BY-SA-3.0": [
  29895. "Creative Commons Attribution Share Alike 3.0 Unported",
  29896. false,
  29897. false
  29898. ],
  29899. "CC-BY-SA-4.0": [
  29900. "Creative Commons Attribution Share Alike 4.0 International",
  29901. false,
  29902. false
  29903. ],
  29904. "CC0-1.0": [
  29905. "Creative Commons Zero v1.0 Universal",
  29906. false,
  29907. false
  29908. ],
  29909. "CDDL-1.0": [
  29910. "Common Development and Distribution License 1.0",
  29911. true,
  29912. false
  29913. ],
  29914. "CDDL-1.1": [
  29915. "Common Development and Distribution License 1.1",
  29916. false,
  29917. false
  29918. ],
  29919. "CDLA-Permissive-1.0": [
  29920. "Community Data License Agreement Permissive 1.0",
  29921. false,
  29922. false
  29923. ],
  29924. "CDLA-Sharing-1.0": [
  29925. "Community Data License Agreement Sharing 1.0",
  29926. false,
  29927. false
  29928. ],
  29929. "CECILL-1.0": [
  29930. "CeCILL Free Software License Agreement v1.0",
  29931. false,
  29932. false
  29933. ],
  29934. "CECILL-1.1": [
  29935. "CeCILL Free Software License Agreement v1.1",
  29936. false,
  29937. false
  29938. ],
  29939. "CECILL-2.0": [
  29940. "CeCILL Free Software License Agreement v2.0",
  29941. false,
  29942. false
  29943. ],
  29944. "CECILL-2.1": [
  29945. "CeCILL Free Software License Agreement v2.1",
  29946. true,
  29947. false
  29948. ],
  29949. "CECILL-B": [
  29950. "CeCILL-B Free Software License Agreement",
  29951. false,
  29952. false
  29953. ],
  29954. "CECILL-C": [
  29955. "CeCILL-C Free Software License Agreement",
  29956. false,
  29957. false
  29958. ],
  29959. "CERN-OHL-1.1": [
  29960. "CERN Open Hardware License v1.1",
  29961. false,
  29962. false
  29963. ],
  29964. "CERN-OHL-1.2": [
  29965. "CERN Open Hardware Licence v1.2",
  29966. false,
  29967. false
  29968. ],
  29969. "ClArtistic": [
  29970. "Clarified Artistic License",
  29971. false,
  29972. false
  29973. ],
  29974. "CNRI-Jython": [
  29975. "CNRI Jython License",
  29976. false,
  29977. false
  29978. ],
  29979. "CNRI-Python": [
  29980. "CNRI Python License",
  29981. true,
  29982. false
  29983. ],
  29984. "CNRI-Python-GPL-Compatible": [
  29985. "CNRI Python Open Source GPL Compatible License Agreement",
  29986. false,
  29987. false
  29988. ],
  29989. "Condor-1.1": [
  29990. "Condor Public License v1.1",
  29991. false,
  29992. false
  29993. ],
  29994. "copyleft-next-0.3.0": [
  29995. "copyleft-next 0.3.0",
  29996. false,
  29997. false
  29998. ],
  29999. "copyleft-next-0.3.1": [
  30000. "copyleft-next 0.3.1",
  30001. false,
  30002. false
  30003. ],
  30004. "CPAL-1.0": [
  30005. "Common Public Attribution License 1.0",
  30006. true,
  30007. false
  30008. ],
  30009. "CPL-1.0": [
  30010. "Common Public License 1.0",
  30011. true,
  30012. false
  30013. ],
  30014. "CPOL-1.02": [
  30015. "Code Project Open License 1.02",
  30016. false,
  30017. false
  30018. ],
  30019. "Crossword": [
  30020. "Crossword License",
  30021. false,
  30022. false
  30023. ],
  30024. "CrystalStacker": [
  30025. "CrystalStacker License",
  30026. false,
  30027. false
  30028. ],
  30029. "CUA-OPL-1.0": [
  30030. "CUA Office Public License v1.0",
  30031. true,
  30032. false
  30033. ],
  30034. "Cube": [
  30035. "Cube License",
  30036. false,
  30037. false
  30038. ],
  30039. "curl": [
  30040. "curl License",
  30041. false,
  30042. false
  30043. ],
  30044. "D-FSL-1.0": [
  30045. "Deutsche Freie Software Lizenz",
  30046. false,
  30047. false
  30048. ],
  30049. "diffmark": [
  30050. "diffmark license",
  30051. false,
  30052. false
  30053. ],
  30054. "DOC": [
  30055. "DOC License",
  30056. false,
  30057. false
  30058. ],
  30059. "Dotseqn": [
  30060. "Dotseqn License",
  30061. false,
  30062. false
  30063. ],
  30064. "DSDP": [
  30065. "DSDP License",
  30066. false,
  30067. false
  30068. ],
  30069. "dvipdfm": [
  30070. "dvipdfm License",
  30071. false,
  30072. false
  30073. ],
  30074. "ECL-1.0": [
  30075. "Educational Community License v1.0",
  30076. true,
  30077. false
  30078. ],
  30079. "ECL-2.0": [
  30080. "Educational Community License v2.0",
  30081. true,
  30082. false
  30083. ],
  30084. "eCos-2.0": [
  30085. "eCos license version 2.0",
  30086. false,
  30087. true
  30088. ],
  30089. "EFL-1.0": [
  30090. "Eiffel Forum License v1.0",
  30091. true,
  30092. false
  30093. ],
  30094. "EFL-2.0": [
  30095. "Eiffel Forum License v2.0",
  30096. true,
  30097. false
  30098. ],
  30099. "eGenix": [
  30100. "eGenix.com Public License 1.1.0",
  30101. false,
  30102. false
  30103. ],
  30104. "Entessa": [
  30105. "Entessa Public License v1.0",
  30106. true,
  30107. false
  30108. ],
  30109. "EPL-1.0": [
  30110. "Eclipse Public License 1.0",
  30111. true,
  30112. false
  30113. ],
  30114. "EPL-2.0": [
  30115. "Eclipse Public License 2.0",
  30116. true,
  30117. false
  30118. ],
  30119. "ErlPL-1.1": [
  30120. "Erlang Public License v1.1",
  30121. false,
  30122. false
  30123. ],
  30124. "EUDatagrid": [
  30125. "EU DataGrid Software License",
  30126. true,
  30127. false
  30128. ],
  30129. "EUPL-1.0": [
  30130. "European Union Public License 1.0",
  30131. false,
  30132. false
  30133. ],
  30134. "EUPL-1.1": [
  30135. "European Union Public License 1.1",
  30136. true,
  30137. false
  30138. ],
  30139. "EUPL-1.2": [
  30140. "European Union Public License 1.2",
  30141. true,
  30142. false
  30143. ],
  30144. "Eurosym": [
  30145. "Eurosym License",
  30146. false,
  30147. false
  30148. ],
  30149. "Fair": [
  30150. "Fair License",
  30151. true,
  30152. false
  30153. ],
  30154. "Frameworx-1.0": [
  30155. "Frameworx Open License 1.0",
  30156. true,
  30157. false
  30158. ],
  30159. "FreeImage": [
  30160. "FreeImage Public License v1.0",
  30161. false,
  30162. false
  30163. ],
  30164. "FSFAP": [
  30165. "FSF All Permissive License",
  30166. false,
  30167. false
  30168. ],
  30169. "FSFUL": [
  30170. "FSF Unlimited License",
  30171. false,
  30172. false
  30173. ],
  30174. "FSFULLR": [
  30175. "FSF Unlimited License (with License Retention)",
  30176. false,
  30177. false
  30178. ],
  30179. "FTL": [
  30180. "Freetype Project License",
  30181. false,
  30182. false
  30183. ],
  30184. "GFDL-1.1": [
  30185. "GNU Free Documentation License v1.1",
  30186. false,
  30187. true
  30188. ],
  30189. "GFDL-1.1-only": [
  30190. "GNU Free Documentation License v1.1 only",
  30191. false,
  30192. false
  30193. ],
  30194. "GFDL-1.1-or-later": [
  30195. "GNU Free Documentation License v1.1 or later",
  30196. false,
  30197. false
  30198. ],
  30199. "GFDL-1.2": [
  30200. "GNU Free Documentation License v1.2",
  30201. false,
  30202. true
  30203. ],
  30204. "GFDL-1.2-only": [
  30205. "GNU Free Documentation License v1.2 only",
  30206. false,
  30207. false
  30208. ],
  30209. "GFDL-1.2-or-later": [
  30210. "GNU Free Documentation License v1.2 or later",
  30211. false,
  30212. false
  30213. ],
  30214. "GFDL-1.3": [
  30215. "GNU Free Documentation License v1.3",
  30216. false,
  30217. true
  30218. ],
  30219. "GFDL-1.3-only": [
  30220. "GNU Free Documentation License v1.3 only",
  30221. false,
  30222. false
  30223. ],
  30224. "GFDL-1.3-or-later": [
  30225. "GNU Free Documentation License v1.3 or later",
  30226. false,
  30227. false
  30228. ],
  30229. "Giftware": [
  30230. "Giftware License",
  30231. false,
  30232. false
  30233. ],
  30234. "GL2PS": [
  30235. "GL2PS License",
  30236. false,
  30237. false
  30238. ],
  30239. "Glide": [
  30240. "3dfx Glide License",
  30241. false,
  30242. false
  30243. ],
  30244. "Glulxe": [
  30245. "Glulxe License",
  30246. false,
  30247. false
  30248. ],
  30249. "gnuplot": [
  30250. "gnuplot License",
  30251. false,
  30252. false
  30253. ],
  30254. "GPL-1.0": [
  30255. "GNU General Public License v1.0 only",
  30256. false,
  30257. true
  30258. ],
  30259. "GPL-1.0+": [
  30260. "GNU General Public License v1.0 or later",
  30261. false,
  30262. true
  30263. ],
  30264. "GPL-1.0-only": [
  30265. "GNU General Public License v1.0 only",
  30266. false,
  30267. false
  30268. ],
  30269. "GPL-1.0-or-later": [
  30270. "GNU General Public License v1.0 or later",
  30271. false,
  30272. false
  30273. ],
  30274. "GPL-2.0": [
  30275. "GNU General Public License v2.0 only",
  30276. true,
  30277. true
  30278. ],
  30279. "GPL-2.0+": [
  30280. "GNU General Public License v2.0 or later",
  30281. true,
  30282. true
  30283. ],
  30284. "GPL-2.0-only": [
  30285. "GNU General Public License v2.0 only",
  30286. true,
  30287. false
  30288. ],
  30289. "GPL-2.0-or-later": [
  30290. "GNU General Public License v2.0 or later",
  30291. true,
  30292. false
  30293. ],
  30294. "GPL-2.0-with-autoconf-exception": [
  30295. "GNU General Public License v2.0 w/Autoconf exception",
  30296. false,
  30297. true
  30298. ],
  30299. "GPL-2.0-with-bison-exception": [
  30300. "GNU General Public License v2.0 w/Bison exception",
  30301. false,
  30302. true
  30303. ],
  30304. "GPL-2.0-with-classpath-exception": [
  30305. "GNU General Public License v2.0 w/Classpath exception",
  30306. false,
  30307. true
  30308. ],
  30309. "GPL-2.0-with-font-exception": [
  30310. "GNU General Public License v2.0 w/Font exception",
  30311. false,
  30312. true
  30313. ],
  30314. "GPL-2.0-with-GCC-exception": [
  30315. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  30316. false,
  30317. true
  30318. ],
  30319. "GPL-3.0": [
  30320. "GNU General Public License v3.0 only",
  30321. true,
  30322. true
  30323. ],
  30324. "GPL-3.0+": [
  30325. "GNU General Public License v3.0 or later",
  30326. true,
  30327. true
  30328. ],
  30329. "GPL-3.0-only": [
  30330. "GNU General Public License v3.0 only",
  30331. true,
  30332. false
  30333. ],
  30334. "GPL-3.0-or-later": [
  30335. "GNU General Public License v3.0 or later",
  30336. true,
  30337. false
  30338. ],
  30339. "GPL-3.0-with-autoconf-exception": [
  30340. "GNU General Public License v3.0 w/Autoconf exception",
  30341. false,
  30342. true
  30343. ],
  30344. "GPL-3.0-with-GCC-exception": [
  30345. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  30346. true,
  30347. true
  30348. ],
  30349. "gSOAP-1.3b": [
  30350. "gSOAP Public License v1.3b",
  30351. false,
  30352. false
  30353. ],
  30354. "HaskellReport": [
  30355. "Haskell Language Report License",
  30356. false,
  30357. false
  30358. ],
  30359. "HPND": [
  30360. "Historical Permission Notice and Disclaimer",
  30361. true,
  30362. false
  30363. ],
  30364. "HPND-sell-variant": [
  30365. "Historical Permission Notice and Disclaimer - sell variant",
  30366. false,
  30367. false
  30368. ],
  30369. "IBM-pibs": [
  30370. "IBM PowerPC Initialization and Boot Software",
  30371. false,
  30372. false
  30373. ],
  30374. "ICU": [
  30375. "ICU License",
  30376. false,
  30377. false
  30378. ],
  30379. "IJG": [
  30380. "Independent JPEG Group License",
  30381. false,
  30382. false
  30383. ],
  30384. "ImageMagick": [
  30385. "ImageMagick License",
  30386. false,
  30387. false
  30388. ],
  30389. "iMatix": [
  30390. "iMatix Standard Function Library Agreement",
  30391. false,
  30392. false
  30393. ],
  30394. "Imlib2": [
  30395. "Imlib2 License",
  30396. false,
  30397. false
  30398. ],
  30399. "Info-ZIP": [
  30400. "Info-ZIP License",
  30401. false,
  30402. false
  30403. ],
  30404. "Intel": [
  30405. "Intel Open Source License",
  30406. true,
  30407. false
  30408. ],
  30409. "Intel-ACPI": [
  30410. "Intel ACPI Software License Agreement",
  30411. false,
  30412. false
  30413. ],
  30414. "Interbase-1.0": [
  30415. "Interbase Public License v1.0",
  30416. false,
  30417. false
  30418. ],
  30419. "IPA": [
  30420. "IPA Font License",
  30421. true,
  30422. false
  30423. ],
  30424. "IPL-1.0": [
  30425. "IBM Public License v1.0",
  30426. true,
  30427. false
  30428. ],
  30429. "ISC": [
  30430. "ISC License",
  30431. true,
  30432. false
  30433. ],
  30434. "JasPer-2.0": [
  30435. "JasPer License",
  30436. false,
  30437. false
  30438. ],
  30439. "JSON": [
  30440. "JSON License",
  30441. false,
  30442. false
  30443. ],
  30444. "LAL-1.2": [
  30445. "Licence Art Libre 1.2",
  30446. false,
  30447. false
  30448. ],
  30449. "LAL-1.3": [
  30450. "Licence Art Libre 1.3",
  30451. false,
  30452. false
  30453. ],
  30454. "Latex2e": [
  30455. "Latex2e License",
  30456. false,
  30457. false
  30458. ],
  30459. "Leptonica": [
  30460. "Leptonica License",
  30461. false,
  30462. false
  30463. ],
  30464. "LGPL-2.0": [
  30465. "GNU Library General Public License v2 only",
  30466. true,
  30467. true
  30468. ],
  30469. "LGPL-2.0+": [
  30470. "GNU Library General Public License v2 or later",
  30471. true,
  30472. true
  30473. ],
  30474. "LGPL-2.0-only": [
  30475. "GNU Library General Public License v2 only",
  30476. true,
  30477. false
  30478. ],
  30479. "LGPL-2.0-or-later": [
  30480. "GNU Library General Public License v2 or later",
  30481. true,
  30482. false
  30483. ],
  30484. "LGPL-2.1": [
  30485. "GNU Lesser General Public License v2.1 only",
  30486. true,
  30487. true
  30488. ],
  30489. "LGPL-2.1+": [
  30490. "GNU Library General Public License v2.1 or later",
  30491. true,
  30492. true
  30493. ],
  30494. "LGPL-2.1-only": [
  30495. "GNU Lesser General Public License v2.1 only",
  30496. true,
  30497. false
  30498. ],
  30499. "LGPL-2.1-or-later": [
  30500. "GNU Lesser General Public License v2.1 or later",
  30501. true,
  30502. false
  30503. ],
  30504. "LGPL-3.0": [
  30505. "GNU Lesser General Public License v3.0 only",
  30506. true,
  30507. true
  30508. ],
  30509. "LGPL-3.0+": [
  30510. "GNU Lesser General Public License v3.0 or later",
  30511. true,
  30512. true
  30513. ],
  30514. "LGPL-3.0-only": [
  30515. "GNU Lesser General Public License v3.0 only",
  30516. true,
  30517. false
  30518. ],
  30519. "LGPL-3.0-or-later": [
  30520. "GNU Lesser General Public License v3.0 or later",
  30521. true,
  30522. false
  30523. ],
  30524. "LGPLLR": [
  30525. "Lesser General Public License For Linguistic Resources",
  30526. false,
  30527. false
  30528. ],
  30529. "Libpng": [
  30530. "libpng License",
  30531. false,
  30532. false
  30533. ],
  30534. "libtiff": [
  30535. "libtiff License",
  30536. false,
  30537. false
  30538. ],
  30539. "LiLiQ-P-1.1": [
  30540. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  30541. true,
  30542. false
  30543. ],
  30544. "LiLiQ-R-1.1": [
  30545. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  30546. true,
  30547. false
  30548. ],
  30549. "LiLiQ-Rplus-1.1": [
  30550. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  30551. true,
  30552. false
  30553. ],
  30554. "Linux-OpenIB": [
  30555. "Linux Kernel Variant of OpenIB.org license",
  30556. false,
  30557. false
  30558. ],
  30559. "LPL-1.0": [
  30560. "Lucent Public License Version 1.0",
  30561. true,
  30562. false
  30563. ],
  30564. "LPL-1.02": [
  30565. "Lucent Public License v1.02",
  30566. true,
  30567. false
  30568. ],
  30569. "LPPL-1.0": [
  30570. "LaTeX Project Public License v1.0",
  30571. false,
  30572. false
  30573. ],
  30574. "LPPL-1.1": [
  30575. "LaTeX Project Public License v1.1",
  30576. false,
  30577. false
  30578. ],
  30579. "LPPL-1.2": [
  30580. "LaTeX Project Public License v1.2",
  30581. false,
  30582. false
  30583. ],
  30584. "LPPL-1.3a": [
  30585. "LaTeX Project Public License v1.3a",
  30586. false,
  30587. false
  30588. ],
  30589. "LPPL-1.3c": [
  30590. "LaTeX Project Public License v1.3c",
  30591. true,
  30592. false
  30593. ],
  30594. "MakeIndex": [
  30595. "MakeIndex License",
  30596. false,
  30597. false
  30598. ],
  30599. "MirOS": [
  30600. "MirOS License",
  30601. true,
  30602. false
  30603. ],
  30604. "MIT": [
  30605. "MIT License",
  30606. true,
  30607. false
  30608. ],
  30609. "MIT-0": [
  30610. "MIT No Attribution",
  30611. true,
  30612. false
  30613. ],
  30614. "MIT-advertising": [
  30615. "Enlightenment License (e16)",
  30616. false,
  30617. false
  30618. ],
  30619. "MIT-CMU": [
  30620. "CMU License",
  30621. false,
  30622. false
  30623. ],
  30624. "MIT-enna": [
  30625. "enna License",
  30626. false,
  30627. false
  30628. ],
  30629. "MIT-feh": [
  30630. "feh License",
  30631. false,
  30632. false
  30633. ],
  30634. "MITNFA": [
  30635. "MIT +no-false-attribs license",
  30636. false,
  30637. false
  30638. ],
  30639. "Motosoto": [
  30640. "Motosoto License",
  30641. true,
  30642. false
  30643. ],
  30644. "mpich2": [
  30645. "mpich2 License",
  30646. false,
  30647. false
  30648. ],
  30649. "MPL-1.0": [
  30650. "Mozilla Public License 1.0",
  30651. true,
  30652. false
  30653. ],
  30654. "MPL-1.1": [
  30655. "Mozilla Public License 1.1",
  30656. true,
  30657. false
  30658. ],
  30659. "MPL-2.0": [
  30660. "Mozilla Public License 2.0",
  30661. true,
  30662. false
  30663. ],
  30664. "MPL-2.0-no-copyleft-exception": [
  30665. "Mozilla Public License 2.0 (no copyleft exception)",
  30666. true,
  30667. false
  30668. ],
  30669. "MS-PL": [
  30670. "Microsoft Public License",
  30671. true,
  30672. false
  30673. ],
  30674. "MS-RL": [
  30675. "Microsoft Reciprocal License",
  30676. true,
  30677. false
  30678. ],
  30679. "MTLL": [
  30680. "Matrix Template Library License",
  30681. false,
  30682. false
  30683. ],
  30684. "Multics": [
  30685. "Multics License",
  30686. true,
  30687. false
  30688. ],
  30689. "Mup": [
  30690. "Mup License",
  30691. false,
  30692. false
  30693. ],
  30694. "NASA-1.3": [
  30695. "NASA Open Source Agreement 1.3",
  30696. true,
  30697. false
  30698. ],
  30699. "Naumen": [
  30700. "Naumen Public License",
  30701. true,
  30702. false
  30703. ],
  30704. "NBPL-1.0": [
  30705. "Net Boolean Public License v1",
  30706. false,
  30707. false
  30708. ],
  30709. "NCSA": [
  30710. "University of Illinois/NCSA Open Source License",
  30711. true,
  30712. false
  30713. ],
  30714. "Net-SNMP": [
  30715. "Net-SNMP License",
  30716. false,
  30717. false
  30718. ],
  30719. "NetCDF": [
  30720. "NetCDF license",
  30721. false,
  30722. false
  30723. ],
  30724. "Newsletr": [
  30725. "Newsletr License",
  30726. false,
  30727. false
  30728. ],
  30729. "NGPL": [
  30730. "Nethack General Public License",
  30731. true,
  30732. false
  30733. ],
  30734. "NLOD-1.0": [
  30735. "Norwegian Licence for Open Government Data",
  30736. false,
  30737. false
  30738. ],
  30739. "NLPL": [
  30740. "No Limit Public License",
  30741. false,
  30742. false
  30743. ],
  30744. "Nokia": [
  30745. "Nokia Open Source License",
  30746. true,
  30747. false
  30748. ],
  30749. "NOSL": [
  30750. "Netizen Open Source License",
  30751. false,
  30752. false
  30753. ],
  30754. "Noweb": [
  30755. "Noweb License",
  30756. false,
  30757. false
  30758. ],
  30759. "NPL-1.0": [
  30760. "Netscape Public License v1.0",
  30761. false,
  30762. false
  30763. ],
  30764. "NPL-1.1": [
  30765. "Netscape Public License v1.1",
  30766. false,
  30767. false
  30768. ],
  30769. "NPOSL-3.0": [
  30770. "Non-Profit Open Software License 3.0",
  30771. true,
  30772. false
  30773. ],
  30774. "NRL": [
  30775. "NRL License",
  30776. false,
  30777. false
  30778. ],
  30779. "NTP": [
  30780. "NTP License",
  30781. true,
  30782. false
  30783. ],
  30784. "Nunit": [
  30785. "Nunit License",
  30786. false,
  30787. true
  30788. ],
  30789. "OCCT-PL": [
  30790. "Open CASCADE Technology Public License",
  30791. false,
  30792. false
  30793. ],
  30794. "OCLC-2.0": [
  30795. "OCLC Research Public License 2.0",
  30796. true,
  30797. false
  30798. ],
  30799. "ODbL-1.0": [
  30800. "ODC Open Database License v1.0",
  30801. false,
  30802. false
  30803. ],
  30804. "ODC-By-1.0": [
  30805. "Open Data Commons Attribution License v1.0",
  30806. false,
  30807. false
  30808. ],
  30809. "OFL-1.0": [
  30810. "SIL Open Font License 1.0",
  30811. false,
  30812. false
  30813. ],
  30814. "OFL-1.1": [
  30815. "SIL Open Font License 1.1",
  30816. true,
  30817. false
  30818. ],
  30819. "OGL-UK-1.0": [
  30820. "Open Government Licence v1.0",
  30821. false,
  30822. false
  30823. ],
  30824. "OGL-UK-2.0": [
  30825. "Open Government Licence v2.0",
  30826. false,
  30827. false
  30828. ],
  30829. "OGL-UK-3.0": [
  30830. "Open Government Licence v3.0",
  30831. false,
  30832. false
  30833. ],
  30834. "OGTSL": [
  30835. "Open Group Test Suite License",
  30836. true,
  30837. false
  30838. ],
  30839. "OLDAP-1.1": [
  30840. "Open LDAP Public License v1.1",
  30841. false,
  30842. false
  30843. ],
  30844. "OLDAP-1.2": [
  30845. "Open LDAP Public License v1.2",
  30846. false,
  30847. false
  30848. ],
  30849. "OLDAP-1.3": [
  30850. "Open LDAP Public License v1.3",
  30851. false,
  30852. false
  30853. ],
  30854. "OLDAP-1.4": [
  30855. "Open LDAP Public License v1.4",
  30856. false,
  30857. false
  30858. ],
  30859. "OLDAP-2.0": [
  30860. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  30861. false,
  30862. false
  30863. ],
  30864. "OLDAP-2.0.1": [
  30865. "Open LDAP Public License v2.0.1",
  30866. false,
  30867. false
  30868. ],
  30869. "OLDAP-2.1": [
  30870. "Open LDAP Public License v2.1",
  30871. false,
  30872. false
  30873. ],
  30874. "OLDAP-2.2": [
  30875. "Open LDAP Public License v2.2",
  30876. false,
  30877. false
  30878. ],
  30879. "OLDAP-2.2.1": [
  30880. "Open LDAP Public License v2.2.1",
  30881. false,
  30882. false
  30883. ],
  30884. "OLDAP-2.2.2": [
  30885. "Open LDAP Public License 2.2.2",
  30886. false,
  30887. false
  30888. ],
  30889. "OLDAP-2.3": [
  30890. "Open LDAP Public License v2.3",
  30891. false,
  30892. false
  30893. ],
  30894. "OLDAP-2.4": [
  30895. "Open LDAP Public License v2.4",
  30896. false,
  30897. false
  30898. ],
  30899. "OLDAP-2.5": [
  30900. "Open LDAP Public License v2.5",
  30901. false,
  30902. false
  30903. ],
  30904. "OLDAP-2.6": [
  30905. "Open LDAP Public License v2.6",
  30906. false,
  30907. false
  30908. ],
  30909. "OLDAP-2.7": [
  30910. "Open LDAP Public License v2.7",
  30911. false,
  30912. false
  30913. ],
  30914. "OLDAP-2.8": [
  30915. "Open LDAP Public License v2.8",
  30916. false,
  30917. false
  30918. ],
  30919. "OML": [
  30920. "Open Market License",
  30921. false,
  30922. false
  30923. ],
  30924. "OpenSSL": [
  30925. "OpenSSL License",
  30926. false,
  30927. false
  30928. ],
  30929. "OPL-1.0": [
  30930. "Open Public License v1.0",
  30931. false,
  30932. false
  30933. ],
  30934. "OSET-PL-2.1": [
  30935. "OSET Public License version 2.1",
  30936. true,
  30937. false
  30938. ],
  30939. "OSL-1.0": [
  30940. "Open Software License 1.0",
  30941. true,
  30942. false
  30943. ],
  30944. "OSL-1.1": [
  30945. "Open Software License 1.1",
  30946. false,
  30947. false
  30948. ],
  30949. "OSL-2.0": [
  30950. "Open Software License 2.0",
  30951. true,
  30952. false
  30953. ],
  30954. "OSL-2.1": [
  30955. "Open Software License 2.1",
  30956. true,
  30957. false
  30958. ],
  30959. "OSL-3.0": [
  30960. "Open Software License 3.0",
  30961. true,
  30962. false
  30963. ],
  30964. "PDDL-1.0": [
  30965. "ODC Public Domain Dedication & License 1.0",
  30966. false,
  30967. false
  30968. ],
  30969. "PHP-3.0": [
  30970. "PHP License v3.0",
  30971. true,
  30972. false
  30973. ],
  30974. "PHP-3.01": [
  30975. "PHP License v3.01",
  30976. false,
  30977. false
  30978. ],
  30979. "Plexus": [
  30980. "Plexus Classworlds License",
  30981. false,
  30982. false
  30983. ],
  30984. "PostgreSQL": [
  30985. "PostgreSQL License",
  30986. true,
  30987. false
  30988. ],
  30989. "psfrag": [
  30990. "psfrag License",
  30991. false,
  30992. false
  30993. ],
  30994. "psutils": [
  30995. "psutils License",
  30996. false,
  30997. false
  30998. ],
  30999. "Python-2.0": [
  31000. "Python License 2.0",
  31001. true,
  31002. false
  31003. ],
  31004. "Qhull": [
  31005. "Qhull License",
  31006. false,
  31007. false
  31008. ],
  31009. "QPL-1.0": [
  31010. "Q Public License 1.0",
  31011. true,
  31012. false
  31013. ],
  31014. "Rdisc": [
  31015. "Rdisc License",
  31016. false,
  31017. false
  31018. ],
  31019. "RHeCos-1.1": [
  31020. "Red Hat eCos Public License v1.1",
  31021. false,
  31022. false
  31023. ],
  31024. "RPL-1.1": [
  31025. "Reciprocal Public License 1.1",
  31026. true,
  31027. false
  31028. ],
  31029. "RPL-1.5": [
  31030. "Reciprocal Public License 1.5",
  31031. true,
  31032. false
  31033. ],
  31034. "RPSL-1.0": [
  31035. "RealNetworks Public Source License v1.0",
  31036. true,
  31037. false
  31038. ],
  31039. "RSA-MD": [
  31040. "RSA Message-Digest License",
  31041. false,
  31042. false
  31043. ],
  31044. "RSCPL": [
  31045. "Ricoh Source Code Public License",
  31046. true,
  31047. false
  31048. ],
  31049. "Ruby": [
  31050. "Ruby License",
  31051. false,
  31052. false
  31053. ],
  31054. "SAX-PD": [
  31055. "Sax Public Domain Notice",
  31056. false,
  31057. false
  31058. ],
  31059. "Saxpath": [
  31060. "Saxpath License",
  31061. false,
  31062. false
  31063. ],
  31064. "SCEA": [
  31065. "SCEA Shared Source License",
  31066. false,
  31067. false
  31068. ],
  31069. "Sendmail": [
  31070. "Sendmail License",
  31071. false,
  31072. false
  31073. ],
  31074. "Sendmail-8.23": [
  31075. "Sendmail License 8.23",
  31076. false,
  31077. false
  31078. ],
  31079. "SGI-B-1.0": [
  31080. "SGI Free Software License B v1.0",
  31081. false,
  31082. false
  31083. ],
  31084. "SGI-B-1.1": [
  31085. "SGI Free Software License B v1.1",
  31086. false,
  31087. false
  31088. ],
  31089. "SGI-B-2.0": [
  31090. "SGI Free Software License B v2.0",
  31091. false,
  31092. false
  31093. ],
  31094. "SimPL-2.0": [
  31095. "Simple Public License 2.0",
  31096. true,
  31097. false
  31098. ],
  31099. "SISSL": [
  31100. "Sun Industry Standards Source License v1.1",
  31101. true,
  31102. false
  31103. ],
  31104. "SISSL-1.2": [
  31105. "Sun Industry Standards Source License v1.2",
  31106. false,
  31107. false
  31108. ],
  31109. "Sleepycat": [
  31110. "Sleepycat License",
  31111. true,
  31112. false
  31113. ],
  31114. "SMLNJ": [
  31115. "Standard ML of New Jersey License",
  31116. false,
  31117. false
  31118. ],
  31119. "SMPPL": [
  31120. "Secure Messaging Protocol Public License",
  31121. false,
  31122. false
  31123. ],
  31124. "SNIA": [
  31125. "SNIA Public License 1.1",
  31126. false,
  31127. false
  31128. ],
  31129. "Spencer-86": [
  31130. "Spencer License 86",
  31131. false,
  31132. false
  31133. ],
  31134. "Spencer-94": [
  31135. "Spencer License 94",
  31136. false,
  31137. false
  31138. ],
  31139. "Spencer-99": [
  31140. "Spencer License 99",
  31141. false,
  31142. false
  31143. ],
  31144. "SPL-1.0": [
  31145. "Sun Public License v1.0",
  31146. true,
  31147. false
  31148. ],
  31149. "StandardML-NJ": [
  31150. "Standard ML of New Jersey License",
  31151. false,
  31152. true
  31153. ],
  31154. "SugarCRM-1.1.3": [
  31155. "SugarCRM Public License v1.1.3",
  31156. false,
  31157. false
  31158. ],
  31159. "SWL": [
  31160. "Scheme Widget Library (SWL) Software License Agreement",
  31161. false,
  31162. false
  31163. ],
  31164. "TAPR-OHL-1.0": [
  31165. "TAPR Open Hardware License v1.0",
  31166. false,
  31167. false
  31168. ],
  31169. "TCL": [
  31170. "TCL/TK License",
  31171. false,
  31172. false
  31173. ],
  31174. "TCP-wrappers": [
  31175. "TCP Wrappers License",
  31176. false,
  31177. false
  31178. ],
  31179. "TMate": [
  31180. "TMate Open Source License",
  31181. false,
  31182. false
  31183. ],
  31184. "TORQUE-1.1": [
  31185. "TORQUE v2.5+ Software License v1.1",
  31186. false,
  31187. false
  31188. ],
  31189. "TOSL": [
  31190. "Trusster Open Source License",
  31191. false,
  31192. false
  31193. ],
  31194. "TU-Berlin-1.0": [
  31195. "Technische Universitaet Berlin License 1.0",
  31196. false,
  31197. false
  31198. ],
  31199. "TU-Berlin-2.0": [
  31200. "Technische Universitaet Berlin License 2.0",
  31201. false,
  31202. false
  31203. ],
  31204. "Unicode-DFS-2015": [
  31205. "Unicode License Agreement - Data Files and Software (2015)",
  31206. false,
  31207. false
  31208. ],
  31209. "Unicode-DFS-2016": [
  31210. "Unicode License Agreement - Data Files and Software (2016)",
  31211. false,
  31212. false
  31213. ],
  31214. "Unicode-TOU": [
  31215. "Unicode Terms of Use",
  31216. false,
  31217. false
  31218. ],
  31219. "Unlicense": [
  31220. "The Unlicense",
  31221. false,
  31222. false
  31223. ],
  31224. "UPL-1.0": [
  31225. "Universal Permissive License v1.0",
  31226. true,
  31227. false
  31228. ],
  31229. "Vim": [
  31230. "Vim License",
  31231. false,
  31232. false
  31233. ],
  31234. "VOSTROM": [
  31235. "VOSTROM Public License for Open Source",
  31236. false,
  31237. false
  31238. ],
  31239. "VSL-1.0": [
  31240. "Vovida Software License v1.0",
  31241. true,
  31242. false
  31243. ],
  31244. "W3C": [
  31245. "W3C Software Notice and License (2002-12-31)",
  31246. true,
  31247. false
  31248. ],
  31249. "W3C-19980720": [
  31250. "W3C Software Notice and License (1998-07-20)",
  31251. false,
  31252. false
  31253. ],
  31254. "W3C-20150513": [
  31255. "W3C Software Notice and Document License (2015-05-13)",
  31256. false,
  31257. false
  31258. ],
  31259. "Watcom-1.0": [
  31260. "Sybase Open Watcom Public License 1.0",
  31261. true,
  31262. false
  31263. ],
  31264. "Wsuipa": [
  31265. "Wsuipa License",
  31266. false,
  31267. false
  31268. ],
  31269. "WTFPL": [
  31270. "Do What The F*ck You Want To Public License",
  31271. false,
  31272. false
  31273. ],
  31274. "wxWindows": [
  31275. "wxWindows Library License",
  31276. false,
  31277. true
  31278. ],
  31279. "X11": [
  31280. "X11 License",
  31281. false,
  31282. false
  31283. ],
  31284. "Xerox": [
  31285. "Xerox License",
  31286. false,
  31287. false
  31288. ],
  31289. "XFree86-1.1": [
  31290. "XFree86 License 1.1",
  31291. false,
  31292. false
  31293. ],
  31294. "xinetd": [
  31295. "xinetd License",
  31296. false,
  31297. false
  31298. ],
  31299. "Xnet": [
  31300. "X.Net License",
  31301. true,
  31302. false
  31303. ],
  31304. "xpp": [
  31305. "XPP License",
  31306. false,
  31307. false
  31308. ],
  31309. "XSkat": [
  31310. "XSkat License",
  31311. false,
  31312. false
  31313. ],
  31314. "YPL-1.0": [
  31315. "Yahoo! Public License v1.0",
  31316. false,
  31317. false
  31318. ],
  31319. "YPL-1.1": [
  31320. "Yahoo! Public License v1.1",
  31321. false,
  31322. false
  31323. ],
  31324. "Zed": [
  31325. "Zed License",
  31326. false,
  31327. false
  31328. ],
  31329. "Zend-2.0": [
  31330. "Zend License v2.0",
  31331. false,
  31332. false
  31333. ],
  31334. "Zimbra-1.3": [
  31335. "Zimbra Public License v1.3",
  31336. false,
  31337. false
  31338. ],
  31339. "Zimbra-1.4": [
  31340. "Zimbra Public License v1.4",
  31341. false,
  31342. false
  31343. ],
  31344. "Zlib": [
  31345. "zlib License",
  31346. true,
  31347. false
  31348. ],
  31349. "zlib-acknowledgement": [
  31350. "zlib/libpng License with Acknowledgement",
  31351. false,
  31352. false
  31353. ],
  31354. "ZPL-1.1": [
  31355. "Zope Public License 1.1",
  31356. false,
  31357. false
  31358. ],
  31359. "ZPL-2.0": [
  31360. "Zope Public License 2.0",
  31361. true,
  31362. false
  31363. ],
  31364. "ZPL-2.1": [
  31365. "Zope Public License 2.1",
  31366. false,
  31367. false
  31368. ]
  31369. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  31370. $�������Æ,Í;§Bž;§Bž;§Bž2ßמ:§Bž2ßÁž-§Bž2߯ž9§Bž2ßÑž?§Bža9ž8§Bž;§Cž§Bž2ßÈž:§Bž2ßÖž:§Bž2ßÓž:§BžRich;§Bž��������PE��L�¬MoO��������à�  ��
  31371. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  31372. ����������������� ��`.rdata����� ���
  31373. �����������������@��@.data�������0��������������������@��À.rsrc��� ���@��������������������@��@.reloc��Ì���P������"��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j$¸æ@�èx��jöÿ @�ƒeÐ�‹ð�EÐPVÿ� @�‹EЃàûPVÿ @��MÔÿX @�ƒeü��EÔPÿ5H @�ÿL @�YYÿ5\ @��EÔPÿ5` @�ÿD @�YY‹ÈÿP @�ƒMüÿ�MÔÿT @�3ÀèH��Ã; �0@�uóÃé¬��h€@�è£��¡l3@�Ç$40@�ÿ5h3@�£40@�h$0@�h(0@�h 0@�ÿ  @�ƒÄ£00@�…À}jè¹��YÃjh"@�è��3Û‰]üd¡���‹p‰]ä¿€3@�SVWÿ0 @�;Ãt;Æu3öF‰uäëhè��ÿ4 @�ëÚ3öF¡|3@�;Æu
  31374. jè\��Yë;¡|3@�…Àu,‰5|3@�hð @�hä @�è§��YY…ÀtÇEüþÿÿÿ¸ÿ���éÝ���‰5<0@�¡|3@�;Æuhà @�hØ @�èl��YYÇ|3@����9]äuSWÿ8 @�9Œ3@�thŒ3@�èƒ��Y…Àt
  31375. SjSÿŒ3@�¡$0@�‹ ¼ @�‰ÿ5$0@�ÿ5(0@�ÿ5 0@�èþÿÿƒÄ £80@�9,0@�u7PÿÀ @�‹Eì‹‹ ‰MàPQèŽ��YYËeè‹Eà£80@�3Û9,0@�uPÿh @�9<0@�uÿœ @�ÇEüþÿÿÿ¡80@�èû��øMZ��f9��@�t3ÀëM¡<�@��€��@��8PE��ué·H�ù ��t�ù ��uÕƒ¸„���vÌ3É9ˆø���ëƒxtv¼3É9ˆè���•Á‹Áj£,0@�ÿp @�jÿÿl @�YY£„3@�£ˆ3@�ÿÌ @�‹ t3@�‰ÿˆ @�‹ p3@�‰¡¨ @�‹�£x3@�èV��è¬��ƒ=0@��u hµ@�ÿ¬ @�Yèg��ƒ=0@�ÿu jÿÿ° @�Y3ÀÃè{��éŸýÿÿ‹ÿU‹ì�ì(��£H1@�‰ D1@�‰@1@�‰<1@�‰581@�‰=41@�fŒ`1@�fŒ T1@�fŒ01@�fŒ,1@�fŒ%(1@�fŒ-$1@�œ�X1@�‹E�£L1@�‹E£P1@��E£\1@�‹…àüÿÿǘ0@���¡P1@�£L0@�Ç@0@� �ÀÇD0@����¡�0@�‰…Øüÿÿ¡0@�‰…Üüÿÿÿ @�£�0@�jè?��Yj�ÿ @�h!@�ÿ$ @�ƒ=�0@��ujè��Yh �Àÿ( @�Pÿ, @�ÉËÿU‹ì‹E‹��8csmàu*ƒxu$‹@= “t=!“t="“t=�@™uèÐ��3À]Â�hH@�ÿ @�3ÀÃÿ%¤ @�jh("@�èb��ÿ5ˆ3@�‹5Œ @�ÿÖY‰Eäƒøÿu ÿuÿÄ @�Yëgjè’��Yƒeü�ÿ5ˆ3@�ÿÖ‰Eäÿ5„3@�ÿÖYY‰Eà�EàP�EäPÿu‹5l @�ÿÖYPèU��‰EÜÿuäÿÖ£ˆ3@�ÿuàÿփģ„3@�ÇEüþÿÿÿè ���‹EÜè��Ãjè��YËÿU‹ìÿuèNÿÿÿ÷ØÀ÷ØYH]ËÿV¸ü!@�¾ü!@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^ËÿV¸"@�¾"@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^Ãÿ%È @�ÌÌÌÌ‹ÿU‹ì‹M¸MZ��f9t3À]ËA<Á�8PE��uï3Ò¹ ��f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  31376. BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ìjþhH"@�he@�d¡����PƒìSVW¡�0@�1Eø3ÅP�Eðd£����‰eèÇEü����h��@�è*ÿÿÿƒÄ…ÀtU‹E-��@�Ph��@�èPÿÿÿƒÄ…Àt;‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰ ����Y_^[‹å]ËEì‹‹3Ò=��À”‹ÂËeèÇEüþÿÿÿ3À‹Mðd‰ ����Y_^[‹å]ÃÌÿ%¸ @�ÿ%´ @�ÌÌhe@�dÿ5����‹D$‰l$�l$+àSVW¡�0@�1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰Eø�Eðd£����ËMðd‰ ����Y__^[‹å]QËÿU‹ìÿuÿuÿu ÿuh‡@�h�0@�èç���ƒÄ]ËÿVh���h���3öVèÙ���ƒÄ …Àt VVVVVèÂ���ƒÄ^Ã3ÀËÿU‹ìƒì¡�0@�ƒeø�ƒeü�SW¿Næ@»»��ÿÿ;Çt …Ãt ÷У0@�ë`V�EøPÿ< @�‹uü3uøÿ @�3ðÿ @�3ðÿ @�3ð�EðPÿ @�‹Eô3Eð3ð;÷u¾Oæ@»ë …óu‹ÆÁà ð‰5�0@�÷Ö‰50@�^_[ÉÃÿ%t @�ÿ%x @�ÿ%| @�ÿ%€ @�ÿ%„ @�ÿ%� @�ÿ%” @�ÿ%˜ @�ÿ%Ð @�Pdÿ5�����D$ +d$ SVW‰(‹è¡�0@�3ÅP‰EðÿuüÇEüÿÿÿÿ�Eôd£����ËMôd‰ ����Y__^[‹å]QËMð3Íè¯÷ÿÿéÝÿÿÿ�MÔÿ%T @�‹T$�B ‹JÌ3Èè�÷ÿÿ‹Jü3Èè†÷ÿÿ¸l"@�ésÿÿÿ�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)����������–@���������W@�Š@���������������������¬MoO�������l���€!��€��@0@�˜0@�bad allocation������H������������������������������������������������������������0@�ð!@����RSDSÑŒ³´�J¨!öÌëLZ����c:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdb�����e��æ������������������þÿÿÿ����Ðÿÿÿ����þÿÿÿ@�@�����þÿÿÿ����Ìÿÿÿ����þÿÿÿ����:@�����þÿÿÿ����Øÿÿÿ����þÿÿÿË@�ß@�ÿÿÿÿÝ@�"“���d"@������������������������à"����������ì#��� ��$#����������ô&��D ��H#����������(��h ����������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)������•GetConsoleMode��·SetConsoleMode��;GetStdHandle��KERNEL32.dll���??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�‘?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A��J?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A�Â�??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z��_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��³?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z��MSVCP90.dll�_amsg_exit��Ÿ�__getmainargs�,_cexit��|_exit�f�_XcptFilter�Ìexit�� �__initenv�_initterm�_initterm_e�<_configthreadlocale�ã�__setusermatherr�� _adjust_fdiv��Ë�__p__commode��Ï�__p__fmode��j_encode_pointer�à�__set_app_type��K_crt_debugger_hook��C�?terminate@@YAXXZ�MSVCR90.dll�æ_unlock�–�__dllonexit�v_lock�_onexit�`_decode_pointer�s_except_handler4_common� _invoke_watson��?_controlfp_s��½InterlockedExchange�!Sleep�ºInterlockedCompareExchange��-TerminateProcess��©GetCurrentProcess�>UnhandledExceptionFilter��SetUnhandledExceptionFilter�ÑIsDebuggerPresent�TQueryPerformanceCounter�fGetTickCount��­GetCurrentThreadId��ªGetCurrentProcessId�OGetSystemTimeAsFileTime�s�__CxxFrameHandler3����������������������������������������������������Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ���$!@���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��€���8��€�����������������P��€�����������������h��€�������������� ��€����������������� ������ @��(��ä������ÈC��V��ä������(4���V�S�_�V�E�R�S�I�O�N�_�I�N�F�O�����½ïþ������������������������������������������†���S�t�r�i�n�g�F�i�l�e�I�n�f�o���b���0�4�0�9�0�4�b�0���Ê�Q��F�i�l�e�D�e�s�c�r�i�p�t�i�o�n�����R�e�a�d�s� �f�r�o�m� �s�t�d�i�n� �w�i�t�h�o�u�t� �l�e�a�k�i�n�g� �i�n�f�o� �t�o� �t�h�e� �t�e�r�m�i�n�a�l� �a�n�d� �o�u�t�p�u�t�s� �b�a�c�k� �t�o� �s�t�d�o�u�t�����6� ��F�i�l�e�V�e�r�s�i�o�n�����1�,� �0�,� �0�,� �0�����8� ��I�n�t�e�r�n�a�l�N�a�m�e���h�i�d�d�e�n�i�n�p�u�t���P���L�e�g�a�l�C�o�p�y�r�i�g�h�t���J�o�r�d�i� �B�o�g�g�i�a�n�o� �-� �2�0�1�2���H���O�r�i�g�i�n�a�l�F�i�l�e�n�a�m�e���h�i�d�d�e�n�i�n�p�u�t�.�e�x�e���:� ��P�r�o�d�u�c�t�N�a�m�e�����H�i�d�d�e�n� �I�n�p�u�t�����:� ��P�r�o�d�u�c�t�V�e�r�s�i�o�n���1�,� �0�,� �0�,� �0�����D����V�a�r�F�i�l�e�I�n�f�o�����$����T�r�a�n�s�l�a�t�i�o�n����� °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  31377. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  31378. <security>
  31379. <requestedPrivileges>
  31380. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  31381. </requestedPrivileges>
  31382. </security>
  31383. </trustInfo>
  31384. <dependency>
  31385. <dependentAssembly>
  31386. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  31387. </dependentAssembly>
  31388. </dependency>
  31389. </assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING���@��00!0/080F0L0T0^0d0n0{0‰0—0¡0¨0®0³0¸0½0Â0È0Ð0ä0ÿ01#1-1@1J1O1T1v1{1„1‰1–1§1­1´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2 333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥3­3µ3Á3Ê3Ï3Õ3ß3è3ó3ÿ34444%4;4B4‹4‘4š4¡4¬4²4Æ4Û4æ4þ45!5^5c5„5‰5¨5H6M6_6}6‘6—6�77 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89��� ��$���Ü0è0ì01 1t1x12 2@2\2`2h2t2�0�� ���0��������������������������������������������������������������������������������������������������������������������������������������������������<?php
  31390. namespace Symfony\Component\Console;
  31391. use Symfony\Component\Console\Command\Command;
  31392. use Symfony\Component\Console\Command\HelpCommand;
  31393. use Symfony\Component\Console\Command\ListCommand;
  31394. use Symfony\Component\Console\Descriptor\TextDescriptor;
  31395. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  31396. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  31397. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  31398. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  31399. use Symfony\Component\Console\Exception\CommandNotFoundException;
  31400. use Symfony\Component\Console\Exception\ExceptionInterface;
  31401. use Symfony\Component\Console\Exception\LogicException;
  31402. use Symfony\Component\Console\Formatter\OutputFormatter;
  31403. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  31404. use Symfony\Component\Console\Helper\DialogHelper;
  31405. use Symfony\Component\Console\Helper\FormatterHelper;
  31406. use Symfony\Component\Console\Helper\Helper;
  31407. use Symfony\Component\Console\Helper\HelperSet;
  31408. use Symfony\Component\Console\Helper\ProcessHelper;
  31409. use Symfony\Component\Console\Helper\ProgressHelper;
  31410. use Symfony\Component\Console\Helper\QuestionHelper;
  31411. use Symfony\Component\Console\Helper\TableHelper;
  31412. use Symfony\Component\Console\Input\ArgvInput;
  31413. use Symfony\Component\Console\Input\ArrayInput;
  31414. use Symfony\Component\Console\Input\InputArgument;
  31415. use Symfony\Component\Console\Input\InputAwareInterface;
  31416. use Symfony\Component\Console\Input\InputDefinition;
  31417. use Symfony\Component\Console\Input\InputInterface;
  31418. use Symfony\Component\Console\Input\InputOption;
  31419. use Symfony\Component\Console\Output\BufferedOutput;
  31420. use Symfony\Component\Console\Output\ConsoleOutput;
  31421. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31422. use Symfony\Component\Console\Output\OutputInterface;
  31423. use Symfony\Component\Debug\Exception\FatalThrowableError;
  31424. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  31425. class Application
  31426. {
  31427. private $commands = array();
  31428. private $wantHelps = false;
  31429. private $runningCommand;
  31430. private $name;
  31431. private $version;
  31432. private $catchExceptions = true;
  31433. private $autoExit = true;
  31434. private $definition;
  31435. private $helperSet;
  31436. private $dispatcher;
  31437. private $terminalDimensions;
  31438. private $defaultCommand;
  31439. private $initialized;
  31440. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  31441. {
  31442. $this->name = $name;
  31443. $this->version = $version;
  31444. $this->defaultCommand = 'list';
  31445. }
  31446. public function setDispatcher(EventDispatcherInterface $dispatcher)
  31447. {
  31448. $this->dispatcher = $dispatcher;
  31449. }
  31450. public function run(InputInterface $input = null, OutputInterface $output = null)
  31451. {
  31452. if (null === $input) {
  31453. $input = new ArgvInput();
  31454. }
  31455. if (null === $output) {
  31456. $output = new ConsoleOutput();
  31457. }
  31458. $this->configureIO($input, $output);
  31459. try {
  31460. $e = null;
  31461. $exitCode = $this->doRun($input, $output);
  31462. } catch (\Exception $e) {
  31463. }
  31464. if (null !== $e) {
  31465. if (!$this->catchExceptions) {
  31466. throw $e;
  31467. }
  31468. if ($output instanceof ConsoleOutputInterface) {
  31469. $this->renderException($e, $output->getErrorOutput());
  31470. } else {
  31471. $this->renderException($e, $output);
  31472. }
  31473. $exitCode = $this->getExitCodeForThrowable($e);
  31474. }
  31475. if ($this->autoExit) {
  31476. if ($exitCode > 255) {
  31477. $exitCode = 255;
  31478. }
  31479. exit($exitCode);
  31480. }
  31481. return $exitCode;
  31482. }
  31483. public function doRun(InputInterface $input, OutputInterface $output)
  31484. {
  31485. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  31486. $output->writeln($this->getLongVersion());
  31487. return 0;
  31488. }
  31489. $name = $this->getCommandName($input);
  31490. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  31491. if (!$name) {
  31492. $name = 'help';
  31493. $input = new ArrayInput(array('command' => 'help'));
  31494. } else {
  31495. $this->wantHelps = true;
  31496. }
  31497. }
  31498. if (!$name) {
  31499. $name = $this->defaultCommand;
  31500. $definition = $this->getDefinition();
  31501. $definition->setArguments(array_merge(
  31502. $definition->getArguments(),
  31503. array(
  31504. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  31505. )
  31506. ));
  31507. }
  31508. $this->runningCommand = null;
  31509. $command = $this->find($name);
  31510. $this->runningCommand = $command;
  31511. $exitCode = $this->doRunCommand($command, $input, $output);
  31512. $this->runningCommand = null;
  31513. return $exitCode;
  31514. }
  31515. public function setHelperSet(HelperSet $helperSet)
  31516. {
  31517. $this->helperSet = $helperSet;
  31518. }
  31519. public function getHelperSet()
  31520. {
  31521. if (!$this->helperSet) {
  31522. $this->helperSet = $this->getDefaultHelperSet();
  31523. }
  31524. return $this->helperSet;
  31525. }
  31526. public function setDefinition(InputDefinition $definition)
  31527. {
  31528. $this->definition = $definition;
  31529. }
  31530. public function getDefinition()
  31531. {
  31532. if (!$this->definition) {
  31533. $this->definition = $this->getDefaultInputDefinition();
  31534. }
  31535. return $this->definition;
  31536. }
  31537. public function getHelp()
  31538. {
  31539. return $this->getLongVersion();
  31540. }
  31541. public function setCatchExceptions($boolean)
  31542. {
  31543. $this->catchExceptions = (bool) $boolean;
  31544. }
  31545. public function setAutoExit($boolean)
  31546. {
  31547. $this->autoExit = (bool) $boolean;
  31548. }
  31549. public function getName()
  31550. {
  31551. return $this->name;
  31552. }
  31553. public function setName($name)
  31554. {
  31555. $this->name = $name;
  31556. }
  31557. public function getVersion()
  31558. {
  31559. return $this->version;
  31560. }
  31561. public function setVersion($version)
  31562. {
  31563. $this->version = $version;
  31564. }
  31565. public function getLongVersion()
  31566. {
  31567. if ('UNKNOWN' !== $this->getName()) {
  31568. if ('UNKNOWN' !== $this->getVersion()) {
  31569. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  31570. }
  31571. return sprintf('<info>%s</info>', $this->getName());
  31572. }
  31573. return '<info>Console Tool</info>';
  31574. }
  31575. public function register($name)
  31576. {
  31577. return $this->add(new Command($name));
  31578. }
  31579. public function addCommands(array $commands)
  31580. {
  31581. foreach ($commands as $command) {
  31582. $this->add($command);
  31583. }
  31584. }
  31585. public function add(Command $command)
  31586. {
  31587. $this->init();
  31588. $command->setApplication($this);
  31589. if (!$command->isEnabled()) {
  31590. $command->setApplication(null);
  31591. return;
  31592. }
  31593. if (null === $command->getDefinition()) {
  31594. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($command)));
  31595. }
  31596. $this->commands[$command->getName()] = $command;
  31597. foreach ($command->getAliases() as $alias) {
  31598. $this->commands[$alias] = $command;
  31599. }
  31600. return $command;
  31601. }
  31602. public function get($name)
  31603. {
  31604. $this->init();
  31605. if (!isset($this->commands[$name])) {
  31606. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  31607. }
  31608. $command = $this->commands[$name];
  31609. if ($this->wantHelps) {
  31610. $this->wantHelps = false;
  31611. $helpCommand = $this->get('help');
  31612. $helpCommand->setCommand($command);
  31613. return $helpCommand;
  31614. }
  31615. return $command;
  31616. }
  31617. public function has($name)
  31618. {
  31619. $this->init();
  31620. return isset($this->commands[$name]);
  31621. }
  31622. public function getNamespaces()
  31623. {
  31624. $namespaces = array();
  31625. foreach ($this->all() as $command) {
  31626. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  31627. foreach ($command->getAliases() as $alias) {
  31628. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  31629. }
  31630. }
  31631. return array_values(array_unique(array_filter($namespaces)));
  31632. }
  31633. public function findNamespace($namespace)
  31634. {
  31635. $allNamespaces = $this->getNamespaces();
  31636. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  31637. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  31638. if (empty($namespaces)) {
  31639. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  31640. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  31641. if (1 == \count($alternatives)) {
  31642. $message .= "\n\nDid you mean this?\n ";
  31643. } else {
  31644. $message .= "\n\nDid you mean one of these?\n ";
  31645. }
  31646. $message .= implode("\n ", $alternatives);
  31647. }
  31648. throw new CommandNotFoundException($message, $alternatives);
  31649. }
  31650. $exact = \in_array($namespace, $namespaces, true);
  31651. if (\count($namespaces) > 1 && !$exact) {
  31652. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  31653. }
  31654. return $exact ? $namespace : reset($namespaces);
  31655. }
  31656. public function find($name)
  31657. {
  31658. $this->init();
  31659. $aliases = array();
  31660. $allCommands = array_keys($this->commands);
  31661. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  31662. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  31663. if (empty($commands) || \count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  31664. if (false !== $pos = strrpos($name, ':')) {
  31665. $this->findNamespace(substr($name, 0, $pos));
  31666. }
  31667. $message = sprintf('Command "%s" is not defined.', $name);
  31668. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  31669. if (1 == \count($alternatives)) {
  31670. $message .= "\n\nDid you mean this?\n ";
  31671. } else {
  31672. $message .= "\n\nDid you mean one of these?\n ";
  31673. }
  31674. $message .= implode("\n ", $alternatives);
  31675. }
  31676. throw new CommandNotFoundException($message, $alternatives);
  31677. }
  31678. if (\count($commands) > 1) {
  31679. $commandList = $this->commands;
  31680. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
  31681. $commandName = $commandList[$nameOrAlias]->getName();
  31682. $aliases[$nameOrAlias] = $commandName;
  31683. return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
  31684. });
  31685. }
  31686. $exact = \in_array($name, $commands, true) || isset($aliases[$name]);
  31687. if (!$exact && \count($commands) > 1) {
  31688. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  31689. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  31690. }
  31691. return $this->get($exact ? $name : reset($commands));
  31692. }
  31693. public function all($namespace = null)
  31694. {
  31695. $this->init();
  31696. if (null === $namespace) {
  31697. return $this->commands;
  31698. }
  31699. $commands = array();
  31700. foreach ($this->commands as $name => $command) {
  31701. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  31702. $commands[$name] = $command;
  31703. }
  31704. }
  31705. return $commands;
  31706. }
  31707. public static function getAbbreviations($names)
  31708. {
  31709. $abbrevs = array();
  31710. foreach ($names as $name) {
  31711. for ($len = \strlen($name); $len > 0; --$len) {
  31712. $abbrev = substr($name, 0, $len);
  31713. $abbrevs[$abbrev][] = $name;
  31714. }
  31715. }
  31716. return $abbrevs;
  31717. }
  31718. public function asText($namespace = null, $raw = false)
  31719. {
  31720. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31721. $descriptor = new TextDescriptor();
  31722. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  31723. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  31724. return $output->fetch();
  31725. }
  31726. public function asXml($namespace = null, $asDom = false)
  31727. {
  31728. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31729. $descriptor = new XmlDescriptor();
  31730. if ($asDom) {
  31731. return $descriptor->getApplicationDocument($this, $namespace);
  31732. }
  31733. $output = new BufferedOutput();
  31734. $descriptor->describe($output, $this, array('namespace' => $namespace));
  31735. return $output->fetch();
  31736. }
  31737. public function renderException($e, $output)
  31738. {
  31739. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  31740. do {
  31741. $title = sprintf(' [%s] ', \get_class($e));
  31742. $len = Helper::strlen($title);
  31743. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  31744. if (\defined('HHVM_VERSION') && $width > 1 << 31) {
  31745. $width = 1 << 31;
  31746. }
  31747. $lines = array();
  31748. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  31749. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  31750. $lineLength = Helper::strlen($line) + 4;
  31751. $lines[] = array($line, $lineLength);
  31752. $len = max($lineLength, $len);
  31753. }
  31754. }
  31755. $messages = array();
  31756. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  31757. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  31758. foreach ($lines as $line) {
  31759. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  31760. }
  31761. $messages[] = $emptyLine;
  31762. $messages[] = '';
  31763. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  31764. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  31765. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  31766. $trace = $e->getTrace();
  31767. array_unshift($trace, array(
  31768. 'function' => '',
  31769. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  31770. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  31771. 'args' => array(),
  31772. ));
  31773. for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
  31774. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  31775. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  31776. $function = $trace[$i]['function'];
  31777. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  31778. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  31779. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  31780. }
  31781. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  31782. }
  31783. } while ($e = $e->getPrevious());
  31784. if (null !== $this->runningCommand) {
  31785. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  31786. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  31787. }
  31788. }
  31789. protected function getTerminalWidth()
  31790. {
  31791. $dimensions = $this->getTerminalDimensions();
  31792. return $dimensions[0];
  31793. }
  31794. protected function getTerminalHeight()
  31795. {
  31796. $dimensions = $this->getTerminalDimensions();
  31797. return $dimensions[1];
  31798. }
  31799. public function getTerminalDimensions()
  31800. {
  31801. if ($this->terminalDimensions) {
  31802. return $this->terminalDimensions;
  31803. }
  31804. if ('\\' === \DIRECTORY_SEPARATOR) {
  31805. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  31806. return array((int) $matches[1], (int) $matches[2]);
  31807. }
  31808. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  31809. return array((int) $matches[1], (int) $matches[2]);
  31810. }
  31811. }
  31812. if ($sttyString = $this->getSttyColumns()) {
  31813. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  31814. return array((int) $matches[2], (int) $matches[1]);
  31815. }
  31816. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  31817. return array((int) $matches[2], (int) $matches[1]);
  31818. }
  31819. }
  31820. return array(null, null);
  31821. }
  31822. public function setTerminalDimensions($width, $height)
  31823. {
  31824. $this->terminalDimensions = array($width, $height);
  31825. return $this;
  31826. }
  31827. protected function configureIO(InputInterface $input, OutputInterface $output)
  31828. {
  31829. if (true === $input->hasParameterOption(array('--ansi'))) {
  31830. $output->setDecorated(true);
  31831. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  31832. $output->setDecorated(false);
  31833. }
  31834. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  31835. $input->setInteractive(false);
  31836. } elseif (\function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  31837. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  31838. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  31839. $input->setInteractive(false);
  31840. }
  31841. }
  31842. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  31843. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  31844. $input->setInteractive(false);
  31845. } else {
  31846. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  31847. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  31848. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  31849. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  31850. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  31851. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  31852. }
  31853. }
  31854. }
  31855. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  31856. {
  31857. foreach ($command->getHelperSet() as $helper) {
  31858. if ($helper instanceof InputAwareInterface) {
  31859. $helper->setInput($input);
  31860. }
  31861. }
  31862. if (null === $this->dispatcher) {
  31863. return $command->run($input, $output);
  31864. }
  31865. try {
  31866. $command->mergeApplicationDefinition();
  31867. $input->bind($command->getDefinition());
  31868. } catch (ExceptionInterface $e) {
  31869. }
  31870. $event = new ConsoleCommandEvent($command, $input, $output);
  31871. $e = null;
  31872. try {
  31873. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  31874. if ($event->commandShouldRun()) {
  31875. $exitCode = $command->run($input, $output);
  31876. } else {
  31877. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  31878. }
  31879. } catch (\Exception $e) {
  31880. } catch (\Throwable $e) {
  31881. }
  31882. if (null !== $e) {
  31883. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  31884. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  31885. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  31886. if ($x !== $event->getException()) {
  31887. $e = $event->getException();
  31888. }
  31889. $exitCode = $this->getExitCodeForThrowable($e);
  31890. }
  31891. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  31892. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  31893. if (null !== $e) {
  31894. throw $e;
  31895. }
  31896. return $event->getExitCode();
  31897. }
  31898. protected function getCommandName(InputInterface $input)
  31899. {
  31900. return $input->getFirstArgument();
  31901. }
  31902. protected function getDefaultInputDefinition()
  31903. {
  31904. return new InputDefinition(array(
  31905. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  31906. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  31907. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  31908. new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
  31909. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  31910. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  31911. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  31912. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  31913. ));
  31914. }
  31915. protected function getDefaultCommands()
  31916. {
  31917. return array(new HelpCommand(), new ListCommand());
  31918. }
  31919. protected function getDefaultHelperSet()
  31920. {
  31921. return new HelperSet(array(
  31922. new FormatterHelper(),
  31923. new DialogHelper(false),
  31924. new ProgressHelper(false),
  31925. new TableHelper(false),
  31926. new DebugFormatterHelper(),
  31927. new ProcessHelper(),
  31928. new QuestionHelper(),
  31929. ));
  31930. }
  31931. private function getSttyColumns()
  31932. {
  31933. if (!\function_exists('proc_open')) {
  31934. return;
  31935. }
  31936. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  31937. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  31938. if (\is_resource($process)) {
  31939. $info = stream_get_contents($pipes[1]);
  31940. fclose($pipes[1]);
  31941. fclose($pipes[2]);
  31942. proc_close($process);
  31943. return $info;
  31944. }
  31945. }
  31946. private function getConsoleMode()
  31947. {
  31948. if (!\function_exists('proc_open')) {
  31949. return;
  31950. }
  31951. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  31952. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  31953. if (\is_resource($process)) {
  31954. $info = stream_get_contents($pipes[1]);
  31955. fclose($pipes[1]);
  31956. fclose($pipes[2]);
  31957. proc_close($process);
  31958. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  31959. return $matches[2].'x'.$matches[1];
  31960. }
  31961. }
  31962. }
  31963. private function getAbbreviationSuggestions($abbrevs)
  31964. {
  31965. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], \count($abbrevs) > 2 ? sprintf(' and %d more', \count($abbrevs) - 2) : '');
  31966. }
  31967. public function extractNamespace($name, $limit = null)
  31968. {
  31969. $parts = explode(':', $name);
  31970. array_pop($parts);
  31971. return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
  31972. }
  31973. private function findAlternatives($name, $collection)
  31974. {
  31975. $threshold = 1e3;
  31976. $alternatives = array();
  31977. $collectionParts = array();
  31978. foreach ($collection as $item) {
  31979. $collectionParts[$item] = explode(':', $item);
  31980. }
  31981. foreach (explode(':', $name) as $i => $subname) {
  31982. foreach ($collectionParts as $collectionName => $parts) {
  31983. $exists = isset($alternatives[$collectionName]);
  31984. if (!isset($parts[$i]) && $exists) {
  31985. $alternatives[$collectionName] += $threshold;
  31986. continue;
  31987. } elseif (!isset($parts[$i])) {
  31988. continue;
  31989. }
  31990. $lev = levenshtein($subname, $parts[$i]);
  31991. if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  31992. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  31993. } elseif ($exists) {
  31994. $alternatives[$collectionName] += $threshold;
  31995. }
  31996. }
  31997. }
  31998. foreach ($collection as $item) {
  31999. $lev = levenshtein($name, $item);
  32000. if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
  32001. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  32002. }
  32003. }
  32004. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  32005. asort($alternatives);
  32006. return array_keys($alternatives);
  32007. }
  32008. public function setDefaultCommand($commandName)
  32009. {
  32010. $this->defaultCommand = $commandName;
  32011. }
  32012. private function splitStringByWidth($string, $width)
  32013. {
  32014. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  32015. return str_split($string, $width);
  32016. }
  32017. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  32018. $lines = array();
  32019. $line = '';
  32020. foreach (preg_split('//u', $utf8String) as $char) {
  32021. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  32022. $line .= $char;
  32023. continue;
  32024. }
  32025. $lines[] = str_pad($line, $width);
  32026. $line = $char;
  32027. }
  32028. $lines[] = \count($lines) ? str_pad($line, $width) : $line;
  32029. mb_convert_variables($encoding, 'utf8', $lines);
  32030. return $lines;
  32031. }
  32032. private function extractAllNamespaces($name)
  32033. {
  32034. $parts = explode(':', $name, -1);
  32035. $namespaces = array();
  32036. foreach ($parts as $part) {
  32037. if (\count($namespaces)) {
  32038. $namespaces[] = end($namespaces).':'.$part;
  32039. } else {
  32040. $namespaces[] = $part;
  32041. }
  32042. }
  32043. return $namespaces;
  32044. }
  32045. private function init()
  32046. {
  32047. if ($this->initialized) {
  32048. return;
  32049. }
  32050. $this->initialized = true;
  32051. foreach ($this->getDefaultCommands() as $command) {
  32052. $this->add($command);
  32053. }
  32054. }
  32055. private function getExitCodeForThrowable($throwable)
  32056. {
  32057. $exitCode = $throwable->getCode();
  32058. if (is_numeric($exitCode)) {
  32059. $exitCode = (int) $exitCode;
  32060. if (0 === $exitCode) {
  32061. $exitCode = 1;
  32062. }
  32063. } else {
  32064. $exitCode = 1;
  32065. }
  32066. return $exitCode;
  32067. }
  32068. }
  32069. <?php
  32070. namespace Symfony\Component\Console\Command;
  32071. use Symfony\Component\Console\Application;
  32072. use Symfony\Component\Console\Descriptor\TextDescriptor;
  32073. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  32074. use Symfony\Component\Console\Exception\ExceptionInterface;
  32075. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32076. use Symfony\Component\Console\Exception\LogicException;
  32077. use Symfony\Component\Console\Helper\HelperSet;
  32078. use Symfony\Component\Console\Input\InputArgument;
  32079. use Symfony\Component\Console\Input\InputDefinition;
  32080. use Symfony\Component\Console\Input\InputInterface;
  32081. use Symfony\Component\Console\Input\InputOption;
  32082. use Symfony\Component\Console\Output\BufferedOutput;
  32083. use Symfony\Component\Console\Output\OutputInterface;
  32084. class Command
  32085. {
  32086. private $application;
  32087. private $name;
  32088. private $processTitle;
  32089. private $aliases = array();
  32090. private $definition;
  32091. private $help;
  32092. private $description;
  32093. private $ignoreValidationErrors = false;
  32094. private $applicationDefinitionMerged = false;
  32095. private $applicationDefinitionMergedWithArgs = false;
  32096. private $code;
  32097. private $synopsis = array();
  32098. private $usages = array();
  32099. private $helperSet;
  32100. public function __construct($name = null)
  32101. {
  32102. $this->definition = new InputDefinition();
  32103. if (null !== $name) {
  32104. $this->setName($name);
  32105. }
  32106. $this->configure();
  32107. if (!$this->name) {
  32108. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($this)));
  32109. }
  32110. }
  32111. public function ignoreValidationErrors()
  32112. {
  32113. $this->ignoreValidationErrors = true;
  32114. }
  32115. public function setApplication(Application $application = null)
  32116. {
  32117. $this->application = $application;
  32118. if ($application) {
  32119. $this->setHelperSet($application->getHelperSet());
  32120. } else {
  32121. $this->helperSet = null;
  32122. }
  32123. }
  32124. public function setHelperSet(HelperSet $helperSet)
  32125. {
  32126. $this->helperSet = $helperSet;
  32127. }
  32128. public function getHelperSet()
  32129. {
  32130. return $this->helperSet;
  32131. }
  32132. public function getApplication()
  32133. {
  32134. return $this->application;
  32135. }
  32136. public function isEnabled()
  32137. {
  32138. return true;
  32139. }
  32140. protected function configure()
  32141. {
  32142. }
  32143. protected function execute(InputInterface $input, OutputInterface $output)
  32144. {
  32145. throw new LogicException('You must override the execute() method in the concrete command class.');
  32146. }
  32147. protected function interact(InputInterface $input, OutputInterface $output)
  32148. {
  32149. }
  32150. protected function initialize(InputInterface $input, OutputInterface $output)
  32151. {
  32152. }
  32153. public function run(InputInterface $input, OutputInterface $output)
  32154. {
  32155. $this->getSynopsis(true);
  32156. $this->getSynopsis(false);
  32157. $this->mergeApplicationDefinition();
  32158. try {
  32159. $input->bind($this->definition);
  32160. } catch (ExceptionInterface $e) {
  32161. if (!$this->ignoreValidationErrors) {
  32162. throw $e;
  32163. }
  32164. }
  32165. $this->initialize($input, $output);
  32166. if (null !== $this->processTitle) {
  32167. if (\function_exists('cli_set_process_title')) {
  32168. if (!@cli_set_process_title($this->processTitle)) {
  32169. if ('Darwin' === PHP_OS) {
  32170. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  32171. } else {
  32172. cli_set_process_title($this->processTitle);
  32173. }
  32174. }
  32175. } elseif (\function_exists('setproctitle')) {
  32176. setproctitle($this->processTitle);
  32177. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  32178. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  32179. }
  32180. }
  32181. if ($input->isInteractive()) {
  32182. $this->interact($input, $output);
  32183. }
  32184. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  32185. $input->setArgument('command', $this->getName());
  32186. }
  32187. $input->validate();
  32188. if ($this->code) {
  32189. $statusCode = \call_user_func($this->code, $input, $output);
  32190. } else {
  32191. $statusCode = $this->execute($input, $output);
  32192. }
  32193. return is_numeric($statusCode) ? (int) $statusCode : 0;
  32194. }
  32195. public function setCode($code)
  32196. {
  32197. if (!\is_callable($code)) {
  32198. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  32199. }
  32200. if (\PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  32201. $r = new \ReflectionFunction($code);
  32202. if (null === $r->getClosureThis()) {
  32203. if (\PHP_VERSION_ID < 70000) {
  32204. $code = @\Closure::bind($code, $this);
  32205. } else {
  32206. $code = \Closure::bind($code, $this);
  32207. }
  32208. }
  32209. }
  32210. $this->code = $code;
  32211. return $this;
  32212. }
  32213. public function mergeApplicationDefinition($mergeArgs = true)
  32214. {
  32215. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  32216. return;
  32217. }
  32218. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  32219. $this->applicationDefinitionMerged = true;
  32220. if ($mergeArgs) {
  32221. $currentArguments = $this->definition->getArguments();
  32222. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  32223. $this->definition->addArguments($currentArguments);
  32224. $this->applicationDefinitionMergedWithArgs = true;
  32225. }
  32226. }
  32227. public function setDefinition($definition)
  32228. {
  32229. if ($definition instanceof InputDefinition) {
  32230. $this->definition = $definition;
  32231. } else {
  32232. $this->definition->setDefinition($definition);
  32233. }
  32234. $this->applicationDefinitionMerged = false;
  32235. return $this;
  32236. }
  32237. public function getDefinition()
  32238. {
  32239. return $this->definition;
  32240. }
  32241. public function getNativeDefinition()
  32242. {
  32243. return $this->getDefinition();
  32244. }
  32245. public function addArgument($name, $mode = null, $description = '', $default = null)
  32246. {
  32247. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  32248. return $this;
  32249. }
  32250. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  32251. {
  32252. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  32253. return $this;
  32254. }
  32255. public function setName($name)
  32256. {
  32257. $this->validateName($name);
  32258. $this->name = $name;
  32259. return $this;
  32260. }
  32261. public function setProcessTitle($title)
  32262. {
  32263. $this->processTitle = $title;
  32264. return $this;
  32265. }
  32266. public function getName()
  32267. {
  32268. return $this->name;
  32269. }
  32270. public function setDescription($description)
  32271. {
  32272. $this->description = $description;
  32273. return $this;
  32274. }
  32275. public function getDescription()
  32276. {
  32277. return $this->description;
  32278. }
  32279. public function setHelp($help)
  32280. {
  32281. $this->help = $help;
  32282. return $this;
  32283. }
  32284. public function getHelp()
  32285. {
  32286. return $this->help;
  32287. }
  32288. public function getProcessedHelp()
  32289. {
  32290. $name = $this->name;
  32291. $placeholders = array(
  32292. '%command.name%',
  32293. '%command.full_name%',
  32294. );
  32295. $replacements = array(
  32296. $name,
  32297. $_SERVER['PHP_SELF'].' '.$name,
  32298. );
  32299. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  32300. }
  32301. public function setAliases($aliases)
  32302. {
  32303. if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
  32304. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  32305. }
  32306. foreach ($aliases as $alias) {
  32307. $this->validateName($alias);
  32308. }
  32309. $this->aliases = $aliases;
  32310. return $this;
  32311. }
  32312. public function getAliases()
  32313. {
  32314. return $this->aliases;
  32315. }
  32316. public function getSynopsis($short = false)
  32317. {
  32318. $key = $short ? 'short' : 'long';
  32319. if (!isset($this->synopsis[$key])) {
  32320. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  32321. }
  32322. return $this->synopsis[$key];
  32323. }
  32324. public function addUsage($usage)
  32325. {
  32326. if (0 !== strpos($usage, $this->name)) {
  32327. $usage = sprintf('%s %s', $this->name, $usage);
  32328. }
  32329. $this->usages[] = $usage;
  32330. return $this;
  32331. }
  32332. public function getUsages()
  32333. {
  32334. return $this->usages;
  32335. }
  32336. public function getHelper($name)
  32337. {
  32338. if (null === $this->helperSet) {
  32339. throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
  32340. }
  32341. return $this->helperSet->get($name);
  32342. }
  32343. public function asText()
  32344. {
  32345. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32346. $descriptor = new TextDescriptor();
  32347. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  32348. $descriptor->describe($output, $this, array('raw_output' => true));
  32349. return $output->fetch();
  32350. }
  32351. public function asXml($asDom = false)
  32352. {
  32353. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32354. $descriptor = new XmlDescriptor();
  32355. if ($asDom) {
  32356. return $descriptor->getCommandDocument($this);
  32357. }
  32358. $output = new BufferedOutput();
  32359. $descriptor->describe($output, $this);
  32360. return $output->fetch();
  32361. }
  32362. private function validateName($name)
  32363. {
  32364. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  32365. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  32366. }
  32367. }
  32368. }
  32369. <?php
  32370. namespace Symfony\Component\Console\Command;
  32371. use Symfony\Component\Console\Helper\DescriptorHelper;
  32372. use Symfony\Component\Console\Input\InputArgument;
  32373. use Symfony\Component\Console\Input\InputInterface;
  32374. use Symfony\Component\Console\Input\InputOption;
  32375. use Symfony\Component\Console\Output\OutputInterface;
  32376. class HelpCommand extends Command
  32377. {
  32378. private $command;
  32379. protected function configure()
  32380. {
  32381. $this->ignoreValidationErrors();
  32382. $this
  32383. ->setName('help')
  32384. ->setDefinition(array(
  32385. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  32386. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  32387. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  32388. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  32389. ))
  32390. ->setDescription('Displays help for a command')
  32391. ->setHelp(<<<'EOF'
  32392. The <info>%command.name%</info> command displays help for a given command:
  32393. <info>php %command.full_name% list</info>
  32394. You can also output the help in other formats by using the <comment>--format</comment> option:
  32395. <info>php %command.full_name% --format=xml list</info>
  32396. To display the list of available commands, please use the <info>list</info> command.
  32397. EOF
  32398. )
  32399. ;
  32400. }
  32401. public function setCommand(Command $command)
  32402. {
  32403. $this->command = $command;
  32404. }
  32405. protected function execute(InputInterface $input, OutputInterface $output)
  32406. {
  32407. if (null === $this->command) {
  32408. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  32409. }
  32410. if ($input->getOption('xml')) {
  32411. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  32412. $input->setOption('format', 'xml');
  32413. }
  32414. $helper = new DescriptorHelper();
  32415. $helper->describe($output, $this->command, array(
  32416. 'format' => $input->getOption('format'),
  32417. 'raw_text' => $input->getOption('raw'),
  32418. ));
  32419. $this->command = null;
  32420. }
  32421. }
  32422. <?php
  32423. namespace Symfony\Component\Console\Command;
  32424. use Symfony\Component\Console\Helper\DescriptorHelper;
  32425. use Symfony\Component\Console\Input\InputArgument;
  32426. use Symfony\Component\Console\Input\InputDefinition;
  32427. use Symfony\Component\Console\Input\InputInterface;
  32428. use Symfony\Component\Console\Input\InputOption;
  32429. use Symfony\Component\Console\Output\OutputInterface;
  32430. class ListCommand extends Command
  32431. {
  32432. protected function configure()
  32433. {
  32434. $this
  32435. ->setName('list')
  32436. ->setDefinition($this->createDefinition())
  32437. ->setDescription('Lists commands')
  32438. ->setHelp(<<<'EOF'
  32439. The <info>%command.name%</info> command lists all commands:
  32440. <info>php %command.full_name%</info>
  32441. You can also display the commands for a specific namespace:
  32442. <info>php %command.full_name% test</info>
  32443. You can also output the information in other formats by using the <comment>--format</comment> option:
  32444. <info>php %command.full_name% --format=xml</info>
  32445. It's also possible to get raw list of commands (useful for embedding command runner):
  32446. <info>php %command.full_name% --raw</info>
  32447. EOF
  32448. )
  32449. ;
  32450. }
  32451. public function getNativeDefinition()
  32452. {
  32453. return $this->createDefinition();
  32454. }
  32455. protected function execute(InputInterface $input, OutputInterface $output)
  32456. {
  32457. if ($input->getOption('xml')) {
  32458. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  32459. $input->setOption('format', 'xml');
  32460. }
  32461. $helper = new DescriptorHelper();
  32462. $helper->describe($output, $this->getApplication(), array(
  32463. 'format' => $input->getOption('format'),
  32464. 'raw_text' => $input->getOption('raw'),
  32465. 'namespace' => $input->getArgument('namespace'),
  32466. ));
  32467. }
  32468. private function createDefinition()
  32469. {
  32470. return new InputDefinition(array(
  32471. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  32472. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  32473. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  32474. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  32475. ));
  32476. }
  32477. }
  32478. <?php
  32479. namespace Symfony\Component\Console;
  32480. final class ConsoleEvents
  32481. {
  32482. const COMMAND = 'console.command';
  32483. const TERMINATE = 'console.terminate';
  32484. const EXCEPTION = 'console.exception';
  32485. }
  32486. <?php
  32487. namespace Symfony\Component\Console\Descriptor;
  32488. use Symfony\Component\Console\Application;
  32489. use Symfony\Component\Console\Command\Command;
  32490. use Symfony\Component\Console\Exception\CommandNotFoundException;
  32491. class ApplicationDescription
  32492. {
  32493. const GLOBAL_NAMESPACE = '_global';
  32494. private $application;
  32495. private $namespace;
  32496. private $namespaces;
  32497. private $commands;
  32498. private $aliases;
  32499. public function __construct(Application $application, $namespace = null)
  32500. {
  32501. $this->application = $application;
  32502. $this->namespace = $namespace;
  32503. }
  32504. public function getNamespaces()
  32505. {
  32506. if (null === $this->namespaces) {
  32507. $this->inspectApplication();
  32508. }
  32509. return $this->namespaces;
  32510. }
  32511. public function getCommands()
  32512. {
  32513. if (null === $this->commands) {
  32514. $this->inspectApplication();
  32515. }
  32516. return $this->commands;
  32517. }
  32518. public function getCommand($name)
  32519. {
  32520. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  32521. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  32522. }
  32523. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  32524. }
  32525. private function inspectApplication()
  32526. {
  32527. $this->commands = array();
  32528. $this->namespaces = array();
  32529. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  32530. foreach ($this->sortCommands($all) as $namespace => $commands) {
  32531. $names = array();
  32532. foreach ($commands as $name => $command) {
  32533. if (!$command->getName()) {
  32534. continue;
  32535. }
  32536. if ($command->getName() === $name) {
  32537. $this->commands[$name] = $command;
  32538. } else {
  32539. $this->aliases[$name] = $command;
  32540. }
  32541. $names[] = $name;
  32542. }
  32543. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  32544. }
  32545. }
  32546. private function sortCommands(array $commands)
  32547. {
  32548. $namespacedCommands = array();
  32549. $globalCommands = array();
  32550. foreach ($commands as $name => $command) {
  32551. $key = $this->application->extractNamespace($name, 1);
  32552. if (!$key) {
  32553. $globalCommands['_global'][$name] = $command;
  32554. } else {
  32555. $namespacedCommands[$key][$name] = $command;
  32556. }
  32557. }
  32558. ksort($namespacedCommands);
  32559. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  32560. foreach ($namespacedCommands as &$commandsSet) {
  32561. ksort($commandsSet);
  32562. }
  32563. unset($commandsSet);
  32564. return $namespacedCommands;
  32565. }
  32566. }
  32567. <?php
  32568. namespace Symfony\Component\Console\Descriptor;
  32569. use Symfony\Component\Console\Application;
  32570. use Symfony\Component\Console\Command\Command;
  32571. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32572. use Symfony\Component\Console\Input\InputArgument;
  32573. use Symfony\Component\Console\Input\InputDefinition;
  32574. use Symfony\Component\Console\Input\InputOption;
  32575. use Symfony\Component\Console\Output\OutputInterface;
  32576. abstract class Descriptor implements DescriptorInterface
  32577. {
  32578. private $output;
  32579. public function describe(OutputInterface $output, $object, array $options = array())
  32580. {
  32581. $this->output = $output;
  32582. switch (true) {
  32583. case $object instanceof InputArgument:
  32584. $this->describeInputArgument($object, $options);
  32585. break;
  32586. case $object instanceof InputOption:
  32587. $this->describeInputOption($object, $options);
  32588. break;
  32589. case $object instanceof InputDefinition:
  32590. $this->describeInputDefinition($object, $options);
  32591. break;
  32592. case $object instanceof Command:
  32593. $this->describeCommand($object, $options);
  32594. break;
  32595. case $object instanceof Application:
  32596. $this->describeApplication($object, $options);
  32597. break;
  32598. default:
  32599. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object)));
  32600. }
  32601. }
  32602. protected function write($content, $decorated = false)
  32603. {
  32604. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  32605. }
  32606. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  32607. abstract protected function describeInputOption(InputOption $option, array $options = array());
  32608. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  32609. abstract protected function describeCommand(Command $command, array $options = array());
  32610. abstract protected function describeApplication(Application $application, array $options = array());
  32611. }
  32612. <?php
  32613. namespace Symfony\Component\Console\Descriptor;
  32614. use Symfony\Component\Console\Output\OutputInterface;
  32615. interface DescriptorInterface
  32616. {
  32617. public function describe(OutputInterface $output, $object, array $options = array());
  32618. }
  32619. <?php
  32620. namespace Symfony\Component\Console\Descriptor;
  32621. use Symfony\Component\Console\Application;
  32622. use Symfony\Component\Console\Command\Command;
  32623. use Symfony\Component\Console\Input\InputArgument;
  32624. use Symfony\Component\Console\Input\InputDefinition;
  32625. use Symfony\Component\Console\Input\InputOption;
  32626. class JsonDescriptor extends Descriptor
  32627. {
  32628. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32629. {
  32630. $this->writeData($this->getInputArgumentData($argument), $options);
  32631. }
  32632. protected function describeInputOption(InputOption $option, array $options = array())
  32633. {
  32634. $this->writeData($this->getInputOptionData($option), $options);
  32635. }
  32636. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32637. {
  32638. $this->writeData($this->getInputDefinitionData($definition), $options);
  32639. }
  32640. protected function describeCommand(Command $command, array $options = array())
  32641. {
  32642. $this->writeData($this->getCommandData($command), $options);
  32643. }
  32644. protected function describeApplication(Application $application, array $options = array())
  32645. {
  32646. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32647. $description = new ApplicationDescription($application, $describedNamespace);
  32648. $commands = array();
  32649. foreach ($description->getCommands() as $command) {
  32650. $commands[] = $this->getCommandData($command);
  32651. }
  32652. $data = $describedNamespace
  32653. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  32654. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  32655. $this->writeData($data, $options);
  32656. }
  32657. private function writeData(array $data, array $options)
  32658. {
  32659. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  32660. }
  32661. private function getInputArgumentData(InputArgument $argument)
  32662. {
  32663. return array(
  32664. 'name' => $argument->getName(),
  32665. 'is_required' => $argument->isRequired(),
  32666. 'is_array' => $argument->isArray(),
  32667. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  32668. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  32669. );
  32670. }
  32671. private function getInputOptionData(InputOption $option)
  32672. {
  32673. return array(
  32674. 'name' => '--'.$option->getName(),
  32675. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  32676. 'accept_value' => $option->acceptValue(),
  32677. 'is_value_required' => $option->isValueRequired(),
  32678. 'is_multiple' => $option->isArray(),
  32679. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  32680. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  32681. );
  32682. }
  32683. private function getInputDefinitionData(InputDefinition $definition)
  32684. {
  32685. $inputArguments = array();
  32686. foreach ($definition->getArguments() as $name => $argument) {
  32687. $inputArguments[$name] = $this->getInputArgumentData($argument);
  32688. }
  32689. $inputOptions = array();
  32690. foreach ($definition->getOptions() as $name => $option) {
  32691. $inputOptions[$name] = $this->getInputOptionData($option);
  32692. }
  32693. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  32694. }
  32695. private function getCommandData(Command $command)
  32696. {
  32697. $command->getSynopsis();
  32698. $command->mergeApplicationDefinition(false);
  32699. return array(
  32700. 'name' => $command->getName(),
  32701. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  32702. 'description' => $command->getDescription(),
  32703. 'help' => $command->getProcessedHelp(),
  32704. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  32705. );
  32706. }
  32707. }
  32708. <?php
  32709. namespace Symfony\Component\Console\Descriptor;
  32710. use Symfony\Component\Console\Application;
  32711. use Symfony\Component\Console\Command\Command;
  32712. use Symfony\Component\Console\Helper\Helper;
  32713. use Symfony\Component\Console\Input\InputArgument;
  32714. use Symfony\Component\Console\Input\InputDefinition;
  32715. use Symfony\Component\Console\Input\InputOption;
  32716. class MarkdownDescriptor extends Descriptor
  32717. {
  32718. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32719. {
  32720. $this->write(
  32721. '**'.$argument->getName().':**'."\n\n"
  32722. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  32723. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  32724. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  32725. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  32726. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  32727. );
  32728. }
  32729. protected function describeInputOption(InputOption $option, array $options = array())
  32730. {
  32731. $this->write(
  32732. '**'.$option->getName().':**'."\n\n"
  32733. .'* Name: `--'.$option->getName().'`'."\n"
  32734. .'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '<none>')."\n"
  32735. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  32736. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  32737. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  32738. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  32739. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  32740. );
  32741. }
  32742. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32743. {
  32744. if ($showArguments = \count($definition->getArguments()) > 0) {
  32745. $this->write('### Arguments:');
  32746. foreach ($definition->getArguments() as $argument) {
  32747. $this->write("\n\n");
  32748. $this->write($this->describeInputArgument($argument));
  32749. }
  32750. }
  32751. if (\count($definition->getOptions()) > 0) {
  32752. if ($showArguments) {
  32753. $this->write("\n\n");
  32754. }
  32755. $this->write('### Options:');
  32756. foreach ($definition->getOptions() as $option) {
  32757. $this->write("\n\n");
  32758. $this->write($this->describeInputOption($option));
  32759. }
  32760. }
  32761. }
  32762. protected function describeCommand(Command $command, array $options = array())
  32763. {
  32764. $command->getSynopsis();
  32765. $command->mergeApplicationDefinition(false);
  32766. $this->write(
  32767. $command->getName()."\n"
  32768. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  32769. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  32770. .'* Usage:'."\n\n"
  32771. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  32772. return $carry.' * `'.$usage.'`'."\n";
  32773. })
  32774. );
  32775. if ($help = $command->getProcessedHelp()) {
  32776. $this->write("\n");
  32777. $this->write($help);
  32778. }
  32779. if ($command->getNativeDefinition()) {
  32780. $this->write("\n\n");
  32781. $this->describeInputDefinition($command->getNativeDefinition());
  32782. }
  32783. }
  32784. protected function describeApplication(Application $application, array $options = array())
  32785. {
  32786. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32787. $description = new ApplicationDescription($application, $describedNamespace);
  32788. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  32789. foreach ($description->getNamespaces() as $namespace) {
  32790. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  32791. $this->write("\n\n");
  32792. $this->write('**'.$namespace['id'].':**');
  32793. }
  32794. $this->write("\n\n");
  32795. $this->write(implode("\n", array_map(function ($commandName) {
  32796. return '* '.$commandName;
  32797. }, $namespace['commands'])));
  32798. }
  32799. foreach ($description->getCommands() as $command) {
  32800. $this->write("\n\n");
  32801. $this->write($this->describeCommand($command));
  32802. }
  32803. }
  32804. }
  32805. <?php
  32806. namespace Symfony\Component\Console\Descriptor;
  32807. use Symfony\Component\Console\Application;
  32808. use Symfony\Component\Console\Command\Command;
  32809. use Symfony\Component\Console\Formatter\OutputFormatter;
  32810. use Symfony\Component\Console\Helper\Helper;
  32811. use Symfony\Component\Console\Input\InputArgument;
  32812. use Symfony\Component\Console\Input\InputDefinition;
  32813. use Symfony\Component\Console\Input\InputOption;
  32814. class TextDescriptor extends Descriptor
  32815. {
  32816. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32817. {
  32818. if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
  32819. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  32820. } else {
  32821. $default = '';
  32822. }
  32823. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  32824. $spacingWidth = $totalWidth - \strlen($argument->getName());
  32825. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  32826. $argument->getName(),
  32827. str_repeat(' ', $spacingWidth),
  32828. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  32829. $default
  32830. ), $options);
  32831. }
  32832. protected function describeInputOption(InputOption $option, array $options = array())
  32833. {
  32834. if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
  32835. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  32836. } else {
  32837. $default = '';
  32838. }
  32839. $value = '';
  32840. if ($option->acceptValue()) {
  32841. $value = '='.strtoupper($option->getName());
  32842. if ($option->isValueOptional()) {
  32843. $value = '['.$value.']';
  32844. }
  32845. }
  32846. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  32847. $synopsis = sprintf('%s%s',
  32848. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  32849. sprintf('--%s%s', $option->getName(), $value)
  32850. );
  32851. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  32852. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  32853. $synopsis,
  32854. str_repeat(' ', $spacingWidth),
  32855. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  32856. $default,
  32857. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  32858. ), $options);
  32859. }
  32860. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32861. {
  32862. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  32863. foreach ($definition->getArguments() as $argument) {
  32864. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  32865. }
  32866. if ($definition->getArguments()) {
  32867. $this->writeText('<comment>Arguments:</comment>', $options);
  32868. $this->writeText("\n");
  32869. foreach ($definition->getArguments() as $argument) {
  32870. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  32871. $this->writeText("\n");
  32872. }
  32873. }
  32874. if ($definition->getArguments() && $definition->getOptions()) {
  32875. $this->writeText("\n");
  32876. }
  32877. if ($definition->getOptions()) {
  32878. $laterOptions = array();
  32879. $this->writeText('<comment>Options:</comment>', $options);
  32880. foreach ($definition->getOptions() as $option) {
  32881. if (\strlen($option->getShortcut()) > 1) {
  32882. $laterOptions[] = $option;
  32883. continue;
  32884. }
  32885. $this->writeText("\n");
  32886. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  32887. }
  32888. foreach ($laterOptions as $option) {
  32889. $this->writeText("\n");
  32890. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  32891. }
  32892. }
  32893. }
  32894. protected function describeCommand(Command $command, array $options = array())
  32895. {
  32896. $command->getSynopsis(true);
  32897. $command->getSynopsis(false);
  32898. $command->mergeApplicationDefinition(false);
  32899. $this->writeText('<comment>Usage:</comment>', $options);
  32900. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  32901. $this->writeText("\n");
  32902. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  32903. }
  32904. $this->writeText("\n");
  32905. $definition = $command->getNativeDefinition();
  32906. if ($definition->getOptions() || $definition->getArguments()) {
  32907. $this->writeText("\n");
  32908. $this->describeInputDefinition($definition, $options);
  32909. $this->writeText("\n");
  32910. }
  32911. if ($help = $command->getProcessedHelp()) {
  32912. $this->writeText("\n");
  32913. $this->writeText('<comment>Help:</comment>', $options);
  32914. $this->writeText("\n");
  32915. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  32916. $this->writeText("\n");
  32917. }
  32918. }
  32919. protected function describeApplication(Application $application, array $options = array())
  32920. {
  32921. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32922. $description = new ApplicationDescription($application, $describedNamespace);
  32923. if (isset($options['raw_text']) && $options['raw_text']) {
  32924. $width = $this->getColumnWidth($description->getCommands());
  32925. foreach ($description->getCommands() as $command) {
  32926. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  32927. $this->writeText("\n");
  32928. }
  32929. } else {
  32930. if ('' != $help = $application->getHelp()) {
  32931. $this->writeText("$help\n\n", $options);
  32932. }
  32933. $this->writeText("<comment>Usage:</comment>\n", $options);
  32934. $this->writeText(" command [options] [arguments]\n\n", $options);
  32935. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  32936. $this->writeText("\n");
  32937. $this->writeText("\n");
  32938. $width = $this->getColumnWidth($description->getCommands());
  32939. if ($describedNamespace) {
  32940. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  32941. } else {
  32942. $this->writeText('<comment>Available commands:</comment>', $options);
  32943. }
  32944. foreach ($description->getNamespaces() as $namespace) {
  32945. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  32946. $this->writeText("\n");
  32947. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  32948. }
  32949. foreach ($namespace['commands'] as $name) {
  32950. $this->writeText("\n");
  32951. $spacingWidth = $width - Helper::strlen($name);
  32952. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  32953. }
  32954. }
  32955. $this->writeText("\n");
  32956. }
  32957. }
  32958. private function writeText($content, array $options = array())
  32959. {
  32960. $this->write(
  32961. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  32962. isset($options['raw_output']) ? !$options['raw_output'] : true
  32963. );
  32964. }
  32965. private function formatDefaultValue($default)
  32966. {
  32967. if (INF === $default) {
  32968. return 'INF';
  32969. }
  32970. if (\is_string($default)) {
  32971. $default = OutputFormatter::escape($default);
  32972. } elseif (\is_array($default)) {
  32973. foreach ($default as $key => $value) {
  32974. if (\is_string($value)) {
  32975. $default[$key] = OutputFormatter::escape($value);
  32976. }
  32977. }
  32978. }
  32979. if (\PHP_VERSION_ID < 50400) {
  32980. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  32981. }
  32982. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  32983. }
  32984. private function getColumnWidth(array $commands)
  32985. {
  32986. $widths = array();
  32987. foreach ($commands as $command) {
  32988. $widths[] = Helper::strlen($command->getName());
  32989. foreach ($command->getAliases() as $alias) {
  32990. $widths[] = Helper::strlen($alias);
  32991. }
  32992. }
  32993. return max($widths) + 2;
  32994. }
  32995. private function calculateTotalWidthForOptions(array $options)
  32996. {
  32997. $totalWidth = 0;
  32998. foreach ($options as $option) {
  32999. $nameLength = 1 + max(\strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  33000. if ($option->acceptValue()) {
  33001. $valueLength = 1 + Helper::strlen($option->getName());
  33002. $valueLength += $option->isValueOptional() ? 2 : 0;
  33003. $nameLength += $valueLength;
  33004. }
  33005. $totalWidth = max($totalWidth, $nameLength);
  33006. }
  33007. return $totalWidth;
  33008. }
  33009. }
  33010. <?php
  33011. namespace Symfony\Component\Console\Descriptor;
  33012. use Symfony\Component\Console\Application;
  33013. use Symfony\Component\Console\Command\Command;
  33014. use Symfony\Component\Console\Input\InputArgument;
  33015. use Symfony\Component\Console\Input\InputDefinition;
  33016. use Symfony\Component\Console\Input\InputOption;
  33017. class XmlDescriptor extends Descriptor
  33018. {
  33019. public function getInputDefinitionDocument(InputDefinition $definition)
  33020. {
  33021. $dom = new \DOMDocument('1.0', 'UTF-8');
  33022. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  33023. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  33024. foreach ($definition->getArguments() as $argument) {
  33025. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  33026. }
  33027. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  33028. foreach ($definition->getOptions() as $option) {
  33029. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  33030. }
  33031. return $dom;
  33032. }
  33033. public function getCommandDocument(Command $command)
  33034. {
  33035. $dom = new \DOMDocument('1.0', 'UTF-8');
  33036. $dom->appendChild($commandXML = $dom->createElement('command'));
  33037. $command->getSynopsis();
  33038. $command->mergeApplicationDefinition(false);
  33039. $commandXML->setAttribute('id', $command->getName());
  33040. $commandXML->setAttribute('name', $command->getName());
  33041. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  33042. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  33043. $usagesXML->appendChild($dom->createElement('usage', $usage));
  33044. }
  33045. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  33046. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  33047. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  33048. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  33049. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  33050. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  33051. return $dom;
  33052. }
  33053. public function getApplicationDocument(Application $application, $namespace = null)
  33054. {
  33055. $dom = new \DOMDocument('1.0', 'UTF-8');
  33056. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  33057. if ('UNKNOWN' !== $application->getName()) {
  33058. $rootXml->setAttribute('name', $application->getName());
  33059. if ('UNKNOWN' !== $application->getVersion()) {
  33060. $rootXml->setAttribute('version', $application->getVersion());
  33061. }
  33062. }
  33063. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  33064. $description = new ApplicationDescription($application, $namespace);
  33065. if ($namespace) {
  33066. $commandsXML->setAttribute('namespace', $namespace);
  33067. }
  33068. foreach ($description->getCommands() as $command) {
  33069. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  33070. }
  33071. if (!$namespace) {
  33072. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  33073. foreach ($description->getNamespaces() as $namespaceDescription) {
  33074. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  33075. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  33076. foreach ($namespaceDescription['commands'] as $name) {
  33077. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  33078. $commandXML->appendChild($dom->createTextNode($name));
  33079. }
  33080. }
  33081. }
  33082. return $dom;
  33083. }
  33084. protected function describeInputArgument(InputArgument $argument, array $options = array())
  33085. {
  33086. $this->writeDocument($this->getInputArgumentDocument($argument));
  33087. }
  33088. protected function describeInputOption(InputOption $option, array $options = array())
  33089. {
  33090. $this->writeDocument($this->getInputOptionDocument($option));
  33091. }
  33092. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  33093. {
  33094. $this->writeDocument($this->getInputDefinitionDocument($definition));
  33095. }
  33096. protected function describeCommand(Command $command, array $options = array())
  33097. {
  33098. $this->writeDocument($this->getCommandDocument($command));
  33099. }
  33100. protected function describeApplication(Application $application, array $options = array())
  33101. {
  33102. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  33103. }
  33104. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  33105. {
  33106. foreach ($importedParent->childNodes as $childNode) {
  33107. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  33108. }
  33109. }
  33110. private function writeDocument(\DOMDocument $dom)
  33111. {
  33112. $dom->formatOutput = true;
  33113. $this->write($dom->saveXML());
  33114. }
  33115. private function getInputArgumentDocument(InputArgument $argument)
  33116. {
  33117. $dom = new \DOMDocument('1.0', 'UTF-8');
  33118. $dom->appendChild($objectXML = $dom->createElement('argument'));
  33119. $objectXML->setAttribute('name', $argument->getName());
  33120. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  33121. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  33122. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  33123. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  33124. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  33125. $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  33126. foreach ($defaults as $default) {
  33127. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  33128. $defaultXML->appendChild($dom->createTextNode($default));
  33129. }
  33130. return $dom;
  33131. }
  33132. private function getInputOptionDocument(InputOption $option)
  33133. {
  33134. $dom = new \DOMDocument('1.0', 'UTF-8');
  33135. $dom->appendChild($objectXML = $dom->createElement('option'));
  33136. $objectXML->setAttribute('name', '--'.$option->getName());
  33137. $pos = strpos($option->getShortcut(), '|');
  33138. if (false !== $pos) {
  33139. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  33140. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  33141. } else {
  33142. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  33143. }
  33144. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  33145. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  33146. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  33147. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  33148. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  33149. if ($option->acceptValue()) {
  33150. $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  33151. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  33152. if (!empty($defaults)) {
  33153. foreach ($defaults as $default) {
  33154. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  33155. $defaultXML->appendChild($dom->createTextNode($default));
  33156. }
  33157. }
  33158. }
  33159. return $dom;
  33160. }
  33161. }
  33162. <?php
  33163. namespace Symfony\Component\Console\Event;
  33164. class ConsoleCommandEvent extends ConsoleEvent
  33165. {
  33166. const RETURN_CODE_DISABLED = 113;
  33167. private $commandShouldRun = true;
  33168. public function disableCommand()
  33169. {
  33170. return $this->commandShouldRun = false;
  33171. }
  33172. public function enableCommand()
  33173. {
  33174. return $this->commandShouldRun = true;
  33175. }
  33176. public function commandShouldRun()
  33177. {
  33178. return $this->commandShouldRun;
  33179. }
  33180. }
  33181. <?php
  33182. namespace Symfony\Component\Console\Event;
  33183. use Symfony\Component\Console\Command\Command;
  33184. use Symfony\Component\Console\Input\InputInterface;
  33185. use Symfony\Component\Console\Output\OutputInterface;
  33186. use Symfony\Component\EventDispatcher\Event;
  33187. class ConsoleEvent extends Event
  33188. {
  33189. protected $command;
  33190. private $input;
  33191. private $output;
  33192. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  33193. {
  33194. $this->command = $command;
  33195. $this->input = $input;
  33196. $this->output = $output;
  33197. }
  33198. public function getCommand()
  33199. {
  33200. return $this->command;
  33201. }
  33202. public function getInput()
  33203. {
  33204. return $this->input;
  33205. }
  33206. public function getOutput()
  33207. {
  33208. return $this->output;
  33209. }
  33210. }
  33211. <?php
  33212. namespace Symfony\Component\Console\Event;
  33213. use Symfony\Component\Console\Command\Command;
  33214. use Symfony\Component\Console\Input\InputInterface;
  33215. use Symfony\Component\Console\Output\OutputInterface;
  33216. class ConsoleExceptionEvent extends ConsoleEvent
  33217. {
  33218. private $exception;
  33219. private $exitCode;
  33220. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  33221. {
  33222. parent::__construct($command, $input, $output);
  33223. $this->setException($exception);
  33224. $this->exitCode = (int) $exitCode;
  33225. }
  33226. public function getException()
  33227. {
  33228. return $this->exception;
  33229. }
  33230. public function setException(\Exception $exception)
  33231. {
  33232. $this->exception = $exception;
  33233. }
  33234. public function getExitCode()
  33235. {
  33236. return $this->exitCode;
  33237. }
  33238. }
  33239. <?php
  33240. namespace Symfony\Component\Console\Event;
  33241. use Symfony\Component\Console\Command\Command;
  33242. use Symfony\Component\Console\Input\InputInterface;
  33243. use Symfony\Component\Console\Output\OutputInterface;
  33244. class ConsoleTerminateEvent extends ConsoleEvent
  33245. {
  33246. private $exitCode;
  33247. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  33248. {
  33249. parent::__construct($command, $input, $output);
  33250. $this->setExitCode($exitCode);
  33251. }
  33252. public function setExitCode($exitCode)
  33253. {
  33254. $this->exitCode = (int) $exitCode;
  33255. }
  33256. public function getExitCode()
  33257. {
  33258. return $this->exitCode;
  33259. }
  33260. }
  33261. <?php
  33262. namespace Symfony\Component\Console\Exception;
  33263. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  33264. {
  33265. private $alternatives;
  33266. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  33267. {
  33268. parent::__construct($message, $code, $previous);
  33269. $this->alternatives = $alternatives;
  33270. }
  33271. public function getAlternatives()
  33272. {
  33273. return $this->alternatives;
  33274. }
  33275. }
  33276. <?php
  33277. namespace Symfony\Component\Console\Exception;
  33278. interface ExceptionInterface
  33279. {
  33280. }
  33281. <?php
  33282. namespace Symfony\Component\Console\Exception;
  33283. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  33284. {
  33285. }
  33286. <?php
  33287. namespace Symfony\Component\Console\Exception;
  33288. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  33289. {
  33290. }
  33291. <?php
  33292. namespace Symfony\Component\Console\Exception;
  33293. class LogicException extends \LogicException implements ExceptionInterface
  33294. {
  33295. }
  33296. <?php
  33297. namespace Symfony\Component\Console\Exception;
  33298. class RuntimeException extends \RuntimeException implements ExceptionInterface
  33299. {
  33300. }
  33301. <?php
  33302. namespace Symfony\Component\Console\Formatter;
  33303. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33304. class OutputFormatter implements OutputFormatterInterface
  33305. {
  33306. private $decorated;
  33307. private $styles = array();
  33308. private $styleStack;
  33309. public static function escape($text)
  33310. {
  33311. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  33312. return self::escapeTrailingBackslash($text);
  33313. }
  33314. public static function escapeTrailingBackslash($text)
  33315. {
  33316. if ('\\' === substr($text, -1)) {
  33317. $len = \strlen($text);
  33318. $text = rtrim($text, '\\');
  33319. $text = str_replace("\0", '', $text);
  33320. $text .= str_repeat("\0", $len - \strlen($text));
  33321. }
  33322. return $text;
  33323. }
  33324. public function __construct($decorated = false, array $styles = array())
  33325. {
  33326. $this->decorated = (bool) $decorated;
  33327. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  33328. $this->setStyle('info', new OutputFormatterStyle('green'));
  33329. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  33330. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  33331. foreach ($styles as $name => $style) {
  33332. $this->setStyle($name, $style);
  33333. }
  33334. $this->styleStack = new OutputFormatterStyleStack();
  33335. }
  33336. public function setDecorated($decorated)
  33337. {
  33338. $this->decorated = (bool) $decorated;
  33339. }
  33340. public function isDecorated()
  33341. {
  33342. return $this->decorated;
  33343. }
  33344. public function setStyle($name, OutputFormatterStyleInterface $style)
  33345. {
  33346. $this->styles[strtolower($name)] = $style;
  33347. }
  33348. public function hasStyle($name)
  33349. {
  33350. return isset($this->styles[strtolower($name)]);
  33351. }
  33352. public function getStyle($name)
  33353. {
  33354. if (!$this->hasStyle($name)) {
  33355. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  33356. }
  33357. return $this->styles[strtolower($name)];
  33358. }
  33359. public function format($message)
  33360. {
  33361. $message = (string) $message;
  33362. $offset = 0;
  33363. $output = '';
  33364. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  33365. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  33366. foreach ($matches[0] as $i => $match) {
  33367. $pos = $match[1];
  33368. $text = $match[0];
  33369. if (0 != $pos && '\\' == $message[$pos - 1]) {
  33370. continue;
  33371. }
  33372. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  33373. $offset = $pos + \strlen($text);
  33374. if ($open = '/' != $text[1]) {
  33375. $tag = $matches[1][$i][0];
  33376. } else {
  33377. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  33378. }
  33379. if (!$open && !$tag) {
  33380. $this->styleStack->pop();
  33381. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  33382. $output .= $this->applyCurrentStyle($text);
  33383. } elseif ($open) {
  33384. $this->styleStack->push($style);
  33385. } else {
  33386. $this->styleStack->pop($style);
  33387. }
  33388. }
  33389. $output .= $this->applyCurrentStyle(substr($message, $offset));
  33390. if (false !== strpos($output, "\0")) {
  33391. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  33392. }
  33393. return str_replace('\\<', '<', $output);
  33394. }
  33395. public function getStyleStack()
  33396. {
  33397. return $this->styleStack;
  33398. }
  33399. private function createStyleFromString($string)
  33400. {
  33401. if (isset($this->styles[$string])) {
  33402. return $this->styles[$string];
  33403. }
  33404. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  33405. return false;
  33406. }
  33407. $style = new OutputFormatterStyle();
  33408. foreach ($matches as $match) {
  33409. array_shift($match);
  33410. if ('fg' == $match[0]) {
  33411. $style->setForeground($match[1]);
  33412. } elseif ('bg' == $match[0]) {
  33413. $style->setBackground($match[1]);
  33414. } else {
  33415. try {
  33416. $style->setOption($match[1]);
  33417. } catch (\InvalidArgumentException $e) {
  33418. return false;
  33419. }
  33420. }
  33421. }
  33422. return $style;
  33423. }
  33424. private function applyCurrentStyle($text)
  33425. {
  33426. return $this->isDecorated() && \strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  33427. }
  33428. }
  33429. <?php
  33430. namespace Symfony\Component\Console\Formatter;
  33431. interface OutputFormatterInterface
  33432. {
  33433. public function setDecorated($decorated);
  33434. public function isDecorated();
  33435. public function setStyle($name, OutputFormatterStyleInterface $style);
  33436. public function hasStyle($name);
  33437. public function getStyle($name);
  33438. public function format($message);
  33439. }
  33440. <?php
  33441. namespace Symfony\Component\Console\Formatter;
  33442. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33443. class OutputFormatterStyle implements OutputFormatterStyleInterface
  33444. {
  33445. private static $availableForegroundColors = array(
  33446. 'black' => array('set' => 30, 'unset' => 39),
  33447. 'red' => array('set' => 31, 'unset' => 39),
  33448. 'green' => array('set' => 32, 'unset' => 39),
  33449. 'yellow' => array('set' => 33, 'unset' => 39),
  33450. 'blue' => array('set' => 34, 'unset' => 39),
  33451. 'magenta' => array('set' => 35, 'unset' => 39),
  33452. 'cyan' => array('set' => 36, 'unset' => 39),
  33453. 'white' => array('set' => 37, 'unset' => 39),
  33454. 'default' => array('set' => 39, 'unset' => 39),
  33455. );
  33456. private static $availableBackgroundColors = array(
  33457. 'black' => array('set' => 40, 'unset' => 49),
  33458. 'red' => array('set' => 41, 'unset' => 49),
  33459. 'green' => array('set' => 42, 'unset' => 49),
  33460. 'yellow' => array('set' => 43, 'unset' => 49),
  33461. 'blue' => array('set' => 44, 'unset' => 49),
  33462. 'magenta' => array('set' => 45, 'unset' => 49),
  33463. 'cyan' => array('set' => 46, 'unset' => 49),
  33464. 'white' => array('set' => 47, 'unset' => 49),
  33465. 'default' => array('set' => 49, 'unset' => 49),
  33466. );
  33467. private static $availableOptions = array(
  33468. 'bold' => array('set' => 1, 'unset' => 22),
  33469. 'underscore' => array('set' => 4, 'unset' => 24),
  33470. 'blink' => array('set' => 5, 'unset' => 25),
  33471. 'reverse' => array('set' => 7, 'unset' => 27),
  33472. 'conceal' => array('set' => 8, 'unset' => 28),
  33473. );
  33474. private $foreground;
  33475. private $background;
  33476. private $options = array();
  33477. public function __construct($foreground = null, $background = null, array $options = array())
  33478. {
  33479. if (null !== $foreground) {
  33480. $this->setForeground($foreground);
  33481. }
  33482. if (null !== $background) {
  33483. $this->setBackground($background);
  33484. }
  33485. if (\count($options)) {
  33486. $this->setOptions($options);
  33487. }
  33488. }
  33489. public function setForeground($color = null)
  33490. {
  33491. if (null === $color) {
  33492. $this->foreground = null;
  33493. return;
  33494. }
  33495. if (!isset(static::$availableForegroundColors[$color])) {
  33496. throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors))));
  33497. }
  33498. $this->foreground = static::$availableForegroundColors[$color];
  33499. }
  33500. public function setBackground($color = null)
  33501. {
  33502. if (null === $color) {
  33503. $this->background = null;
  33504. return;
  33505. }
  33506. if (!isset(static::$availableBackgroundColors[$color])) {
  33507. throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
  33508. }
  33509. $this->background = static::$availableBackgroundColors[$color];
  33510. }
  33511. public function setOption($option)
  33512. {
  33513. if (!isset(static::$availableOptions[$option])) {
  33514. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  33515. }
  33516. if (!\in_array(static::$availableOptions[$option], $this->options)) {
  33517. $this->options[] = static::$availableOptions[$option];
  33518. }
  33519. }
  33520. public function unsetOption($option)
  33521. {
  33522. if (!isset(static::$availableOptions[$option])) {
  33523. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  33524. }
  33525. $pos = array_search(static::$availableOptions[$option], $this->options);
  33526. if (false !== $pos) {
  33527. unset($this->options[$pos]);
  33528. }
  33529. }
  33530. public function setOptions(array $options)
  33531. {
  33532. $this->options = array();
  33533. foreach ($options as $option) {
  33534. $this->setOption($option);
  33535. }
  33536. }
  33537. public function apply($text)
  33538. {
  33539. $setCodes = array();
  33540. $unsetCodes = array();
  33541. if (null !== $this->foreground) {
  33542. $setCodes[] = $this->foreground['set'];
  33543. $unsetCodes[] = $this->foreground['unset'];
  33544. }
  33545. if (null !== $this->background) {
  33546. $setCodes[] = $this->background['set'];
  33547. $unsetCodes[] = $this->background['unset'];
  33548. }
  33549. if (\count($this->options)) {
  33550. foreach ($this->options as $option) {
  33551. $setCodes[] = $option['set'];
  33552. $unsetCodes[] = $option['unset'];
  33553. }
  33554. }
  33555. if (0 === \count($setCodes)) {
  33556. return $text;
  33557. }
  33558. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  33559. }
  33560. }
  33561. <?php
  33562. namespace Symfony\Component\Console\Formatter;
  33563. interface OutputFormatterStyleInterface
  33564. {
  33565. public function setForeground($color = null);
  33566. public function setBackground($color = null);
  33567. public function setOption($option);
  33568. public function unsetOption($option);
  33569. public function setOptions(array $options);
  33570. public function apply($text);
  33571. }
  33572. <?php
  33573. namespace Symfony\Component\Console\Formatter;
  33574. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33575. class OutputFormatterStyleStack
  33576. {
  33577. private $styles;
  33578. private $emptyStyle;
  33579. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  33580. {
  33581. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  33582. $this->reset();
  33583. }
  33584. public function reset()
  33585. {
  33586. $this->styles = array();
  33587. }
  33588. public function push(OutputFormatterStyleInterface $style)
  33589. {
  33590. $this->styles[] = $style;
  33591. }
  33592. public function pop(OutputFormatterStyleInterface $style = null)
  33593. {
  33594. if (empty($this->styles)) {
  33595. return $this->emptyStyle;
  33596. }
  33597. if (null === $style) {
  33598. return array_pop($this->styles);
  33599. }
  33600. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  33601. if ($style->apply('') === $stackedStyle->apply('')) {
  33602. $this->styles = \array_slice($this->styles, 0, $index);
  33603. return $stackedStyle;
  33604. }
  33605. }
  33606. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  33607. }
  33608. public function getCurrent()
  33609. {
  33610. if (empty($this->styles)) {
  33611. return $this->emptyStyle;
  33612. }
  33613. return $this->styles[\count($this->styles) - 1];
  33614. }
  33615. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  33616. {
  33617. $this->emptyStyle = $emptyStyle;
  33618. return $this;
  33619. }
  33620. public function getEmptyStyle()
  33621. {
  33622. return $this->emptyStyle;
  33623. }
  33624. }
  33625. <?php
  33626. namespace Symfony\Component\Console\Helper;
  33627. class DebugFormatterHelper extends Helper
  33628. {
  33629. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  33630. private $started = array();
  33631. private $count = -1;
  33632. public function start($id, $message, $prefix = 'RUN')
  33633. {
  33634. $this->started[$id] = array('border' => ++$this->count % \count($this->colors));
  33635. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  33636. }
  33637. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  33638. {
  33639. $message = '';
  33640. if ($error) {
  33641. if (isset($this->started[$id]['out'])) {
  33642. $message .= "\n";
  33643. unset($this->started[$id]['out']);
  33644. }
  33645. if (!isset($this->started[$id]['err'])) {
  33646. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  33647. $this->started[$id]['err'] = true;
  33648. }
  33649. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  33650. } else {
  33651. if (isset($this->started[$id]['err'])) {
  33652. $message .= "\n";
  33653. unset($this->started[$id]['err']);
  33654. }
  33655. if (!isset($this->started[$id]['out'])) {
  33656. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  33657. $this->started[$id]['out'] = true;
  33658. }
  33659. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  33660. }
  33661. return $message;
  33662. }
  33663. public function stop($id, $message, $successful, $prefix = 'RES')
  33664. {
  33665. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  33666. if ($successful) {
  33667. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  33668. }
  33669. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  33670. unset($this->started[$id]['out'], $this->started[$id]['err']);
  33671. return $message;
  33672. }
  33673. private function getBorder($id)
  33674. {
  33675. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  33676. }
  33677. public function getName()
  33678. {
  33679. return 'debug_formatter';
  33680. }
  33681. }
  33682. <?php
  33683. namespace Symfony\Component\Console\Helper;
  33684. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  33685. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  33686. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  33687. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33688. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33689. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33690. use Symfony\Component\Console\Output\OutputInterface;
  33691. class DescriptorHelper extends Helper
  33692. {
  33693. private $descriptors = array();
  33694. public function __construct()
  33695. {
  33696. $this
  33697. ->register('txt', new TextDescriptor())
  33698. ->register('xml', new XmlDescriptor())
  33699. ->register('json', new JsonDescriptor())
  33700. ->register('md', new MarkdownDescriptor())
  33701. ;
  33702. }
  33703. public function describe(OutputInterface $output, $object, array $options = array())
  33704. {
  33705. $options = array_merge(array(
  33706. 'raw_text' => false,
  33707. 'format' => 'txt',
  33708. ), $options);
  33709. if (!isset($this->descriptors[$options['format']])) {
  33710. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  33711. }
  33712. $descriptor = $this->descriptors[$options['format']];
  33713. $descriptor->describe($output, $object, $options);
  33714. }
  33715. public function register($format, DescriptorInterface $descriptor)
  33716. {
  33717. $this->descriptors[$format] = $descriptor;
  33718. return $this;
  33719. }
  33720. public function getName()
  33721. {
  33722. return 'descriptor';
  33723. }
  33724. }
  33725. <?php
  33726. namespace Symfony\Component\Console\Helper;
  33727. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33728. use Symfony\Component\Console\Exception\RuntimeException;
  33729. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  33730. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33731. use Symfony\Component\Console\Output\OutputInterface;
  33732. class DialogHelper extends InputAwareHelper
  33733. {
  33734. private $inputStream;
  33735. private static $shell;
  33736. private static $stty;
  33737. public function __construct($triggerDeprecationError = true)
  33738. {
  33739. if ($triggerDeprecationError) {
  33740. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  33741. }
  33742. }
  33743. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  33744. {
  33745. if ($output instanceof ConsoleOutputInterface) {
  33746. $output = $output->getErrorOutput();
  33747. }
  33748. $width = max(array_map('strlen', array_keys($choices)));
  33749. $messages = (array) $question;
  33750. foreach ($choices as $key => $value) {
  33751. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  33752. }
  33753. $output->writeln($messages);
  33754. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  33755. $selectedChoices = str_replace(' ', '', $picked);
  33756. if ($multiselect) {
  33757. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  33758. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  33759. }
  33760. $selectedChoices = explode(',', $selectedChoices);
  33761. } else {
  33762. $selectedChoices = array($picked);
  33763. }
  33764. $multiselectChoices = array();
  33765. foreach ($selectedChoices as $value) {
  33766. if (empty($choices[$value])) {
  33767. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  33768. }
  33769. $multiselectChoices[] = $value;
  33770. }
  33771. if ($multiselect) {
  33772. return $multiselectChoices;
  33773. }
  33774. return $picked;
  33775. }, $attempts, $default);
  33776. return $result;
  33777. }
  33778. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  33779. {
  33780. if ($this->input && !$this->input->isInteractive()) {
  33781. return $default;
  33782. }
  33783. if ($output instanceof ConsoleOutputInterface) {
  33784. $output = $output->getErrorOutput();
  33785. }
  33786. $output->write($question);
  33787. $inputStream = $this->inputStream ?: STDIN;
  33788. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  33789. $ret = fgets($inputStream, 4096);
  33790. if (false === $ret) {
  33791. throw new RuntimeException('Aborted');
  33792. }
  33793. $ret = trim($ret);
  33794. } else {
  33795. $ret = '';
  33796. $i = 0;
  33797. $ofs = -1;
  33798. $matches = $autocomplete;
  33799. $numMatches = \count($matches);
  33800. $sttyMode = shell_exec('stty -g');
  33801. shell_exec('stty -icanon -echo');
  33802. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  33803. while (!feof($inputStream)) {
  33804. $c = fread($inputStream, 1);
  33805. if ("\177" === $c) {
  33806. if (0 === $numMatches && 0 !== $i) {
  33807. --$i;
  33808. $output->write("\033[1D");
  33809. }
  33810. if (0 === $i) {
  33811. $ofs = -1;
  33812. $matches = $autocomplete;
  33813. $numMatches = \count($matches);
  33814. } else {
  33815. $numMatches = 0;
  33816. }
  33817. $ret = substr($ret, 0, $i);
  33818. } elseif ("\033" === $c) {
  33819. $c .= fread($inputStream, 2);
  33820. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  33821. if ('A' === $c[2] && -1 === $ofs) {
  33822. $ofs = 0;
  33823. }
  33824. if (0 === $numMatches) {
  33825. continue;
  33826. }
  33827. $ofs += ('A' === $c[2]) ? -1 : 1;
  33828. $ofs = ($numMatches + $ofs) % $numMatches;
  33829. }
  33830. } elseif (\ord($c) < 32) {
  33831. if ("\t" === $c || "\n" === $c) {
  33832. if ($numMatches > 0 && -1 !== $ofs) {
  33833. $ret = $matches[$ofs];
  33834. $output->write(substr($ret, $i));
  33835. $i = \strlen($ret);
  33836. }
  33837. if ("\n" === $c) {
  33838. $output->write($c);
  33839. break;
  33840. }
  33841. $numMatches = 0;
  33842. }
  33843. continue;
  33844. } else {
  33845. $output->write($c);
  33846. $ret .= $c;
  33847. ++$i;
  33848. $numMatches = 0;
  33849. $ofs = 0;
  33850. foreach ($autocomplete as $value) {
  33851. if (0 === strpos($value, $ret) && $i !== \strlen($value)) {
  33852. $matches[$numMatches++] = $value;
  33853. }
  33854. }
  33855. }
  33856. $output->write("\033[K");
  33857. if ($numMatches > 0 && -1 !== $ofs) {
  33858. $output->write("\0337");
  33859. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  33860. $output->write("\0338");
  33861. }
  33862. }
  33863. shell_exec(sprintf('stty %s', $sttyMode));
  33864. }
  33865. return \strlen($ret) > 0 ? $ret : $default;
  33866. }
  33867. public function askConfirmation(OutputInterface $output, $question, $default = true)
  33868. {
  33869. $answer = 'z';
  33870. while ($answer && !\in_array(strtolower($answer[0]), array('y', 'n'))) {
  33871. $answer = $this->ask($output, $question);
  33872. }
  33873. if (false === $default) {
  33874. return $answer && 'y' == strtolower($answer[0]);
  33875. }
  33876. return !$answer || 'y' == strtolower($answer[0]);
  33877. }
  33878. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  33879. {
  33880. if ($output instanceof ConsoleOutputInterface) {
  33881. $output = $output->getErrorOutput();
  33882. }
  33883. if ('\\' === \DIRECTORY_SEPARATOR) {
  33884. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  33885. if ('phar:' === substr(__FILE__, 0, 5)) {
  33886. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  33887. copy($exe, $tmpExe);
  33888. $exe = $tmpExe;
  33889. }
  33890. $output->write($question);
  33891. $value = rtrim(shell_exec($exe));
  33892. $output->writeln('');
  33893. if (isset($tmpExe)) {
  33894. unlink($tmpExe);
  33895. }
  33896. return $value;
  33897. }
  33898. if ($this->hasSttyAvailable()) {
  33899. $output->write($question);
  33900. $sttyMode = shell_exec('stty -g');
  33901. shell_exec('stty -echo');
  33902. $value = fgets($this->inputStream ?: STDIN, 4096);
  33903. shell_exec(sprintf('stty %s', $sttyMode));
  33904. if (false === $value) {
  33905. throw new RuntimeException('Aborted');
  33906. }
  33907. $value = trim($value);
  33908. $output->writeln('');
  33909. return $value;
  33910. }
  33911. if (false !== $shell = $this->getShell()) {
  33912. $output->write($question);
  33913. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  33914. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  33915. $value = rtrim(shell_exec($command));
  33916. $output->writeln('');
  33917. return $value;
  33918. }
  33919. if ($fallback) {
  33920. return $this->ask($output, $question);
  33921. }
  33922. throw new RuntimeException('Unable to hide the response');
  33923. }
  33924. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  33925. {
  33926. $that = $this;
  33927. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  33928. return $that->ask($output, $question, $default, $autocomplete);
  33929. };
  33930. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  33931. }
  33932. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  33933. {
  33934. $that = $this;
  33935. $interviewer = function () use ($output, $question, $fallback, $that) {
  33936. return $that->askHiddenResponse($output, $question, $fallback);
  33937. };
  33938. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  33939. }
  33940. public function setInputStream($stream)
  33941. {
  33942. $this->inputStream = $stream;
  33943. }
  33944. public function getInputStream()
  33945. {
  33946. return $this->inputStream;
  33947. }
  33948. public function getName()
  33949. {
  33950. return 'dialog';
  33951. }
  33952. private function getShell()
  33953. {
  33954. if (null !== self::$shell) {
  33955. return self::$shell;
  33956. }
  33957. self::$shell = false;
  33958. if (file_exists('/usr/bin/env')) {
  33959. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  33960. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  33961. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  33962. self::$shell = $sh;
  33963. break;
  33964. }
  33965. }
  33966. }
  33967. return self::$shell;
  33968. }
  33969. private function hasSttyAvailable()
  33970. {
  33971. if (null !== self::$stty) {
  33972. return self::$stty;
  33973. }
  33974. exec('stty 2>&1', $output, $exitcode);
  33975. return self::$stty = 0 === $exitcode;
  33976. }
  33977. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  33978. {
  33979. if ($output instanceof ConsoleOutputInterface) {
  33980. $output = $output->getErrorOutput();
  33981. }
  33982. $e = null;
  33983. while (false === $attempts || $attempts--) {
  33984. if (null !== $e) {
  33985. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  33986. }
  33987. try {
  33988. return \call_user_func($validator, $interviewer());
  33989. } catch (\Exception $e) {
  33990. }
  33991. }
  33992. throw $e;
  33993. }
  33994. }
  33995. <?php
  33996. namespace Symfony\Component\Console\Helper;
  33997. use Symfony\Component\Console\Formatter\OutputFormatter;
  33998. class FormatterHelper extends Helper
  33999. {
  34000. public function formatSection($section, $message, $style = 'info')
  34001. {
  34002. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  34003. }
  34004. public function formatBlock($messages, $style, $large = false)
  34005. {
  34006. if (!\is_array($messages)) {
  34007. $messages = array($messages);
  34008. }
  34009. $len = 0;
  34010. $lines = array();
  34011. foreach ($messages as $message) {
  34012. $message = OutputFormatter::escape($message);
  34013. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  34014. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  34015. }
  34016. $messages = $large ? array(str_repeat(' ', $len)) : array();
  34017. for ($i = 0; isset($lines[$i]); ++$i) {
  34018. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  34019. }
  34020. if ($large) {
  34021. $messages[] = str_repeat(' ', $len);
  34022. }
  34023. for ($i = 0; isset($messages[$i]); ++$i) {
  34024. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  34025. }
  34026. return implode("\n", $messages);
  34027. }
  34028. public function getName()
  34029. {
  34030. return 'formatter';
  34031. }
  34032. }
  34033. <?php
  34034. namespace Symfony\Component\Console\Helper;
  34035. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  34036. abstract class Helper implements HelperInterface
  34037. {
  34038. protected $helperSet = null;
  34039. public function setHelperSet(HelperSet $helperSet = null)
  34040. {
  34041. $this->helperSet = $helperSet;
  34042. }
  34043. public function getHelperSet()
  34044. {
  34045. return $this->helperSet;
  34046. }
  34047. public static function strlen($string)
  34048. {
  34049. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  34050. return \strlen($string);
  34051. }
  34052. return mb_strwidth($string, $encoding);
  34053. }
  34054. public static function formatTime($secs)
  34055. {
  34056. static $timeFormats = array(
  34057. array(0, '< 1 sec'),
  34058. array(1, '1 sec'),
  34059. array(2, 'secs', 1),
  34060. array(60, '1 min'),
  34061. array(120, 'mins', 60),
  34062. array(3600, '1 hr'),
  34063. array(7200, 'hrs', 3600),
  34064. array(86400, '1 day'),
  34065. array(172800, 'days', 86400),
  34066. );
  34067. foreach ($timeFormats as $index => $format) {
  34068. if ($secs >= $format[0]) {
  34069. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  34070. || $index == \count($timeFormats) - 1
  34071. ) {
  34072. if (2 == \count($format)) {
  34073. return $format[1];
  34074. }
  34075. return floor($secs / $format[2]).' '.$format[1];
  34076. }
  34077. }
  34078. }
  34079. }
  34080. public static function formatMemory($memory)
  34081. {
  34082. if ($memory >= 1024 * 1024 * 1024) {
  34083. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  34084. }
  34085. if ($memory >= 1024 * 1024) {
  34086. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  34087. }
  34088. if ($memory >= 1024) {
  34089. return sprintf('%d KiB', $memory / 1024);
  34090. }
  34091. return sprintf('%d B', $memory);
  34092. }
  34093. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  34094. {
  34095. return self::strlen(self::removeDecoration($formatter, $string));
  34096. }
  34097. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  34098. {
  34099. $isDecorated = $formatter->isDecorated();
  34100. $formatter->setDecorated(false);
  34101. $string = $formatter->format($string);
  34102. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  34103. $formatter->setDecorated($isDecorated);
  34104. return $string;
  34105. }
  34106. }
  34107. <?php
  34108. namespace Symfony\Component\Console\Helper;
  34109. interface HelperInterface
  34110. {
  34111. public function setHelperSet(HelperSet $helperSet = null);
  34112. public function getHelperSet();
  34113. public function getName();
  34114. }
  34115. <?php
  34116. namespace Symfony\Component\Console\Helper;
  34117. use Symfony\Component\Console\Command\Command;
  34118. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34119. class HelperSet implements \IteratorAggregate
  34120. {
  34121. private $helpers = array();
  34122. private $command;
  34123. public function __construct(array $helpers = array())
  34124. {
  34125. foreach ($helpers as $alias => $helper) {
  34126. $this->set($helper, \is_int($alias) ? null : $alias);
  34127. }
  34128. }
  34129. public function set(HelperInterface $helper, $alias = null)
  34130. {
  34131. $this->helpers[$helper->getName()] = $helper;
  34132. if (null !== $alias) {
  34133. $this->helpers[$alias] = $helper;
  34134. }
  34135. $helper->setHelperSet($this);
  34136. }
  34137. public function has($name)
  34138. {
  34139. return isset($this->helpers[$name]);
  34140. }
  34141. public function get($name)
  34142. {
  34143. if (!$this->has($name)) {
  34144. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  34145. }
  34146. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  34147. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  34148. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  34149. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  34150. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  34151. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  34152. }
  34153. return $this->helpers[$name];
  34154. }
  34155. public function setCommand(Command $command = null)
  34156. {
  34157. $this->command = $command;
  34158. }
  34159. public function getCommand()
  34160. {
  34161. return $this->command;
  34162. }
  34163. public function getIterator()
  34164. {
  34165. return new \ArrayIterator($this->helpers);
  34166. }
  34167. }
  34168. <?php
  34169. namespace Symfony\Component\Console\Helper;
  34170. use Symfony\Component\Console\Input\InputAwareInterface;
  34171. use Symfony\Component\Console\Input\InputInterface;
  34172. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  34173. {
  34174. protected $input;
  34175. public function setInput(InputInterface $input)
  34176. {
  34177. $this->input = $input;
  34178. }
  34179. }
  34180. <?php
  34181. namespace Symfony\Component\Console\Helper;
  34182. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34183. use Symfony\Component\Console\Output\OutputInterface;
  34184. use Symfony\Component\Process\Exception\ProcessFailedException;
  34185. use Symfony\Component\Process\Process;
  34186. use Symfony\Component\Process\ProcessBuilder;
  34187. class ProcessHelper extends Helper
  34188. {
  34189. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  34190. {
  34191. if ($output instanceof ConsoleOutputInterface) {
  34192. $output = $output->getErrorOutput();
  34193. }
  34194. $formatter = $this->getHelperSet()->get('debug_formatter');
  34195. if (\is_array($cmd)) {
  34196. $process = ProcessBuilder::create($cmd)->getProcess();
  34197. } elseif ($cmd instanceof Process) {
  34198. $process = $cmd;
  34199. } else {
  34200. $process = new Process($cmd);
  34201. }
  34202. if ($verbosity <= $output->getVerbosity()) {
  34203. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  34204. }
  34205. if ($output->isDebug()) {
  34206. $callback = $this->wrapCallback($output, $process, $callback);
  34207. }
  34208. $process->run($callback);
  34209. if ($verbosity <= $output->getVerbosity()) {
  34210. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  34211. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  34212. }
  34213. if (!$process->isSuccessful() && null !== $error) {
  34214. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  34215. }
  34216. return $process;
  34217. }
  34218. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  34219. {
  34220. $process = $this->run($output, $cmd, $error, $callback);
  34221. if (!$process->isSuccessful()) {
  34222. throw new ProcessFailedException($process);
  34223. }
  34224. return $process;
  34225. }
  34226. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  34227. {
  34228. if ($output instanceof ConsoleOutputInterface) {
  34229. $output = $output->getErrorOutput();
  34230. }
  34231. $formatter = $this->getHelperSet()->get('debug_formatter');
  34232. $that = $this;
  34233. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  34234. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  34235. if (null !== $callback) {
  34236. \call_user_func($callback, $type, $buffer);
  34237. }
  34238. };
  34239. }
  34240. public function escapeString($str)
  34241. {
  34242. return str_replace('<', '\\<', $str);
  34243. }
  34244. public function getName()
  34245. {
  34246. return 'process';
  34247. }
  34248. }
  34249. <?php
  34250. namespace Symfony\Component\Console\Helper;
  34251. use Symfony\Component\Console\Exception\LogicException;
  34252. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34253. use Symfony\Component\Console\Output\OutputInterface;
  34254. class ProgressBar
  34255. {
  34256. private $barWidth = 28;
  34257. private $barChar;
  34258. private $emptyBarChar = '-';
  34259. private $progressChar = '>';
  34260. private $format;
  34261. private $internalFormat;
  34262. private $redrawFreq = 1;
  34263. private $output;
  34264. private $step = 0;
  34265. private $max;
  34266. private $startTime;
  34267. private $stepWidth;
  34268. private $percent = 0.0;
  34269. private $formatLineCount;
  34270. private $messages = array();
  34271. private $overwrite = true;
  34272. private $firstRun = true;
  34273. private static $formatters;
  34274. private static $formats;
  34275. public function __construct(OutputInterface $output, $max = 0)
  34276. {
  34277. if ($output instanceof ConsoleOutputInterface) {
  34278. $output = $output->getErrorOutput();
  34279. }
  34280. $this->output = $output;
  34281. $this->setMaxSteps($max);
  34282. if (!$this->output->isDecorated()) {
  34283. $this->overwrite = false;
  34284. $this->setRedrawFrequency($max / 10);
  34285. }
  34286. $this->startTime = time();
  34287. }
  34288. public static function setPlaceholderFormatterDefinition($name, $callable)
  34289. {
  34290. if (!self::$formatters) {
  34291. self::$formatters = self::initPlaceholderFormatters();
  34292. }
  34293. self::$formatters[$name] = $callable;
  34294. }
  34295. public static function getPlaceholderFormatterDefinition($name)
  34296. {
  34297. if (!self::$formatters) {
  34298. self::$formatters = self::initPlaceholderFormatters();
  34299. }
  34300. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  34301. }
  34302. public static function setFormatDefinition($name, $format)
  34303. {
  34304. if (!self::$formats) {
  34305. self::$formats = self::initFormats();
  34306. }
  34307. self::$formats[$name] = $format;
  34308. }
  34309. public static function getFormatDefinition($name)
  34310. {
  34311. if (!self::$formats) {
  34312. self::$formats = self::initFormats();
  34313. }
  34314. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  34315. }
  34316. public function setMessage($message, $name = 'message')
  34317. {
  34318. $this->messages[$name] = $message;
  34319. }
  34320. public function getMessage($name = 'message')
  34321. {
  34322. return $this->messages[$name];
  34323. }
  34324. public function getStartTime()
  34325. {
  34326. return $this->startTime;
  34327. }
  34328. public function getMaxSteps()
  34329. {
  34330. return $this->max;
  34331. }
  34332. public function getStep()
  34333. {
  34334. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  34335. return $this->getProgress();
  34336. }
  34337. public function getProgress()
  34338. {
  34339. return $this->step;
  34340. }
  34341. public function getStepWidth()
  34342. {
  34343. return $this->stepWidth;
  34344. }
  34345. public function getProgressPercent()
  34346. {
  34347. return $this->percent;
  34348. }
  34349. public function setBarWidth($size)
  34350. {
  34351. $this->barWidth = (int) $size;
  34352. }
  34353. public function getBarWidth()
  34354. {
  34355. return $this->barWidth;
  34356. }
  34357. public function setBarCharacter($char)
  34358. {
  34359. $this->barChar = $char;
  34360. }
  34361. public function getBarCharacter()
  34362. {
  34363. if (null === $this->barChar) {
  34364. return $this->max ? '=' : $this->emptyBarChar;
  34365. }
  34366. return $this->barChar;
  34367. }
  34368. public function setEmptyBarCharacter($char)
  34369. {
  34370. $this->emptyBarChar = $char;
  34371. }
  34372. public function getEmptyBarCharacter()
  34373. {
  34374. return $this->emptyBarChar;
  34375. }
  34376. public function setProgressCharacter($char)
  34377. {
  34378. $this->progressChar = $char;
  34379. }
  34380. public function getProgressCharacter()
  34381. {
  34382. return $this->progressChar;
  34383. }
  34384. public function setFormat($format)
  34385. {
  34386. $this->format = null;
  34387. $this->internalFormat = $format;
  34388. }
  34389. public function setRedrawFrequency($freq)
  34390. {
  34391. $this->redrawFreq = max((int) $freq, 1);
  34392. }
  34393. public function start($max = null)
  34394. {
  34395. $this->startTime = time();
  34396. $this->step = 0;
  34397. $this->percent = 0.0;
  34398. if (null !== $max) {
  34399. $this->setMaxSteps($max);
  34400. }
  34401. $this->display();
  34402. }
  34403. public function advance($step = 1)
  34404. {
  34405. $this->setProgress($this->step + $step);
  34406. }
  34407. public function setCurrent($step)
  34408. {
  34409. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  34410. $this->setProgress($step);
  34411. }
  34412. public function setOverwrite($overwrite)
  34413. {
  34414. $this->overwrite = (bool) $overwrite;
  34415. }
  34416. public function setProgress($step)
  34417. {
  34418. $step = (int) $step;
  34419. if ($step < $this->step) {
  34420. throw new LogicException('You can\'t regress the progress bar.');
  34421. }
  34422. if ($this->max && $step > $this->max) {
  34423. $this->max = $step;
  34424. }
  34425. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  34426. $currPeriod = (int) ($step / $this->redrawFreq);
  34427. $this->step = $step;
  34428. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  34429. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  34430. $this->display();
  34431. }
  34432. }
  34433. public function finish()
  34434. {
  34435. if (!$this->max) {
  34436. $this->max = $this->step;
  34437. }
  34438. if ($this->step === $this->max && !$this->overwrite) {
  34439. return;
  34440. }
  34441. $this->setProgress($this->max);
  34442. }
  34443. public function display()
  34444. {
  34445. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  34446. return;
  34447. }
  34448. if (null === $this->format) {
  34449. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  34450. }
  34451. $self = $this;
  34452. $output = $this->output;
  34453. $messages = $this->messages;
  34454. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  34455. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  34456. $text = \call_user_func($formatter, $self, $output);
  34457. } elseif (isset($messages[$matches[1]])) {
  34458. $text = $messages[$matches[1]];
  34459. } else {
  34460. return $matches[0];
  34461. }
  34462. if (isset($matches[2])) {
  34463. $text = sprintf('%'.$matches[2], $text);
  34464. }
  34465. return $text;
  34466. }, $this->format));
  34467. }
  34468. public function clear()
  34469. {
  34470. if (!$this->overwrite) {
  34471. return;
  34472. }
  34473. if (null === $this->format) {
  34474. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  34475. }
  34476. $this->overwrite('');
  34477. }
  34478. private function setRealFormat($format)
  34479. {
  34480. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  34481. $this->format = self::getFormatDefinition($format.'_nomax');
  34482. } elseif (null !== self::getFormatDefinition($format)) {
  34483. $this->format = self::getFormatDefinition($format);
  34484. } else {
  34485. $this->format = $format;
  34486. }
  34487. $this->formatLineCount = substr_count($this->format, "\n");
  34488. }
  34489. private function setMaxSteps($max)
  34490. {
  34491. $this->max = max(0, (int) $max);
  34492. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  34493. }
  34494. private function overwrite($message)
  34495. {
  34496. if ($this->overwrite) {
  34497. if (!$this->firstRun) {
  34498. $this->output->write("\x0D");
  34499. $this->output->write("\x1B[2K");
  34500. if ($this->formatLineCount > 0) {
  34501. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  34502. }
  34503. }
  34504. } elseif ($this->step > 0) {
  34505. $this->output->writeln('');
  34506. }
  34507. $this->firstRun = false;
  34508. $this->output->write($message);
  34509. }
  34510. private function determineBestFormat()
  34511. {
  34512. switch ($this->output->getVerbosity()) {
  34513. case OutputInterface::VERBOSITY_VERBOSE:
  34514. return $this->max ? 'verbose' : 'verbose_nomax';
  34515. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34516. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  34517. case OutputInterface::VERBOSITY_DEBUG:
  34518. return $this->max ? 'debug' : 'debug_nomax';
  34519. default:
  34520. return $this->max ? 'normal' : 'normal_nomax';
  34521. }
  34522. }
  34523. private static function initPlaceholderFormatters()
  34524. {
  34525. return array(
  34526. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  34527. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  34528. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  34529. if ($completeBars < $bar->getBarWidth()) {
  34530. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  34531. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  34532. }
  34533. return $display;
  34534. },
  34535. 'elapsed' => function (ProgressBar $bar) {
  34536. return Helper::formatTime(time() - $bar->getStartTime());
  34537. },
  34538. 'remaining' => function (ProgressBar $bar) {
  34539. if (!$bar->getMaxSteps()) {
  34540. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  34541. }
  34542. if (!$bar->getProgress()) {
  34543. $remaining = 0;
  34544. } else {
  34545. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  34546. }
  34547. return Helper::formatTime($remaining);
  34548. },
  34549. 'estimated' => function (ProgressBar $bar) {
  34550. if (!$bar->getMaxSteps()) {
  34551. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  34552. }
  34553. if (!$bar->getProgress()) {
  34554. $estimated = 0;
  34555. } else {
  34556. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  34557. }
  34558. return Helper::formatTime($estimated);
  34559. },
  34560. 'memory' => function (ProgressBar $bar) {
  34561. return Helper::formatMemory(memory_get_usage(true));
  34562. },
  34563. 'current' => function (ProgressBar $bar) {
  34564. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  34565. },
  34566. 'max' => function (ProgressBar $bar) {
  34567. return $bar->getMaxSteps();
  34568. },
  34569. 'percent' => function (ProgressBar $bar) {
  34570. return floor($bar->getProgressPercent() * 100);
  34571. },
  34572. );
  34573. }
  34574. private static function initFormats()
  34575. {
  34576. return array(
  34577. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  34578. 'normal_nomax' => ' %current% [%bar%]',
  34579. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  34580. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  34581. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  34582. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  34583. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  34584. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  34585. );
  34586. }
  34587. }
  34588. <?php
  34589. namespace Symfony\Component\Console\Helper;
  34590. use Symfony\Component\Console\Exception\LogicException;
  34591. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34592. use Symfony\Component\Console\Output\NullOutput;
  34593. use Symfony\Component\Console\Output\OutputInterface;
  34594. class ProgressHelper extends Helper
  34595. {
  34596. const FORMAT_QUIET = ' %percent%%';
  34597. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  34598. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  34599. const FORMAT_QUIET_NOMAX = ' %current%';
  34600. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  34601. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  34602. private $barWidth = 28;
  34603. private $barChar = '=';
  34604. private $emptyBarChar = '-';
  34605. private $progressChar = '>';
  34606. private $format = null;
  34607. private $redrawFreq = 1;
  34608. private $lastMessagesLength;
  34609. private $barCharOriginal;
  34610. private $output;
  34611. private $current;
  34612. private $max;
  34613. private $startTime;
  34614. private $defaultFormatVars = array(
  34615. 'current',
  34616. 'max',
  34617. 'bar',
  34618. 'percent',
  34619. 'elapsed',
  34620. );
  34621. private $formatVars;
  34622. private $widths = array(
  34623. 'current' => 4,
  34624. 'max' => 4,
  34625. 'percent' => 3,
  34626. 'elapsed' => 6,
  34627. );
  34628. private $timeFormats = array(
  34629. array(0, '???'),
  34630. array(2, '1 sec'),
  34631. array(59, 'secs', 1),
  34632. array(60, '1 min'),
  34633. array(3600, 'mins', 60),
  34634. array(5400, '1 hr'),
  34635. array(86400, 'hrs', 3600),
  34636. array(129600, '1 day'),
  34637. array(604800, 'days', 86400),
  34638. );
  34639. public function __construct($triggerDeprecationError = true)
  34640. {
  34641. if ($triggerDeprecationError) {
  34642. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  34643. }
  34644. }
  34645. public function setBarWidth($size)
  34646. {
  34647. $this->barWidth = (int) $size;
  34648. }
  34649. public function setBarCharacter($char)
  34650. {
  34651. $this->barChar = $char;
  34652. }
  34653. public function setEmptyBarCharacter($char)
  34654. {
  34655. $this->emptyBarChar = $char;
  34656. }
  34657. public function setProgressCharacter($char)
  34658. {
  34659. $this->progressChar = $char;
  34660. }
  34661. public function setFormat($format)
  34662. {
  34663. $this->format = $format;
  34664. }
  34665. public function setRedrawFrequency($freq)
  34666. {
  34667. $this->redrawFreq = (int) $freq;
  34668. }
  34669. public function start(OutputInterface $output, $max = null)
  34670. {
  34671. if ($output instanceof ConsoleOutputInterface) {
  34672. $output = $output->getErrorOutput();
  34673. }
  34674. $this->startTime = time();
  34675. $this->current = 0;
  34676. $this->max = (int) $max;
  34677. $this->output = $output->isDecorated() ? $output : new NullOutput();
  34678. $this->lastMessagesLength = 0;
  34679. $this->barCharOriginal = '';
  34680. if (null === $this->format) {
  34681. switch ($output->getVerbosity()) {
  34682. case OutputInterface::VERBOSITY_QUIET:
  34683. $this->format = self::FORMAT_QUIET_NOMAX;
  34684. if ($this->max > 0) {
  34685. $this->format = self::FORMAT_QUIET;
  34686. }
  34687. break;
  34688. case OutputInterface::VERBOSITY_VERBOSE:
  34689. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34690. case OutputInterface::VERBOSITY_DEBUG:
  34691. $this->format = self::FORMAT_VERBOSE_NOMAX;
  34692. if ($this->max > 0) {
  34693. $this->format = self::FORMAT_VERBOSE;
  34694. }
  34695. break;
  34696. default:
  34697. $this->format = self::FORMAT_NORMAL_NOMAX;
  34698. if ($this->max > 0) {
  34699. $this->format = self::FORMAT_NORMAL;
  34700. }
  34701. break;
  34702. }
  34703. }
  34704. $this->initialize();
  34705. }
  34706. public function advance($step = 1, $redraw = false)
  34707. {
  34708. $this->setCurrent($this->current + $step, $redraw);
  34709. }
  34710. public function setCurrent($current, $redraw = false)
  34711. {
  34712. if (null === $this->startTime) {
  34713. throw new LogicException('You must start the progress bar before calling setCurrent().');
  34714. }
  34715. $current = (int) $current;
  34716. if ($current < $this->current) {
  34717. throw new LogicException('You can\'t regress the progress bar');
  34718. }
  34719. if (0 === $this->current) {
  34720. $redraw = true;
  34721. }
  34722. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  34723. $this->current = $current;
  34724. $currPeriod = (int) ($this->current / $this->redrawFreq);
  34725. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  34726. $this->display();
  34727. }
  34728. }
  34729. public function display($finish = false)
  34730. {
  34731. if (null === $this->startTime) {
  34732. throw new LogicException('You must start the progress bar before calling display().');
  34733. }
  34734. $message = $this->format;
  34735. foreach ($this->generate($finish) as $name => $value) {
  34736. $message = str_replace("%{$name}%", $value, $message);
  34737. }
  34738. $this->overwrite($this->output, $message);
  34739. }
  34740. public function clear()
  34741. {
  34742. $this->overwrite($this->output, '');
  34743. }
  34744. public function finish()
  34745. {
  34746. if (null === $this->startTime) {
  34747. throw new LogicException('You must start the progress bar before calling finish().');
  34748. }
  34749. if (null !== $this->startTime) {
  34750. if (!$this->max) {
  34751. $this->barChar = $this->barCharOriginal;
  34752. $this->display(true);
  34753. }
  34754. $this->startTime = null;
  34755. $this->output->writeln('');
  34756. $this->output = null;
  34757. }
  34758. }
  34759. private function initialize()
  34760. {
  34761. $this->formatVars = array();
  34762. foreach ($this->defaultFormatVars as $var) {
  34763. if (false !== strpos($this->format, "%{$var}%")) {
  34764. $this->formatVars[$var] = true;
  34765. }
  34766. }
  34767. if ($this->max > 0) {
  34768. $this->widths['max'] = $this->strlen($this->max);
  34769. $this->widths['current'] = $this->widths['max'];
  34770. } else {
  34771. $this->barCharOriginal = $this->barChar;
  34772. $this->barChar = $this->emptyBarChar;
  34773. }
  34774. }
  34775. private function generate($finish = false)
  34776. {
  34777. $vars = array();
  34778. $percent = 0;
  34779. if ($this->max > 0) {
  34780. $percent = (float) $this->current / $this->max;
  34781. }
  34782. if (isset($this->formatVars['bar'])) {
  34783. if ($this->max > 0) {
  34784. $completeBars = floor($percent * $this->barWidth);
  34785. } else {
  34786. if (!$finish) {
  34787. $completeBars = floor($this->current % $this->barWidth);
  34788. } else {
  34789. $completeBars = $this->barWidth;
  34790. }
  34791. }
  34792. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  34793. $bar = str_repeat($this->barChar, $completeBars);
  34794. if ($completeBars < $this->barWidth) {
  34795. $bar .= $this->progressChar;
  34796. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  34797. }
  34798. $vars['bar'] = $bar;
  34799. }
  34800. if (isset($this->formatVars['elapsed'])) {
  34801. $elapsed = time() - $this->startTime;
  34802. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  34803. }
  34804. if (isset($this->formatVars['current'])) {
  34805. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  34806. }
  34807. if (isset($this->formatVars['max'])) {
  34808. $vars['max'] = $this->max;
  34809. }
  34810. if (isset($this->formatVars['percent'])) {
  34811. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  34812. }
  34813. return $vars;
  34814. }
  34815. private function humaneTime($secs)
  34816. {
  34817. $text = '';
  34818. foreach ($this->timeFormats as $format) {
  34819. if ($secs < $format[0]) {
  34820. if (2 == \count($format)) {
  34821. $text = $format[1];
  34822. break;
  34823. } else {
  34824. $text = ceil($secs / $format[2]).' '.$format[1];
  34825. break;
  34826. }
  34827. }
  34828. }
  34829. return $text;
  34830. }
  34831. private function overwrite(OutputInterface $output, $message)
  34832. {
  34833. $length = $this->strlen($message);
  34834. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  34835. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  34836. }
  34837. $output->write("\x0D");
  34838. $output->write($message);
  34839. $this->lastMessagesLength = $this->strlen($message);
  34840. }
  34841. public function getName()
  34842. {
  34843. return 'progress';
  34844. }
  34845. }
  34846. <?php
  34847. namespace Symfony\Component\Console\Helper;
  34848. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34849. use Symfony\Component\Console\Exception\LogicException;
  34850. use Symfony\Component\Console\Output\OutputInterface;
  34851. class ProgressIndicator
  34852. {
  34853. private $output;
  34854. private $startTime;
  34855. private $format;
  34856. private $message;
  34857. private $indicatorValues;
  34858. private $indicatorCurrent;
  34859. private $indicatorChangeInterval;
  34860. private $indicatorUpdateTime;
  34861. private $started = false;
  34862. private static $formatters;
  34863. private static $formats;
  34864. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  34865. {
  34866. $this->output = $output;
  34867. if (null === $format) {
  34868. $format = $this->determineBestFormat();
  34869. }
  34870. if (null === $indicatorValues) {
  34871. $indicatorValues = array('-', '\\', '|', '/');
  34872. }
  34873. $indicatorValues = array_values($indicatorValues);
  34874. if (2 > \count($indicatorValues)) {
  34875. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  34876. }
  34877. $this->format = self::getFormatDefinition($format);
  34878. $this->indicatorChangeInterval = $indicatorChangeInterval;
  34879. $this->indicatorValues = $indicatorValues;
  34880. $this->startTime = time();
  34881. }
  34882. public function setMessage($message)
  34883. {
  34884. $this->message = $message;
  34885. $this->display();
  34886. }
  34887. public function getMessage()
  34888. {
  34889. return $this->message;
  34890. }
  34891. public function getStartTime()
  34892. {
  34893. return $this->startTime;
  34894. }
  34895. public function getCurrentValue()
  34896. {
  34897. return $this->indicatorValues[$this->indicatorCurrent % \count($this->indicatorValues)];
  34898. }
  34899. public function start($message)
  34900. {
  34901. if ($this->started) {
  34902. throw new LogicException('Progress indicator already started.');
  34903. }
  34904. $this->message = $message;
  34905. $this->started = true;
  34906. $this->startTime = time();
  34907. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  34908. $this->indicatorCurrent = 0;
  34909. $this->display();
  34910. }
  34911. public function advance()
  34912. {
  34913. if (!$this->started) {
  34914. throw new LogicException('Progress indicator has not yet been started.');
  34915. }
  34916. if (!$this->output->isDecorated()) {
  34917. return;
  34918. }
  34919. $currentTime = $this->getCurrentTimeInMilliseconds();
  34920. if ($currentTime < $this->indicatorUpdateTime) {
  34921. return;
  34922. }
  34923. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  34924. ++$this->indicatorCurrent;
  34925. $this->display();
  34926. }
  34927. public function finish($message)
  34928. {
  34929. if (!$this->started) {
  34930. throw new LogicException('Progress indicator has not yet been started.');
  34931. }
  34932. $this->message = $message;
  34933. $this->display();
  34934. $this->output->writeln('');
  34935. $this->started = false;
  34936. }
  34937. public static function getFormatDefinition($name)
  34938. {
  34939. if (!self::$formats) {
  34940. self::$formats = self::initFormats();
  34941. }
  34942. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  34943. }
  34944. public static function setPlaceholderFormatterDefinition($name, $callable)
  34945. {
  34946. if (!self::$formatters) {
  34947. self::$formatters = self::initPlaceholderFormatters();
  34948. }
  34949. self::$formatters[$name] = $callable;
  34950. }
  34951. public static function getPlaceholderFormatterDefinition($name)
  34952. {
  34953. if (!self::$formatters) {
  34954. self::$formatters = self::initPlaceholderFormatters();
  34955. }
  34956. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  34957. }
  34958. private function display()
  34959. {
  34960. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  34961. return;
  34962. }
  34963. $self = $this;
  34964. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  34965. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  34966. return \call_user_func($formatter, $self);
  34967. }
  34968. return $matches[0];
  34969. }, $this->format));
  34970. }
  34971. private function determineBestFormat()
  34972. {
  34973. switch ($this->output->getVerbosity()) {
  34974. case OutputInterface::VERBOSITY_VERBOSE:
  34975. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  34976. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34977. case OutputInterface::VERBOSITY_DEBUG:
  34978. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  34979. default:
  34980. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  34981. }
  34982. }
  34983. private function overwrite($message)
  34984. {
  34985. if ($this->output->isDecorated()) {
  34986. $this->output->write("\x0D\x1B[2K");
  34987. $this->output->write($message);
  34988. } else {
  34989. $this->output->writeln($message);
  34990. }
  34991. }
  34992. private function getCurrentTimeInMilliseconds()
  34993. {
  34994. return round(microtime(true) * 1000);
  34995. }
  34996. private static function initPlaceholderFormatters()
  34997. {
  34998. return array(
  34999. 'indicator' => function (ProgressIndicator $indicator) {
  35000. return $indicator->getCurrentValue();
  35001. },
  35002. 'message' => function (ProgressIndicator $indicator) {
  35003. return $indicator->getMessage();
  35004. },
  35005. 'elapsed' => function (ProgressIndicator $indicator) {
  35006. return Helper::formatTime(time() - $indicator->getStartTime());
  35007. },
  35008. 'memory' => function () {
  35009. return Helper::formatMemory(memory_get_usage(true));
  35010. },
  35011. );
  35012. }
  35013. private static function initFormats()
  35014. {
  35015. return array(
  35016. 'normal' => ' %indicator% %message%',
  35017. 'normal_no_ansi' => ' %message%',
  35018. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  35019. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  35020. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  35021. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  35022. );
  35023. }
  35024. }
  35025. <?php
  35026. namespace Symfony\Component\Console\Helper;
  35027. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35028. use Symfony\Component\Console\Exception\RuntimeException;
  35029. use Symfony\Component\Console\Formatter\OutputFormatter;
  35030. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  35031. use Symfony\Component\Console\Input\InputInterface;
  35032. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35033. use Symfony\Component\Console\Output\OutputInterface;
  35034. use Symfony\Component\Console\Question\ChoiceQuestion;
  35035. use Symfony\Component\Console\Question\Question;
  35036. class QuestionHelper extends Helper
  35037. {
  35038. private $inputStream;
  35039. private static $shell;
  35040. private static $stty;
  35041. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  35042. {
  35043. if ($output instanceof ConsoleOutputInterface) {
  35044. $output = $output->getErrorOutput();
  35045. }
  35046. if (!$input->isInteractive()) {
  35047. $default = $question->getDefault();
  35048. if (null !== $default && $question instanceof ChoiceQuestion) {
  35049. $choices = $question->getChoices();
  35050. if (!$question->isMultiselect()) {
  35051. return isset($choices[$default]) ? $choices[$default] : $default;
  35052. }
  35053. $default = explode(',', $default);
  35054. foreach ($default as $k => $v) {
  35055. $v = trim($v);
  35056. $default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
  35057. }
  35058. }
  35059. return $default;
  35060. }
  35061. if (!$question->getValidator()) {
  35062. return $this->doAsk($output, $question);
  35063. }
  35064. $that = $this;
  35065. $interviewer = function () use ($output, $question, $that) {
  35066. return $that->doAsk($output, $question);
  35067. };
  35068. return $this->validateAttempts($interviewer, $output, $question);
  35069. }
  35070. public function setInputStream($stream)
  35071. {
  35072. if (!\is_resource($stream)) {
  35073. throw new InvalidArgumentException('Input stream must be a valid resource.');
  35074. }
  35075. $this->inputStream = $stream;
  35076. }
  35077. public function getInputStream()
  35078. {
  35079. return $this->inputStream;
  35080. }
  35081. public function getName()
  35082. {
  35083. return 'question';
  35084. }
  35085. public function doAsk(OutputInterface $output, Question $question)
  35086. {
  35087. $this->writePrompt($output, $question);
  35088. $inputStream = $this->inputStream ?: STDIN;
  35089. $autocomplete = $question->getAutocompleterValues();
  35090. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  35091. $ret = false;
  35092. if ($question->isHidden()) {
  35093. try {
  35094. $ret = trim($this->getHiddenResponse($output, $inputStream));
  35095. } catch (RuntimeException $e) {
  35096. if (!$question->isHiddenFallback()) {
  35097. throw $e;
  35098. }
  35099. }
  35100. }
  35101. if (false === $ret) {
  35102. $ret = fgets($inputStream, 4096);
  35103. if (false === $ret) {
  35104. throw new RuntimeException('Aborted');
  35105. }
  35106. $ret = trim($ret);
  35107. }
  35108. } else {
  35109. $ret = trim($this->autocomplete($output, $question, $inputStream, \is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  35110. }
  35111. $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
  35112. if ($normalizer = $question->getNormalizer()) {
  35113. return $normalizer($ret);
  35114. }
  35115. return $ret;
  35116. }
  35117. protected function writePrompt(OutputInterface $output, Question $question)
  35118. {
  35119. $message = $question->getQuestion();
  35120. if ($question instanceof ChoiceQuestion) {
  35121. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  35122. $messages = (array) $question->getQuestion();
  35123. foreach ($question->getChoices() as $key => $value) {
  35124. $width = $maxWidth - $this->strlen($key);
  35125. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  35126. }
  35127. $output->writeln($messages);
  35128. $message = $question->getPrompt();
  35129. }
  35130. $output->write($message);
  35131. }
  35132. protected function writeError(OutputInterface $output, \Exception $error)
  35133. {
  35134. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  35135. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  35136. } else {
  35137. $message = '<error>'.$error->getMessage().'</error>';
  35138. }
  35139. $output->writeln($message);
  35140. }
  35141. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  35142. {
  35143. $ret = '';
  35144. $i = 0;
  35145. $ofs = -1;
  35146. $matches = $autocomplete;
  35147. $numMatches = \count($matches);
  35148. $sttyMode = shell_exec('stty -g');
  35149. shell_exec('stty -icanon -echo');
  35150. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  35151. while (!feof($inputStream)) {
  35152. $c = fread($inputStream, 1);
  35153. if ("\177" === $c) {
  35154. if (0 === $numMatches && 0 !== $i) {
  35155. --$i;
  35156. $output->write("\033[1D");
  35157. }
  35158. if (0 === $i) {
  35159. $ofs = -1;
  35160. $matches = $autocomplete;
  35161. $numMatches = \count($matches);
  35162. } else {
  35163. $numMatches = 0;
  35164. }
  35165. $ret = substr($ret, 0, $i);
  35166. } elseif ("\033" === $c) {
  35167. $c .= fread($inputStream, 2);
  35168. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  35169. if ('A' === $c[2] && -1 === $ofs) {
  35170. $ofs = 0;
  35171. }
  35172. if (0 === $numMatches) {
  35173. continue;
  35174. }
  35175. $ofs += ('A' === $c[2]) ? -1 : 1;
  35176. $ofs = ($numMatches + $ofs) % $numMatches;
  35177. }
  35178. } elseif (\ord($c) < 32) {
  35179. if ("\t" === $c || "\n" === $c) {
  35180. if ($numMatches > 0 && -1 !== $ofs) {
  35181. $ret = $matches[$ofs];
  35182. $output->write(substr($ret, $i));
  35183. $i = \strlen($ret);
  35184. }
  35185. if ("\n" === $c) {
  35186. $output->write($c);
  35187. break;
  35188. }
  35189. $numMatches = 0;
  35190. }
  35191. continue;
  35192. } else {
  35193. $output->write($c);
  35194. $ret .= $c;
  35195. ++$i;
  35196. $numMatches = 0;
  35197. $ofs = 0;
  35198. foreach ($autocomplete as $value) {
  35199. if (0 === strpos($value, $ret)) {
  35200. $matches[$numMatches++] = $value;
  35201. }
  35202. }
  35203. }
  35204. $output->write("\033[K");
  35205. if ($numMatches > 0 && -1 !== $ofs) {
  35206. $output->write("\0337");
  35207. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  35208. $output->write("\0338");
  35209. }
  35210. }
  35211. shell_exec(sprintf('stty %s', $sttyMode));
  35212. return $ret;
  35213. }
  35214. private function getHiddenResponse(OutputInterface $output, $inputStream)
  35215. {
  35216. if ('\\' === \DIRECTORY_SEPARATOR) {
  35217. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  35218. if ('phar:' === substr(__FILE__, 0, 5)) {
  35219. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  35220. copy($exe, $tmpExe);
  35221. $exe = $tmpExe;
  35222. }
  35223. $value = rtrim(shell_exec($exe));
  35224. $output->writeln('');
  35225. if (isset($tmpExe)) {
  35226. unlink($tmpExe);
  35227. }
  35228. return $value;
  35229. }
  35230. if ($this->hasSttyAvailable()) {
  35231. $sttyMode = shell_exec('stty -g');
  35232. shell_exec('stty -echo');
  35233. $value = fgets($inputStream, 4096);
  35234. shell_exec(sprintf('stty %s', $sttyMode));
  35235. if (false === $value) {
  35236. throw new RuntimeException('Aborted');
  35237. }
  35238. $value = trim($value);
  35239. $output->writeln('');
  35240. return $value;
  35241. }
  35242. if (false !== $shell = $this->getShell()) {
  35243. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  35244. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  35245. $value = rtrim(shell_exec($command));
  35246. $output->writeln('');
  35247. return $value;
  35248. }
  35249. throw new RuntimeException('Unable to hide the response.');
  35250. }
  35251. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  35252. {
  35253. $error = null;
  35254. $attempts = $question->getMaxAttempts();
  35255. while (null === $attempts || $attempts--) {
  35256. if (null !== $error) {
  35257. $this->writeError($output, $error);
  35258. }
  35259. try {
  35260. return \call_user_func($question->getValidator(), $interviewer());
  35261. } catch (RuntimeException $e) {
  35262. throw $e;
  35263. } catch (\Exception $error) {
  35264. }
  35265. }
  35266. throw $error;
  35267. }
  35268. private function getShell()
  35269. {
  35270. if (null !== self::$shell) {
  35271. return self::$shell;
  35272. }
  35273. self::$shell = false;
  35274. if (file_exists('/usr/bin/env')) {
  35275. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  35276. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  35277. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  35278. self::$shell = $sh;
  35279. break;
  35280. }
  35281. }
  35282. }
  35283. return self::$shell;
  35284. }
  35285. private function hasSttyAvailable()
  35286. {
  35287. if (null !== self::$stty) {
  35288. return self::$stty;
  35289. }
  35290. exec('stty 2>&1', $output, $exitcode);
  35291. return self::$stty = 0 === $exitcode;
  35292. }
  35293. }
  35294. <?php
  35295. namespace Symfony\Component\Console\Helper;
  35296. use Symfony\Component\Console\Exception\LogicException;
  35297. use Symfony\Component\Console\Formatter\OutputFormatter;
  35298. use Symfony\Component\Console\Input\InputInterface;
  35299. use Symfony\Component\Console\Output\OutputInterface;
  35300. use Symfony\Component\Console\Question\ChoiceQuestion;
  35301. use Symfony\Component\Console\Question\ConfirmationQuestion;
  35302. use Symfony\Component\Console\Question\Question;
  35303. use Symfony\Component\Console\Style\SymfonyStyle;
  35304. class SymfonyQuestionHelper extends QuestionHelper
  35305. {
  35306. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  35307. {
  35308. $validator = $question->getValidator();
  35309. $question->setValidator(function ($value) use ($validator) {
  35310. if (null !== $validator) {
  35311. $value = $validator($value);
  35312. } else {
  35313. if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) {
  35314. throw new LogicException('A value is required.');
  35315. }
  35316. }
  35317. return $value;
  35318. });
  35319. return parent::ask($input, $output, $question);
  35320. }
  35321. protected function writePrompt(OutputInterface $output, Question $question)
  35322. {
  35323. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  35324. $default = $question->getDefault();
  35325. switch (true) {
  35326. case null === $default:
  35327. $text = sprintf(' <info>%s</info>:', $text);
  35328. break;
  35329. case $question instanceof ConfirmationQuestion:
  35330. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  35331. break;
  35332. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  35333. $choices = $question->getChoices();
  35334. $default = explode(',', $default);
  35335. foreach ($default as $key => $value) {
  35336. $default[$key] = $choices[trim($value)];
  35337. }
  35338. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  35339. break;
  35340. case $question instanceof ChoiceQuestion:
  35341. $choices = $question->getChoices();
  35342. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default));
  35343. break;
  35344. default:
  35345. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  35346. }
  35347. $output->writeln($text);
  35348. if ($question instanceof ChoiceQuestion) {
  35349. $width = max(array_map('strlen', array_keys($question->getChoices())));
  35350. foreach ($question->getChoices() as $key => $value) {
  35351. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  35352. }
  35353. }
  35354. $output->write(' > ');
  35355. }
  35356. protected function writeError(OutputInterface $output, \Exception $error)
  35357. {
  35358. if ($output instanceof SymfonyStyle) {
  35359. $output->newLine();
  35360. $output->error($error->getMessage());
  35361. return;
  35362. }
  35363. parent::writeError($output, $error);
  35364. }
  35365. }
  35366. <?php
  35367. namespace Symfony\Component\Console\Helper;
  35368. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35369. use Symfony\Component\Console\Output\OutputInterface;
  35370. class Table
  35371. {
  35372. private $headers = array();
  35373. private $rows = array();
  35374. private $columnWidths = array();
  35375. private $numberOfColumns;
  35376. private $output;
  35377. private $style;
  35378. private $columnStyles = array();
  35379. private static $styles;
  35380. public function __construct(OutputInterface $output)
  35381. {
  35382. $this->output = $output;
  35383. if (!self::$styles) {
  35384. self::$styles = self::initStyles();
  35385. }
  35386. $this->setStyle('default');
  35387. }
  35388. public static function setStyleDefinition($name, TableStyle $style)
  35389. {
  35390. if (!self::$styles) {
  35391. self::$styles = self::initStyles();
  35392. }
  35393. self::$styles[$name] = $style;
  35394. }
  35395. public static function getStyleDefinition($name)
  35396. {
  35397. if (!self::$styles) {
  35398. self::$styles = self::initStyles();
  35399. }
  35400. if (isset(self::$styles[$name])) {
  35401. return self::$styles[$name];
  35402. }
  35403. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  35404. }
  35405. public function setStyle($name)
  35406. {
  35407. $this->style = $this->resolveStyle($name);
  35408. return $this;
  35409. }
  35410. public function getStyle()
  35411. {
  35412. return $this->style;
  35413. }
  35414. public function setColumnStyle($columnIndex, $name)
  35415. {
  35416. $columnIndex = (int) $columnIndex;
  35417. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  35418. return $this;
  35419. }
  35420. public function getColumnStyle($columnIndex)
  35421. {
  35422. if (isset($this->columnStyles[$columnIndex])) {
  35423. return $this->columnStyles[$columnIndex];
  35424. }
  35425. return $this->getStyle();
  35426. }
  35427. public function setHeaders(array $headers)
  35428. {
  35429. $headers = array_values($headers);
  35430. if (!empty($headers) && !\is_array($headers[0])) {
  35431. $headers = array($headers);
  35432. }
  35433. $this->headers = $headers;
  35434. return $this;
  35435. }
  35436. public function setRows(array $rows)
  35437. {
  35438. $this->rows = array();
  35439. return $this->addRows($rows);
  35440. }
  35441. public function addRows(array $rows)
  35442. {
  35443. foreach ($rows as $row) {
  35444. $this->addRow($row);
  35445. }
  35446. return $this;
  35447. }
  35448. public function addRow($row)
  35449. {
  35450. if ($row instanceof TableSeparator) {
  35451. $this->rows[] = $row;
  35452. return $this;
  35453. }
  35454. if (!\is_array($row)) {
  35455. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  35456. }
  35457. $this->rows[] = array_values($row);
  35458. return $this;
  35459. }
  35460. public function setRow($column, array $row)
  35461. {
  35462. $this->rows[$column] = $row;
  35463. return $this;
  35464. }
  35465. public function render()
  35466. {
  35467. $this->calculateNumberOfColumns();
  35468. $rows = $this->buildTableRows($this->rows);
  35469. $headers = $this->buildTableRows($this->headers);
  35470. $this->calculateColumnsWidth(array_merge($headers, $rows));
  35471. $this->renderRowSeparator();
  35472. if (!empty($headers)) {
  35473. foreach ($headers as $header) {
  35474. $this->renderRow($header, $this->style->getCellHeaderFormat());
  35475. $this->renderRowSeparator();
  35476. }
  35477. }
  35478. foreach ($rows as $row) {
  35479. if ($row instanceof TableSeparator) {
  35480. $this->renderRowSeparator();
  35481. } else {
  35482. $this->renderRow($row, $this->style->getCellRowFormat());
  35483. }
  35484. }
  35485. if (!empty($rows)) {
  35486. $this->renderRowSeparator();
  35487. }
  35488. $this->cleanup();
  35489. }
  35490. private function renderRowSeparator()
  35491. {
  35492. if (0 === $count = $this->numberOfColumns) {
  35493. return;
  35494. }
  35495. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  35496. return;
  35497. }
  35498. $markup = $this->style->getCrossingChar();
  35499. for ($column = 0; $column < $count; ++$column) {
  35500. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  35501. }
  35502. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  35503. }
  35504. private function renderColumnSeparator()
  35505. {
  35506. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  35507. }
  35508. private function renderRow(array $row, $cellFormat)
  35509. {
  35510. if (empty($row)) {
  35511. return;
  35512. }
  35513. $rowContent = $this->renderColumnSeparator();
  35514. foreach ($this->getRowColumns($row) as $column) {
  35515. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  35516. $rowContent .= $this->renderColumnSeparator();
  35517. }
  35518. $this->output->writeln($rowContent);
  35519. }
  35520. private function renderCell(array $row, $column, $cellFormat)
  35521. {
  35522. $cell = isset($row[$column]) ? $row[$column] : '';
  35523. $width = $this->columnWidths[$column];
  35524. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35525. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  35526. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  35527. }
  35528. }
  35529. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  35530. $width += \strlen($cell) - mb_strwidth($cell, $encoding);
  35531. }
  35532. $style = $this->getColumnStyle($column);
  35533. if ($cell instanceof TableSeparator) {
  35534. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  35535. }
  35536. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  35537. $content = sprintf($style->getCellRowContentFormat(), $cell);
  35538. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  35539. }
  35540. private function calculateNumberOfColumns()
  35541. {
  35542. if (null !== $this->numberOfColumns) {
  35543. return;
  35544. }
  35545. $columns = array(0);
  35546. foreach (array_merge($this->headers, $this->rows) as $row) {
  35547. if ($row instanceof TableSeparator) {
  35548. continue;
  35549. }
  35550. $columns[] = $this->getNumberOfColumns($row);
  35551. }
  35552. $this->numberOfColumns = max($columns);
  35553. }
  35554. private function buildTableRows($rows)
  35555. {
  35556. $unmergedRows = array();
  35557. for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
  35558. $rows = $this->fillNextRows($rows, $rowKey);
  35559. foreach ($rows[$rowKey] as $column => $cell) {
  35560. if (!strstr($cell, "\n")) {
  35561. continue;
  35562. }
  35563. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  35564. foreach ($lines as $lineKey => $line) {
  35565. if ($cell instanceof TableCell) {
  35566. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  35567. }
  35568. if (0 === $lineKey) {
  35569. $rows[$rowKey][$column] = $line;
  35570. } else {
  35571. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  35572. }
  35573. }
  35574. }
  35575. }
  35576. $tableRows = array();
  35577. foreach ($rows as $rowKey => $row) {
  35578. $tableRows[] = $this->fillCells($row);
  35579. if (isset($unmergedRows[$rowKey])) {
  35580. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  35581. }
  35582. }
  35583. return $tableRows;
  35584. }
  35585. private function fillNextRows(array $rows, $line)
  35586. {
  35587. $unmergedRows = array();
  35588. foreach ($rows[$line] as $column => $cell) {
  35589. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  35590. $nbLines = $cell->getRowspan() - 1;
  35591. $lines = array($cell);
  35592. if (strstr($cell, "\n")) {
  35593. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  35594. $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  35595. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  35596. unset($lines[0]);
  35597. }
  35598. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  35599. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  35600. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  35601. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  35602. if ($nbLines === $unmergedRowKey - $line) {
  35603. break;
  35604. }
  35605. }
  35606. }
  35607. }
  35608. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  35609. if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  35610. foreach ($unmergedRow as $cellKey => $cell) {
  35611. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  35612. }
  35613. } else {
  35614. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  35615. foreach ($unmergedRow as $column => $cell) {
  35616. if (!empty($cell)) {
  35617. $row[$column] = $unmergedRow[$column];
  35618. }
  35619. }
  35620. array_splice($rows, $unmergedRowKey, 0, array($row));
  35621. }
  35622. }
  35623. return $rows;
  35624. }
  35625. private function fillCells($row)
  35626. {
  35627. $newRow = array();
  35628. foreach ($row as $column => $cell) {
  35629. $newRow[] = $cell;
  35630. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35631. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  35632. $newRow[] = '';
  35633. }
  35634. }
  35635. }
  35636. return $newRow ?: $row;
  35637. }
  35638. private function copyRow(array $rows, $line)
  35639. {
  35640. $row = $rows[$line];
  35641. foreach ($row as $cellKey => $cellValue) {
  35642. $row[$cellKey] = '';
  35643. if ($cellValue instanceof TableCell) {
  35644. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  35645. }
  35646. }
  35647. return $row;
  35648. }
  35649. private function getNumberOfColumns(array $row)
  35650. {
  35651. $columns = \count($row);
  35652. foreach ($row as $column) {
  35653. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  35654. }
  35655. return $columns;
  35656. }
  35657. private function getRowColumns(array $row)
  35658. {
  35659. $columns = range(0, $this->numberOfColumns - 1);
  35660. foreach ($row as $cellKey => $cell) {
  35661. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35662. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  35663. }
  35664. }
  35665. return $columns;
  35666. }
  35667. private function calculateColumnsWidth($rows)
  35668. {
  35669. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  35670. $lengths = array();
  35671. foreach ($rows as $row) {
  35672. if ($row instanceof TableSeparator) {
  35673. continue;
  35674. }
  35675. foreach ($row as $i => $cell) {
  35676. if ($cell instanceof TableCell) {
  35677. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  35678. $textLength = Helper::strlen($textContent);
  35679. if ($textLength > 0) {
  35680. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  35681. foreach ($contentColumns as $position => $content) {
  35682. $row[$i + $position] = $content;
  35683. }
  35684. }
  35685. }
  35686. }
  35687. $lengths[] = $this->getCellWidth($row, $column);
  35688. }
  35689. $this->columnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2;
  35690. }
  35691. }
  35692. private function getColumnSeparatorWidth()
  35693. {
  35694. return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  35695. }
  35696. private function getCellWidth(array $row, $column)
  35697. {
  35698. if (isset($row[$column])) {
  35699. $cell = $row[$column];
  35700. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  35701. return $cellWidth;
  35702. }
  35703. return 0;
  35704. }
  35705. private function cleanup()
  35706. {
  35707. $this->columnWidths = array();
  35708. $this->numberOfColumns = null;
  35709. }
  35710. private static function initStyles()
  35711. {
  35712. $borderless = new TableStyle();
  35713. $borderless
  35714. ->setHorizontalBorderChar('=')
  35715. ->setVerticalBorderChar(' ')
  35716. ->setCrossingChar(' ')
  35717. ;
  35718. $compact = new TableStyle();
  35719. $compact
  35720. ->setHorizontalBorderChar('')
  35721. ->setVerticalBorderChar(' ')
  35722. ->setCrossingChar('')
  35723. ->setCellRowContentFormat('%s')
  35724. ;
  35725. $styleGuide = new TableStyle();
  35726. $styleGuide
  35727. ->setHorizontalBorderChar('-')
  35728. ->setVerticalBorderChar(' ')
  35729. ->setCrossingChar(' ')
  35730. ->setCellHeaderFormat('%s')
  35731. ;
  35732. return array(
  35733. 'default' => new TableStyle(),
  35734. 'borderless' => $borderless,
  35735. 'compact' => $compact,
  35736. 'symfony-style-guide' => $styleGuide,
  35737. );
  35738. }
  35739. private function resolveStyle($name)
  35740. {
  35741. if ($name instanceof TableStyle) {
  35742. return $name;
  35743. }
  35744. if (isset(self::$styles[$name])) {
  35745. return self::$styles[$name];
  35746. }
  35747. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  35748. }
  35749. }
  35750. <?php
  35751. namespace Symfony\Component\Console\Helper;
  35752. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35753. class TableCell
  35754. {
  35755. private $value;
  35756. private $options = array(
  35757. 'rowspan' => 1,
  35758. 'colspan' => 1,
  35759. );
  35760. public function __construct($value = '', array $options = array())
  35761. {
  35762. if (is_numeric($value) && !\is_string($value)) {
  35763. $value = (string) $value;
  35764. }
  35765. $this->value = $value;
  35766. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  35767. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  35768. }
  35769. $this->options = array_merge($this->options, $options);
  35770. }
  35771. public function __toString()
  35772. {
  35773. return $this->value;
  35774. }
  35775. public function getColspan()
  35776. {
  35777. return (int) $this->options['colspan'];
  35778. }
  35779. public function getRowspan()
  35780. {
  35781. return (int) $this->options['rowspan'];
  35782. }
  35783. }
  35784. <?php
  35785. namespace Symfony\Component\Console\Helper;
  35786. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35787. use Symfony\Component\Console\Output\NullOutput;
  35788. use Symfony\Component\Console\Output\OutputInterface;
  35789. class TableHelper extends Helper
  35790. {
  35791. const LAYOUT_DEFAULT = 0;
  35792. const LAYOUT_BORDERLESS = 1;
  35793. const LAYOUT_COMPACT = 2;
  35794. private $table;
  35795. public function __construct($triggerDeprecationError = true)
  35796. {
  35797. if ($triggerDeprecationError) {
  35798. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  35799. }
  35800. $this->table = new Table(new NullOutput());
  35801. }
  35802. public function setLayout($layout)
  35803. {
  35804. switch ($layout) {
  35805. case self::LAYOUT_BORDERLESS:
  35806. $this->table->setStyle('borderless');
  35807. break;
  35808. case self::LAYOUT_COMPACT:
  35809. $this->table->setStyle('compact');
  35810. break;
  35811. case self::LAYOUT_DEFAULT:
  35812. $this->table->setStyle('default');
  35813. break;
  35814. default:
  35815. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  35816. }
  35817. return $this;
  35818. }
  35819. public function setHeaders(array $headers)
  35820. {
  35821. $this->table->setHeaders($headers);
  35822. return $this;
  35823. }
  35824. public function setRows(array $rows)
  35825. {
  35826. $this->table->setRows($rows);
  35827. return $this;
  35828. }
  35829. public function addRows(array $rows)
  35830. {
  35831. $this->table->addRows($rows);
  35832. return $this;
  35833. }
  35834. public function addRow(array $row)
  35835. {
  35836. $this->table->addRow($row);
  35837. return $this;
  35838. }
  35839. public function setRow($column, array $row)
  35840. {
  35841. $this->table->setRow($column, $row);
  35842. return $this;
  35843. }
  35844. public function setPaddingChar($paddingChar)
  35845. {
  35846. $this->table->getStyle()->setPaddingChar($paddingChar);
  35847. return $this;
  35848. }
  35849. public function setHorizontalBorderChar($horizontalBorderChar)
  35850. {
  35851. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  35852. return $this;
  35853. }
  35854. public function setVerticalBorderChar($verticalBorderChar)
  35855. {
  35856. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  35857. return $this;
  35858. }
  35859. public function setCrossingChar($crossingChar)
  35860. {
  35861. $this->table->getStyle()->setCrossingChar($crossingChar);
  35862. return $this;
  35863. }
  35864. public function setCellHeaderFormat($cellHeaderFormat)
  35865. {
  35866. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  35867. return $this;
  35868. }
  35869. public function setCellRowFormat($cellRowFormat)
  35870. {
  35871. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  35872. return $this;
  35873. }
  35874. public function setCellRowContentFormat($cellRowContentFormat)
  35875. {
  35876. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  35877. return $this;
  35878. }
  35879. public function setBorderFormat($borderFormat)
  35880. {
  35881. $this->table->getStyle()->setBorderFormat($borderFormat);
  35882. return $this;
  35883. }
  35884. public function setPadType($padType)
  35885. {
  35886. $this->table->getStyle()->setPadType($padType);
  35887. return $this;
  35888. }
  35889. public function render(OutputInterface $output)
  35890. {
  35891. $p = new \ReflectionProperty($this->table, 'output');
  35892. $p->setAccessible(true);
  35893. $p->setValue($this->table, $output);
  35894. $this->table->render();
  35895. }
  35896. public function getName()
  35897. {
  35898. return 'table';
  35899. }
  35900. }
  35901. <?php
  35902. namespace Symfony\Component\Console\Helper;
  35903. class TableSeparator extends TableCell
  35904. {
  35905. public function __construct(array $options = array())
  35906. {
  35907. parent::__construct('', $options);
  35908. }
  35909. }
  35910. <?php
  35911. namespace Symfony\Component\Console\Helper;
  35912. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35913. use Symfony\Component\Console\Exception\LogicException;
  35914. class TableStyle
  35915. {
  35916. private $paddingChar = ' ';
  35917. private $horizontalBorderChar = '-';
  35918. private $verticalBorderChar = '|';
  35919. private $crossingChar = '+';
  35920. private $cellHeaderFormat = '<info>%s</info>';
  35921. private $cellRowFormat = '%s';
  35922. private $cellRowContentFormat = ' %s ';
  35923. private $borderFormat = '%s';
  35924. private $padType = STR_PAD_RIGHT;
  35925. public function setPaddingChar($paddingChar)
  35926. {
  35927. if (!$paddingChar) {
  35928. throw new LogicException('The padding char must not be empty');
  35929. }
  35930. $this->paddingChar = $paddingChar;
  35931. return $this;
  35932. }
  35933. public function getPaddingChar()
  35934. {
  35935. return $this->paddingChar;
  35936. }
  35937. public function setHorizontalBorderChar($horizontalBorderChar)
  35938. {
  35939. $this->horizontalBorderChar = $horizontalBorderChar;
  35940. return $this;
  35941. }
  35942. public function getHorizontalBorderChar()
  35943. {
  35944. return $this->horizontalBorderChar;
  35945. }
  35946. public function setVerticalBorderChar($verticalBorderChar)
  35947. {
  35948. $this->verticalBorderChar = $verticalBorderChar;
  35949. return $this;
  35950. }
  35951. public function getVerticalBorderChar()
  35952. {
  35953. return $this->verticalBorderChar;
  35954. }
  35955. public function setCrossingChar($crossingChar)
  35956. {
  35957. $this->crossingChar = $crossingChar;
  35958. return $this;
  35959. }
  35960. public function getCrossingChar()
  35961. {
  35962. return $this->crossingChar;
  35963. }
  35964. public function setCellHeaderFormat($cellHeaderFormat)
  35965. {
  35966. $this->cellHeaderFormat = $cellHeaderFormat;
  35967. return $this;
  35968. }
  35969. public function getCellHeaderFormat()
  35970. {
  35971. return $this->cellHeaderFormat;
  35972. }
  35973. public function setCellRowFormat($cellRowFormat)
  35974. {
  35975. $this->cellRowFormat = $cellRowFormat;
  35976. return $this;
  35977. }
  35978. public function getCellRowFormat()
  35979. {
  35980. return $this->cellRowFormat;
  35981. }
  35982. public function setCellRowContentFormat($cellRowContentFormat)
  35983. {
  35984. $this->cellRowContentFormat = $cellRowContentFormat;
  35985. return $this;
  35986. }
  35987. public function getCellRowContentFormat()
  35988. {
  35989. return $this->cellRowContentFormat;
  35990. }
  35991. public function setBorderFormat($borderFormat)
  35992. {
  35993. $this->borderFormat = $borderFormat;
  35994. return $this;
  35995. }
  35996. public function getBorderFormat()
  35997. {
  35998. return $this->borderFormat;
  35999. }
  36000. public function setPadType($padType)
  36001. {
  36002. if (!\in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  36003. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  36004. }
  36005. $this->padType = $padType;
  36006. return $this;
  36007. }
  36008. public function getPadType()
  36009. {
  36010. return $this->padType;
  36011. }
  36012. }
  36013. <?php
  36014. namespace Symfony\Component\Console\Input;
  36015. use Symfony\Component\Console\Exception\RuntimeException;
  36016. class ArgvInput extends Input
  36017. {
  36018. private $tokens;
  36019. private $parsed;
  36020. public function __construct(array $argv = null, InputDefinition $definition = null)
  36021. {
  36022. if (null === $argv) {
  36023. $argv = $_SERVER['argv'];
  36024. }
  36025. array_shift($argv);
  36026. $this->tokens = $argv;
  36027. parent::__construct($definition);
  36028. }
  36029. protected function setTokens(array $tokens)
  36030. {
  36031. $this->tokens = $tokens;
  36032. }
  36033. protected function parse()
  36034. {
  36035. $parseOptions = true;
  36036. $this->parsed = $this->tokens;
  36037. while (null !== $token = array_shift($this->parsed)) {
  36038. if ($parseOptions && '' == $token) {
  36039. $this->parseArgument($token);
  36040. } elseif ($parseOptions && '--' == $token) {
  36041. $parseOptions = false;
  36042. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  36043. $this->parseLongOption($token);
  36044. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  36045. $this->parseShortOption($token);
  36046. } else {
  36047. $this->parseArgument($token);
  36048. }
  36049. }
  36050. }
  36051. private function parseShortOption($token)
  36052. {
  36053. $name = substr($token, 1);
  36054. if (\strlen($name) > 1) {
  36055. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  36056. $this->addShortOption($name[0], substr($name, 1));
  36057. } else {
  36058. $this->parseShortOptionSet($name);
  36059. }
  36060. } else {
  36061. $this->addShortOption($name, null);
  36062. }
  36063. }
  36064. private function parseShortOptionSet($name)
  36065. {
  36066. $len = \strlen($name);
  36067. for ($i = 0; $i < $len; ++$i) {
  36068. if (!$this->definition->hasShortcut($name[$i])) {
  36069. $encoding = mb_detect_encoding($name, null, true);
  36070. throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
  36071. }
  36072. $option = $this->definition->getOptionForShortcut($name[$i]);
  36073. if ($option->acceptValue()) {
  36074. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  36075. break;
  36076. } else {
  36077. $this->addLongOption($option->getName(), null);
  36078. }
  36079. }
  36080. }
  36081. private function parseLongOption($token)
  36082. {
  36083. $name = substr($token, 2);
  36084. if (false !== $pos = strpos($name, '=')) {
  36085. if (0 === \strlen($value = substr($name, $pos + 1))) {
  36086. array_unshift($this->parsed, null);
  36087. }
  36088. $this->addLongOption(substr($name, 0, $pos), $value);
  36089. } else {
  36090. $this->addLongOption($name, null);
  36091. }
  36092. }
  36093. private function parseArgument($token)
  36094. {
  36095. $c = \count($this->arguments);
  36096. if ($this->definition->hasArgument($c)) {
  36097. $arg = $this->definition->getArgument($c);
  36098. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  36099. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  36100. $arg = $this->definition->getArgument($c - 1);
  36101. $this->arguments[$arg->getName()][] = $token;
  36102. } else {
  36103. $all = $this->definition->getArguments();
  36104. if (\count($all)) {
  36105. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  36106. }
  36107. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  36108. }
  36109. }
  36110. private function addShortOption($shortcut, $value)
  36111. {
  36112. if (!$this->definition->hasShortcut($shortcut)) {
  36113. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  36114. }
  36115. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  36116. }
  36117. private function addLongOption($name, $value)
  36118. {
  36119. if (!$this->definition->hasOption($name)) {
  36120. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  36121. }
  36122. $option = $this->definition->getOption($name);
  36123. if (!isset($value[0])) {
  36124. $value = null;
  36125. }
  36126. if (null !== $value && !$option->acceptValue()) {
  36127. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  36128. }
  36129. if (null === $value && $option->acceptValue() && \count($this->parsed)) {
  36130. $next = array_shift($this->parsed);
  36131. if (isset($next[0]) && '-' !== $next[0]) {
  36132. $value = $next;
  36133. } elseif (empty($next)) {
  36134. $value = null;
  36135. } else {
  36136. array_unshift($this->parsed, $next);
  36137. }
  36138. }
  36139. if (null === $value) {
  36140. if ($option->isValueRequired()) {
  36141. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  36142. }
  36143. if (!$option->isArray()) {
  36144. $value = $option->isValueOptional() ? $option->getDefault() : true;
  36145. }
  36146. }
  36147. if ($option->isArray()) {
  36148. $this->options[$name][] = $value;
  36149. } else {
  36150. $this->options[$name] = $value;
  36151. }
  36152. }
  36153. public function getFirstArgument()
  36154. {
  36155. foreach ($this->tokens as $token) {
  36156. if ($token && '-' === $token[0]) {
  36157. continue;
  36158. }
  36159. return $token;
  36160. }
  36161. }
  36162. public function hasParameterOption($values)
  36163. {
  36164. $values = (array) $values;
  36165. foreach ($this->tokens as $token) {
  36166. foreach ($values as $value) {
  36167. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  36168. if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
  36169. return true;
  36170. }
  36171. }
  36172. }
  36173. return false;
  36174. }
  36175. public function getParameterOption($values, $default = false)
  36176. {
  36177. $values = (array) $values;
  36178. $tokens = $this->tokens;
  36179. while (0 < \count($tokens)) {
  36180. $token = array_shift($tokens);
  36181. foreach ($values as $value) {
  36182. if ($token === $value) {
  36183. return array_shift($tokens);
  36184. }
  36185. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  36186. if ('' !== $leading && 0 === strpos($token, $leading)) {
  36187. return substr($token, \strlen($leading));
  36188. }
  36189. }
  36190. }
  36191. return $default;
  36192. }
  36193. public function __toString()
  36194. {
  36195. $self = $this;
  36196. $tokens = array_map(function ($token) use ($self) {
  36197. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  36198. return $match[1].$self->escapeToken($match[2]);
  36199. }
  36200. if ($token && '-' !== $token[0]) {
  36201. return $self->escapeToken($token);
  36202. }
  36203. return $token;
  36204. }, $this->tokens);
  36205. return implode(' ', $tokens);
  36206. }
  36207. }
  36208. <?php
  36209. namespace Symfony\Component\Console\Input;
  36210. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36211. use Symfony\Component\Console\Exception\InvalidOptionException;
  36212. class ArrayInput extends Input
  36213. {
  36214. private $parameters;
  36215. public function __construct(array $parameters, InputDefinition $definition = null)
  36216. {
  36217. $this->parameters = $parameters;
  36218. parent::__construct($definition);
  36219. }
  36220. public function getFirstArgument()
  36221. {
  36222. foreach ($this->parameters as $key => $value) {
  36223. if ($key && '-' === $key[0]) {
  36224. continue;
  36225. }
  36226. return $value;
  36227. }
  36228. }
  36229. public function hasParameterOption($values)
  36230. {
  36231. $values = (array) $values;
  36232. foreach ($this->parameters as $k => $v) {
  36233. if (!\is_int($k)) {
  36234. $v = $k;
  36235. }
  36236. if (\in_array($v, $values)) {
  36237. return true;
  36238. }
  36239. }
  36240. return false;
  36241. }
  36242. public function getParameterOption($values, $default = false)
  36243. {
  36244. $values = (array) $values;
  36245. foreach ($this->parameters as $k => $v) {
  36246. if (\is_int($k)) {
  36247. if (\in_array($v, $values)) {
  36248. return true;
  36249. }
  36250. } elseif (\in_array($k, $values)) {
  36251. return $v;
  36252. }
  36253. }
  36254. return $default;
  36255. }
  36256. public function __toString()
  36257. {
  36258. $params = array();
  36259. foreach ($this->parameters as $param => $val) {
  36260. if ($param && '-' === $param[0]) {
  36261. if (\is_array($val)) {
  36262. foreach ($val as $v) {
  36263. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  36264. }
  36265. } else {
  36266. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  36267. }
  36268. } else {
  36269. $params[] = \is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
  36270. }
  36271. }
  36272. return implode(' ', $params);
  36273. }
  36274. protected function parse()
  36275. {
  36276. foreach ($this->parameters as $key => $value) {
  36277. if (0 === strpos($key, '--')) {
  36278. $this->addLongOption(substr($key, 2), $value);
  36279. } elseif ('-' === $key[0]) {
  36280. $this->addShortOption(substr($key, 1), $value);
  36281. } else {
  36282. $this->addArgument($key, $value);
  36283. }
  36284. }
  36285. }
  36286. private function addShortOption($shortcut, $value)
  36287. {
  36288. if (!$this->definition->hasShortcut($shortcut)) {
  36289. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  36290. }
  36291. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  36292. }
  36293. private function addLongOption($name, $value)
  36294. {
  36295. if (!$this->definition->hasOption($name)) {
  36296. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  36297. }
  36298. $option = $this->definition->getOption($name);
  36299. if (null === $value) {
  36300. if ($option->isValueRequired()) {
  36301. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  36302. }
  36303. $value = $option->isValueOptional() ? $option->getDefault() : true;
  36304. }
  36305. $this->options[$name] = $value;
  36306. }
  36307. private function addArgument($name, $value)
  36308. {
  36309. if (!$this->definition->hasArgument($name)) {
  36310. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36311. }
  36312. $this->arguments[$name] = $value;
  36313. }
  36314. }
  36315. <?php
  36316. namespace Symfony\Component\Console\Input;
  36317. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36318. use Symfony\Component\Console\Exception\RuntimeException;
  36319. abstract class Input implements InputInterface
  36320. {
  36321. protected $definition;
  36322. protected $options = array();
  36323. protected $arguments = array();
  36324. protected $interactive = true;
  36325. public function __construct(InputDefinition $definition = null)
  36326. {
  36327. if (null === $definition) {
  36328. $this->definition = new InputDefinition();
  36329. } else {
  36330. $this->bind($definition);
  36331. $this->validate();
  36332. }
  36333. }
  36334. public function bind(InputDefinition $definition)
  36335. {
  36336. $this->arguments = array();
  36337. $this->options = array();
  36338. $this->definition = $definition;
  36339. $this->parse();
  36340. }
  36341. abstract protected function parse();
  36342. public function validate()
  36343. {
  36344. $definition = $this->definition;
  36345. $givenArguments = $this->arguments;
  36346. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  36347. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  36348. });
  36349. if (\count($missingArguments) > 0) {
  36350. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  36351. }
  36352. }
  36353. public function isInteractive()
  36354. {
  36355. return $this->interactive;
  36356. }
  36357. public function setInteractive($interactive)
  36358. {
  36359. $this->interactive = (bool) $interactive;
  36360. }
  36361. public function getArguments()
  36362. {
  36363. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  36364. }
  36365. public function getArgument($name)
  36366. {
  36367. if (!$this->definition->hasArgument($name)) {
  36368. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36369. }
  36370. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  36371. }
  36372. public function setArgument($name, $value)
  36373. {
  36374. if (!$this->definition->hasArgument($name)) {
  36375. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36376. }
  36377. $this->arguments[$name] = $value;
  36378. }
  36379. public function hasArgument($name)
  36380. {
  36381. return $this->definition->hasArgument($name);
  36382. }
  36383. public function getOptions()
  36384. {
  36385. return array_merge($this->definition->getOptionDefaults(), $this->options);
  36386. }
  36387. public function getOption($name)
  36388. {
  36389. if (!$this->definition->hasOption($name)) {
  36390. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  36391. }
  36392. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  36393. }
  36394. public function setOption($name, $value)
  36395. {
  36396. if (!$this->definition->hasOption($name)) {
  36397. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  36398. }
  36399. $this->options[$name] = $value;
  36400. }
  36401. public function hasOption($name)
  36402. {
  36403. return $this->definition->hasOption($name);
  36404. }
  36405. public function escapeToken($token)
  36406. {
  36407. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  36408. }
  36409. }
  36410. <?php
  36411. namespace Symfony\Component\Console\Input;
  36412. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36413. use Symfony\Component\Console\Exception\LogicException;
  36414. class InputArgument
  36415. {
  36416. const REQUIRED = 1;
  36417. const OPTIONAL = 2;
  36418. const IS_ARRAY = 4;
  36419. private $name;
  36420. private $mode;
  36421. private $default;
  36422. private $description;
  36423. public function __construct($name, $mode = null, $description = '', $default = null)
  36424. {
  36425. if (null === $mode) {
  36426. $mode = self::OPTIONAL;
  36427. } elseif (!\is_int($mode) || $mode > 7 || $mode < 1) {
  36428. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  36429. }
  36430. $this->name = $name;
  36431. $this->mode = $mode;
  36432. $this->description = $description;
  36433. $this->setDefault($default);
  36434. }
  36435. public function getName()
  36436. {
  36437. return $this->name;
  36438. }
  36439. public function isRequired()
  36440. {
  36441. return self::REQUIRED === (self::REQUIRED & $this->mode);
  36442. }
  36443. public function isArray()
  36444. {
  36445. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  36446. }
  36447. public function setDefault($default = null)
  36448. {
  36449. if (self::REQUIRED === $this->mode && null !== $default) {
  36450. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  36451. }
  36452. if ($this->isArray()) {
  36453. if (null === $default) {
  36454. $default = array();
  36455. } elseif (!\is_array($default)) {
  36456. throw new LogicException('A default value for an array argument must be an array.');
  36457. }
  36458. }
  36459. $this->default = $default;
  36460. }
  36461. public function getDefault()
  36462. {
  36463. return $this->default;
  36464. }
  36465. public function getDescription()
  36466. {
  36467. return $this->description;
  36468. }
  36469. }
  36470. <?php
  36471. namespace Symfony\Component\Console\Input;
  36472. interface InputAwareInterface
  36473. {
  36474. public function setInput(InputInterface $input);
  36475. }
  36476. <?php
  36477. namespace Symfony\Component\Console\Input;
  36478. use Symfony\Component\Console\Descriptor\TextDescriptor;
  36479. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  36480. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36481. use Symfony\Component\Console\Exception\LogicException;
  36482. use Symfony\Component\Console\Output\BufferedOutput;
  36483. class InputDefinition
  36484. {
  36485. private $arguments;
  36486. private $requiredCount;
  36487. private $hasAnArrayArgument = false;
  36488. private $hasOptional;
  36489. private $options;
  36490. private $shortcuts;
  36491. public function __construct(array $definition = array())
  36492. {
  36493. $this->setDefinition($definition);
  36494. }
  36495. public function setDefinition(array $definition)
  36496. {
  36497. $arguments = array();
  36498. $options = array();
  36499. foreach ($definition as $item) {
  36500. if ($item instanceof InputOption) {
  36501. $options[] = $item;
  36502. } else {
  36503. $arguments[] = $item;
  36504. }
  36505. }
  36506. $this->setArguments($arguments);
  36507. $this->setOptions($options);
  36508. }
  36509. public function setArguments($arguments = array())
  36510. {
  36511. $this->arguments = array();
  36512. $this->requiredCount = 0;
  36513. $this->hasOptional = false;
  36514. $this->hasAnArrayArgument = false;
  36515. $this->addArguments($arguments);
  36516. }
  36517. public function addArguments($arguments = array())
  36518. {
  36519. if (null !== $arguments) {
  36520. foreach ($arguments as $argument) {
  36521. $this->addArgument($argument);
  36522. }
  36523. }
  36524. }
  36525. public function addArgument(InputArgument $argument)
  36526. {
  36527. if (isset($this->arguments[$argument->getName()])) {
  36528. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  36529. }
  36530. if ($this->hasAnArrayArgument) {
  36531. throw new LogicException('Cannot add an argument after an array argument.');
  36532. }
  36533. if ($argument->isRequired() && $this->hasOptional) {
  36534. throw new LogicException('Cannot add a required argument after an optional one.');
  36535. }
  36536. if ($argument->isArray()) {
  36537. $this->hasAnArrayArgument = true;
  36538. }
  36539. if ($argument->isRequired()) {
  36540. ++$this->requiredCount;
  36541. } else {
  36542. $this->hasOptional = true;
  36543. }
  36544. $this->arguments[$argument->getName()] = $argument;
  36545. }
  36546. public function getArgument($name)
  36547. {
  36548. if (!$this->hasArgument($name)) {
  36549. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36550. }
  36551. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  36552. return $arguments[$name];
  36553. }
  36554. public function hasArgument($name)
  36555. {
  36556. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  36557. return isset($arguments[$name]);
  36558. }
  36559. public function getArguments()
  36560. {
  36561. return $this->arguments;
  36562. }
  36563. public function getArgumentCount()
  36564. {
  36565. return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments);
  36566. }
  36567. public function getArgumentRequiredCount()
  36568. {
  36569. return $this->requiredCount;
  36570. }
  36571. public function getArgumentDefaults()
  36572. {
  36573. $values = array();
  36574. foreach ($this->arguments as $argument) {
  36575. $values[$argument->getName()] = $argument->getDefault();
  36576. }
  36577. return $values;
  36578. }
  36579. public function setOptions($options = array())
  36580. {
  36581. $this->options = array();
  36582. $this->shortcuts = array();
  36583. $this->addOptions($options);
  36584. }
  36585. public function addOptions($options = array())
  36586. {
  36587. foreach ($options as $option) {
  36588. $this->addOption($option);
  36589. }
  36590. }
  36591. public function addOption(InputOption $option)
  36592. {
  36593. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  36594. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  36595. }
  36596. if ($option->getShortcut()) {
  36597. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  36598. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  36599. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  36600. }
  36601. }
  36602. }
  36603. $this->options[$option->getName()] = $option;
  36604. if ($option->getShortcut()) {
  36605. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  36606. $this->shortcuts[$shortcut] = $option->getName();
  36607. }
  36608. }
  36609. }
  36610. public function getOption($name)
  36611. {
  36612. if (!$this->hasOption($name)) {
  36613. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  36614. }
  36615. return $this->options[$name];
  36616. }
  36617. public function hasOption($name)
  36618. {
  36619. return isset($this->options[$name]);
  36620. }
  36621. public function getOptions()
  36622. {
  36623. return $this->options;
  36624. }
  36625. public function hasShortcut($name)
  36626. {
  36627. return isset($this->shortcuts[$name]);
  36628. }
  36629. public function getOptionForShortcut($shortcut)
  36630. {
  36631. return $this->getOption($this->shortcutToName($shortcut));
  36632. }
  36633. public function getOptionDefaults()
  36634. {
  36635. $values = array();
  36636. foreach ($this->options as $option) {
  36637. $values[$option->getName()] = $option->getDefault();
  36638. }
  36639. return $values;
  36640. }
  36641. private function shortcutToName($shortcut)
  36642. {
  36643. if (!isset($this->shortcuts[$shortcut])) {
  36644. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  36645. }
  36646. return $this->shortcuts[$shortcut];
  36647. }
  36648. public function getSynopsis($short = false)
  36649. {
  36650. $elements = array();
  36651. if ($short && $this->getOptions()) {
  36652. $elements[] = '[options]';
  36653. } elseif (!$short) {
  36654. foreach ($this->getOptions() as $option) {
  36655. $value = '';
  36656. if ($option->acceptValue()) {
  36657. $value = sprintf(
  36658. ' %s%s%s',
  36659. $option->isValueOptional() ? '[' : '',
  36660. strtoupper($option->getName()),
  36661. $option->isValueOptional() ? ']' : ''
  36662. );
  36663. }
  36664. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  36665. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  36666. }
  36667. }
  36668. if (\count($elements) && $this->getArguments()) {
  36669. $elements[] = '[--]';
  36670. }
  36671. foreach ($this->getArguments() as $argument) {
  36672. $element = '<'.$argument->getName().'>';
  36673. if (!$argument->isRequired()) {
  36674. $element = '['.$element.']';
  36675. } elseif ($argument->isArray()) {
  36676. $element .= ' ('.$element.')';
  36677. }
  36678. if ($argument->isArray()) {
  36679. $element .= '...';
  36680. }
  36681. $elements[] = $element;
  36682. }
  36683. return implode(' ', $elements);
  36684. }
  36685. public function asText()
  36686. {
  36687. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  36688. $descriptor = new TextDescriptor();
  36689. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  36690. $descriptor->describe($output, $this, array('raw_output' => true));
  36691. return $output->fetch();
  36692. }
  36693. public function asXml($asDom = false)
  36694. {
  36695. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  36696. $descriptor = new XmlDescriptor();
  36697. if ($asDom) {
  36698. return $descriptor->getInputDefinitionDocument($this);
  36699. }
  36700. $output = new BufferedOutput();
  36701. $descriptor->describe($output, $this);
  36702. return $output->fetch();
  36703. }
  36704. }
  36705. <?php
  36706. namespace Symfony\Component\Console\Input;
  36707. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36708. use Symfony\Component\Console\Exception\RuntimeException;
  36709. interface InputInterface
  36710. {
  36711. public function getFirstArgument();
  36712. public function hasParameterOption($values);
  36713. public function getParameterOption($values, $default = false);
  36714. public function bind(InputDefinition $definition);
  36715. public function validate();
  36716. public function getArguments();
  36717. public function getArgument($name);
  36718. public function setArgument($name, $value);
  36719. public function hasArgument($name);
  36720. public function getOptions();
  36721. public function getOption($name);
  36722. public function setOption($name, $value);
  36723. public function hasOption($name);
  36724. public function isInteractive();
  36725. public function setInteractive($interactive);
  36726. }
  36727. <?php
  36728. namespace Symfony\Component\Console\Input;
  36729. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36730. use Symfony\Component\Console\Exception\LogicException;
  36731. class InputOption
  36732. {
  36733. const VALUE_NONE = 1;
  36734. const VALUE_REQUIRED = 2;
  36735. const VALUE_OPTIONAL = 4;
  36736. const VALUE_IS_ARRAY = 8;
  36737. private $name;
  36738. private $shortcut;
  36739. private $mode;
  36740. private $default;
  36741. private $description;
  36742. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  36743. {
  36744. if (0 === strpos($name, '--')) {
  36745. $name = substr($name, 2);
  36746. }
  36747. if (empty($name)) {
  36748. throw new InvalidArgumentException('An option name cannot be empty.');
  36749. }
  36750. if (empty($shortcut)) {
  36751. $shortcut = null;
  36752. }
  36753. if (null !== $shortcut) {
  36754. if (\is_array($shortcut)) {
  36755. $shortcut = implode('|', $shortcut);
  36756. }
  36757. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  36758. $shortcuts = array_filter($shortcuts);
  36759. $shortcut = implode('|', $shortcuts);
  36760. if (empty($shortcut)) {
  36761. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  36762. }
  36763. }
  36764. if (null === $mode) {
  36765. $mode = self::VALUE_NONE;
  36766. } elseif (!\is_int($mode) || $mode > 15 || $mode < 1) {
  36767. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  36768. }
  36769. $this->name = $name;
  36770. $this->shortcut = $shortcut;
  36771. $this->mode = $mode;
  36772. $this->description = $description;
  36773. if ($this->isArray() && !$this->acceptValue()) {
  36774. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  36775. }
  36776. $this->setDefault($default);
  36777. }
  36778. public function getShortcut()
  36779. {
  36780. return $this->shortcut;
  36781. }
  36782. public function getName()
  36783. {
  36784. return $this->name;
  36785. }
  36786. public function acceptValue()
  36787. {
  36788. return $this->isValueRequired() || $this->isValueOptional();
  36789. }
  36790. public function isValueRequired()
  36791. {
  36792. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  36793. }
  36794. public function isValueOptional()
  36795. {
  36796. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  36797. }
  36798. public function isArray()
  36799. {
  36800. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  36801. }
  36802. public function setDefault($default = null)
  36803. {
  36804. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  36805. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  36806. }
  36807. if ($this->isArray()) {
  36808. if (null === $default) {
  36809. $default = array();
  36810. } elseif (!\is_array($default)) {
  36811. throw new LogicException('A default value for an array option must be an array.');
  36812. }
  36813. }
  36814. $this->default = $this->acceptValue() ? $default : false;
  36815. }
  36816. public function getDefault()
  36817. {
  36818. return $this->default;
  36819. }
  36820. public function getDescription()
  36821. {
  36822. return $this->description;
  36823. }
  36824. public function equals(self $option)
  36825. {
  36826. return $option->getName() === $this->getName()
  36827. && $option->getShortcut() === $this->getShortcut()
  36828. && $option->getDefault() === $this->getDefault()
  36829. && $option->isArray() === $this->isArray()
  36830. && $option->isValueRequired() === $this->isValueRequired()
  36831. && $option->isValueOptional() === $this->isValueOptional()
  36832. ;
  36833. }
  36834. }
  36835. <?php
  36836. namespace Symfony\Component\Console\Input;
  36837. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36838. class StringInput extends ArgvInput
  36839. {
  36840. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  36841. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  36842. public function __construct($input, InputDefinition $definition = null)
  36843. {
  36844. if ($definition) {
  36845. @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
  36846. }
  36847. parent::__construct(array(), null);
  36848. $this->setTokens($this->tokenize($input));
  36849. if (null !== $definition) {
  36850. $this->bind($definition);
  36851. }
  36852. }
  36853. private function tokenize($input)
  36854. {
  36855. $tokens = array();
  36856. $length = \strlen($input);
  36857. $cursor = 0;
  36858. while ($cursor < $length) {
  36859. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  36860. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  36861. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, \strlen($match[3]) - 2)));
  36862. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  36863. $tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
  36864. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  36865. $tokens[] = stripcslashes($match[1]);
  36866. } else {
  36867. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  36868. }
  36869. $cursor += \strlen($match[0]);
  36870. }
  36871. return $tokens;
  36872. }
  36873. }
  36874. Copyright (c) 2004-2018 Fabien Potencier
  36875. Permission is hereby granted, free of charge, to any person obtaining a copy
  36876. of this software and associated documentation files (the "Software"), to deal
  36877. in the Software without restriction, including without limitation the rights
  36878. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  36879. copies of the Software, and to permit persons to whom the Software is furnished
  36880. to do so, subject to the following conditions:
  36881. The above copyright notice and this permission notice shall be included in all
  36882. copies or substantial portions of the Software.
  36883. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  36884. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  36885. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  36886. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  36887. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  36888. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  36889. THE SOFTWARE.
  36890. <?php
  36891. namespace Symfony\Component\Console\Logger;
  36892. use Psr\Log\AbstractLogger;
  36893. use Psr\Log\InvalidArgumentException;
  36894. use Psr\Log\LogLevel;
  36895. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36896. use Symfony\Component\Console\Output\OutputInterface;
  36897. class ConsoleLogger extends AbstractLogger
  36898. {
  36899. const INFO = 'info';
  36900. const ERROR = 'error';
  36901. private $output;
  36902. private $verbosityLevelMap = array(
  36903. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  36904. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  36905. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  36906. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  36907. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  36908. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  36909. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  36910. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  36911. );
  36912. private $formatLevelMap = array(
  36913. LogLevel::EMERGENCY => self::ERROR,
  36914. LogLevel::ALERT => self::ERROR,
  36915. LogLevel::CRITICAL => self::ERROR,
  36916. LogLevel::ERROR => self::ERROR,
  36917. LogLevel::WARNING => self::INFO,
  36918. LogLevel::NOTICE => self::INFO,
  36919. LogLevel::INFO => self::INFO,
  36920. LogLevel::DEBUG => self::INFO,
  36921. );
  36922. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  36923. {
  36924. $this->output = $output;
  36925. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  36926. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  36927. }
  36928. public function log($level, $message, array $context = array())
  36929. {
  36930. if (!isset($this->verbosityLevelMap[$level])) {
  36931. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  36932. }
  36933. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  36934. $output = $this->output->getErrorOutput();
  36935. } else {
  36936. $output = $this->output;
  36937. }
  36938. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  36939. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  36940. }
  36941. }
  36942. private function interpolate($message, array $context)
  36943. {
  36944. $replace = array();
  36945. foreach ($context as $key => $val) {
  36946. if (!\is_array($val) && (!\is_object($val) || method_exists($val, '__toString'))) {
  36947. $replace[sprintf('{%s}', $key)] = $val;
  36948. }
  36949. }
  36950. return strtr($message, $replace);
  36951. }
  36952. }
  36953. <?php
  36954. namespace Symfony\Component\Console\Output;
  36955. class BufferedOutput extends Output
  36956. {
  36957. private $buffer = '';
  36958. public function fetch()
  36959. {
  36960. $content = $this->buffer;
  36961. $this->buffer = '';
  36962. return $content;
  36963. }
  36964. protected function doWrite($message, $newline)
  36965. {
  36966. $this->buffer .= $message;
  36967. if ($newline) {
  36968. $this->buffer .= PHP_EOL;
  36969. }
  36970. }
  36971. }
  36972. <?php
  36973. namespace Symfony\Component\Console\Output;
  36974. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36975. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  36976. {
  36977. private $stderr;
  36978. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  36979. {
  36980. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  36981. $actualDecorated = $this->isDecorated();
  36982. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  36983. if (null === $decorated) {
  36984. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  36985. }
  36986. }
  36987. public function setDecorated($decorated)
  36988. {
  36989. parent::setDecorated($decorated);
  36990. $this->stderr->setDecorated($decorated);
  36991. }
  36992. public function setFormatter(OutputFormatterInterface $formatter)
  36993. {
  36994. parent::setFormatter($formatter);
  36995. $this->stderr->setFormatter($formatter);
  36996. }
  36997. public function setVerbosity($level)
  36998. {
  36999. parent::setVerbosity($level);
  37000. $this->stderr->setVerbosity($level);
  37001. }
  37002. public function getErrorOutput()
  37003. {
  37004. return $this->stderr;
  37005. }
  37006. public function setErrorOutput(OutputInterface $error)
  37007. {
  37008. $this->stderr = $error;
  37009. }
  37010. protected function hasStdoutSupport()
  37011. {
  37012. return false === $this->isRunningOS400();
  37013. }
  37014. protected function hasStderrSupport()
  37015. {
  37016. return false === $this->isRunningOS400();
  37017. }
  37018. private function isRunningOS400()
  37019. {
  37020. $checks = array(
  37021. \function_exists('php_uname') ? php_uname('s') : '',
  37022. getenv('OSTYPE'),
  37023. PHP_OS,
  37024. );
  37025. return false !== stripos(implode(';', $checks), 'OS400');
  37026. }
  37027. private function openOutputStream()
  37028. {
  37029. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  37030. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  37031. }
  37032. private function openErrorStream()
  37033. {
  37034. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  37035. return fopen($errorStream, 'w');
  37036. }
  37037. }
  37038. <?php
  37039. namespace Symfony\Component\Console\Output;
  37040. interface ConsoleOutputInterface extends OutputInterface
  37041. {
  37042. public function getErrorOutput();
  37043. public function setErrorOutput(OutputInterface $error);
  37044. }
  37045. <?php
  37046. namespace Symfony\Component\Console\Output;
  37047. use Symfony\Component\Console\Formatter\OutputFormatter;
  37048. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37049. class NullOutput implements OutputInterface
  37050. {
  37051. public function setFormatter(OutputFormatterInterface $formatter)
  37052. {
  37053. }
  37054. public function getFormatter()
  37055. {
  37056. return new OutputFormatter();
  37057. }
  37058. public function setDecorated($decorated)
  37059. {
  37060. }
  37061. public function isDecorated()
  37062. {
  37063. return false;
  37064. }
  37065. public function setVerbosity($level)
  37066. {
  37067. }
  37068. public function getVerbosity()
  37069. {
  37070. return self::VERBOSITY_QUIET;
  37071. }
  37072. public function isQuiet()
  37073. {
  37074. return true;
  37075. }
  37076. public function isVerbose()
  37077. {
  37078. return false;
  37079. }
  37080. public function isVeryVerbose()
  37081. {
  37082. return false;
  37083. }
  37084. public function isDebug()
  37085. {
  37086. return false;
  37087. }
  37088. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  37089. {
  37090. }
  37091. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  37092. {
  37093. }
  37094. }
  37095. <?php
  37096. namespace Symfony\Component\Console\Output;
  37097. use Symfony\Component\Console\Formatter\OutputFormatter;
  37098. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37099. abstract class Output implements OutputInterface
  37100. {
  37101. private $verbosity;
  37102. private $formatter;
  37103. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  37104. {
  37105. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  37106. $this->formatter = $formatter ?: new OutputFormatter();
  37107. $this->formatter->setDecorated($decorated);
  37108. }
  37109. public function setFormatter(OutputFormatterInterface $formatter)
  37110. {
  37111. $this->formatter = $formatter;
  37112. }
  37113. public function getFormatter()
  37114. {
  37115. return $this->formatter;
  37116. }
  37117. public function setDecorated($decorated)
  37118. {
  37119. $this->formatter->setDecorated($decorated);
  37120. }
  37121. public function isDecorated()
  37122. {
  37123. return $this->formatter->isDecorated();
  37124. }
  37125. public function setVerbosity($level)
  37126. {
  37127. $this->verbosity = (int) $level;
  37128. }
  37129. public function getVerbosity()
  37130. {
  37131. return $this->verbosity;
  37132. }
  37133. public function isQuiet()
  37134. {
  37135. return self::VERBOSITY_QUIET === $this->verbosity;
  37136. }
  37137. public function isVerbose()
  37138. {
  37139. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  37140. }
  37141. public function isVeryVerbose()
  37142. {
  37143. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  37144. }
  37145. public function isDebug()
  37146. {
  37147. return self::VERBOSITY_DEBUG <= $this->verbosity;
  37148. }
  37149. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  37150. {
  37151. $this->write($messages, true, $options);
  37152. }
  37153. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  37154. {
  37155. $messages = (array) $messages;
  37156. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  37157. $type = $types & $options ?: self::OUTPUT_NORMAL;
  37158. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  37159. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  37160. if ($verbosity > $this->getVerbosity()) {
  37161. return;
  37162. }
  37163. foreach ($messages as $message) {
  37164. switch ($type) {
  37165. case OutputInterface::OUTPUT_NORMAL:
  37166. $message = $this->formatter->format($message);
  37167. break;
  37168. case OutputInterface::OUTPUT_RAW:
  37169. break;
  37170. case OutputInterface::OUTPUT_PLAIN:
  37171. $message = strip_tags($this->formatter->format($message));
  37172. break;
  37173. }
  37174. $this->doWrite($message, $newline);
  37175. }
  37176. }
  37177. abstract protected function doWrite($message, $newline);
  37178. }
  37179. <?php
  37180. namespace Symfony\Component\Console\Output;
  37181. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37182. interface OutputInterface
  37183. {
  37184. const VERBOSITY_QUIET = 16;
  37185. const VERBOSITY_NORMAL = 32;
  37186. const VERBOSITY_VERBOSE = 64;
  37187. const VERBOSITY_VERY_VERBOSE = 128;
  37188. const VERBOSITY_DEBUG = 256;
  37189. const OUTPUT_NORMAL = 1;
  37190. const OUTPUT_RAW = 2;
  37191. const OUTPUT_PLAIN = 4;
  37192. public function write($messages, $newline = false, $options = 0);
  37193. public function writeln($messages, $options = 0);
  37194. public function setVerbosity($level);
  37195. public function getVerbosity();
  37196. public function setDecorated($decorated);
  37197. public function isDecorated();
  37198. public function setFormatter(OutputFormatterInterface $formatter);
  37199. public function getFormatter();
  37200. }
  37201. <?php
  37202. namespace Symfony\Component\Console\Output;
  37203. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37204. use Symfony\Component\Console\Exception\RuntimeException;
  37205. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37206. class StreamOutput extends Output
  37207. {
  37208. private $stream;
  37209. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  37210. {
  37211. if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  37212. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  37213. }
  37214. $this->stream = $stream;
  37215. if (null === $decorated) {
  37216. $decorated = $this->hasColorSupport();
  37217. }
  37218. parent::__construct($verbosity, $decorated, $formatter);
  37219. }
  37220. public function getStream()
  37221. {
  37222. return $this->stream;
  37223. }
  37224. protected function doWrite($message, $newline)
  37225. {
  37226. if ($newline) {
  37227. $message .= PHP_EOL;
  37228. }
  37229. if (false === @fwrite($this->stream, $message)) {
  37230. throw new RuntimeException('Unable to write output.');
  37231. }
  37232. fflush($this->stream);
  37233. }
  37234. protected function hasColorSupport()
  37235. {
  37236. if ('Hyper' === getenv('TERM_PROGRAM')) {
  37237. return true;
  37238. }
  37239. if (\DIRECTORY_SEPARATOR === '\\') {
  37240. return (\function_exists('sapi_windows_vt100_support')
  37241. && @sapi_windows_vt100_support($this->stream))
  37242. || false !== getenv('ANSICON')
  37243. || 'ON' === getenv('ConEmuANSI')
  37244. || 'xterm' === getenv('TERM');
  37245. }
  37246. if (\function_exists('stream_isatty')) {
  37247. return @stream_isatty($this->stream);
  37248. }
  37249. if (\function_exists('posix_isatty')) {
  37250. return @posix_isatty($this->stream);
  37251. }
  37252. $stat = @fstat($this->stream);
  37253. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  37254. }
  37255. }
  37256. <?php
  37257. namespace Symfony\Component\Console\Question;
  37258. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37259. class ChoiceQuestion extends Question
  37260. {
  37261. private $choices;
  37262. private $multiselect = false;
  37263. private $prompt = ' > ';
  37264. private $errorMessage = 'Value "%s" is invalid';
  37265. public function __construct($question, array $choices, $default = null)
  37266. {
  37267. if (!$choices) {
  37268. throw new \LogicException('Choice question must have at least 1 choice available.');
  37269. }
  37270. parent::__construct($question, $default);
  37271. $this->choices = $choices;
  37272. $this->setValidator($this->getDefaultValidator());
  37273. $this->setAutocompleterValues($choices);
  37274. }
  37275. public function getChoices()
  37276. {
  37277. return $this->choices;
  37278. }
  37279. public function setMultiselect($multiselect)
  37280. {
  37281. $this->multiselect = $multiselect;
  37282. $this->setValidator($this->getDefaultValidator());
  37283. return $this;
  37284. }
  37285. public function isMultiselect()
  37286. {
  37287. return $this->multiselect;
  37288. }
  37289. public function getPrompt()
  37290. {
  37291. return $this->prompt;
  37292. }
  37293. public function setPrompt($prompt)
  37294. {
  37295. $this->prompt = $prompt;
  37296. return $this;
  37297. }
  37298. public function setErrorMessage($errorMessage)
  37299. {
  37300. $this->errorMessage = $errorMessage;
  37301. $this->setValidator($this->getDefaultValidator());
  37302. return $this;
  37303. }
  37304. private function getDefaultValidator()
  37305. {
  37306. $choices = $this->choices;
  37307. $errorMessage = $this->errorMessage;
  37308. $multiselect = $this->multiselect;
  37309. $isAssoc = $this->isAssoc($choices);
  37310. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  37311. $selectedChoices = str_replace(' ', '', $selected);
  37312. if ($multiselect) {
  37313. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  37314. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  37315. }
  37316. $selectedChoices = explode(',', $selectedChoices);
  37317. } else {
  37318. $selectedChoices = array($selected);
  37319. }
  37320. $multiselectChoices = array();
  37321. foreach ($selectedChoices as $value) {
  37322. $results = array();
  37323. foreach ($choices as $key => $choice) {
  37324. if ($choice === $value) {
  37325. $results[] = $key;
  37326. }
  37327. }
  37328. if (\count($results) > 1) {
  37329. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  37330. }
  37331. $result = array_search($value, $choices);
  37332. if (!$isAssoc) {
  37333. if (false !== $result) {
  37334. $result = $choices[$result];
  37335. } elseif (isset($choices[$value])) {
  37336. $result = $choices[$value];
  37337. }
  37338. } elseif (false === $result && isset($choices[$value])) {
  37339. $result = $value;
  37340. }
  37341. if (false === $result) {
  37342. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  37343. }
  37344. $multiselectChoices[] = (string) $result;
  37345. }
  37346. if ($multiselect) {
  37347. return $multiselectChoices;
  37348. }
  37349. return current($multiselectChoices);
  37350. };
  37351. }
  37352. }
  37353. <?php
  37354. namespace Symfony\Component\Console\Question;
  37355. class ConfirmationQuestion extends Question
  37356. {
  37357. private $trueAnswerRegex;
  37358. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  37359. {
  37360. parent::__construct($question, (bool) $default);
  37361. $this->trueAnswerRegex = $trueAnswerRegex;
  37362. $this->setNormalizer($this->getDefaultNormalizer());
  37363. }
  37364. private function getDefaultNormalizer()
  37365. {
  37366. $default = $this->getDefault();
  37367. $regex = $this->trueAnswerRegex;
  37368. return function ($answer) use ($default, $regex) {
  37369. if (\is_bool($answer)) {
  37370. return $answer;
  37371. }
  37372. $answerIsTrue = (bool) preg_match($regex, $answer);
  37373. if (false === $default) {
  37374. return $answer && $answerIsTrue;
  37375. }
  37376. return !$answer || $answerIsTrue;
  37377. };
  37378. }
  37379. }
  37380. <?php
  37381. namespace Symfony\Component\Console\Question;
  37382. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37383. use Symfony\Component\Console\Exception\LogicException;
  37384. class Question
  37385. {
  37386. private $question;
  37387. private $attempts;
  37388. private $hidden = false;
  37389. private $hiddenFallback = true;
  37390. private $autocompleterValues;
  37391. private $validator;
  37392. private $default;
  37393. private $normalizer;
  37394. public function __construct($question, $default = null)
  37395. {
  37396. $this->question = $question;
  37397. $this->default = $default;
  37398. }
  37399. public function getQuestion()
  37400. {
  37401. return $this->question;
  37402. }
  37403. public function getDefault()
  37404. {
  37405. return $this->default;
  37406. }
  37407. public function isHidden()
  37408. {
  37409. return $this->hidden;
  37410. }
  37411. public function setHidden($hidden)
  37412. {
  37413. if ($this->autocompleterValues) {
  37414. throw new LogicException('A hidden question cannot use the autocompleter.');
  37415. }
  37416. $this->hidden = (bool) $hidden;
  37417. return $this;
  37418. }
  37419. public function isHiddenFallback()
  37420. {
  37421. return $this->hiddenFallback;
  37422. }
  37423. public function setHiddenFallback($fallback)
  37424. {
  37425. $this->hiddenFallback = (bool) $fallback;
  37426. return $this;
  37427. }
  37428. public function getAutocompleterValues()
  37429. {
  37430. return $this->autocompleterValues;
  37431. }
  37432. public function setAutocompleterValues($values)
  37433. {
  37434. if (\is_array($values)) {
  37435. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  37436. }
  37437. if (null !== $values && !\is_array($values) && !$values instanceof \Traversable) {
  37438. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  37439. }
  37440. if ($this->hidden) {
  37441. throw new LogicException('A hidden question cannot use the autocompleter.');
  37442. }
  37443. $this->autocompleterValues = $values;
  37444. return $this;
  37445. }
  37446. public function setValidator($validator)
  37447. {
  37448. $this->validator = $validator;
  37449. return $this;
  37450. }
  37451. public function getValidator()
  37452. {
  37453. return $this->validator;
  37454. }
  37455. public function setMaxAttempts($attempts)
  37456. {
  37457. if (null !== $attempts && $attempts < 1) {
  37458. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  37459. }
  37460. $this->attempts = $attempts;
  37461. return $this;
  37462. }
  37463. public function getMaxAttempts()
  37464. {
  37465. return $this->attempts;
  37466. }
  37467. public function setNormalizer($normalizer)
  37468. {
  37469. $this->normalizer = $normalizer;
  37470. return $this;
  37471. }
  37472. public function getNormalizer()
  37473. {
  37474. return $this->normalizer;
  37475. }
  37476. protected function isAssoc($array)
  37477. {
  37478. return (bool) \count(array_filter(array_keys($array), 'is_string'));
  37479. }
  37480. }
  37481. <?php
  37482. namespace Symfony\Component\Console;
  37483. use Symfony\Component\Console\Exception\RuntimeException;
  37484. use Symfony\Component\Console\Input\StringInput;
  37485. use Symfony\Component\Console\Output\ConsoleOutput;
  37486. use Symfony\Component\Process\PhpExecutableFinder;
  37487. use Symfony\Component\Process\ProcessBuilder;
  37488. class Shell
  37489. {
  37490. private $application;
  37491. private $history;
  37492. private $output;
  37493. private $hasReadline;
  37494. private $processIsolation = false;
  37495. public function __construct(Application $application)
  37496. {
  37497. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  37498. $this->hasReadline = \function_exists('readline');
  37499. $this->application = $application;
  37500. $this->history = getenv('HOME').'/.history_'.$application->getName();
  37501. $this->output = new ConsoleOutput();
  37502. }
  37503. public function run()
  37504. {
  37505. $this->application->setAutoExit(false);
  37506. $this->application->setCatchExceptions(true);
  37507. if ($this->hasReadline) {
  37508. readline_read_history($this->history);
  37509. readline_completion_function(array($this, 'autocompleter'));
  37510. }
  37511. $this->output->writeln($this->getHeader());
  37512. $php = null;
  37513. if ($this->processIsolation) {
  37514. $finder = new PhpExecutableFinder();
  37515. $php = $finder->find();
  37516. $this->output->writeln(<<<'EOF'
  37517. <info>Running with process isolation, you should consider this:</info>
  37518. * each command is executed as separate process,
  37519. * commands don't support interactivity, all params must be passed explicitly,
  37520. * commands output is not colorized.
  37521. EOF
  37522. );
  37523. }
  37524. while (true) {
  37525. $command = $this->readline();
  37526. if (false === $command) {
  37527. $this->output->writeln("\n");
  37528. break;
  37529. }
  37530. if ($this->hasReadline) {
  37531. readline_add_history($command);
  37532. readline_write_history($this->history);
  37533. }
  37534. if ($this->processIsolation) {
  37535. $pb = new ProcessBuilder();
  37536. $process = $pb
  37537. ->add($php)
  37538. ->add($_SERVER['argv'][0])
  37539. ->add($command)
  37540. ->inheritEnvironmentVariables(true)
  37541. ->getProcess()
  37542. ;
  37543. $output = $this->output;
  37544. $process->run(function ($type, $data) use ($output) {
  37545. $output->writeln($data);
  37546. });
  37547. $ret = $process->getExitCode();
  37548. } else {
  37549. $ret = $this->application->run(new StringInput($command), $this->output);
  37550. }
  37551. if (0 !== $ret) {
  37552. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  37553. }
  37554. }
  37555. }
  37556. protected function getHeader()
  37557. {
  37558. return <<<EOF
  37559. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  37560. At the prompt, type <comment>help</comment> for some help,
  37561. or <comment>list</comment> to get a list of available commands.
  37562. To exit the shell, type <comment>^D</comment>.
  37563. EOF;
  37564. }
  37565. protected function getPrompt()
  37566. {
  37567. return $this->output->getFormatter()->format($this->application->getName().' > ');
  37568. }
  37569. protected function getOutput()
  37570. {
  37571. return $this->output;
  37572. }
  37573. protected function getApplication()
  37574. {
  37575. return $this->application;
  37576. }
  37577. private function autocompleter($text)
  37578. {
  37579. $info = readline_info();
  37580. $text = substr($info['line_buffer'], 0, $info['end']);
  37581. if ($info['point'] !== $info['end']) {
  37582. return true;
  37583. }
  37584. if (false === strpos($text, ' ') || !$text) {
  37585. return array_keys($this->application->all());
  37586. }
  37587. try {
  37588. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  37589. } catch (\Exception $e) {
  37590. return true;
  37591. }
  37592. $list = array('--help');
  37593. foreach ($command->getDefinition()->getOptions() as $option) {
  37594. $list[] = '--'.$option->getName();
  37595. }
  37596. return $list;
  37597. }
  37598. private function readline()
  37599. {
  37600. if ($this->hasReadline) {
  37601. $line = readline($this->getPrompt());
  37602. } else {
  37603. $this->output->write($this->getPrompt());
  37604. $line = fgets(STDIN, 1024);
  37605. $line = (false === $line || '' === $line) ? false : rtrim($line);
  37606. }
  37607. return $line;
  37608. }
  37609. public function getProcessIsolation()
  37610. {
  37611. return $this->processIsolation;
  37612. }
  37613. public function setProcessIsolation($processIsolation)
  37614. {
  37615. $this->processIsolation = (bool) $processIsolation;
  37616. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  37617. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  37618. }
  37619. }
  37620. }
  37621. <?php
  37622. namespace Symfony\Component\Console\Style;
  37623. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37624. use Symfony\Component\Console\Helper\ProgressBar;
  37625. use Symfony\Component\Console\Output\OutputInterface;
  37626. abstract class OutputStyle implements OutputInterface, StyleInterface
  37627. {
  37628. private $output;
  37629. public function __construct(OutputInterface $output)
  37630. {
  37631. $this->output = $output;
  37632. }
  37633. public function newLine($count = 1)
  37634. {
  37635. $this->output->write(str_repeat(PHP_EOL, $count));
  37636. }
  37637. public function createProgressBar($max = 0)
  37638. {
  37639. return new ProgressBar($this->output, $max);
  37640. }
  37641. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  37642. {
  37643. $this->output->write($messages, $newline, $type);
  37644. }
  37645. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  37646. {
  37647. $this->output->writeln($messages, $type);
  37648. }
  37649. public function setVerbosity($level)
  37650. {
  37651. $this->output->setVerbosity($level);
  37652. }
  37653. public function getVerbosity()
  37654. {
  37655. return $this->output->getVerbosity();
  37656. }
  37657. public function setDecorated($decorated)
  37658. {
  37659. $this->output->setDecorated($decorated);
  37660. }
  37661. public function isDecorated()
  37662. {
  37663. return $this->output->isDecorated();
  37664. }
  37665. public function setFormatter(OutputFormatterInterface $formatter)
  37666. {
  37667. $this->output->setFormatter($formatter);
  37668. }
  37669. public function getFormatter()
  37670. {
  37671. return $this->output->getFormatter();
  37672. }
  37673. }
  37674. <?php
  37675. namespace Symfony\Component\Console\Style;
  37676. interface StyleInterface
  37677. {
  37678. public function title($message);
  37679. public function section($message);
  37680. public function listing(array $elements);
  37681. public function text($message);
  37682. public function success($message);
  37683. public function error($message);
  37684. public function warning($message);
  37685. public function note($message);
  37686. public function caution($message);
  37687. public function table(array $headers, array $rows);
  37688. public function ask($question, $default = null, $validator = null);
  37689. public function askHidden($question, $validator = null);
  37690. public function confirm($question, $default = true);
  37691. public function choice($question, array $choices, $default = null);
  37692. public function newLine($count = 1);
  37693. public function progressStart($max = 0);
  37694. public function progressAdvance($step = 1);
  37695. public function progressFinish();
  37696. }
  37697. <?php
  37698. namespace Symfony\Component\Console\Style;
  37699. use Symfony\Component\Console\Application;
  37700. use Symfony\Component\Console\Exception\RuntimeException;
  37701. use Symfony\Component\Console\Formatter\OutputFormatter;
  37702. use Symfony\Component\Console\Helper\Helper;
  37703. use Symfony\Component\Console\Helper\ProgressBar;
  37704. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  37705. use Symfony\Component\Console\Helper\Table;
  37706. use Symfony\Component\Console\Input\InputInterface;
  37707. use Symfony\Component\Console\Output\BufferedOutput;
  37708. use Symfony\Component\Console\Output\OutputInterface;
  37709. use Symfony\Component\Console\Question\ChoiceQuestion;
  37710. use Symfony\Component\Console\Question\ConfirmationQuestion;
  37711. use Symfony\Component\Console\Question\Question;
  37712. class SymfonyStyle extends OutputStyle
  37713. {
  37714. const MAX_LINE_LENGTH = 120;
  37715. private $input;
  37716. private $questionHelper;
  37717. private $progressBar;
  37718. private $lineLength;
  37719. private $bufferedOutput;
  37720. public function __construct(InputInterface $input, OutputInterface $output)
  37721. {
  37722. $this->input = $input;
  37723. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  37724. $this->lineLength = min($this->getTerminalWidth() - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  37725. parent::__construct($output);
  37726. }
  37727. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  37728. {
  37729. $messages = \is_array($messages) ? array_values($messages) : array($messages);
  37730. $this->autoPrependBlock();
  37731. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  37732. $this->newLine();
  37733. }
  37734. public function title($message)
  37735. {
  37736. $this->autoPrependBlock();
  37737. $this->writeln(array(
  37738. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  37739. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  37740. ));
  37741. $this->newLine();
  37742. }
  37743. public function section($message)
  37744. {
  37745. $this->autoPrependBlock();
  37746. $this->writeln(array(
  37747. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  37748. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  37749. ));
  37750. $this->newLine();
  37751. }
  37752. public function listing(array $elements)
  37753. {
  37754. $this->autoPrependText();
  37755. $elements = array_map(function ($element) {
  37756. return sprintf(' * %s', $element);
  37757. }, $elements);
  37758. $this->writeln($elements);
  37759. $this->newLine();
  37760. }
  37761. public function text($message)
  37762. {
  37763. $this->autoPrependText();
  37764. $messages = \is_array($message) ? array_values($message) : array($message);
  37765. foreach ($messages as $message) {
  37766. $this->writeln(sprintf(' %s', $message));
  37767. }
  37768. }
  37769. public function comment($message)
  37770. {
  37771. $messages = \is_array($message) ? array_values($message) : array($message);
  37772. $this->autoPrependBlock();
  37773. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  37774. $this->newLine();
  37775. }
  37776. public function success($message)
  37777. {
  37778. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  37779. }
  37780. public function error($message)
  37781. {
  37782. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  37783. }
  37784. public function warning($message)
  37785. {
  37786. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  37787. }
  37788. public function note($message)
  37789. {
  37790. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  37791. }
  37792. public function caution($message)
  37793. {
  37794. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  37795. }
  37796. public function table(array $headers, array $rows)
  37797. {
  37798. $style = clone Table::getStyleDefinition('symfony-style-guide');
  37799. $style->setCellHeaderFormat('<info>%s</info>');
  37800. $table = new Table($this);
  37801. $table->setHeaders($headers);
  37802. $table->setRows($rows);
  37803. $table->setStyle($style);
  37804. $table->render();
  37805. $this->newLine();
  37806. }
  37807. public function ask($question, $default = null, $validator = null)
  37808. {
  37809. $question = new Question($question, $default);
  37810. $question->setValidator($validator);
  37811. return $this->askQuestion($question);
  37812. }
  37813. public function askHidden($question, $validator = null)
  37814. {
  37815. $question = new Question($question);
  37816. $question->setHidden(true);
  37817. $question->setValidator($validator);
  37818. return $this->askQuestion($question);
  37819. }
  37820. public function confirm($question, $default = true)
  37821. {
  37822. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  37823. }
  37824. public function choice($question, array $choices, $default = null)
  37825. {
  37826. if (null !== $default) {
  37827. $values = array_flip($choices);
  37828. $default = $values[$default];
  37829. }
  37830. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  37831. }
  37832. public function progressStart($max = 0)
  37833. {
  37834. $this->progressBar = $this->createProgressBar($max);
  37835. $this->progressBar->start();
  37836. }
  37837. public function progressAdvance($step = 1)
  37838. {
  37839. $this->getProgressBar()->advance($step);
  37840. }
  37841. public function progressFinish()
  37842. {
  37843. $this->getProgressBar()->finish();
  37844. $this->newLine(2);
  37845. $this->progressBar = null;
  37846. }
  37847. public function createProgressBar($max = 0)
  37848. {
  37849. $progressBar = parent::createProgressBar($max);
  37850. if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  37851. $progressBar->setEmptyBarCharacter('â–‘');
  37852. $progressBar->setProgressCharacter('');
  37853. $progressBar->setBarCharacter('â–“');
  37854. }
  37855. return $progressBar;
  37856. }
  37857. public function askQuestion(Question $question)
  37858. {
  37859. if ($this->input->isInteractive()) {
  37860. $this->autoPrependBlock();
  37861. }
  37862. if (!$this->questionHelper) {
  37863. $this->questionHelper = new SymfonyQuestionHelper();
  37864. }
  37865. $answer = $this->questionHelper->ask($this->input, $this, $question);
  37866. if ($this->input->isInteractive()) {
  37867. $this->newLine();
  37868. $this->bufferedOutput->write("\n");
  37869. }
  37870. return $answer;
  37871. }
  37872. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  37873. {
  37874. parent::writeln($messages, $type);
  37875. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  37876. }
  37877. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  37878. {
  37879. parent::write($messages, $newline, $type);
  37880. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  37881. }
  37882. public function newLine($count = 1)
  37883. {
  37884. parent::newLine($count);
  37885. $this->bufferedOutput->write(str_repeat("\n", $count));
  37886. }
  37887. private function getProgressBar()
  37888. {
  37889. if (!$this->progressBar) {
  37890. throw new RuntimeException('The ProgressBar is not started.');
  37891. }
  37892. return $this->progressBar;
  37893. }
  37894. private function getTerminalWidth()
  37895. {
  37896. $application = new Application();
  37897. $dimensions = $application->getTerminalDimensions();
  37898. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  37899. }
  37900. private function autoPrependBlock()
  37901. {
  37902. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  37903. if (!isset($chars[0])) {
  37904. return $this->newLine();
  37905. }
  37906. $this->newLine(2 - substr_count($chars, "\n"));
  37907. }
  37908. private function autoPrependText()
  37909. {
  37910. $fetched = $this->bufferedOutput->fetch();
  37911. if ("\n" !== substr($fetched, -1)) {
  37912. $this->newLine();
  37913. }
  37914. }
  37915. private function reduceBuffer($messages)
  37916. {
  37917. return array_map(function ($value) {
  37918. return substr($value, -4);
  37919. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  37920. }
  37921. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  37922. {
  37923. $indentLength = 0;
  37924. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  37925. $lines = array();
  37926. if (null !== $type) {
  37927. $type = sprintf('[%s] ', $type);
  37928. $indentLength = \strlen($type);
  37929. $lineIndentation = str_repeat(' ', $indentLength);
  37930. }
  37931. foreach ($messages as $key => $message) {
  37932. if ($escape) {
  37933. $message = OutputFormatter::escape($message);
  37934. }
  37935. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  37936. if (\count($messages) > 1 && $key < \count($messages) - 1) {
  37937. $lines[] = '';
  37938. }
  37939. }
  37940. $firstLineIndex = 0;
  37941. if ($padding && $this->isDecorated()) {
  37942. $firstLineIndex = 1;
  37943. array_unshift($lines, '');
  37944. $lines[] = '';
  37945. }
  37946. foreach ($lines as $i => &$line) {
  37947. if (null !== $type) {
  37948. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  37949. }
  37950. $line = $prefix.$line;
  37951. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  37952. if ($style) {
  37953. $line = sprintf('<%s>%s</>', $style, $line);
  37954. }
  37955. }
  37956. return $lines;
  37957. }
  37958. }
  37959. <?php
  37960. namespace Symfony\Component\Console\Tester;
  37961. use Symfony\Component\Console\Application;
  37962. use Symfony\Component\Console\Input\ArrayInput;
  37963. use Symfony\Component\Console\Input\InputInterface;
  37964. use Symfony\Component\Console\Output\OutputInterface;
  37965. use Symfony\Component\Console\Output\StreamOutput;
  37966. class ApplicationTester
  37967. {
  37968. private $application;
  37969. private $input;
  37970. private $output;
  37971. private $statusCode;
  37972. public function __construct(Application $application)
  37973. {
  37974. $this->application = $application;
  37975. }
  37976. public function run(array $input, $options = array())
  37977. {
  37978. $this->input = new ArrayInput($input);
  37979. if (isset($options['interactive'])) {
  37980. $this->input->setInteractive($options['interactive']);
  37981. }
  37982. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  37983. if (isset($options['decorated'])) {
  37984. $this->output->setDecorated($options['decorated']);
  37985. }
  37986. if (isset($options['verbosity'])) {
  37987. $this->output->setVerbosity($options['verbosity']);
  37988. }
  37989. return $this->statusCode = $this->application->run($this->input, $this->output);
  37990. }
  37991. public function getDisplay($normalize = false)
  37992. {
  37993. rewind($this->output->getStream());
  37994. $display = stream_get_contents($this->output->getStream());
  37995. if ($normalize) {
  37996. $display = str_replace(PHP_EOL, "\n", $display);
  37997. }
  37998. return $display;
  37999. }
  38000. public function getInput()
  38001. {
  38002. return $this->input;
  38003. }
  38004. public function getOutput()
  38005. {
  38006. return $this->output;
  38007. }
  38008. public function getStatusCode()
  38009. {
  38010. return $this->statusCode;
  38011. }
  38012. }
  38013. <?php
  38014. namespace Symfony\Component\Console\Tester;
  38015. use Symfony\Component\Console\Command\Command;
  38016. use Symfony\Component\Console\Input\ArrayInput;
  38017. use Symfony\Component\Console\Input\InputInterface;
  38018. use Symfony\Component\Console\Output\OutputInterface;
  38019. use Symfony\Component\Console\Output\StreamOutput;
  38020. class CommandTester
  38021. {
  38022. private $command;
  38023. private $input;
  38024. private $output;
  38025. private $statusCode;
  38026. public function __construct(Command $command)
  38027. {
  38028. $this->command = $command;
  38029. }
  38030. public function execute(array $input, array $options = array())
  38031. {
  38032. if (!isset($input['command'])
  38033. && (null !== $application = $this->command->getApplication())
  38034. && $application->getDefinition()->hasArgument('command')
  38035. ) {
  38036. $input = array_merge(array('command' => $this->command->getName()), $input);
  38037. }
  38038. $this->input = new ArrayInput($input);
  38039. if (isset($options['interactive'])) {
  38040. $this->input->setInteractive($options['interactive']);
  38041. }
  38042. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  38043. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  38044. if (isset($options['verbosity'])) {
  38045. $this->output->setVerbosity($options['verbosity']);
  38046. }
  38047. return $this->statusCode = $this->command->run($this->input, $this->output);
  38048. }
  38049. public function getDisplay($normalize = false)
  38050. {
  38051. rewind($this->output->getStream());
  38052. $display = stream_get_contents($this->output->getStream());
  38053. if ($normalize) {
  38054. $display = str_replace(PHP_EOL, "\n", $display);
  38055. }
  38056. return $display;
  38057. }
  38058. public function getInput()
  38059. {
  38060. return $this->input;
  38061. }
  38062. public function getOutput()
  38063. {
  38064. return $this->output;
  38065. }
  38066. public function getStatusCode()
  38067. {
  38068. return $this->statusCode;
  38069. }
  38070. }
  38071. <?php
  38072. namespace Symfony\Component\Debug;
  38073. use Psr\Log\AbstractLogger;
  38074. class BufferingLogger extends AbstractLogger
  38075. {
  38076. private $logs = array();
  38077. public function log($level, $message, array $context = array())
  38078. {
  38079. $this->logs[] = array($level, $message, $context);
  38080. }
  38081. public function cleanLogs()
  38082. {
  38083. $logs = $this->logs;
  38084. $this->logs = array();
  38085. return $logs;
  38086. }
  38087. }
  38088. <?php
  38089. namespace Symfony\Component\Debug;
  38090. class Debug
  38091. {
  38092. private static $enabled = false;
  38093. public static function enable($errorReportingLevel = null, $displayErrors = true)
  38094. {
  38095. if (static::$enabled) {
  38096. return;
  38097. }
  38098. static::$enabled = true;
  38099. if (null !== $errorReportingLevel) {
  38100. error_reporting($errorReportingLevel);
  38101. } else {
  38102. error_reporting(-1);
  38103. }
  38104. if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
  38105. ini_set('display_errors', 0);
  38106. ExceptionHandler::register();
  38107. } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
  38108. ini_set('display_errors', 1);
  38109. }
  38110. if ($displayErrors) {
  38111. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  38112. } else {
  38113. ErrorHandler::register()->throwAt(0, true);
  38114. }
  38115. DebugClassLoader::enable();
  38116. }
  38117. }
  38118. <?php
  38119. namespace Symfony\Component\Debug;
  38120. class DebugClassLoader
  38121. {
  38122. private $classLoader;
  38123. private $isFinder;
  38124. private $loaded = array();
  38125. private $wasFinder;
  38126. private static $caseCheck;
  38127. private static $deprecated = array();
  38128. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  38129. private static $darwinCache = array('/' => array('/', array()));
  38130. public function __construct($classLoader)
  38131. {
  38132. $this->wasFinder = \is_object($classLoader) && method_exists($classLoader, 'findFile');
  38133. if ($this->wasFinder) {
  38134. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  38135. $this->classLoader = array($classLoader, 'loadClass');
  38136. $this->isFinder = true;
  38137. } else {
  38138. $this->classLoader = $classLoader;
  38139. $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  38140. }
  38141. if (!isset(self::$caseCheck)) {
  38142. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR);
  38143. $i = strrpos($file, \DIRECTORY_SEPARATOR);
  38144. $dir = substr($file, 0, 1 + $i);
  38145. $file = substr($file, 1 + $i);
  38146. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  38147. $test = realpath($dir.$test);
  38148. if (false === $test || false === $i) {
  38149. self::$caseCheck = 0;
  38150. } elseif (substr($test, -\strlen($file)) === $file) {
  38151. self::$caseCheck = 1;
  38152. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  38153. self::$caseCheck = 2;
  38154. } else {
  38155. self::$caseCheck = 0;
  38156. }
  38157. }
  38158. }
  38159. public function getClassLoader()
  38160. {
  38161. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  38162. }
  38163. public static function enable()
  38164. {
  38165. class_exists('Symfony\Component\Debug\ErrorHandler');
  38166. class_exists('Psr\Log\LogLevel');
  38167. if (!\is_array($functions = spl_autoload_functions())) {
  38168. return;
  38169. }
  38170. foreach ($functions as $function) {
  38171. spl_autoload_unregister($function);
  38172. }
  38173. foreach ($functions as $function) {
  38174. if (!\is_array($function) || !$function[0] instanceof self) {
  38175. $function = array(new static($function), 'loadClass');
  38176. }
  38177. spl_autoload_register($function);
  38178. }
  38179. }
  38180. public static function disable()
  38181. {
  38182. if (!\is_array($functions = spl_autoload_functions())) {
  38183. return;
  38184. }
  38185. foreach ($functions as $function) {
  38186. spl_autoload_unregister($function);
  38187. }
  38188. foreach ($functions as $function) {
  38189. if (\is_array($function) && $function[0] instanceof self) {
  38190. $function = $function[0]->getClassLoader();
  38191. }
  38192. spl_autoload_register($function);
  38193. }
  38194. }
  38195. public function findFile($class)
  38196. {
  38197. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  38198. if ($this->wasFinder) {
  38199. return $this->classLoader[0]->findFile($class);
  38200. }
  38201. }
  38202. public function loadClass($class)
  38203. {
  38204. ErrorHandler::stackErrors();
  38205. try {
  38206. if ($this->isFinder && !isset($this->loaded[$class])) {
  38207. $this->loaded[$class] = true;
  38208. if ($file = $this->classLoader[0]->findFile($class)) {
  38209. require $file;
  38210. }
  38211. } else {
  38212. \call_user_func($this->classLoader, $class);
  38213. $file = false;
  38214. }
  38215. } catch (\Exception $e) {
  38216. ErrorHandler::unstackErrors();
  38217. throw $e;
  38218. } catch (\Throwable $e) {
  38219. ErrorHandler::unstackErrors();
  38220. throw $e;
  38221. }
  38222. ErrorHandler::unstackErrors();
  38223. $exists = class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  38224. if ($class && '\\' === $class[0]) {
  38225. $class = substr($class, 1);
  38226. }
  38227. if ($exists) {
  38228. $refl = new \ReflectionClass($class);
  38229. $name = $refl->getName();
  38230. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  38231. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  38232. }
  38233. if (\in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  38234. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  38235. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  38236. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  38237. } else {
  38238. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  38239. $len = 0;
  38240. $ns = '';
  38241. } else {
  38242. $ns = substr($name, 0, $len);
  38243. }
  38244. $parent = get_parent_class($class);
  38245. if (!$parent || strncmp($ns, $parent, $len)) {
  38246. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  38247. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  38248. }
  38249. $parentInterfaces = array();
  38250. $deprecatedInterfaces = array();
  38251. if ($parent) {
  38252. foreach (class_implements($parent) as $interface) {
  38253. $parentInterfaces[$interface] = 1;
  38254. }
  38255. }
  38256. foreach ($refl->getInterfaceNames() as $interface) {
  38257. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  38258. $deprecatedInterfaces[] = $interface;
  38259. }
  38260. foreach (class_implements($interface) as $interface) {
  38261. $parentInterfaces[$interface] = 1;
  38262. }
  38263. }
  38264. foreach ($deprecatedInterfaces as $interface) {
  38265. if (!isset($parentInterfaces[$interface])) {
  38266. @trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
  38267. }
  38268. }
  38269. }
  38270. }
  38271. }
  38272. if ($file) {
  38273. if (!$exists) {
  38274. if (false !== strpos($class, '/')) {
  38275. throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
  38276. }
  38277. throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
  38278. }
  38279. if (self::$caseCheck) {
  38280. $real = explode('\\', $class.strrchr($file, '.'));
  38281. $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file));
  38282. $i = \count($tail) - 1;
  38283. $j = \count($real) - 1;
  38284. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  38285. --$i;
  38286. --$j;
  38287. }
  38288. array_splice($tail, 0, $i + 1);
  38289. }
  38290. if (self::$caseCheck && $tail) {
  38291. $tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
  38292. $tailLen = \strlen($tail);
  38293. $real = $refl->getFileName();
  38294. if (2 === self::$caseCheck) {
  38295. $i = 1 + strrpos($real, '/');
  38296. $file = substr($real, $i);
  38297. $real = substr($real, 0, $i);
  38298. if (isset(self::$darwinCache[$real])) {
  38299. $kDir = $real;
  38300. } else {
  38301. $kDir = strtolower($real);
  38302. if (isset(self::$darwinCache[$kDir])) {
  38303. $real = self::$darwinCache[$kDir][0];
  38304. } else {
  38305. $dir = getcwd();
  38306. chdir($real);
  38307. $real = getcwd().'/';
  38308. chdir($dir);
  38309. $dir = $real;
  38310. $k = $kDir;
  38311. $i = \strlen($dir) - 1;
  38312. while (!isset(self::$darwinCache[$k])) {
  38313. self::$darwinCache[$k] = array($dir, array());
  38314. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  38315. while ('/' !== $dir[--$i]) {
  38316. }
  38317. $k = substr($k, 0, ++$i);
  38318. $dir = substr($dir, 0, $i--);
  38319. }
  38320. }
  38321. }
  38322. $dirFiles = self::$darwinCache[$kDir][1];
  38323. if (isset($dirFiles[$file])) {
  38324. $kFile = $file;
  38325. } else {
  38326. $kFile = strtolower($file);
  38327. if (!isset($dirFiles[$kFile])) {
  38328. foreach (scandir($real, 2) as $f) {
  38329. if ('.' !== $f[0]) {
  38330. $dirFiles[$f] = $f;
  38331. if ($f === $file) {
  38332. $kFile = $k = $file;
  38333. } elseif ($f !== $k = strtolower($f)) {
  38334. $dirFiles[$k] = $f;
  38335. }
  38336. }
  38337. }
  38338. self::$darwinCache[$kDir][1] = $dirFiles;
  38339. }
  38340. }
  38341. $real .= $dirFiles[$kFile];
  38342. }
  38343. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  38344. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  38345. ) {
  38346. throw new \RuntimeException(sprintf('Case mismatch between class and real file names: %s vs %s in %s', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)));
  38347. }
  38348. }
  38349. return true;
  38350. }
  38351. }
  38352. }
  38353. <?php
  38354. namespace Symfony\Component\Debug;
  38355. use Psr\Log\LoggerInterface;
  38356. use Psr\Log\LogLevel;
  38357. use Symfony\Component\Debug\Exception\ContextErrorException;
  38358. use Symfony\Component\Debug\Exception\FatalErrorException;
  38359. use Symfony\Component\Debug\Exception\FatalThrowableError;
  38360. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  38361. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  38362. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  38363. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  38364. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  38365. class ErrorHandler
  38366. {
  38367. const TYPE_DEPRECATION = -100;
  38368. private $levels = array(
  38369. E_DEPRECATED => 'Deprecated',
  38370. E_USER_DEPRECATED => 'User Deprecated',
  38371. E_NOTICE => 'Notice',
  38372. E_USER_NOTICE => 'User Notice',
  38373. E_STRICT => 'Runtime Notice',
  38374. E_WARNING => 'Warning',
  38375. E_USER_WARNING => 'User Warning',
  38376. E_COMPILE_WARNING => 'Compile Warning',
  38377. E_CORE_WARNING => 'Core Warning',
  38378. E_USER_ERROR => 'User Error',
  38379. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  38380. E_COMPILE_ERROR => 'Compile Error',
  38381. E_PARSE => 'Parse Error',
  38382. E_ERROR => 'Error',
  38383. E_CORE_ERROR => 'Core Error',
  38384. );
  38385. private $loggers = array(
  38386. E_DEPRECATED => array(null, LogLevel::INFO),
  38387. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  38388. E_NOTICE => array(null, LogLevel::WARNING),
  38389. E_USER_NOTICE => array(null, LogLevel::WARNING),
  38390. E_STRICT => array(null, LogLevel::WARNING),
  38391. E_WARNING => array(null, LogLevel::WARNING),
  38392. E_USER_WARNING => array(null, LogLevel::WARNING),
  38393. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  38394. E_CORE_WARNING => array(null, LogLevel::WARNING),
  38395. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  38396. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  38397. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  38398. E_PARSE => array(null, LogLevel::CRITICAL),
  38399. E_ERROR => array(null, LogLevel::CRITICAL),
  38400. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  38401. );
  38402. private $thrownErrors = 0x1FFF;
  38403. private $scopedErrors = 0x1FFF;
  38404. private $tracedErrors = 0x77FB;
  38405. private $screamedErrors = 0x55;
  38406. private $loggedErrors = 0;
  38407. private $loggedTraces = array();
  38408. private $isRecursive = 0;
  38409. private $isRoot = false;
  38410. private $exceptionHandler;
  38411. private $bootstrappingLogger;
  38412. private static $reservedMemory;
  38413. private static $stackedErrors = array();
  38414. private static $stackedErrorLevels = array();
  38415. private static $toStringException = null;
  38416. private static $exitCode = 0;
  38417. private $displayErrors = 0x1FFF;
  38418. public static function register($handler = null, $replace = true)
  38419. {
  38420. if (null === self::$reservedMemory) {
  38421. self::$reservedMemory = str_repeat('x', 10240);
  38422. register_shutdown_function(__CLASS__.'::handleFatalError');
  38423. }
  38424. $levels = -1;
  38425. if ($handlerIsNew = !$handler instanceof self) {
  38426. if (null !== $handler) {
  38427. $levels = $replace ? $handler : 0;
  38428. $replace = true;
  38429. }
  38430. $handler = new static();
  38431. }
  38432. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  38433. restore_error_handler();
  38434. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  38435. $handler->isRoot = true;
  38436. }
  38437. if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) {
  38438. $handler = $prev[0];
  38439. $replace = false;
  38440. }
  38441. if (!$replace && $prev) {
  38442. restore_error_handler();
  38443. $handlerIsRegistered = \is_array($prev) && $handler === $prev[0];
  38444. } else {
  38445. $handlerIsRegistered = true;
  38446. }
  38447. if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
  38448. restore_exception_handler();
  38449. if (!$handlerIsRegistered) {
  38450. $handler = $prev[0];
  38451. } elseif ($handler !== $prev[0] && $replace) {
  38452. set_exception_handler(array($handler, 'handleException'));
  38453. $p = $prev[0]->setExceptionHandler(null);
  38454. $handler->setExceptionHandler($p);
  38455. $prev[0]->setExceptionHandler($p);
  38456. }
  38457. } else {
  38458. $handler->setExceptionHandler($prev);
  38459. }
  38460. $handler->throwAt($levels & $handler->thrownErrors, true);
  38461. return $handler;
  38462. }
  38463. public function __construct(BufferingLogger $bootstrappingLogger = null)
  38464. {
  38465. if ($bootstrappingLogger) {
  38466. $this->bootstrappingLogger = $bootstrappingLogger;
  38467. $this->setDefaultLogger($bootstrappingLogger);
  38468. }
  38469. }
  38470. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  38471. {
  38472. $loggers = array();
  38473. if (\is_array($levels)) {
  38474. foreach ($levels as $type => $logLevel) {
  38475. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  38476. $loggers[$type] = array($logger, $logLevel);
  38477. }
  38478. }
  38479. } else {
  38480. if (null === $levels) {
  38481. $levels = E_ALL | E_STRICT;
  38482. }
  38483. foreach ($this->loggers as $type => $log) {
  38484. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  38485. $log[0] = $logger;
  38486. $loggers[$type] = $log;
  38487. }
  38488. }
  38489. }
  38490. $this->setLoggers($loggers);
  38491. }
  38492. public function setLoggers(array $loggers)
  38493. {
  38494. $prevLogged = $this->loggedErrors;
  38495. $prev = $this->loggers;
  38496. $flush = array();
  38497. foreach ($loggers as $type => $log) {
  38498. if (!isset($prev[$type])) {
  38499. throw new \InvalidArgumentException('Unknown error type: '.$type);
  38500. }
  38501. if (!\is_array($log)) {
  38502. $log = array($log);
  38503. } elseif (!array_key_exists(0, $log)) {
  38504. throw new \InvalidArgumentException('No logger provided');
  38505. }
  38506. if (null === $log[0]) {
  38507. $this->loggedErrors &= ~$type;
  38508. } elseif ($log[0] instanceof LoggerInterface) {
  38509. $this->loggedErrors |= $type;
  38510. } else {
  38511. throw new \InvalidArgumentException('Invalid logger provided');
  38512. }
  38513. $this->loggers[$type] = $log + $prev[$type];
  38514. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  38515. $flush[$type] = $type;
  38516. }
  38517. }
  38518. $this->reRegister($prevLogged | $this->thrownErrors);
  38519. if ($flush) {
  38520. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  38521. $type = $log[2]['type'];
  38522. if (!isset($flush[$type])) {
  38523. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  38524. } elseif ($this->loggers[$type][0]) {
  38525. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  38526. }
  38527. }
  38528. }
  38529. return $prev;
  38530. }
  38531. public function setExceptionHandler($handler)
  38532. {
  38533. if (null !== $handler && !\is_callable($handler)) {
  38534. throw new \LogicException('The exception handler must be a valid PHP callable.');
  38535. }
  38536. $prev = $this->exceptionHandler;
  38537. $this->exceptionHandler = $handler;
  38538. return $prev;
  38539. }
  38540. public function throwAt($levels, $replace = false)
  38541. {
  38542. $prev = $this->thrownErrors;
  38543. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  38544. if (!$replace) {
  38545. $this->thrownErrors |= $prev;
  38546. }
  38547. $this->reRegister($prev | $this->loggedErrors);
  38548. $this->displayErrors = $this->thrownErrors;
  38549. return $prev;
  38550. }
  38551. public function scopeAt($levels, $replace = false)
  38552. {
  38553. $prev = $this->scopedErrors;
  38554. $this->scopedErrors = (int) $levels;
  38555. if (!$replace) {
  38556. $this->scopedErrors |= $prev;
  38557. }
  38558. return $prev;
  38559. }
  38560. public function traceAt($levels, $replace = false)
  38561. {
  38562. $prev = $this->tracedErrors;
  38563. $this->tracedErrors = (int) $levels;
  38564. if (!$replace) {
  38565. $this->tracedErrors |= $prev;
  38566. }
  38567. return $prev;
  38568. }
  38569. public function screamAt($levels, $replace = false)
  38570. {
  38571. $prev = $this->screamedErrors;
  38572. $this->screamedErrors = (int) $levels;
  38573. if (!$replace) {
  38574. $this->screamedErrors |= $prev;
  38575. }
  38576. return $prev;
  38577. }
  38578. private function reRegister($prev)
  38579. {
  38580. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  38581. $handler = set_error_handler('var_dump');
  38582. $handler = \is_array($handler) ? $handler[0] : null;
  38583. restore_error_handler();
  38584. if ($handler === $this) {
  38585. restore_error_handler();
  38586. if ($this->isRoot) {
  38587. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  38588. } else {
  38589. set_error_handler(array($this, 'handleError'));
  38590. }
  38591. }
  38592. }
  38593. }
  38594. public function handleError($type, $message, $file, $line)
  38595. {
  38596. $level = error_reporting();
  38597. $silenced = 0 === ($level & $type);
  38598. $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  38599. $log = $this->loggedErrors & $type;
  38600. $throw = $this->thrownErrors & $type & $level;
  38601. $type &= $level | $this->screamedErrors;
  38602. if (!$type || (!$log && !$throw)) {
  38603. return !$silenced && $type && $log;
  38604. }
  38605. $scope = $this->scopedErrors & $type;
  38606. if (4 < $numArgs = \func_num_args()) {
  38607. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  38608. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  38609. } else {
  38610. $context = array();
  38611. $backtrace = null;
  38612. }
  38613. if (isset($context['GLOBALS']) && $scope) {
  38614. $e = $context;
  38615. unset($e['GLOBALS'], $context);
  38616. $context = $e;
  38617. }
  38618. if (null !== $backtrace && $type & E_ERROR) {
  38619. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  38620. return true;
  38621. }
  38622. if ($throw) {
  38623. if (null !== self::$toStringException) {
  38624. $throw = self::$toStringException;
  38625. self::$toStringException = null;
  38626. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  38627. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  38628. } else {
  38629. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  38630. }
  38631. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  38632. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  38633. }
  38634. if (E_USER_ERROR & $type) {
  38635. $backtrace = $backtrace ?: $throw->getTrace();
  38636. for ($i = 1; isset($backtrace[$i]); ++$i) {
  38637. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  38638. && '__toString' === $backtrace[$i]['function']
  38639. && '->' === $backtrace[$i]['type']
  38640. && !isset($backtrace[$i - 1]['class'])
  38641. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  38642. ) {
  38643. foreach ($context as $e) {
  38644. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  38645. if (1 === $i) {
  38646. $throw = $e;
  38647. break;
  38648. }
  38649. self::$toStringException = $e;
  38650. return true;
  38651. }
  38652. }
  38653. if (1 < $i) {
  38654. $this->handleException($throw);
  38655. return false;
  38656. }
  38657. }
  38658. }
  38659. }
  38660. throw $throw;
  38661. }
  38662. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  38663. $trace = true;
  38664. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  38665. $trace = false;
  38666. } else {
  38667. $this->loggedTraces[$e] = 1;
  38668. }
  38669. $e = compact('type', 'file', 'line', 'level');
  38670. if ($type & $level) {
  38671. if ($scope) {
  38672. $e['scope_vars'] = $context;
  38673. if ($trace) {
  38674. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  38675. }
  38676. } elseif ($trace) {
  38677. if (null === $backtrace) {
  38678. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  38679. } else {
  38680. foreach ($backtrace as &$frame) {
  38681. unset($frame['args'], $frame);
  38682. }
  38683. $e['stack'] = $backtrace;
  38684. }
  38685. }
  38686. }
  38687. if ($this->isRecursive) {
  38688. $log = 0;
  38689. } elseif (self::$stackedErrorLevels) {
  38690. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  38691. } else {
  38692. try {
  38693. $this->isRecursive = true;
  38694. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  38695. $this->isRecursive = false;
  38696. } catch (\Exception $e) {
  38697. $this->isRecursive = false;
  38698. throw $e;
  38699. } catch (\Throwable $e) {
  38700. $this->isRecursive = false;
  38701. throw $e;
  38702. }
  38703. }
  38704. return !$silenced && $type && $log;
  38705. }
  38706. public function handleException($exception, array $error = null)
  38707. {
  38708. if (null === $error) {
  38709. self::$exitCode = 255;
  38710. }
  38711. if (!$exception instanceof \Exception) {
  38712. $exception = new FatalThrowableError($exception);
  38713. }
  38714. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  38715. $handlerException = null;
  38716. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  38717. $e = array(
  38718. 'type' => $type,
  38719. 'file' => $exception->getFile(),
  38720. 'line' => $exception->getLine(),
  38721. 'level' => error_reporting(),
  38722. 'stack' => $exception->getTrace(),
  38723. );
  38724. if ($exception instanceof FatalErrorException) {
  38725. if ($exception instanceof FatalThrowableError) {
  38726. $error = array(
  38727. 'type' => $type,
  38728. 'message' => $message = $exception->getMessage(),
  38729. 'file' => $e['file'],
  38730. 'line' => $e['line'],
  38731. );
  38732. } else {
  38733. $message = 'Fatal '.$exception->getMessage();
  38734. }
  38735. } elseif ($exception instanceof \ErrorException) {
  38736. $message = 'Uncaught '.$exception->getMessage();
  38737. if ($exception instanceof ContextErrorException) {
  38738. $e['context'] = $exception->getContext();
  38739. }
  38740. } else {
  38741. $message = 'Uncaught Exception: '.$exception->getMessage();
  38742. }
  38743. }
  38744. if ($this->loggedErrors & $type) {
  38745. try {
  38746. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  38747. } catch (\Exception $handlerException) {
  38748. } catch (\Throwable $handlerException) {
  38749. }
  38750. }
  38751. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  38752. foreach ($this->getFatalErrorHandlers() as $handler) {
  38753. if ($e = $handler->handleError($error, $exception)) {
  38754. $exception = $e;
  38755. break;
  38756. }
  38757. }
  38758. }
  38759. $exceptionHandler = $this->exceptionHandler;
  38760. $this->exceptionHandler = null;
  38761. try {
  38762. if (null !== $exceptionHandler) {
  38763. return \call_user_func($exceptionHandler, $exception);
  38764. }
  38765. $handlerException = $handlerException ?: $exception;
  38766. } catch (\Exception $handlerException) {
  38767. } catch (\Throwable $handlerException) {
  38768. }
  38769. if ($exception === $handlerException) {
  38770. self::$reservedMemory = null;
  38771. throw $exception;
  38772. }
  38773. $this->handleException($handlerException);
  38774. }
  38775. public static function handleFatalError(array $error = null)
  38776. {
  38777. if (null === self::$reservedMemory) {
  38778. return;
  38779. }
  38780. $handler = self::$reservedMemory = null;
  38781. $handlers = array();
  38782. $previousHandler = null;
  38783. $sameHandlerLimit = 10;
  38784. while (!\is_array($handler) || !$handler[0] instanceof self) {
  38785. $handler = set_exception_handler('var_dump');
  38786. restore_exception_handler();
  38787. if (!$handler) {
  38788. break;
  38789. }
  38790. restore_exception_handler();
  38791. if ($handler !== $previousHandler) {
  38792. array_unshift($handlers, $handler);
  38793. $previousHandler = $handler;
  38794. } elseif (0 === --$sameHandlerLimit) {
  38795. $handler = null;
  38796. break;
  38797. }
  38798. }
  38799. foreach ($handlers as $h) {
  38800. set_exception_handler($h);
  38801. }
  38802. if (!$handler) {
  38803. return;
  38804. }
  38805. if ($handler !== $h) {
  38806. $handler[0]->setExceptionHandler($h);
  38807. }
  38808. $handler = $handler[0];
  38809. $handlers = array();
  38810. if ($exit = null === $error) {
  38811. $error = error_get_last();
  38812. }
  38813. try {
  38814. while (self::$stackedErrorLevels) {
  38815. static::unstackErrors();
  38816. }
  38817. } catch (\Exception $exception) {
  38818. } catch (\Throwable $exception) {
  38819. }
  38820. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  38821. $handler->throwAt(0, true);
  38822. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  38823. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  38824. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  38825. } else {
  38826. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  38827. }
  38828. }
  38829. try {
  38830. if (isset($exception)) {
  38831. self::$exitCode = 255;
  38832. $handler->handleException($exception, $error);
  38833. }
  38834. } catch (FatalErrorException $e) {
  38835. }
  38836. if ($exit && self::$exitCode) {
  38837. $exitCode = self::$exitCode;
  38838. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  38839. }
  38840. }
  38841. public static function stackErrors()
  38842. {
  38843. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  38844. }
  38845. public static function unstackErrors()
  38846. {
  38847. $level = array_pop(self::$stackedErrorLevels);
  38848. if (null !== $level) {
  38849. $e = error_reporting($level);
  38850. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  38851. error_reporting($e);
  38852. }
  38853. }
  38854. if (empty(self::$stackedErrorLevels)) {
  38855. $errors = self::$stackedErrors;
  38856. self::$stackedErrors = array();
  38857. foreach ($errors as $e) {
  38858. $e[0]->log($e[1], $e[2], $e[3]);
  38859. }
  38860. }
  38861. }
  38862. protected function getFatalErrorHandlers()
  38863. {
  38864. return array(
  38865. new UndefinedFunctionFatalErrorHandler(),
  38866. new UndefinedMethodFatalErrorHandler(),
  38867. new ClassNotFoundFatalErrorHandler(),
  38868. );
  38869. }
  38870. public function setLevel($level)
  38871. {
  38872. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  38873. $level = null === $level ? error_reporting() : $level;
  38874. $this->throwAt($level, true);
  38875. }
  38876. public function setDisplayErrors($displayErrors)
  38877. {
  38878. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  38879. if ($displayErrors) {
  38880. $this->throwAt($this->displayErrors, true);
  38881. } else {
  38882. $displayErrors = $this->displayErrors;
  38883. $this->throwAt(0, true);
  38884. $this->displayErrors = $displayErrors;
  38885. }
  38886. }
  38887. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  38888. {
  38889. @trigger_error('The '.__METHOD__.' static method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
  38890. $handler = set_error_handler('var_dump');
  38891. $handler = \is_array($handler) ? $handler[0] : null;
  38892. restore_error_handler();
  38893. if (!$handler instanceof self) {
  38894. return;
  38895. }
  38896. if ('deprecation' === $channel) {
  38897. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  38898. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  38899. } elseif ('scream' === $channel) {
  38900. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  38901. $handler->screamAt(E_ALL | E_STRICT);
  38902. } elseif ('emergency' === $channel) {
  38903. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  38904. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  38905. }
  38906. }
  38907. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  38908. {
  38909. $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());
  38910. return $this->handleError($level, $message, $file, $line, (array) $context);
  38911. }
  38912. public function handleFatal()
  38913. {
  38914. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
  38915. static::handleFatalError();
  38916. }
  38917. }
  38918. class ErrorHandlerCanary
  38919. {
  38920. private static $displayErrors = null;
  38921. public function __construct()
  38922. {
  38923. if (null === self::$displayErrors) {
  38924. self::$displayErrors = ini_set('display_errors', 1);
  38925. }
  38926. }
  38927. public function __destruct()
  38928. {
  38929. if (null !== self::$displayErrors) {
  38930. ini_set('display_errors', self::$displayErrors);
  38931. self::$displayErrors = null;
  38932. }
  38933. }
  38934. }
  38935. <?php
  38936. namespace Symfony\Component\Debug\Exception;
  38937. class ClassNotFoundException extends FatalErrorException
  38938. {
  38939. public function __construct($message, \ErrorException $previous)
  38940. {
  38941. parent::__construct(
  38942. $message,
  38943. $previous->getCode(),
  38944. $previous->getSeverity(),
  38945. $previous->getFile(),
  38946. $previous->getLine(),
  38947. null,
  38948. true,
  38949. null,
  38950. $previous->getPrevious()
  38951. );
  38952. $this->setTrace($previous->getTrace());
  38953. }
  38954. }
  38955. <?php
  38956. namespace Symfony\Component\Debug\Exception;
  38957. class ContextErrorException extends \ErrorException
  38958. {
  38959. private $context = array();
  38960. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  38961. {
  38962. parent::__construct($message, $code, $severity, $filename, $lineno);
  38963. $this->context = $context;
  38964. }
  38965. public function getContext()
  38966. {
  38967. return $this->context;
  38968. }
  38969. }
  38970. <?php
  38971. namespace Symfony\Component\Debug\Exception;
  38972. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  38973. class DummyException extends \ErrorException
  38974. {
  38975. }
  38976. <?php
  38977. namespace Symfony\Component\HttpKernel\Exception;
  38978. class FatalErrorException extends \ErrorException
  38979. {
  38980. }
  38981. namespace Symfony\Component\Debug\Exception;
  38982. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  38983. class FatalErrorException extends LegacyFatalErrorException
  38984. {
  38985. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
  38986. {
  38987. parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
  38988. if (null !== $trace) {
  38989. if (!$traceArgs) {
  38990. foreach ($trace as &$frame) {
  38991. unset($frame['args'], $frame['this'], $frame);
  38992. }
  38993. }
  38994. $this->setTrace($trace);
  38995. } elseif (null !== $traceOffset) {
  38996. if (\function_exists('xdebug_get_function_stack')) {
  38997. $trace = xdebug_get_function_stack();
  38998. if (0 < $traceOffset) {
  38999. array_splice($trace, -$traceOffset);
  39000. }
  39001. foreach ($trace as &$frame) {
  39002. if (!isset($frame['type'])) {
  39003. if (isset($frame['class'])) {
  39004. $frame['type'] = '::';
  39005. }
  39006. } elseif ('dynamic' === $frame['type']) {
  39007. $frame['type'] = '->';
  39008. } elseif ('static' === $frame['type']) {
  39009. $frame['type'] = '::';
  39010. }
  39011. if (!$traceArgs) {
  39012. unset($frame['params'], $frame['args']);
  39013. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  39014. $frame['args'] = $frame['params'];
  39015. unset($frame['params']);
  39016. }
  39017. }
  39018. unset($frame);
  39019. $trace = array_reverse($trace);
  39020. } elseif (\function_exists('symfony_debug_backtrace')) {
  39021. $trace = symfony_debug_backtrace();
  39022. if (0 < $traceOffset) {
  39023. array_splice($trace, 0, $traceOffset);
  39024. }
  39025. } else {
  39026. $trace = array();
  39027. }
  39028. $this->setTrace($trace);
  39029. }
  39030. }
  39031. protected function setTrace($trace)
  39032. {
  39033. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  39034. $traceReflector->setAccessible(true);
  39035. $traceReflector->setValue($this, $trace);
  39036. }
  39037. }
  39038. <?php
  39039. namespace Symfony\Component\Debug\Exception;
  39040. class FatalThrowableError extends FatalErrorException
  39041. {
  39042. public function __construct(\Throwable $e)
  39043. {
  39044. if ($e instanceof \ParseError) {
  39045. $message = 'Parse error: '.$e->getMessage();
  39046. $severity = E_PARSE;
  39047. } elseif ($e instanceof \TypeError) {
  39048. $message = 'Type error: '.$e->getMessage();
  39049. $severity = E_RECOVERABLE_ERROR;
  39050. } else {
  39051. $message = $e->getMessage();
  39052. $severity = E_ERROR;
  39053. }
  39054. \ErrorException::__construct(
  39055. $message,
  39056. $e->getCode(),
  39057. $severity,
  39058. $e->getFile(),
  39059. $e->getLine(),
  39060. $e->getPrevious()
  39061. );
  39062. $this->setTrace($e->getTrace());
  39063. }
  39064. }
  39065. <?php
  39066. namespace Symfony\Component\HttpKernel\Exception;
  39067. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  39068. class FlattenException
  39069. {
  39070. private $handler;
  39071. public static function __callStatic($method, $args)
  39072. {
  39073. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  39074. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_called_class(), $method));
  39075. }
  39076. return \call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  39077. }
  39078. public function __call($method, $args)
  39079. {
  39080. if (!isset($this->handler)) {
  39081. $this->handler = new DebugFlattenException();
  39082. }
  39083. if (!method_exists($this->handler, $method)) {
  39084. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method));
  39085. }
  39086. return \call_user_func_array(array($this->handler, $method), $args);
  39087. }
  39088. }
  39089. namespace Symfony\Component\Debug\Exception;
  39090. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  39091. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  39092. class FlattenException extends LegacyFlattenException
  39093. {
  39094. private $message;
  39095. private $code;
  39096. private $previous;
  39097. private $trace;
  39098. private $class;
  39099. private $statusCode;
  39100. private $headers;
  39101. private $file;
  39102. private $line;
  39103. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  39104. {
  39105. $e = new static();
  39106. $e->setMessage($exception->getMessage());
  39107. $e->setCode($exception->getCode());
  39108. if ($exception instanceof HttpExceptionInterface) {
  39109. $statusCode = $exception->getStatusCode();
  39110. $headers = array_merge($headers, $exception->getHeaders());
  39111. }
  39112. if (null === $statusCode) {
  39113. $statusCode = 500;
  39114. }
  39115. $e->setStatusCode($statusCode);
  39116. $e->setHeaders($headers);
  39117. $e->setTraceFromException($exception);
  39118. $e->setClass(\get_class($exception));
  39119. $e->setFile($exception->getFile());
  39120. $e->setLine($exception->getLine());
  39121. $previous = $exception->getPrevious();
  39122. if ($previous instanceof \Exception) {
  39123. $e->setPrevious(static::create($previous));
  39124. } elseif ($previous instanceof \Throwable) {
  39125. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  39126. }
  39127. return $e;
  39128. }
  39129. public function toArray()
  39130. {
  39131. $exceptions = array();
  39132. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  39133. $exceptions[] = array(
  39134. 'message' => $exception->getMessage(),
  39135. 'class' => $exception->getClass(),
  39136. 'trace' => $exception->getTrace(),
  39137. );
  39138. }
  39139. return $exceptions;
  39140. }
  39141. public function getStatusCode()
  39142. {
  39143. return $this->statusCode;
  39144. }
  39145. public function setStatusCode($code)
  39146. {
  39147. $this->statusCode = $code;
  39148. }
  39149. public function getHeaders()
  39150. {
  39151. return $this->headers;
  39152. }
  39153. public function setHeaders(array $headers)
  39154. {
  39155. $this->headers = $headers;
  39156. }
  39157. public function getClass()
  39158. {
  39159. return $this->class;
  39160. }
  39161. public function setClass($class)
  39162. {
  39163. $this->class = $class;
  39164. }
  39165. public function getFile()
  39166. {
  39167. return $this->file;
  39168. }
  39169. public function setFile($file)
  39170. {
  39171. $this->file = $file;
  39172. }
  39173. public function getLine()
  39174. {
  39175. return $this->line;
  39176. }
  39177. public function setLine($line)
  39178. {
  39179. $this->line = $line;
  39180. }
  39181. public function getMessage()
  39182. {
  39183. return $this->message;
  39184. }
  39185. public function setMessage($message)
  39186. {
  39187. $this->message = $message;
  39188. }
  39189. public function getCode()
  39190. {
  39191. return $this->code;
  39192. }
  39193. public function setCode($code)
  39194. {
  39195. $this->code = $code;
  39196. }
  39197. public function getPrevious()
  39198. {
  39199. return $this->previous;
  39200. }
  39201. public function setPrevious(FlattenException $previous)
  39202. {
  39203. $this->previous = $previous;
  39204. }
  39205. public function getAllPrevious()
  39206. {
  39207. $exceptions = array();
  39208. $e = $this;
  39209. while ($e = $e->getPrevious()) {
  39210. $exceptions[] = $e;
  39211. }
  39212. return $exceptions;
  39213. }
  39214. public function getTrace()
  39215. {
  39216. return $this->trace;
  39217. }
  39218. public function setTraceFromException(\Exception $exception)
  39219. {
  39220. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  39221. }
  39222. public function setTrace($trace, $file, $line)
  39223. {
  39224. $this->trace = array();
  39225. $this->trace[] = array(
  39226. 'namespace' => '',
  39227. 'short_class' => '',
  39228. 'class' => '',
  39229. 'type' => '',
  39230. 'function' => '',
  39231. 'file' => $file,
  39232. 'line' => $line,
  39233. 'args' => array(),
  39234. );
  39235. foreach ($trace as $entry) {
  39236. $class = '';
  39237. $namespace = '';
  39238. if (isset($entry['class'])) {
  39239. $parts = explode('\\', $entry['class']);
  39240. $class = array_pop($parts);
  39241. $namespace = implode('\\', $parts);
  39242. }
  39243. $this->trace[] = array(
  39244. 'namespace' => $namespace,
  39245. 'short_class' => $class,
  39246. 'class' => isset($entry['class']) ? $entry['class'] : '',
  39247. 'type' => isset($entry['type']) ? $entry['type'] : '',
  39248. 'function' => isset($entry['function']) ? $entry['function'] : null,
  39249. 'file' => isset($entry['file']) ? $entry['file'] : null,
  39250. 'line' => isset($entry['line']) ? $entry['line'] : null,
  39251. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  39252. );
  39253. }
  39254. }
  39255. private function flattenArgs($args, $level = 0, &$count = 0)
  39256. {
  39257. $result = array();
  39258. foreach ($args as $key => $value) {
  39259. if (++$count > 1e4) {
  39260. return array('array', '*SKIPPED over 10000 entries*');
  39261. }
  39262. if ($value instanceof \__PHP_Incomplete_Class) {
  39263. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  39264. } elseif (\is_object($value)) {
  39265. $result[$key] = array('object', \get_class($value));
  39266. } elseif (\is_array($value)) {
  39267. if ($level > 10) {
  39268. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  39269. } else {
  39270. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  39271. }
  39272. } elseif (null === $value) {
  39273. $result[$key] = array('null', null);
  39274. } elseif (\is_bool($value)) {
  39275. $result[$key] = array('boolean', $value);
  39276. } elseif (\is_resource($value)) {
  39277. $result[$key] = array('resource', get_resource_type($value));
  39278. } else {
  39279. $result[$key] = array('string', (string) $value);
  39280. }
  39281. }
  39282. return $result;
  39283. }
  39284. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  39285. {
  39286. $array = new \ArrayObject($value);
  39287. return $array['__PHP_Incomplete_Class_Name'];
  39288. }
  39289. }
  39290. <?php
  39291. namespace Symfony\Component\Debug\Exception;
  39292. class OutOfMemoryException extends FatalErrorException
  39293. {
  39294. }
  39295. <?php
  39296. namespace Symfony\Component\Debug\Exception;
  39297. class UndefinedFunctionException extends FatalErrorException
  39298. {
  39299. public function __construct($message, \ErrorException $previous)
  39300. {
  39301. parent::__construct(
  39302. $message,
  39303. $previous->getCode(),
  39304. $previous->getSeverity(),
  39305. $previous->getFile(),
  39306. $previous->getLine(),
  39307. null,
  39308. true,
  39309. null,
  39310. $previous->getPrevious()
  39311. );
  39312. $this->setTrace($previous->getTrace());
  39313. }
  39314. }
  39315. <?php
  39316. namespace Symfony\Component\Debug\Exception;
  39317. class UndefinedMethodException extends FatalErrorException
  39318. {
  39319. public function __construct($message, \ErrorException $previous)
  39320. {
  39321. parent::__construct(
  39322. $message,
  39323. $previous->getCode(),
  39324. $previous->getSeverity(),
  39325. $previous->getFile(),
  39326. $previous->getLine(),
  39327. null,
  39328. true,
  39329. null,
  39330. $previous->getPrevious()
  39331. );
  39332. $this->setTrace($previous->getTrace());
  39333. }
  39334. }
  39335. <?php
  39336. namespace Symfony\Component\Debug;
  39337. use Symfony\Component\Debug\Exception\FlattenException;
  39338. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  39339. use Symfony\Component\HttpFoundation\Response;
  39340. class ExceptionHandler
  39341. {
  39342. private $debug;
  39343. private $charset;
  39344. private $handler;
  39345. private $caughtBuffer;
  39346. private $caughtLength;
  39347. private $fileLinkFormat;
  39348. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  39349. {
  39350. if (false !== strpos($charset, '%')) {
  39351. @trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since Symfony 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);
  39352. $pivot = $fileLinkFormat;
  39353. $fileLinkFormat = $charset;
  39354. $charset = $pivot;
  39355. }
  39356. $this->debug = $debug;
  39357. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  39358. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  39359. }
  39360. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  39361. {
  39362. $handler = new static($debug, $charset, $fileLinkFormat);
  39363. $prev = set_exception_handler(array($handler, 'handle'));
  39364. if (\is_array($prev) && $prev[0] instanceof ErrorHandler) {
  39365. restore_exception_handler();
  39366. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  39367. }
  39368. return $handler;
  39369. }
  39370. public function setHandler($handler)
  39371. {
  39372. if (null !== $handler && !\is_callable($handler)) {
  39373. throw new \LogicException('The exception handler must be a valid PHP callable.');
  39374. }
  39375. $old = $this->handler;
  39376. $this->handler = $handler;
  39377. return $old;
  39378. }
  39379. public function setFileLinkFormat($format)
  39380. {
  39381. $old = $this->fileLinkFormat;
  39382. $this->fileLinkFormat = $format;
  39383. return $old;
  39384. }
  39385. public function handle(\Exception $exception)
  39386. {
  39387. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  39388. $this->failSafeHandle($exception);
  39389. return;
  39390. }
  39391. $caughtLength = $this->caughtLength = 0;
  39392. ob_start(array($this, 'catchOutput'));
  39393. $this->failSafeHandle($exception);
  39394. while (null === $this->caughtBuffer && ob_end_flush()) {
  39395. }
  39396. if (isset($this->caughtBuffer[0])) {
  39397. ob_start(array($this, 'cleanOutput'));
  39398. echo $this->caughtBuffer;
  39399. $caughtLength = ob_get_length();
  39400. }
  39401. $this->caughtBuffer = null;
  39402. try {
  39403. \call_user_func($this->handler, $exception);
  39404. $this->caughtLength = $caughtLength;
  39405. } catch (\Exception $e) {
  39406. if (!$caughtLength) {
  39407. throw $exception;
  39408. }
  39409. }
  39410. }
  39411. private function failSafeHandle(\Exception $exception)
  39412. {
  39413. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  39414. && __CLASS__ !== \get_class($this)
  39415. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  39416. && __CLASS__ !== $reflector->class
  39417. ) {
  39418. $response = $this->createResponse($exception);
  39419. $response->sendHeaders();
  39420. $response->sendContent();
  39421. @trigger_error(sprintf("The %s::createResponse method is deprecated since Symfony 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
  39422. return;
  39423. }
  39424. $this->sendPhpResponse($exception);
  39425. }
  39426. public function sendPhpResponse($exception)
  39427. {
  39428. if (!$exception instanceof FlattenException) {
  39429. $exception = FlattenException::create($exception);
  39430. }
  39431. if (!headers_sent()) {
  39432. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  39433. foreach ($exception->getHeaders() as $name => $value) {
  39434. header($name.': '.$value, false);
  39435. }
  39436. header('Content-Type: text/html; charset='.$this->charset);
  39437. }
  39438. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  39439. }
  39440. public function createResponse($exception)
  39441. {
  39442. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39443. if (!$exception instanceof FlattenException) {
  39444. $exception = FlattenException::create($exception);
  39445. }
  39446. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  39447. }
  39448. public function getHtml($exception)
  39449. {
  39450. if (!$exception instanceof FlattenException) {
  39451. $exception = FlattenException::create($exception);
  39452. }
  39453. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  39454. }
  39455. public function getContent(FlattenException $exception)
  39456. {
  39457. switch ($exception->getStatusCode()) {
  39458. case 404:
  39459. $title = 'Sorry, the page you are looking for could not be found.';
  39460. break;
  39461. default:
  39462. $title = 'Whoops, looks like something went wrong.';
  39463. }
  39464. $content = '';
  39465. if ($this->debug) {
  39466. try {
  39467. $count = \count($exception->getAllPrevious());
  39468. $total = $count + 1;
  39469. foreach ($exception->toArray() as $position => $e) {
  39470. $ind = $count - $position + 1;
  39471. $class = $this->formatClass($e['class']);
  39472. $message = nl2br($this->escapeHtml($e['message']));
  39473. $content .= sprintf(<<<'EOF'
  39474. <h2 class="block_exception clear_fix">
  39475. <span class="exception_counter">%d/%d</span>
  39476. <span class="exception_title">%s%s:</span>
  39477. <span class="exception_message">%s</span>
  39478. </h2>
  39479. <div class="block">
  39480. <ol class="traces list_exception">
  39481. EOF
  39482. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  39483. foreach ($e['trace'] as $trace) {
  39484. $content .= ' <li>';
  39485. if ($trace['function']) {
  39486. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  39487. }
  39488. if (isset($trace['file']) && isset($trace['line'])) {
  39489. $content .= $this->formatPath($trace['file'], $trace['line']);
  39490. }
  39491. $content .= "</li>\n";
  39492. }
  39493. $content .= " </ol>\n</div>\n";
  39494. }
  39495. } catch (\Exception $e) {
  39496. if ($this->debug) {
  39497. $title = sprintf('Exception thrown when handling an exception (%s: %s)', \get_class($e), $this->escapeHtml($e->getMessage()));
  39498. } else {
  39499. $title = 'Whoops, looks like something went wrong.';
  39500. }
  39501. }
  39502. }
  39503. return <<<EOF
  39504. <div id="sf-resetcontent" class="sf-reset">
  39505. <h1>$title</h1>
  39506. $content
  39507. </div>
  39508. EOF;
  39509. }
  39510. public function getStylesheet(FlattenException $exception)
  39511. {
  39512. return <<<'EOF'
  39513. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  39514. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  39515. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  39516. .sf-reset .clear_fix { display:inline-block; }
  39517. .sf-reset * html .clear_fix { height:1%; }
  39518. .sf-reset .clear_fix { display:block; }
  39519. .sf-reset, .sf-reset .block { margin: auto }
  39520. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  39521. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  39522. .sf-reset strong { font-weight:bold; }
  39523. .sf-reset a { color:#6c6159; cursor: default; }
  39524. .sf-reset a img { border:none; }
  39525. .sf-reset a:hover { text-decoration:underline; }
  39526. .sf-reset em { font-style:italic; }
  39527. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  39528. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  39529. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  39530. .sf-reset .exception_message { margin-left: 3em; display: block; }
  39531. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  39532. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  39533. -webkit-border-bottom-right-radius: 16px;
  39534. -webkit-border-bottom-left-radius: 16px;
  39535. -moz-border-radius-bottomright: 16px;
  39536. -moz-border-radius-bottomleft: 16px;
  39537. border-bottom-right-radius: 16px;
  39538. border-bottom-left-radius: 16px;
  39539. border-bottom:1px solid #ccc;
  39540. border-right:1px solid #ccc;
  39541. border-left:1px solid #ccc;
  39542. word-wrap: break-word;
  39543. }
  39544. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  39545. -webkit-border-top-left-radius: 16px;
  39546. -webkit-border-top-right-radius: 16px;
  39547. -moz-border-radius-topleft: 16px;
  39548. -moz-border-radius-topright: 16px;
  39549. border-top-left-radius: 16px;
  39550. border-top-right-radius: 16px;
  39551. border-top:1px solid #ccc;
  39552. border-right:1px solid #ccc;
  39553. border-left:1px solid #ccc;
  39554. overflow: hidden;
  39555. word-wrap: break-word;
  39556. }
  39557. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  39558. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  39559. .sf-reset ol { padding: 10px 0; }
  39560. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  39561. -webkit-border-radius: 10px;
  39562. -moz-border-radius: 10px;
  39563. border-radius: 10px;
  39564. border: 1px solid #ccc;
  39565. }
  39566. EOF;
  39567. }
  39568. private function decorate($content, $css)
  39569. {
  39570. return <<<EOF
  39571. <!DOCTYPE html>
  39572. <html>
  39573. <head>
  39574. <meta charset="{$this->charset}" />
  39575. <meta name="robots" content="noindex,nofollow" />
  39576. <style>
  39577. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  39578. html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
  39579. html { background: #eee; padding: 10px }
  39580. img { border: 0; }
  39581. #sf-resetcontent { width:970px; margin:0 auto; }
  39582. $css
  39583. </style>
  39584. </head>
  39585. <body>
  39586. $content
  39587. </body>
  39588. </html>
  39589. EOF;
  39590. }
  39591. private function formatClass($class)
  39592. {
  39593. $parts = explode('\\', $class);
  39594. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  39595. }
  39596. private function formatPath($path, $line)
  39597. {
  39598. $path = $this->escapeHtml($path);
  39599. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  39600. if ($linkFormat = $this->fileLinkFormat) {
  39601. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  39602. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  39603. }
  39604. return sprintf(' in <a title="%s line %3$d" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>', $path, $file, $line);
  39605. }
  39606. private function formatArgs(array $args)
  39607. {
  39608. $result = array();
  39609. foreach ($args as $key => $item) {
  39610. if ('object' === $item[0]) {
  39611. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  39612. } elseif ('array' === $item[0]) {
  39613. $formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  39614. } elseif ('string' === $item[0]) {
  39615. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  39616. } elseif ('null' === $item[0]) {
  39617. $formattedValue = '<em>null</em>';
  39618. } elseif ('boolean' === $item[0]) {
  39619. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  39620. } elseif ('resource' === $item[0]) {
  39621. $formattedValue = '<em>resource</em>';
  39622. } else {
  39623. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  39624. }
  39625. $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  39626. }
  39627. return implode(', ', $result);
  39628. }
  39629. protected static function utf8Htmlize($str)
  39630. {
  39631. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  39632. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  39633. }
  39634. private function escapeHtml($str)
  39635. {
  39636. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  39637. }
  39638. public function catchOutput($buffer)
  39639. {
  39640. $this->caughtBuffer = $buffer;
  39641. return '';
  39642. }
  39643. public function cleanOutput($buffer)
  39644. {
  39645. if ($this->caughtLength) {
  39646. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  39647. if (isset($cleanBuffer[0])) {
  39648. $buffer = $cleanBuffer;
  39649. }
  39650. }
  39651. return $buffer;
  39652. }
  39653. }
  39654. <?php
  39655. namespace Symfony\Component\Debug\FatalErrorHandler;
  39656. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  39657. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  39658. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  39659. use Symfony\Component\Debug\DebugClassLoader;
  39660. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  39661. use Symfony\Component\Debug\Exception\FatalErrorException;
  39662. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  39663. {
  39664. public function handleError(array $error, FatalErrorException $exception)
  39665. {
  39666. $messageLen = \strlen($error['message']);
  39667. $notFoundSuffix = '\' not found';
  39668. $notFoundSuffixLen = \strlen($notFoundSuffix);
  39669. if ($notFoundSuffixLen > $messageLen) {
  39670. return;
  39671. }
  39672. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  39673. return;
  39674. }
  39675. foreach (array('class', 'interface', 'trait') as $typeName) {
  39676. $prefix = ucfirst($typeName).' \'';
  39677. $prefixLen = \strlen($prefix);
  39678. if (0 !== strpos($error['message'], $prefix)) {
  39679. continue;
  39680. }
  39681. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  39682. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  39683. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  39684. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  39685. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  39686. $tail = ' for another namespace?';
  39687. } else {
  39688. $className = $fullyQualifiedClassName;
  39689. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  39690. $tail = '?';
  39691. }
  39692. if ($candidates = $this->getClassCandidates($className)) {
  39693. $tail = array_pop($candidates).'"?';
  39694. if ($candidates) {
  39695. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  39696. } else {
  39697. $tail = ' for "'.$tail;
  39698. }
  39699. }
  39700. $message .= "\nDid you forget a \"use\" statement".$tail;
  39701. return new ClassNotFoundException($message, $exception);
  39702. }
  39703. }
  39704. private function getClassCandidates($class)
  39705. {
  39706. if (!\is_array($functions = spl_autoload_functions())) {
  39707. return array();
  39708. }
  39709. $classes = array();
  39710. foreach ($functions as $function) {
  39711. if (!\is_array($function)) {
  39712. continue;
  39713. }
  39714. if ($function[0] instanceof DebugClassLoader) {
  39715. $function = $function[0]->getClassLoader();
  39716. if (\is_object($function)) {
  39717. $function = array($function);
  39718. }
  39719. if (!\is_array($function)) {
  39720. continue;
  39721. }
  39722. }
  39723. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  39724. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  39725. foreach ($paths as $path) {
  39726. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  39727. }
  39728. }
  39729. }
  39730. if ($function[0] instanceof ComposerClassLoader) {
  39731. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  39732. foreach ($paths as $path) {
  39733. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  39734. }
  39735. }
  39736. }
  39737. }
  39738. return array_unique($classes);
  39739. }
  39740. private function findClassInPath($path, $class, $prefix)
  39741. {
  39742. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  39743. return array();
  39744. }
  39745. $classes = array();
  39746. $filename = $class.'.php';
  39747. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  39748. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  39749. $classes[] = $class;
  39750. }
  39751. }
  39752. return $classes;
  39753. }
  39754. private function convertFileToClass($path, $file, $prefix)
  39755. {
  39756. $candidates = array(
  39757. $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  39758. $prefix.$namespacedClass,
  39759. $prefix.'\\'.$namespacedClass,
  39760. str_replace('\\', '_', $namespacedClass),
  39761. str_replace('\\', '_', $prefix.$namespacedClass),
  39762. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  39763. );
  39764. if ($prefix) {
  39765. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  39766. }
  39767. foreach ($candidates as $candidate) {
  39768. if ($this->classExists($candidate)) {
  39769. return $candidate;
  39770. }
  39771. }
  39772. require_once $file;
  39773. foreach ($candidates as $candidate) {
  39774. if ($this->classExists($candidate)) {
  39775. return $candidate;
  39776. }
  39777. }
  39778. }
  39779. private function classExists($class)
  39780. {
  39781. return class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  39782. }
  39783. }
  39784. <?php
  39785. namespace Symfony\Component\Debug\FatalErrorHandler;
  39786. use Symfony\Component\Debug\Exception\FatalErrorException;
  39787. interface FatalErrorHandlerInterface
  39788. {
  39789. public function handleError(array $error, FatalErrorException $exception);
  39790. }
  39791. <?php
  39792. namespace Symfony\Component\Debug\FatalErrorHandler;
  39793. use Symfony\Component\Debug\Exception\FatalErrorException;
  39794. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  39795. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  39796. {
  39797. public function handleError(array $error, FatalErrorException $exception)
  39798. {
  39799. $messageLen = \strlen($error['message']);
  39800. $notFoundSuffix = '()';
  39801. $notFoundSuffixLen = \strlen($notFoundSuffix);
  39802. if ($notFoundSuffixLen > $messageLen) {
  39803. return;
  39804. }
  39805. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  39806. return;
  39807. }
  39808. $prefix = 'Call to undefined function ';
  39809. $prefixLen = \strlen($prefix);
  39810. if (0 !== strpos($error['message'], $prefix)) {
  39811. return;
  39812. }
  39813. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  39814. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  39815. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  39816. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  39817. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  39818. } else {
  39819. $functionName = $fullyQualifiedFunctionName;
  39820. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  39821. }
  39822. $candidates = array();
  39823. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  39824. foreach ($definedFunctionNames as $definedFunctionName) {
  39825. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  39826. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  39827. } else {
  39828. $definedFunctionNameBasename = $definedFunctionName;
  39829. }
  39830. if ($definedFunctionNameBasename === $functionName) {
  39831. $candidates[] = '\\'.$definedFunctionName;
  39832. }
  39833. }
  39834. }
  39835. if ($candidates) {
  39836. sort($candidates);
  39837. $last = array_pop($candidates).'"?';
  39838. if ($candidates) {
  39839. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  39840. } else {
  39841. $candidates = '"'.$last;
  39842. }
  39843. $message .= "\nDid you mean to call ".$candidates;
  39844. }
  39845. return new UndefinedFunctionException($message, $exception);
  39846. }
  39847. }
  39848. <?php
  39849. namespace Symfony\Component\Debug\FatalErrorHandler;
  39850. use Symfony\Component\Debug\Exception\FatalErrorException;
  39851. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  39852. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  39853. {
  39854. public function handleError(array $error, FatalErrorException $exception)
  39855. {
  39856. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  39857. if (!$matches) {
  39858. return;
  39859. }
  39860. $className = $matches[1];
  39861. $methodName = $matches[2];
  39862. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  39863. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  39864. return new UndefinedMethodException($message, $exception);
  39865. }
  39866. $candidates = array();
  39867. foreach ($methods as $definedMethodName) {
  39868. $lev = levenshtein($methodName, $definedMethodName);
  39869. if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  39870. $candidates[] = $definedMethodName;
  39871. }
  39872. }
  39873. if ($candidates) {
  39874. sort($candidates);
  39875. $last = array_pop($candidates).'"?';
  39876. if ($candidates) {
  39877. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  39878. } else {
  39879. $candidates = '"'.$last;
  39880. }
  39881. $message .= "\nDid you mean to call ".$candidates;
  39882. }
  39883. return new UndefinedMethodException($message, $exception);
  39884. }
  39885. }
  39886. Copyright (c) 2004-2018 Fabien Potencier
  39887. Permission is hereby granted, free of charge, to any person obtaining a copy
  39888. of this software and associated documentation files (the "Software"), to deal
  39889. in the Software without restriction, including without limitation the rights
  39890. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39891. copies of the Software, and to permit persons to whom the Software is furnished
  39892. to do so, subject to the following conditions:
  39893. The above copyright notice and this permission notice shall be included in all
  39894. copies or substantial portions of the Software.
  39895. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39896. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39897. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39898. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39899. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39900. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39901. THE SOFTWARE.
  39902. <?php
  39903. namespace Symfony\Component\Filesystem\Exception;
  39904. interface ExceptionInterface
  39905. {
  39906. }
  39907. <?php
  39908. namespace Symfony\Component\Filesystem\Exception;
  39909. class FileNotFoundException extends IOException
  39910. {
  39911. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  39912. {
  39913. if (null === $message) {
  39914. if (null === $path) {
  39915. $message = 'File could not be found.';
  39916. } else {
  39917. $message = sprintf('File "%s" could not be found.', $path);
  39918. }
  39919. }
  39920. parent::__construct($message, $code, $previous, $path);
  39921. }
  39922. }
  39923. <?php
  39924. namespace Symfony\Component\Filesystem\Exception;
  39925. class IOException extends \RuntimeException implements IOExceptionInterface
  39926. {
  39927. private $path;
  39928. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  39929. {
  39930. $this->path = $path;
  39931. parent::__construct($message, $code, $previous);
  39932. }
  39933. public function getPath()
  39934. {
  39935. return $this->path;
  39936. }
  39937. }
  39938. <?php
  39939. namespace Symfony\Component\Filesystem\Exception;
  39940. interface IOExceptionInterface extends ExceptionInterface
  39941. {
  39942. public function getPath();
  39943. }
  39944. <?php
  39945. namespace Symfony\Component\Filesystem;
  39946. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  39947. use Symfony\Component\Filesystem\Exception\IOException;
  39948. class Filesystem
  39949. {
  39950. private static $lastError;
  39951. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  39952. {
  39953. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  39954. if ($originIsLocal && !is_file($originFile)) {
  39955. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  39956. }
  39957. $this->mkdir(\dirname($targetFile));
  39958. $doCopy = true;
  39959. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  39960. $doCopy = filemtime($originFile) > filemtime($targetFile);
  39961. }
  39962. if ($doCopy) {
  39963. if (false === $source = @fopen($originFile, 'r')) {
  39964. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  39965. }
  39966. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  39967. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  39968. }
  39969. $bytesCopied = stream_copy_to_stream($source, $target);
  39970. fclose($source);
  39971. fclose($target);
  39972. unset($source, $target);
  39973. if (!is_file($targetFile)) {
  39974. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  39975. }
  39976. if ($originIsLocal) {
  39977. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  39978. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  39979. throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
  39980. }
  39981. }
  39982. }
  39983. }
  39984. public function mkdir($dirs, $mode = 0777)
  39985. {
  39986. foreach ($this->toIterator($dirs) as $dir) {
  39987. if (is_dir($dir)) {
  39988. continue;
  39989. }
  39990. if (!self::box('mkdir', $dir, $mode, true)) {
  39991. if (!is_dir($dir)) {
  39992. if (self::$lastError) {
  39993. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
  39994. }
  39995. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  39996. }
  39997. }
  39998. }
  39999. }
  40000. public function exists($files)
  40001. {
  40002. $maxPathLength = PHP_MAXPATHLEN - 2;
  40003. foreach ($this->toIterator($files) as $file) {
  40004. if (\strlen($file) > $maxPathLength) {
  40005. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  40006. }
  40007. if (!file_exists($file)) {
  40008. return false;
  40009. }
  40010. }
  40011. return true;
  40012. }
  40013. public function touch($files, $time = null, $atime = null)
  40014. {
  40015. foreach ($this->toIterator($files) as $file) {
  40016. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  40017. if (true !== $touch) {
  40018. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  40019. }
  40020. }
  40021. }
  40022. public function remove($files)
  40023. {
  40024. if ($files instanceof \Traversable) {
  40025. $files = iterator_to_array($files, false);
  40026. } elseif (!\is_array($files)) {
  40027. $files = array($files);
  40028. }
  40029. $files = array_reverse($files);
  40030. foreach ($files as $file) {
  40031. if (is_link($file)) {
  40032. if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  40033. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
  40034. }
  40035. } elseif (is_dir($file)) {
  40036. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  40037. if (!self::box('rmdir', $file) && file_exists($file)) {
  40038. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError));
  40039. }
  40040. } elseif (!self::box('unlink', $file) && file_exists($file)) {
  40041. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError));
  40042. }
  40043. }
  40044. }
  40045. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  40046. {
  40047. foreach ($this->toIterator($files) as $file) {
  40048. if (true !== @chmod($file, $mode & ~$umask)) {
  40049. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  40050. }
  40051. if ($recursive && is_dir($file) && !is_link($file)) {
  40052. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  40053. }
  40054. }
  40055. }
  40056. public function chown($files, $user, $recursive = false)
  40057. {
  40058. foreach ($this->toIterator($files) as $file) {
  40059. if ($recursive && is_dir($file) && !is_link($file)) {
  40060. $this->chown(new \FilesystemIterator($file), $user, true);
  40061. }
  40062. if (is_link($file) && \function_exists('lchown')) {
  40063. if (true !== @lchown($file, $user)) {
  40064. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  40065. }
  40066. } else {
  40067. if (true !== @chown($file, $user)) {
  40068. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  40069. }
  40070. }
  40071. }
  40072. }
  40073. public function chgrp($files, $group, $recursive = false)
  40074. {
  40075. foreach ($this->toIterator($files) as $file) {
  40076. if ($recursive && is_dir($file) && !is_link($file)) {
  40077. $this->chgrp(new \FilesystemIterator($file), $group, true);
  40078. }
  40079. if (is_link($file) && \function_exists('lchgrp')) {
  40080. if (true !== @lchgrp($file, $group) || (\defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  40081. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  40082. }
  40083. } else {
  40084. if (true !== @chgrp($file, $group)) {
  40085. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  40086. }
  40087. }
  40088. }
  40089. }
  40090. public function rename($origin, $target, $overwrite = false)
  40091. {
  40092. if (!$overwrite && $this->isReadable($target)) {
  40093. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  40094. }
  40095. if (true !== @rename($origin, $target)) {
  40096. if (is_dir($origin)) {
  40097. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  40098. $this->remove($origin);
  40099. return;
  40100. }
  40101. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  40102. }
  40103. }
  40104. private function isReadable($filename)
  40105. {
  40106. $maxPathLength = PHP_MAXPATHLEN - 2;
  40107. if (\strlen($filename) > $maxPathLength) {
  40108. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  40109. }
  40110. return is_readable($filename);
  40111. }
  40112. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  40113. {
  40114. if ('\\' === \DIRECTORY_SEPARATOR) {
  40115. $originDir = strtr($originDir, '/', '\\');
  40116. $targetDir = strtr($targetDir, '/', '\\');
  40117. if ($copyOnWindows) {
  40118. $this->mirror($originDir, $targetDir);
  40119. return;
  40120. }
  40121. }
  40122. $this->mkdir(\dirname($targetDir));
  40123. if (is_link($targetDir)) {
  40124. if (readlink($targetDir) === $originDir) {
  40125. return;
  40126. }
  40127. $this->remove($targetDir);
  40128. }
  40129. if (!self::box('symlink', $originDir, $targetDir)) {
  40130. if (null !== self::$lastError) {
  40131. if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
  40132. throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir);
  40133. }
  40134. }
  40135. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  40136. }
  40137. }
  40138. public function makePathRelative($endPath, $startPath)
  40139. {
  40140. if ('\\' === \DIRECTORY_SEPARATOR) {
  40141. $endPath = str_replace('\\', '/', $endPath);
  40142. $startPath = str_replace('\\', '/', $startPath);
  40143. }
  40144. $stripDriveLetter = function ($path) {
  40145. if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  40146. return substr($path, 2);
  40147. }
  40148. return $path;
  40149. };
  40150. $endPath = $stripDriveLetter($endPath);
  40151. $startPath = $stripDriveLetter($startPath);
  40152. $startPathArr = explode('/', trim($startPath, '/'));
  40153. $endPathArr = explode('/', trim($endPath, '/'));
  40154. $normalizePathArray = function ($pathSegments, $absolute) {
  40155. $result = array();
  40156. foreach ($pathSegments as $segment) {
  40157. if ('..' === $segment && ($absolute || \count($result))) {
  40158. array_pop($result);
  40159. } elseif ('.' !== $segment) {
  40160. $result[] = $segment;
  40161. }
  40162. }
  40163. return $result;
  40164. };
  40165. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  40166. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  40167. $index = 0;
  40168. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  40169. ++$index;
  40170. }
  40171. if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
  40172. $depth = 0;
  40173. } else {
  40174. $depth = \count($startPathArr) - $index;
  40175. }
  40176. $traverser = str_repeat('../', $depth);
  40177. $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
  40178. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  40179. return '' === $relativePath ? './' : $relativePath;
  40180. }
  40181. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  40182. {
  40183. $targetDir = rtrim($targetDir, '/\\');
  40184. $originDir = rtrim($originDir, '/\\');
  40185. $originDirLen = \strlen($originDir);
  40186. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  40187. $deleteIterator = $iterator;
  40188. if (null === $deleteIterator) {
  40189. $flags = \FilesystemIterator::SKIP_DOTS;
  40190. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  40191. }
  40192. $targetDirLen = \strlen($targetDir);
  40193. foreach ($deleteIterator as $file) {
  40194. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  40195. if (!$this->exists($origin)) {
  40196. $this->remove($file);
  40197. }
  40198. }
  40199. }
  40200. $copyOnWindows = false;
  40201. if (isset($options['copy_on_windows'])) {
  40202. $copyOnWindows = $options['copy_on_windows'];
  40203. }
  40204. if (null === $iterator) {
  40205. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  40206. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  40207. }
  40208. if ($this->exists($originDir)) {
  40209. $this->mkdir($targetDir);
  40210. }
  40211. foreach ($iterator as $file) {
  40212. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  40213. if ($copyOnWindows) {
  40214. if (is_file($file)) {
  40215. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  40216. } elseif (is_dir($file)) {
  40217. $this->mkdir($target);
  40218. } else {
  40219. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  40220. }
  40221. } else {
  40222. if (is_link($file)) {
  40223. $this->symlink($file->getLinkTarget(), $target);
  40224. } elseif (is_dir($file)) {
  40225. $this->mkdir($target);
  40226. } elseif (is_file($file)) {
  40227. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  40228. } else {
  40229. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  40230. }
  40231. }
  40232. }
  40233. }
  40234. public function isAbsolutePath($file)
  40235. {
  40236. return strspn($file, '/\\', 0, 1)
  40237. || (\strlen($file) > 3 && ctype_alpha($file[0])
  40238. && ':' === substr($file, 1, 1)
  40239. && strspn($file, '/\\', 2, 1)
  40240. )
  40241. || null !== parse_url($file, PHP_URL_SCHEME)
  40242. ;
  40243. }
  40244. public function tempnam($dir, $prefix)
  40245. {
  40246. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  40247. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  40248. $tmpFile = @tempnam($hierarchy, $prefix);
  40249. if (false !== $tmpFile) {
  40250. if (null !== $scheme && 'gs' !== $scheme) {
  40251. return $scheme.'://'.$tmpFile;
  40252. }
  40253. return $tmpFile;
  40254. }
  40255. throw new IOException('A temporary file could not be created.');
  40256. }
  40257. for ($i = 0; $i < 10; ++$i) {
  40258. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  40259. $handle = @fopen($tmpFile, 'x+');
  40260. if (false === $handle) {
  40261. continue;
  40262. }
  40263. @fclose($handle);
  40264. return $tmpFile;
  40265. }
  40266. throw new IOException('A temporary file could not be created.');
  40267. }
  40268. public function dumpFile($filename, $content, $mode = 0666)
  40269. {
  40270. $dir = \dirname($filename);
  40271. if (!is_dir($dir)) {
  40272. $this->mkdir($dir);
  40273. }
  40274. if (!is_writable($dir)) {
  40275. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  40276. }
  40277. $tmpFile = $this->tempnam($dir, basename($filename));
  40278. if (false === @file_put_contents($tmpFile, $content)) {
  40279. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  40280. }
  40281. if (null !== $mode) {
  40282. if (\func_num_args() > 2) {
  40283. @trigger_error('Support for modifying file permissions is deprecated since Symfony 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  40284. }
  40285. $this->chmod($tmpFile, $mode);
  40286. } elseif (file_exists($filename)) {
  40287. @chmod($tmpFile, fileperms($filename));
  40288. }
  40289. $this->rename($tmpFile, $filename, true);
  40290. }
  40291. private function toIterator($files)
  40292. {
  40293. if (!$files instanceof \Traversable) {
  40294. $files = new \ArrayObject(\is_array($files) ? $files : array($files));
  40295. }
  40296. return $files;
  40297. }
  40298. private function getSchemeAndHierarchy($filename)
  40299. {
  40300. $components = explode('://', $filename, 2);
  40301. return 2 === \count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  40302. }
  40303. private static function box($func)
  40304. {
  40305. self::$lastError = null;
  40306. \set_error_handler(__CLASS__.'::handleError');
  40307. try {
  40308. $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
  40309. \restore_error_handler();
  40310. return $result;
  40311. } catch (\Throwable $e) {
  40312. } catch (\Exception $e) {
  40313. }
  40314. \restore_error_handler();
  40315. throw $e;
  40316. }
  40317. public static function handleError($type, $msg)
  40318. {
  40319. self::$lastError = $msg;
  40320. }
  40321. }
  40322. Copyright (c) 2004-2018 Fabien Potencier
  40323. Permission is hereby granted, free of charge, to any person obtaining a copy
  40324. of this software and associated documentation files (the "Software"), to deal
  40325. in the Software without restriction, including without limitation the rights
  40326. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  40327. copies of the Software, and to permit persons to whom the Software is furnished
  40328. to do so, subject to the following conditions:
  40329. The above copyright notice and this permission notice shall be included in all
  40330. copies or substantial portions of the Software.
  40331. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  40332. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  40333. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  40334. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  40335. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  40336. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  40337. THE SOFTWARE.
  40338. <?php
  40339. namespace Symfony\Component\Filesystem;
  40340. use Symfony\Component\Filesystem\Exception\IOException;
  40341. class LockHandler
  40342. {
  40343. private $file;
  40344. private $handle;
  40345. public function __construct($name, $lockPath = null)
  40346. {
  40347. $lockPath = $lockPath ?: sys_get_temp_dir();
  40348. if (!is_dir($lockPath)) {
  40349. $fs = new Filesystem();
  40350. $fs->mkdir($lockPath);
  40351. }
  40352. if (!is_writable($lockPath)) {
  40353. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  40354. }
  40355. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  40356. }
  40357. public function lock($blocking = false)
  40358. {
  40359. if ($this->handle) {
  40360. return true;
  40361. }
  40362. $error = null;
  40363. set_error_handler(function ($errno, $msg) use (&$error) {
  40364. $error = $msg;
  40365. });
  40366. if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  40367. if ($this->handle = fopen($this->file, 'x')) {
  40368. chmod($this->file, 0666);
  40369. } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  40370. usleep(100);
  40371. $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
  40372. }
  40373. }
  40374. restore_error_handler();
  40375. if (!$this->handle) {
  40376. throw new IOException($error, 0, null, $this->file);
  40377. }
  40378. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  40379. fclose($this->handle);
  40380. $this->handle = null;
  40381. return false;
  40382. }
  40383. return true;
  40384. }
  40385. public function release()
  40386. {
  40387. if ($this->handle) {
  40388. flock($this->handle, LOCK_UN | LOCK_NB);
  40389. fclose($this->handle);
  40390. $this->handle = null;
  40391. }
  40392. }
  40393. }
  40394. <?php
  40395. namespace Symfony\Component\Finder\Adapter;
  40396. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40397. abstract class AbstractAdapter implements AdapterInterface
  40398. {
  40399. protected $followLinks = false;
  40400. protected $mode = 0;
  40401. protected $minDepth = 0;
  40402. protected $maxDepth = PHP_INT_MAX;
  40403. protected $exclude = array();
  40404. protected $names = array();
  40405. protected $notNames = array();
  40406. protected $contains = array();
  40407. protected $notContains = array();
  40408. protected $sizes = array();
  40409. protected $dates = array();
  40410. protected $filters = array();
  40411. protected $sort = false;
  40412. protected $paths = array();
  40413. protected $notPaths = array();
  40414. protected $ignoreUnreadableDirs = false;
  40415. private static $areSupported = array();
  40416. public function isSupported()
  40417. {
  40418. $name = $this->getName();
  40419. if (!array_key_exists($name, self::$areSupported)) {
  40420. self::$areSupported[$name] = $this->canBeUsed();
  40421. }
  40422. return self::$areSupported[$name];
  40423. }
  40424. public function setFollowLinks($followLinks)
  40425. {
  40426. $this->followLinks = $followLinks;
  40427. return $this;
  40428. }
  40429. public function setMode($mode)
  40430. {
  40431. $this->mode = $mode;
  40432. return $this;
  40433. }
  40434. public function setDepths(array $depths)
  40435. {
  40436. $this->minDepth = 0;
  40437. $this->maxDepth = PHP_INT_MAX;
  40438. foreach ($depths as $comparator) {
  40439. switch ($comparator->getOperator()) {
  40440. case '>':
  40441. $this->minDepth = $comparator->getTarget() + 1;
  40442. break;
  40443. case '>=':
  40444. $this->minDepth = $comparator->getTarget();
  40445. break;
  40446. case '<':
  40447. $this->maxDepth = $comparator->getTarget() - 1;
  40448. break;
  40449. case '<=':
  40450. $this->maxDepth = $comparator->getTarget();
  40451. break;
  40452. default:
  40453. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  40454. }
  40455. }
  40456. return $this;
  40457. }
  40458. public function setExclude(array $exclude)
  40459. {
  40460. $this->exclude = $exclude;
  40461. return $this;
  40462. }
  40463. public function setNames(array $names)
  40464. {
  40465. $this->names = $names;
  40466. return $this;
  40467. }
  40468. public function setNotNames(array $notNames)
  40469. {
  40470. $this->notNames = $notNames;
  40471. return $this;
  40472. }
  40473. public function setContains(array $contains)
  40474. {
  40475. $this->contains = $contains;
  40476. return $this;
  40477. }
  40478. public function setNotContains(array $notContains)
  40479. {
  40480. $this->notContains = $notContains;
  40481. return $this;
  40482. }
  40483. public function setSizes(array $sizes)
  40484. {
  40485. $this->sizes = $sizes;
  40486. return $this;
  40487. }
  40488. public function setDates(array $dates)
  40489. {
  40490. $this->dates = $dates;
  40491. return $this;
  40492. }
  40493. public function setFilters(array $filters)
  40494. {
  40495. $this->filters = $filters;
  40496. return $this;
  40497. }
  40498. public function setSort($sort)
  40499. {
  40500. $this->sort = $sort;
  40501. return $this;
  40502. }
  40503. public function setPath(array $paths)
  40504. {
  40505. $this->paths = $paths;
  40506. return $this;
  40507. }
  40508. public function setNotPath(array $notPaths)
  40509. {
  40510. $this->notPaths = $notPaths;
  40511. return $this;
  40512. }
  40513. public function ignoreUnreadableDirs($ignore = true)
  40514. {
  40515. $this->ignoreUnreadableDirs = (bool) $ignore;
  40516. return $this;
  40517. }
  40518. abstract protected function canBeUsed();
  40519. }
  40520. <?php
  40521. namespace Symfony\Component\Finder\Adapter;
  40522. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40523. use Symfony\Component\Finder\Comparator\DateComparator;
  40524. use Symfony\Component\Finder\Comparator\NumberComparator;
  40525. use Symfony\Component\Finder\Exception\AccessDeniedException;
  40526. use Symfony\Component\Finder\Expression\Expression;
  40527. use Symfony\Component\Finder\Iterator;
  40528. use Symfony\Component\Finder\Shell\Command;
  40529. use Symfony\Component\Finder\Shell\Shell;
  40530. abstract class AbstractFindAdapter extends AbstractAdapter
  40531. {
  40532. protected $shell;
  40533. public function __construct()
  40534. {
  40535. $this->shell = new Shell();
  40536. }
  40537. public function searchInDirectory($dir)
  40538. {
  40539. $dir = realpath($dir);
  40540. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  40541. return new Iterator\FilePathsIterator(array(), $dir);
  40542. }
  40543. $command = Command::create();
  40544. $find = $this->buildFindCommand($command, $dir);
  40545. if ($this->followLinks) {
  40546. $find->add('-follow');
  40547. }
  40548. $find->add('-mindepth')->add($this->minDepth + 1);
  40549. if (PHP_INT_MAX !== $this->maxDepth) {
  40550. $find->add('-maxdepth')->add($this->maxDepth + 1);
  40551. }
  40552. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  40553. $find->add('-type d');
  40554. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  40555. $find->add('-type f');
  40556. }
  40557. $this->buildNamesFiltering($find, $this->names);
  40558. $this->buildNamesFiltering($find, $this->notNames, true);
  40559. $this->buildPathsFiltering($find, $dir, $this->paths);
  40560. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  40561. $this->buildSizesFiltering($find, $this->sizes);
  40562. $this->buildDatesFiltering($find, $this->dates);
  40563. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  40564. $useSort = \is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  40565. if ($useGrep && ($this->contains || $this->notContains)) {
  40566. $grep = $command->ins('grep');
  40567. $this->buildContentFiltering($grep, $this->contains);
  40568. $this->buildContentFiltering($grep, $this->notContains, true);
  40569. }
  40570. if ($useSort) {
  40571. $this->buildSorting($command, $this->sort);
  40572. }
  40573. $command->setErrorHandler(
  40574. $this->ignoreUnreadableDirs
  40575. ? function ($stderr) { }
  40576. : function ($stderr) { throw new AccessDeniedException($stderr); }
  40577. );
  40578. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  40579. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  40580. if ($this->exclude) {
  40581. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  40582. }
  40583. if (!$useGrep && ($this->contains || $this->notContains)) {
  40584. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  40585. }
  40586. if ($this->filters) {
  40587. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  40588. }
  40589. if (!$useSort && $this->sort) {
  40590. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  40591. $iterator = $iteratorAggregate->getIterator();
  40592. }
  40593. return $iterator;
  40594. }
  40595. protected function canBeUsed()
  40596. {
  40597. return $this->shell->testCommand('find');
  40598. }
  40599. protected function buildFindCommand(Command $command, $dir)
  40600. {
  40601. return $command
  40602. ->ins('find')
  40603. ->add('find ')
  40604. ->arg($dir)
  40605. ->add('-noleaf');
  40606. }
  40607. private function buildNamesFiltering(Command $command, array $names, $not = false)
  40608. {
  40609. if (0 === \count($names)) {
  40610. return;
  40611. }
  40612. $command->add($not ? '-not' : null)->cmd('(');
  40613. foreach ($names as $i => $name) {
  40614. $expr = Expression::create($name);
  40615. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  40616. $expr = Expression::create($expr->getGlob()->toRegex(false));
  40617. }
  40618. if ($expr->isRegex()) {
  40619. $regex = $expr->getRegex();
  40620. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  40621. ->setStartFlag(false)
  40622. ->setStartJoker(true)
  40623. ->replaceJokers('[^/]');
  40624. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  40625. $regex->setEndJoker(false)->append('[^/]*');
  40626. }
  40627. }
  40628. $command
  40629. ->add($i > 0 ? '-or' : null)
  40630. ->add($expr->isRegex()
  40631. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  40632. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  40633. )
  40634. ->arg($expr->renderPattern());
  40635. }
  40636. $command->cmd(')');
  40637. }
  40638. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  40639. {
  40640. if (0 === \count($paths)) {
  40641. return;
  40642. }
  40643. $command->add($not ? '-not' : null)->cmd('(');
  40644. foreach ($paths as $i => $path) {
  40645. $expr = Expression::create($path);
  40646. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  40647. $expr = Expression::create($expr->getGlob()->toRegex(false));
  40648. }
  40649. if ($expr->isRegex()) {
  40650. $regex = $expr->getRegex();
  40651. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).\DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  40652. } else {
  40653. $expr->prepend('*')->append('*');
  40654. }
  40655. $command
  40656. ->add($i > 0 ? '-or' : null)
  40657. ->add($expr->isRegex()
  40658. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  40659. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  40660. )
  40661. ->arg($expr->renderPattern());
  40662. }
  40663. $command->cmd(')');
  40664. }
  40665. private function buildSizesFiltering(Command $command, array $sizes)
  40666. {
  40667. foreach ($sizes as $i => $size) {
  40668. $command->add($i > 0 ? '-and' : null);
  40669. switch ($size->getOperator()) {
  40670. case '<=':
  40671. $command->add('-size -'.($size->getTarget() + 1).'c');
  40672. break;
  40673. case '>=':
  40674. $command->add('-size +'.($size->getTarget() - 1).'c');
  40675. break;
  40676. case '>':
  40677. $command->add('-size +'.$size->getTarget().'c');
  40678. break;
  40679. case '!=':
  40680. $command->add('-size -'.$size->getTarget().'c');
  40681. $command->add('-size +'.$size->getTarget().'c');
  40682. break;
  40683. case '<':
  40684. default:
  40685. $command->add('-size -'.$size->getTarget().'c');
  40686. }
  40687. }
  40688. }
  40689. private function buildDatesFiltering(Command $command, array $dates)
  40690. {
  40691. foreach ($dates as $i => $date) {
  40692. $command->add($i > 0 ? '-and' : null);
  40693. $mins = (int) round((time() - $date->getTarget()) / 60);
  40694. if (0 > $mins) {
  40695. $command->add(' -mmin -0');
  40696. return;
  40697. }
  40698. switch ($date->getOperator()) {
  40699. case '<=':
  40700. $command->add('-mmin +'.($mins - 1));
  40701. break;
  40702. case '>=':
  40703. $command->add('-mmin -'.($mins + 1));
  40704. break;
  40705. case '>':
  40706. $command->add('-mmin -'.$mins);
  40707. break;
  40708. case '!=':
  40709. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  40710. break;
  40711. case '<':
  40712. default:
  40713. $command->add('-mmin +'.$mins);
  40714. }
  40715. }
  40716. }
  40717. private function buildSorting(Command $command, $sort)
  40718. {
  40719. $this->buildFormatSorting($command, $sort);
  40720. }
  40721. abstract protected function buildFormatSorting(Command $command, $sort);
  40722. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  40723. }
  40724. <?php
  40725. namespace Symfony\Component\Finder\Adapter;
  40726. interface AdapterInterface
  40727. {
  40728. public function setFollowLinks($followLinks);
  40729. public function setMode($mode);
  40730. public function setExclude(array $exclude);
  40731. public function setDepths(array $depths);
  40732. public function setNames(array $names);
  40733. public function setNotNames(array $notNames);
  40734. public function setContains(array $contains);
  40735. public function setNotContains(array $notContains);
  40736. public function setSizes(array $sizes);
  40737. public function setDates(array $dates);
  40738. public function setFilters(array $filters);
  40739. public function setSort($sort);
  40740. public function setPath(array $paths);
  40741. public function setNotPath(array $notPaths);
  40742. public function ignoreUnreadableDirs($ignore = true);
  40743. public function searchInDirectory($dir);
  40744. public function isSupported();
  40745. public function getName();
  40746. }
  40747. <?php
  40748. namespace Symfony\Component\Finder\Adapter;
  40749. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40750. use Symfony\Component\Finder\Expression\Expression;
  40751. use Symfony\Component\Finder\Iterator\SortableIterator;
  40752. use Symfony\Component\Finder\Shell\Command;
  40753. use Symfony\Component\Finder\Shell\Shell;
  40754. class BsdFindAdapter extends AbstractFindAdapter
  40755. {
  40756. public function getName()
  40757. {
  40758. return 'bsd_find';
  40759. }
  40760. protected function canBeUsed()
  40761. {
  40762. return \in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  40763. }
  40764. protected function buildFormatSorting(Command $command, $sort)
  40765. {
  40766. switch ($sort) {
  40767. case SortableIterator::SORT_BY_NAME:
  40768. $command->ins('sort')->add('| sort');
  40769. return;
  40770. case SortableIterator::SORT_BY_TYPE:
  40771. $format = '%HT';
  40772. break;
  40773. case SortableIterator::SORT_BY_ACCESSED_TIME:
  40774. $format = '%a';
  40775. break;
  40776. case SortableIterator::SORT_BY_CHANGED_TIME:
  40777. $format = '%c';
  40778. break;
  40779. case SortableIterator::SORT_BY_MODIFIED_TIME:
  40780. $format = '%m';
  40781. break;
  40782. default:
  40783. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  40784. }
  40785. $command
  40786. ->add('-print0 | xargs -0 stat -f')
  40787. ->arg($format.'%t%N')
  40788. ->add('| sort | cut -f 2');
  40789. }
  40790. protected function buildFindCommand(Command $command, $dir)
  40791. {
  40792. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  40793. return $command;
  40794. }
  40795. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  40796. {
  40797. foreach ($contains as $contain) {
  40798. $expr = Expression::create($contain);
  40799. $command
  40800. ->add('| grep -v \'^$\'')
  40801. ->add('| xargs -I{} grep -I')
  40802. ->add($expr->isCaseSensitive() ? null : '-i')
  40803. ->add($not ? '-L' : '-l')
  40804. ->add('-Ee')->arg($expr->renderPattern())
  40805. ->add('{}')
  40806. ;
  40807. }
  40808. }
  40809. }
  40810. <?php
  40811. namespace Symfony\Component\Finder\Adapter;
  40812. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40813. use Symfony\Component\Finder\Expression\Expression;
  40814. use Symfony\Component\Finder\Iterator\SortableIterator;
  40815. use Symfony\Component\Finder\Shell\Command;
  40816. use Symfony\Component\Finder\Shell\Shell;
  40817. class GnuFindAdapter extends AbstractFindAdapter
  40818. {
  40819. public function getName()
  40820. {
  40821. return 'gnu_find';
  40822. }
  40823. protected function buildFormatSorting(Command $command, $sort)
  40824. {
  40825. switch ($sort) {
  40826. case SortableIterator::SORT_BY_NAME:
  40827. $command->ins('sort')->add('| sort');
  40828. return;
  40829. case SortableIterator::SORT_BY_TYPE:
  40830. $format = '%y';
  40831. break;
  40832. case SortableIterator::SORT_BY_ACCESSED_TIME:
  40833. $format = '%A@';
  40834. break;
  40835. case SortableIterator::SORT_BY_CHANGED_TIME:
  40836. $format = '%C@';
  40837. break;
  40838. case SortableIterator::SORT_BY_MODIFIED_TIME:
  40839. $format = '%T@';
  40840. break;
  40841. default:
  40842. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  40843. }
  40844. $command
  40845. ->get('find')
  40846. ->add('-printf')
  40847. ->arg($format.' %h/%f\\n')
  40848. ->add('| sort | cut')
  40849. ->arg('-d ')
  40850. ->arg('-f2-')
  40851. ;
  40852. }
  40853. protected function canBeUsed()
  40854. {
  40855. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  40856. }
  40857. protected function buildFindCommand(Command $command, $dir)
  40858. {
  40859. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  40860. }
  40861. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  40862. {
  40863. foreach ($contains as $contain) {
  40864. $expr = Expression::create($contain);
  40865. $command
  40866. ->add('| xargs -I{} -r grep -I')
  40867. ->add($expr->isCaseSensitive() ? null : '-i')
  40868. ->add($not ? '-L' : '-l')
  40869. ->add('-Ee')->arg($expr->renderPattern())
  40870. ->add('{}')
  40871. ;
  40872. }
  40873. }
  40874. }
  40875. <?php
  40876. namespace Symfony\Component\Finder\Adapter;
  40877. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  40878. use Symfony\Component\Finder\Iterator;
  40879. class PhpAdapter extends AbstractAdapter
  40880. {
  40881. public function searchInDirectory($dir)
  40882. {
  40883. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  40884. if ($this->followLinks) {
  40885. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  40886. }
  40887. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  40888. if ($this->exclude) {
  40889. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  40890. }
  40891. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  40892. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  40893. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  40894. }
  40895. if ($this->mode) {
  40896. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  40897. }
  40898. if ($this->names || $this->notNames) {
  40899. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  40900. }
  40901. if ($this->contains || $this->notContains) {
  40902. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  40903. }
  40904. if ($this->sizes) {
  40905. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  40906. }
  40907. if ($this->dates) {
  40908. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  40909. }
  40910. if ($this->filters) {
  40911. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  40912. }
  40913. if ($this->paths || $this->notPaths) {
  40914. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  40915. }
  40916. if ($this->sort) {
  40917. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  40918. $iterator = $iteratorAggregate->getIterator();
  40919. }
  40920. return $iterator;
  40921. }
  40922. public function getName()
  40923. {
  40924. return 'php';
  40925. }
  40926. protected function canBeUsed()
  40927. {
  40928. return true;
  40929. }
  40930. }
  40931. <?php
  40932. namespace Symfony\Component\Finder\Comparator;
  40933. class Comparator
  40934. {
  40935. private $target;
  40936. private $operator = '==';
  40937. public function getTarget()
  40938. {
  40939. return $this->target;
  40940. }
  40941. public function setTarget($target)
  40942. {
  40943. $this->target = $target;
  40944. }
  40945. public function getOperator()
  40946. {
  40947. return $this->operator;
  40948. }
  40949. public function setOperator($operator)
  40950. {
  40951. if (!$operator) {
  40952. $operator = '==';
  40953. }
  40954. if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  40955. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  40956. }
  40957. $this->operator = $operator;
  40958. }
  40959. public function test($test)
  40960. {
  40961. switch ($this->operator) {
  40962. case '>':
  40963. return $test > $this->target;
  40964. case '>=':
  40965. return $test >= $this->target;
  40966. case '<':
  40967. return $test < $this->target;
  40968. case '<=':
  40969. return $test <= $this->target;
  40970. case '!=':
  40971. return $test != $this->target;
  40972. }
  40973. return $test == $this->target;
  40974. }
  40975. }
  40976. <?php
  40977. namespace Symfony\Component\Finder\Comparator;
  40978. class DateComparator extends Comparator
  40979. {
  40980. public function __construct($test)
  40981. {
  40982. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  40983. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  40984. }
  40985. try {
  40986. $date = new \DateTime($matches[2]);
  40987. $target = $date->format('U');
  40988. } catch (\Exception $e) {
  40989. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  40990. }
  40991. $operator = isset($matches[1]) ? $matches[1] : '==';
  40992. if ('since' === $operator || 'after' === $operator) {
  40993. $operator = '>';
  40994. }
  40995. if ('until' === $operator || 'before' === $operator) {
  40996. $operator = '<';
  40997. }
  40998. $this->setOperator($operator);
  40999. $this->setTarget($target);
  41000. }
  41001. }
  41002. <?php
  41003. namespace Symfony\Component\Finder\Comparator;
  41004. class NumberComparator extends Comparator
  41005. {
  41006. public function __construct($test)
  41007. {
  41008. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  41009. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  41010. }
  41011. $target = $matches[2];
  41012. if (!is_numeric($target)) {
  41013. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  41014. }
  41015. if (isset($matches[3])) {
  41016. switch (strtolower($matches[3])) {
  41017. case 'k':
  41018. $target *= 1000;
  41019. break;
  41020. case 'ki':
  41021. $target *= 1024;
  41022. break;
  41023. case 'm':
  41024. $target *= 1000000;
  41025. break;
  41026. case 'mi':
  41027. $target *= 1024 * 1024;
  41028. break;
  41029. case 'g':
  41030. $target *= 1000000000;
  41031. break;
  41032. case 'gi':
  41033. $target *= 1024 * 1024 * 1024;
  41034. break;
  41035. }
  41036. }
  41037. $this->setTarget($target);
  41038. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  41039. }
  41040. }
  41041. <?php
  41042. namespace Symfony\Component\Finder\Exception;
  41043. class AccessDeniedException extends \UnexpectedValueException
  41044. {
  41045. }
  41046. <?php
  41047. namespace Symfony\Component\Finder\Exception;
  41048. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41049. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41050. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  41051. {
  41052. private $adapter;
  41053. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  41054. {
  41055. $this->adapter = $adapter;
  41056. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  41057. }
  41058. public function getAdapter()
  41059. {
  41060. return $this->adapter;
  41061. }
  41062. }
  41063. <?php
  41064. namespace Symfony\Component\Finder\Exception;
  41065. interface ExceptionInterface
  41066. {
  41067. public function getAdapter();
  41068. }
  41069. <?php
  41070. namespace Symfony\Component\Finder\Exception;
  41071. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41072. class OperationNotPermitedException extends AdapterFailureException
  41073. {
  41074. }
  41075. <?php
  41076. namespace Symfony\Component\Finder\Exception;
  41077. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41078. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41079. use Symfony\Component\Finder\Shell\Command;
  41080. class ShellCommandFailureException extends AdapterFailureException
  41081. {
  41082. private $command;
  41083. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  41084. {
  41085. $this->command = $command;
  41086. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  41087. }
  41088. public function getCommand()
  41089. {
  41090. return $this->command;
  41091. }
  41092. }
  41093. <?php
  41094. namespace Symfony\Component\Finder\Expression;
  41095. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41096. class Expression implements ValueInterface
  41097. {
  41098. const TYPE_REGEX = 1;
  41099. const TYPE_GLOB = 2;
  41100. private $value;
  41101. public static function create($expr)
  41102. {
  41103. return new self($expr);
  41104. }
  41105. public function __construct($expr)
  41106. {
  41107. try {
  41108. $this->value = Regex::create($expr);
  41109. } catch (\InvalidArgumentException $e) {
  41110. $this->value = new Glob($expr);
  41111. }
  41112. }
  41113. public function __toString()
  41114. {
  41115. return $this->render();
  41116. }
  41117. public function render()
  41118. {
  41119. return $this->value->render();
  41120. }
  41121. public function renderPattern()
  41122. {
  41123. return $this->value->renderPattern();
  41124. }
  41125. public function isCaseSensitive()
  41126. {
  41127. return $this->value->isCaseSensitive();
  41128. }
  41129. public function getType()
  41130. {
  41131. return $this->value->getType();
  41132. }
  41133. public function prepend($expr)
  41134. {
  41135. $this->value->prepend($expr);
  41136. return $this;
  41137. }
  41138. public function append($expr)
  41139. {
  41140. $this->value->append($expr);
  41141. return $this;
  41142. }
  41143. public function isRegex()
  41144. {
  41145. return self::TYPE_REGEX === $this->value->getType();
  41146. }
  41147. public function isGlob()
  41148. {
  41149. return self::TYPE_GLOB === $this->value->getType();
  41150. }
  41151. public function getGlob()
  41152. {
  41153. if (self::TYPE_GLOB !== $this->value->getType()) {
  41154. throw new \LogicException('Regex can\'t be transformed to glob.');
  41155. }
  41156. return $this->value;
  41157. }
  41158. public function getRegex()
  41159. {
  41160. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  41161. }
  41162. }
  41163. <?php
  41164. namespace Symfony\Component\Finder\Expression;
  41165. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41166. use Symfony\Component\Finder\Glob as FinderGlob;
  41167. class Glob implements ValueInterface
  41168. {
  41169. private $pattern;
  41170. public function __construct($pattern)
  41171. {
  41172. $this->pattern = $pattern;
  41173. }
  41174. public function render()
  41175. {
  41176. return $this->pattern;
  41177. }
  41178. public function renderPattern()
  41179. {
  41180. return $this->pattern;
  41181. }
  41182. public function getType()
  41183. {
  41184. return Expression::TYPE_GLOB;
  41185. }
  41186. public function isCaseSensitive()
  41187. {
  41188. return true;
  41189. }
  41190. public function prepend($expr)
  41191. {
  41192. $this->pattern = $expr.$this->pattern;
  41193. return $this;
  41194. }
  41195. public function append($expr)
  41196. {
  41197. $this->pattern .= $expr;
  41198. return $this;
  41199. }
  41200. public function isExpandable()
  41201. {
  41202. return false !== strpos($this->pattern, '{')
  41203. && false !== strpos($this->pattern, '}');
  41204. }
  41205. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  41206. {
  41207. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  41208. return new Regex($regex);
  41209. }
  41210. }
  41211. <?php
  41212. namespace Symfony\Component\Finder\Expression;
  41213. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41214. class Regex implements ValueInterface
  41215. {
  41216. const START_FLAG = '^';
  41217. const END_FLAG = '$';
  41218. const BOUNDARY = '~';
  41219. const JOKER = '.*';
  41220. const ESCAPING = '\\';
  41221. private $pattern;
  41222. private $options;
  41223. private $startFlag;
  41224. private $endFlag;
  41225. private $startJoker;
  41226. private $endJoker;
  41227. public static function create($expr)
  41228. {
  41229. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  41230. $start = substr($m[1], 0, 1);
  41231. $end = substr($m[1], -1);
  41232. if (
  41233. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  41234. || ('{' === $start && '}' === $end)
  41235. || ('(' === $start && ')' === $end)
  41236. ) {
  41237. return new self(substr($m[1], 1, -1), $m[2], $end);
  41238. }
  41239. }
  41240. throw new \InvalidArgumentException('Given expression is not a regex.');
  41241. }
  41242. public function __construct($pattern, $options = '', $delimiter = null)
  41243. {
  41244. if (null !== $delimiter) {
  41245. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  41246. }
  41247. $this->parsePattern($pattern);
  41248. $this->options = $options;
  41249. }
  41250. public function __toString()
  41251. {
  41252. return $this->render();
  41253. }
  41254. public function render()
  41255. {
  41256. return self::BOUNDARY
  41257. .$this->renderPattern()
  41258. .self::BOUNDARY
  41259. .$this->options;
  41260. }
  41261. public function renderPattern()
  41262. {
  41263. return ($this->startFlag ? self::START_FLAG : '')
  41264. .($this->startJoker ? self::JOKER : '')
  41265. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  41266. .($this->endJoker ? self::JOKER : '')
  41267. .($this->endFlag ? self::END_FLAG : '');
  41268. }
  41269. public function isCaseSensitive()
  41270. {
  41271. return !$this->hasOption('i');
  41272. }
  41273. public function getType()
  41274. {
  41275. return Expression::TYPE_REGEX;
  41276. }
  41277. public function prepend($expr)
  41278. {
  41279. $this->pattern = $expr.$this->pattern;
  41280. return $this;
  41281. }
  41282. public function append($expr)
  41283. {
  41284. $this->pattern .= $expr;
  41285. return $this;
  41286. }
  41287. public function hasOption($option)
  41288. {
  41289. return false !== strpos($this->options, $option);
  41290. }
  41291. public function addOption($option)
  41292. {
  41293. if (!$this->hasOption($option)) {
  41294. $this->options .= $option;
  41295. }
  41296. return $this;
  41297. }
  41298. public function removeOption($option)
  41299. {
  41300. $this->options = str_replace($option, '', $this->options);
  41301. return $this;
  41302. }
  41303. public function setStartFlag($startFlag)
  41304. {
  41305. $this->startFlag = $startFlag;
  41306. return $this;
  41307. }
  41308. public function hasStartFlag()
  41309. {
  41310. return $this->startFlag;
  41311. }
  41312. public function setEndFlag($endFlag)
  41313. {
  41314. $this->endFlag = (bool) $endFlag;
  41315. return $this;
  41316. }
  41317. public function hasEndFlag()
  41318. {
  41319. return $this->endFlag;
  41320. }
  41321. public function setStartJoker($startJoker)
  41322. {
  41323. $this->startJoker = $startJoker;
  41324. return $this;
  41325. }
  41326. public function hasStartJoker()
  41327. {
  41328. return $this->startJoker;
  41329. }
  41330. public function setEndJoker($endJoker)
  41331. {
  41332. $this->endJoker = (bool) $endJoker;
  41333. return $this;
  41334. }
  41335. public function hasEndJoker()
  41336. {
  41337. return $this->endJoker;
  41338. }
  41339. public function replaceJokers($replacement)
  41340. {
  41341. $replace = function ($subject) use ($replacement) {
  41342. $subject = $subject[0];
  41343. $replace = 0 === substr_count($subject, '\\') % 2;
  41344. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  41345. };
  41346. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  41347. return $this;
  41348. }
  41349. private function parsePattern($pattern)
  41350. {
  41351. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  41352. $pattern = substr($pattern, 1);
  41353. }
  41354. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  41355. $pattern = substr($pattern, 2);
  41356. }
  41357. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  41358. $pattern = substr($pattern, 0, -1);
  41359. }
  41360. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  41361. $pattern = substr($pattern, 0, -2);
  41362. }
  41363. $this->pattern = $pattern;
  41364. }
  41365. }
  41366. <?php
  41367. namespace Symfony\Component\Finder\Expression;
  41368. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41369. interface ValueInterface
  41370. {
  41371. public function render();
  41372. public function renderPattern();
  41373. public function isCaseSensitive();
  41374. public function getType();
  41375. public function prepend($expr);
  41376. public function append($expr);
  41377. }
  41378. <?php
  41379. namespace Symfony\Component\Finder;
  41380. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41381. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  41382. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  41383. use Symfony\Component\Finder\Adapter\PhpAdapter;
  41384. use Symfony\Component\Finder\Comparator\DateComparator;
  41385. use Symfony\Component\Finder\Comparator\NumberComparator;
  41386. use Symfony\Component\Finder\Exception\ExceptionInterface;
  41387. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  41388. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  41389. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  41390. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  41391. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  41392. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  41393. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  41394. use Symfony\Component\Finder\Iterator\SortableIterator;
  41395. class Finder implements \IteratorAggregate, \Countable
  41396. {
  41397. const IGNORE_VCS_FILES = 1;
  41398. const IGNORE_DOT_FILES = 2;
  41399. private $mode = 0;
  41400. private $names = array();
  41401. private $notNames = array();
  41402. private $exclude = array();
  41403. private $filters = array();
  41404. private $depths = array();
  41405. private $sizes = array();
  41406. private $followLinks = false;
  41407. private $sort = false;
  41408. private $ignore = 0;
  41409. private $dirs = array();
  41410. private $dates = array();
  41411. private $iterators = array();
  41412. private $contains = array();
  41413. private $notContains = array();
  41414. private $adapters = null;
  41415. private $paths = array();
  41416. private $notPaths = array();
  41417. private $ignoreUnreadableDirs = false;
  41418. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  41419. public function __construct()
  41420. {
  41421. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  41422. }
  41423. public static function create()
  41424. {
  41425. return new static();
  41426. }
  41427. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  41428. {
  41429. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41430. $this->initDefaultAdapters();
  41431. $this->adapters[$adapter->getName()] = array(
  41432. 'adapter' => $adapter,
  41433. 'priority' => $priority,
  41434. 'selected' => false,
  41435. );
  41436. return $this->sortAdapters();
  41437. }
  41438. public function useBestAdapter()
  41439. {
  41440. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41441. $this->initDefaultAdapters();
  41442. $this->resetAdapterSelection();
  41443. return $this->sortAdapters();
  41444. }
  41445. public function setAdapter($name)
  41446. {
  41447. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41448. $this->initDefaultAdapters();
  41449. if (!isset($this->adapters[$name])) {
  41450. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  41451. }
  41452. $this->resetAdapterSelection();
  41453. $this->adapters[$name]['selected'] = true;
  41454. return $this->sortAdapters();
  41455. }
  41456. public function removeAdapters()
  41457. {
  41458. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41459. $this->adapters = array();
  41460. return $this;
  41461. }
  41462. public function getAdapters()
  41463. {
  41464. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41465. $this->initDefaultAdapters();
  41466. return array_values(array_map(function (array $adapter) {
  41467. return $adapter['adapter'];
  41468. }, $this->adapters));
  41469. }
  41470. public function directories()
  41471. {
  41472. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  41473. return $this;
  41474. }
  41475. public function files()
  41476. {
  41477. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  41478. return $this;
  41479. }
  41480. public function depth($level)
  41481. {
  41482. $this->depths[] = new Comparator\NumberComparator($level);
  41483. return $this;
  41484. }
  41485. public function date($date)
  41486. {
  41487. $this->dates[] = new Comparator\DateComparator($date);
  41488. return $this;
  41489. }
  41490. public function name($pattern)
  41491. {
  41492. $this->names[] = $pattern;
  41493. return $this;
  41494. }
  41495. public function notName($pattern)
  41496. {
  41497. $this->notNames[] = $pattern;
  41498. return $this;
  41499. }
  41500. public function contains($pattern)
  41501. {
  41502. $this->contains[] = $pattern;
  41503. return $this;
  41504. }
  41505. public function notContains($pattern)
  41506. {
  41507. $this->notContains[] = $pattern;
  41508. return $this;
  41509. }
  41510. public function path($pattern)
  41511. {
  41512. $this->paths[] = $pattern;
  41513. return $this;
  41514. }
  41515. public function notPath($pattern)
  41516. {
  41517. $this->notPaths[] = $pattern;
  41518. return $this;
  41519. }
  41520. public function size($size)
  41521. {
  41522. $this->sizes[] = new Comparator\NumberComparator($size);
  41523. return $this;
  41524. }
  41525. public function exclude($dirs)
  41526. {
  41527. $this->exclude = array_merge($this->exclude, (array) $dirs);
  41528. return $this;
  41529. }
  41530. public function ignoreDotFiles($ignoreDotFiles)
  41531. {
  41532. if ($ignoreDotFiles) {
  41533. $this->ignore |= static::IGNORE_DOT_FILES;
  41534. } else {
  41535. $this->ignore &= ~static::IGNORE_DOT_FILES;
  41536. }
  41537. return $this;
  41538. }
  41539. public function ignoreVCS($ignoreVCS)
  41540. {
  41541. if ($ignoreVCS) {
  41542. $this->ignore |= static::IGNORE_VCS_FILES;
  41543. } else {
  41544. $this->ignore &= ~static::IGNORE_VCS_FILES;
  41545. }
  41546. return $this;
  41547. }
  41548. public static function addVCSPattern($pattern)
  41549. {
  41550. foreach ((array) $pattern as $p) {
  41551. self::$vcsPatterns[] = $p;
  41552. }
  41553. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  41554. }
  41555. public function sort(\Closure $closure)
  41556. {
  41557. $this->sort = $closure;
  41558. return $this;
  41559. }
  41560. public function sortByName()
  41561. {
  41562. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  41563. return $this;
  41564. }
  41565. public function sortByType()
  41566. {
  41567. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  41568. return $this;
  41569. }
  41570. public function sortByAccessedTime()
  41571. {
  41572. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  41573. return $this;
  41574. }
  41575. public function sortByChangedTime()
  41576. {
  41577. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  41578. return $this;
  41579. }
  41580. public function sortByModifiedTime()
  41581. {
  41582. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  41583. return $this;
  41584. }
  41585. public function filter(\Closure $closure)
  41586. {
  41587. $this->filters[] = $closure;
  41588. return $this;
  41589. }
  41590. public function followLinks()
  41591. {
  41592. $this->followLinks = true;
  41593. return $this;
  41594. }
  41595. public function ignoreUnreadableDirs($ignore = true)
  41596. {
  41597. $this->ignoreUnreadableDirs = (bool) $ignore;
  41598. return $this;
  41599. }
  41600. public function in($dirs)
  41601. {
  41602. $resolvedDirs = array();
  41603. foreach ((array) $dirs as $dir) {
  41604. if (is_dir($dir)) {
  41605. $resolvedDirs[] = $this->normalizeDir($dir);
  41606. } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  41607. $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
  41608. } else {
  41609. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  41610. }
  41611. }
  41612. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  41613. return $this;
  41614. }
  41615. public function getIterator()
  41616. {
  41617. if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  41618. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  41619. }
  41620. if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
  41621. return $this->searchInDirectory($this->dirs[0]);
  41622. }
  41623. $iterator = new \AppendIterator();
  41624. foreach ($this->dirs as $dir) {
  41625. $iterator->append($this->searchInDirectory($dir));
  41626. }
  41627. foreach ($this->iterators as $it) {
  41628. $iterator->append($it);
  41629. }
  41630. return $iterator;
  41631. }
  41632. public function append($iterator)
  41633. {
  41634. if ($iterator instanceof \IteratorAggregate) {
  41635. $this->iterators[] = $iterator->getIterator();
  41636. } elseif ($iterator instanceof \Iterator) {
  41637. $this->iterators[] = $iterator;
  41638. } elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
  41639. $it = new \ArrayIterator();
  41640. foreach ($iterator as $file) {
  41641. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  41642. }
  41643. $this->iterators[] = $it;
  41644. } else {
  41645. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  41646. }
  41647. return $this;
  41648. }
  41649. public function count()
  41650. {
  41651. return iterator_count($this->getIterator());
  41652. }
  41653. private function sortAdapters()
  41654. {
  41655. uasort($this->adapters, function (array $a, array $b) {
  41656. if ($a['selected'] || $b['selected']) {
  41657. return $a['selected'] ? -1 : 1;
  41658. }
  41659. return $a['priority'] > $b['priority'] ? -1 : 1;
  41660. });
  41661. return $this;
  41662. }
  41663. private function searchInDirectory($dir)
  41664. {
  41665. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  41666. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  41667. }
  41668. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  41669. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  41670. }
  41671. if ($this->adapters) {
  41672. foreach ($this->adapters as $adapter) {
  41673. if ($adapter['adapter']->isSupported()) {
  41674. try {
  41675. return $this
  41676. ->buildAdapter($adapter['adapter'])
  41677. ->searchInDirectory($dir);
  41678. } catch (ExceptionInterface $e) {
  41679. }
  41680. }
  41681. }
  41682. }
  41683. $minDepth = 0;
  41684. $maxDepth = PHP_INT_MAX;
  41685. foreach ($this->depths as $comparator) {
  41686. switch ($comparator->getOperator()) {
  41687. case '>':
  41688. $minDepth = $comparator->getTarget() + 1;
  41689. break;
  41690. case '>=':
  41691. $minDepth = $comparator->getTarget();
  41692. break;
  41693. case '<':
  41694. $maxDepth = $comparator->getTarget() - 1;
  41695. break;
  41696. case '<=':
  41697. $maxDepth = $comparator->getTarget();
  41698. break;
  41699. default:
  41700. $minDepth = $maxDepth = $comparator->getTarget();
  41701. }
  41702. }
  41703. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  41704. if ($this->followLinks) {
  41705. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  41706. }
  41707. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  41708. if ($this->exclude) {
  41709. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  41710. }
  41711. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  41712. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  41713. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  41714. }
  41715. if ($this->mode) {
  41716. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  41717. }
  41718. if ($this->names || $this->notNames) {
  41719. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  41720. }
  41721. if ($this->contains || $this->notContains) {
  41722. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  41723. }
  41724. if ($this->sizes) {
  41725. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  41726. }
  41727. if ($this->dates) {
  41728. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  41729. }
  41730. if ($this->filters) {
  41731. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  41732. }
  41733. if ($this->paths || $this->notPaths) {
  41734. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  41735. }
  41736. if ($this->sort) {
  41737. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  41738. $iterator = $iteratorAggregate->getIterator();
  41739. }
  41740. return $iterator;
  41741. }
  41742. private function buildAdapter(AdapterInterface $adapter)
  41743. {
  41744. return $adapter
  41745. ->setFollowLinks($this->followLinks)
  41746. ->setDepths($this->depths)
  41747. ->setMode($this->mode)
  41748. ->setExclude($this->exclude)
  41749. ->setNames($this->names)
  41750. ->setNotNames($this->notNames)
  41751. ->setContains($this->contains)
  41752. ->setNotContains($this->notContains)
  41753. ->setSizes($this->sizes)
  41754. ->setDates($this->dates)
  41755. ->setFilters($this->filters)
  41756. ->setSort($this->sort)
  41757. ->setPath($this->paths)
  41758. ->setNotPath($this->notPaths)
  41759. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  41760. }
  41761. private function resetAdapterSelection()
  41762. {
  41763. $this->adapters = array_map(function (array $properties) {
  41764. $properties['selected'] = false;
  41765. return $properties;
  41766. }, $this->adapters);
  41767. }
  41768. private function initDefaultAdapters()
  41769. {
  41770. if (null === $this->adapters) {
  41771. $this->adapters = array();
  41772. $this
  41773. ->addAdapter(new GnuFindAdapter())
  41774. ->addAdapter(new BsdFindAdapter())
  41775. ->addAdapter(new PhpAdapter(), -50)
  41776. ->setAdapter('php')
  41777. ;
  41778. }
  41779. }
  41780. private function normalizeDir($dir)
  41781. {
  41782. return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  41783. }
  41784. }
  41785. <?php
  41786. namespace Symfony\Component\Finder;
  41787. class Glob
  41788. {
  41789. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  41790. {
  41791. $firstByte = true;
  41792. $escaping = false;
  41793. $inCurlies = 0;
  41794. $regex = '';
  41795. $sizeGlob = \strlen($glob);
  41796. for ($i = 0; $i < $sizeGlob; ++$i) {
  41797. $car = $glob[$i];
  41798. if ($firstByte) {
  41799. if ($strictLeadingDot && '.' !== $car) {
  41800. $regex .= '(?=[^\.])';
  41801. }
  41802. $firstByte = false;
  41803. }
  41804. if ('/' === $car) {
  41805. $firstByte = true;
  41806. }
  41807. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  41808. $regex .= "\\$car";
  41809. } elseif ('*' === $car) {
  41810. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  41811. } elseif ('?' === $car) {
  41812. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  41813. } elseif ('{' === $car) {
  41814. $regex .= $escaping ? '\\{' : '(';
  41815. if (!$escaping) {
  41816. ++$inCurlies;
  41817. }
  41818. } elseif ('}' === $car && $inCurlies) {
  41819. $regex .= $escaping ? '}' : ')';
  41820. if (!$escaping) {
  41821. --$inCurlies;
  41822. }
  41823. } elseif (',' === $car && $inCurlies) {
  41824. $regex .= $escaping ? ',' : '|';
  41825. } elseif ('\\' === $car) {
  41826. if ($escaping) {
  41827. $regex .= '\\\\';
  41828. $escaping = false;
  41829. } else {
  41830. $escaping = true;
  41831. }
  41832. continue;
  41833. } else {
  41834. $regex .= $car;
  41835. }
  41836. $escaping = false;
  41837. }
  41838. return $delimiter.'^'.$regex.'$'.$delimiter;
  41839. }
  41840. }
  41841. <?php
  41842. namespace Symfony\Component\Finder\Iterator;
  41843. class CustomFilterIterator extends FilterIterator
  41844. {
  41845. private $filters = array();
  41846. public function __construct(\Iterator $iterator, array $filters)
  41847. {
  41848. foreach ($filters as $filter) {
  41849. if (!\is_callable($filter)) {
  41850. throw new \InvalidArgumentException('Invalid PHP callback.');
  41851. }
  41852. }
  41853. $this->filters = $filters;
  41854. parent::__construct($iterator);
  41855. }
  41856. public function accept()
  41857. {
  41858. $fileinfo = $this->current();
  41859. foreach ($this->filters as $filter) {
  41860. if (false === \call_user_func($filter, $fileinfo)) {
  41861. return false;
  41862. }
  41863. }
  41864. return true;
  41865. }
  41866. }
  41867. <?php
  41868. namespace Symfony\Component\Finder\Iterator;
  41869. use Symfony\Component\Finder\Comparator\DateComparator;
  41870. class DateRangeFilterIterator extends FilterIterator
  41871. {
  41872. private $comparators = array();
  41873. public function __construct(\Iterator $iterator, array $comparators)
  41874. {
  41875. $this->comparators = $comparators;
  41876. parent::__construct($iterator);
  41877. }
  41878. public function accept()
  41879. {
  41880. $fileinfo = $this->current();
  41881. if (!file_exists($fileinfo->getPathname())) {
  41882. return false;
  41883. }
  41884. $filedate = $fileinfo->getMTime();
  41885. foreach ($this->comparators as $compare) {
  41886. if (!$compare->test($filedate)) {
  41887. return false;
  41888. }
  41889. }
  41890. return true;
  41891. }
  41892. }
  41893. <?php
  41894. namespace Symfony\Component\Finder\Iterator;
  41895. class DepthRangeFilterIterator extends FilterIterator
  41896. {
  41897. private $minDepth = 0;
  41898. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  41899. {
  41900. $this->minDepth = $minDepth;
  41901. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  41902. parent::__construct($iterator);
  41903. }
  41904. public function accept()
  41905. {
  41906. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  41907. }
  41908. }
  41909. <?php
  41910. namespace Symfony\Component\Finder\Iterator;
  41911. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  41912. {
  41913. private $iterator;
  41914. private $isRecursive;
  41915. private $excludedDirs = array();
  41916. private $excludedPattern;
  41917. public function __construct(\Iterator $iterator, array $directories)
  41918. {
  41919. $this->iterator = $iterator;
  41920. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  41921. $patterns = array();
  41922. foreach ($directories as $directory) {
  41923. $directory = rtrim($directory, '/');
  41924. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  41925. $patterns[] = preg_quote($directory, '#');
  41926. } else {
  41927. $this->excludedDirs[$directory] = true;
  41928. }
  41929. }
  41930. if ($patterns) {
  41931. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  41932. }
  41933. parent::__construct($iterator);
  41934. }
  41935. public function accept()
  41936. {
  41937. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  41938. return false;
  41939. }
  41940. if ($this->excludedPattern) {
  41941. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  41942. $path = str_replace('\\', '/', $path);
  41943. return !preg_match($this->excludedPattern, $path);
  41944. }
  41945. return true;
  41946. }
  41947. public function hasChildren()
  41948. {
  41949. return $this->isRecursive && $this->iterator->hasChildren();
  41950. }
  41951. public function getChildren()
  41952. {
  41953. $children = new self($this->iterator->getChildren(), array());
  41954. $children->excludedDirs = $this->excludedDirs;
  41955. $children->excludedPattern = $this->excludedPattern;
  41956. return $children;
  41957. }
  41958. }
  41959. <?php
  41960. namespace Symfony\Component\Finder\Iterator;
  41961. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41962. use Symfony\Component\Finder\SplFileInfo;
  41963. class FilePathsIterator extends \ArrayIterator
  41964. {
  41965. private $baseDir;
  41966. private $baseDirLength;
  41967. private $subPath;
  41968. private $subPathname;
  41969. private $current;
  41970. public function __construct(array $paths, $baseDir)
  41971. {
  41972. $this->baseDir = $baseDir;
  41973. $this->baseDirLength = \strlen($baseDir);
  41974. parent::__construct($paths);
  41975. }
  41976. public function __call($name, array $arguments)
  41977. {
  41978. return \call_user_func_array(array($this->current(), $name), $arguments);
  41979. }
  41980. public function current()
  41981. {
  41982. return $this->current;
  41983. }
  41984. public function key()
  41985. {
  41986. return $this->current->getPathname();
  41987. }
  41988. public function next()
  41989. {
  41990. parent::next();
  41991. $this->buildProperties();
  41992. }
  41993. public function rewind()
  41994. {
  41995. parent::rewind();
  41996. $this->buildProperties();
  41997. }
  41998. public function getSubPath()
  41999. {
  42000. return $this->subPath;
  42001. }
  42002. public function getSubPathname()
  42003. {
  42004. return $this->subPathname;
  42005. }
  42006. private function buildProperties()
  42007. {
  42008. $absolutePath = parent::current();
  42009. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  42010. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  42011. $dir = \dirname($this->subPathname);
  42012. $this->subPath = '.' === $dir ? '' : $dir;
  42013. } else {
  42014. $this->subPath = $this->subPathname = '';
  42015. }
  42016. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  42017. }
  42018. }
  42019. <?php
  42020. namespace Symfony\Component\Finder\Iterator;
  42021. class FileTypeFilterIterator extends FilterIterator
  42022. {
  42023. const ONLY_FILES = 1;
  42024. const ONLY_DIRECTORIES = 2;
  42025. private $mode;
  42026. public function __construct(\Iterator $iterator, $mode)
  42027. {
  42028. $this->mode = $mode;
  42029. parent::__construct($iterator);
  42030. }
  42031. public function accept()
  42032. {
  42033. $fileinfo = $this->current();
  42034. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  42035. return false;
  42036. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  42037. return false;
  42038. }
  42039. return true;
  42040. }
  42041. }
  42042. <?php
  42043. namespace Symfony\Component\Finder\Iterator;
  42044. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  42045. {
  42046. public function accept()
  42047. {
  42048. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  42049. return true;
  42050. }
  42051. $fileinfo = $this->current();
  42052. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  42053. return false;
  42054. }
  42055. $content = $fileinfo->getContents();
  42056. if (!$content) {
  42057. return false;
  42058. }
  42059. return $this->isAccepted($content);
  42060. }
  42061. protected function toRegex($str)
  42062. {
  42063. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  42064. }
  42065. }
  42066. <?php
  42067. namespace Symfony\Component\Finder\Iterator;
  42068. use Symfony\Component\Finder\Glob;
  42069. class FilenameFilterIterator extends MultiplePcreFilterIterator
  42070. {
  42071. public function accept()
  42072. {
  42073. return $this->isAccepted($this->current()->getFilename());
  42074. }
  42075. protected function toRegex($str)
  42076. {
  42077. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  42078. }
  42079. }
  42080. <?php
  42081. namespace Symfony\Component\Finder\Iterator;
  42082. abstract class FilterIterator extends \FilterIterator
  42083. {
  42084. public function rewind()
  42085. {
  42086. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  42087. parent::rewind();
  42088. return;
  42089. }
  42090. $iterator = $this;
  42091. while ($iterator instanceof \OuterIterator) {
  42092. $innerIterator = $iterator->getInnerIterator();
  42093. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  42094. if ($innerIterator->isRewindable()) {
  42095. $innerIterator->next();
  42096. $innerIterator->rewind();
  42097. }
  42098. } elseif ($innerIterator instanceof \FilesystemIterator) {
  42099. $innerIterator->next();
  42100. $innerIterator->rewind();
  42101. }
  42102. $iterator = $innerIterator;
  42103. }
  42104. parent::rewind();
  42105. }
  42106. }
  42107. <?php
  42108. namespace Symfony\Component\Finder\Iterator;
  42109. abstract class MultiplePcreFilterIterator extends FilterIterator
  42110. {
  42111. protected $matchRegexps = array();
  42112. protected $noMatchRegexps = array();
  42113. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  42114. {
  42115. foreach ($matchPatterns as $pattern) {
  42116. $this->matchRegexps[] = $this->toRegex($pattern);
  42117. }
  42118. foreach ($noMatchPatterns as $pattern) {
  42119. $this->noMatchRegexps[] = $this->toRegex($pattern);
  42120. }
  42121. parent::__construct($iterator);
  42122. }
  42123. protected function isAccepted($string)
  42124. {
  42125. foreach ($this->noMatchRegexps as $regex) {
  42126. if (preg_match($regex, $string)) {
  42127. return false;
  42128. }
  42129. }
  42130. if ($this->matchRegexps) {
  42131. foreach ($this->matchRegexps as $regex) {
  42132. if (preg_match($regex, $string)) {
  42133. return true;
  42134. }
  42135. }
  42136. return false;
  42137. }
  42138. return true;
  42139. }
  42140. protected function isRegex($str)
  42141. {
  42142. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  42143. $start = substr($m[1], 0, 1);
  42144. $end = substr($m[1], -1);
  42145. if ($start === $end) {
  42146. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  42147. }
  42148. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  42149. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  42150. return true;
  42151. }
  42152. }
  42153. }
  42154. return false;
  42155. }
  42156. abstract protected function toRegex($str);
  42157. }
  42158. <?php
  42159. namespace Symfony\Component\Finder\Iterator;
  42160. class PathFilterIterator extends MultiplePcreFilterIterator
  42161. {
  42162. public function accept()
  42163. {
  42164. $filename = $this->current()->getRelativePathname();
  42165. if ('\\' === \DIRECTORY_SEPARATOR) {
  42166. $filename = str_replace('\\', '/', $filename);
  42167. }
  42168. return $this->isAccepted($filename);
  42169. }
  42170. protected function toRegex($str)
  42171. {
  42172. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  42173. }
  42174. }
  42175. <?php
  42176. namespace Symfony\Component\Finder\Iterator;
  42177. use Symfony\Component\Finder\Exception\AccessDeniedException;
  42178. use Symfony\Component\Finder\SplFileInfo;
  42179. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  42180. {
  42181. private $ignoreUnreadableDirs;
  42182. private $rewindable;
  42183. private $rootPath;
  42184. private $subPath;
  42185. private $directorySeparator = '/';
  42186. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  42187. {
  42188. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  42189. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  42190. }
  42191. parent::__construct($path, $flags);
  42192. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  42193. $this->rootPath = (string) $path;
  42194. if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  42195. $this->directorySeparator = \DIRECTORY_SEPARATOR;
  42196. }
  42197. }
  42198. public function current()
  42199. {
  42200. if (null === $subPathname = $this->subPath) {
  42201. $subPathname = $this->subPath = (string) $this->getSubPath();
  42202. }
  42203. if ('' !== $subPathname) {
  42204. $subPathname .= $this->directorySeparator;
  42205. }
  42206. $subPathname .= $this->getFilename();
  42207. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  42208. }
  42209. public function getChildren()
  42210. {
  42211. try {
  42212. $children = parent::getChildren();
  42213. if ($children instanceof self) {
  42214. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  42215. $children->rewindable = &$this->rewindable;
  42216. $children->rootPath = $this->rootPath;
  42217. }
  42218. return $children;
  42219. } catch (\UnexpectedValueException $e) {
  42220. if ($this->ignoreUnreadableDirs) {
  42221. return new \RecursiveArrayIterator(array());
  42222. } else {
  42223. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  42224. }
  42225. }
  42226. }
  42227. public function rewind()
  42228. {
  42229. if (false === $this->isRewindable()) {
  42230. return;
  42231. }
  42232. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  42233. parent::next();
  42234. }
  42235. parent::rewind();
  42236. }
  42237. public function isRewindable()
  42238. {
  42239. if (null !== $this->rewindable) {
  42240. return $this->rewindable;
  42241. }
  42242. if ('' === $this->getPath()) {
  42243. return $this->rewindable = false;
  42244. }
  42245. if (false !== $stream = @opendir($this->getPath())) {
  42246. $infos = stream_get_meta_data($stream);
  42247. closedir($stream);
  42248. if ($infos['seekable']) {
  42249. return $this->rewindable = true;
  42250. }
  42251. }
  42252. return $this->rewindable = false;
  42253. }
  42254. }
  42255. <?php
  42256. namespace Symfony\Component\Finder\Iterator;
  42257. use Symfony\Component\Finder\Comparator\NumberComparator;
  42258. class SizeRangeFilterIterator extends FilterIterator
  42259. {
  42260. private $comparators = array();
  42261. public function __construct(\Iterator $iterator, array $comparators)
  42262. {
  42263. $this->comparators = $comparators;
  42264. parent::__construct($iterator);
  42265. }
  42266. public function accept()
  42267. {
  42268. $fileinfo = $this->current();
  42269. if (!$fileinfo->isFile()) {
  42270. return true;
  42271. }
  42272. $filesize = $fileinfo->getSize();
  42273. foreach ($this->comparators as $compare) {
  42274. if (!$compare->test($filesize)) {
  42275. return false;
  42276. }
  42277. }
  42278. return true;
  42279. }
  42280. }
  42281. <?php
  42282. namespace Symfony\Component\Finder\Iterator;
  42283. class SortableIterator implements \IteratorAggregate
  42284. {
  42285. const SORT_BY_NAME = 1;
  42286. const SORT_BY_TYPE = 2;
  42287. const SORT_BY_ACCESSED_TIME = 3;
  42288. const SORT_BY_CHANGED_TIME = 4;
  42289. const SORT_BY_MODIFIED_TIME = 5;
  42290. private $iterator;
  42291. private $sort;
  42292. public function __construct(\Traversable $iterator, $sort)
  42293. {
  42294. $this->iterator = $iterator;
  42295. if (self::SORT_BY_NAME === $sort) {
  42296. $this->sort = function ($a, $b) {
  42297. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  42298. };
  42299. } elseif (self::SORT_BY_TYPE === $sort) {
  42300. $this->sort = function ($a, $b) {
  42301. if ($a->isDir() && $b->isFile()) {
  42302. return -1;
  42303. } elseif ($a->isFile() && $b->isDir()) {
  42304. return 1;
  42305. }
  42306. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  42307. };
  42308. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  42309. $this->sort = function ($a, $b) {
  42310. return $a->getATime() - $b->getATime();
  42311. };
  42312. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  42313. $this->sort = function ($a, $b) {
  42314. return $a->getCTime() - $b->getCTime();
  42315. };
  42316. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  42317. $this->sort = function ($a, $b) {
  42318. return $a->getMTime() - $b->getMTime();
  42319. };
  42320. } elseif (\is_callable($sort)) {
  42321. $this->sort = $sort;
  42322. } else {
  42323. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  42324. }
  42325. }
  42326. public function getIterator()
  42327. {
  42328. $array = iterator_to_array($this->iterator, true);
  42329. uasort($array, $this->sort);
  42330. return new \ArrayIterator($array);
  42331. }
  42332. }
  42333. Copyright (c) 2004-2018 Fabien Potencier
  42334. Permission is hereby granted, free of charge, to any person obtaining a copy
  42335. of this software and associated documentation files (the "Software"), to deal
  42336. in the Software without restriction, including without limitation the rights
  42337. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42338. copies of the Software, and to permit persons to whom the Software is furnished
  42339. to do so, subject to the following conditions:
  42340. The above copyright notice and this permission notice shall be included in all
  42341. copies or substantial portions of the Software.
  42342. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42343. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42344. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42345. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42346. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42347. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42348. THE SOFTWARE.
  42349. <?php
  42350. namespace Symfony\Component\Finder\Shell;
  42351. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42352. class Command
  42353. {
  42354. private $parent;
  42355. private $bits = array();
  42356. private $labels = array();
  42357. private $errorHandler;
  42358. public function __construct(Command $parent = null)
  42359. {
  42360. $this->parent = $parent;
  42361. }
  42362. public function __toString()
  42363. {
  42364. return $this->join();
  42365. }
  42366. public static function create(Command $parent = null)
  42367. {
  42368. return new self($parent);
  42369. }
  42370. public static function escape($input)
  42371. {
  42372. return escapeshellcmd($input);
  42373. }
  42374. public static function quote($input)
  42375. {
  42376. return escapeshellarg($input);
  42377. }
  42378. public function add($bit)
  42379. {
  42380. $this->bits[] = $bit;
  42381. return $this;
  42382. }
  42383. public function top($bit)
  42384. {
  42385. array_unshift($this->bits, $bit);
  42386. foreach ($this->labels as $label => $index) {
  42387. ++$this->labels[$label];
  42388. }
  42389. return $this;
  42390. }
  42391. public function arg($arg)
  42392. {
  42393. $this->bits[] = self::quote($arg);
  42394. return $this;
  42395. }
  42396. public function cmd($esc)
  42397. {
  42398. $this->bits[] = self::escape($esc);
  42399. return $this;
  42400. }
  42401. public function ins($label)
  42402. {
  42403. if (isset($this->labels[$label])) {
  42404. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  42405. }
  42406. $this->bits[] = self::create($this);
  42407. $this->labels[$label] = \count($this->bits) - 1;
  42408. return $this->bits[$this->labels[$label]];
  42409. }
  42410. public function get($label)
  42411. {
  42412. if (!isset($this->labels[$label])) {
  42413. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  42414. }
  42415. return $this->bits[$this->labels[$label]];
  42416. }
  42417. public function end()
  42418. {
  42419. if (null === $this->parent) {
  42420. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  42421. }
  42422. return $this->parent;
  42423. }
  42424. public function length()
  42425. {
  42426. return \count($this->bits);
  42427. }
  42428. public function setErrorHandler(\Closure $errorHandler)
  42429. {
  42430. $this->errorHandler = $errorHandler;
  42431. return $this;
  42432. }
  42433. public function getErrorHandler()
  42434. {
  42435. return $this->errorHandler;
  42436. }
  42437. public function execute()
  42438. {
  42439. if (null === $errorHandler = $this->errorHandler) {
  42440. exec($this->join(), $output);
  42441. } else {
  42442. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  42443. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  42444. if ($error = stream_get_contents($pipes[2])) {
  42445. $errorHandler($error);
  42446. }
  42447. proc_close($process);
  42448. }
  42449. return $output ?: array();
  42450. }
  42451. public function join()
  42452. {
  42453. return implode(' ', array_filter(
  42454. array_map(function ($bit) {
  42455. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  42456. }, $this->bits),
  42457. function ($bit) { return null !== $bit; }
  42458. ));
  42459. }
  42460. public function addAtIndex($bit, $index)
  42461. {
  42462. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  42463. return $this;
  42464. }
  42465. }
  42466. <?php
  42467. namespace Symfony\Component\Finder\Shell;
  42468. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42469. class Shell
  42470. {
  42471. const TYPE_UNIX = 1;
  42472. const TYPE_DARWIN = 2;
  42473. const TYPE_CYGWIN = 3;
  42474. const TYPE_WINDOWS = 4;
  42475. const TYPE_BSD = 5;
  42476. private $type;
  42477. public function getType()
  42478. {
  42479. if (null === $this->type) {
  42480. $this->type = $this->guessType();
  42481. }
  42482. return $this->type;
  42483. }
  42484. public function testCommand($command)
  42485. {
  42486. if (!\function_exists('exec')) {
  42487. return false;
  42488. }
  42489. $testCommand = 'which ';
  42490. if (self::TYPE_WINDOWS === $this->type) {
  42491. $testCommand = 'where ';
  42492. }
  42493. $command = escapeshellcmd($command);
  42494. exec($testCommand.$command, $output, $code);
  42495. return 0 === $code && \count($output) > 0;
  42496. }
  42497. private function guessType()
  42498. {
  42499. $os = strtolower(PHP_OS);
  42500. if (false !== strpos($os, 'cygwin')) {
  42501. return self::TYPE_CYGWIN;
  42502. }
  42503. if (false !== strpos($os, 'darwin')) {
  42504. return self::TYPE_DARWIN;
  42505. }
  42506. if (false !== strpos($os, 'bsd')) {
  42507. return self::TYPE_BSD;
  42508. }
  42509. if (0 === strpos($os, 'win')) {
  42510. return self::TYPE_WINDOWS;
  42511. }
  42512. return self::TYPE_UNIX;
  42513. }
  42514. }
  42515. <?php
  42516. namespace Symfony\Component\Finder;
  42517. class SplFileInfo extends \SplFileInfo
  42518. {
  42519. private $relativePath;
  42520. private $relativePathname;
  42521. public function __construct($file, $relativePath, $relativePathname)
  42522. {
  42523. parent::__construct($file);
  42524. $this->relativePath = $relativePath;
  42525. $this->relativePathname = $relativePathname;
  42526. }
  42527. public function getRelativePath()
  42528. {
  42529. return $this->relativePath;
  42530. }
  42531. public function getRelativePathname()
  42532. {
  42533. return $this->relativePathname;
  42534. }
  42535. public function getContents()
  42536. {
  42537. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  42538. $content = file_get_contents($this->getPathname());
  42539. restore_error_handler();
  42540. if (false === $content) {
  42541. throw new \RuntimeException($error);
  42542. }
  42543. return $content;
  42544. }
  42545. }
  42546. <?php
  42547. namespace Symfony\Polyfill\Ctype;
  42548. final class Ctype
  42549. {
  42550. public static function ctype_alnum($text)
  42551. {
  42552. $text = self::convert_int_to_char_for_ctype($text);
  42553. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  42554. }
  42555. public static function ctype_alpha($text)
  42556. {
  42557. $text = self::convert_int_to_char_for_ctype($text);
  42558. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  42559. }
  42560. public static function ctype_cntrl($text)
  42561. {
  42562. $text = self::convert_int_to_char_for_ctype($text);
  42563. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  42564. }
  42565. public static function ctype_digit($text)
  42566. {
  42567. $text = self::convert_int_to_char_for_ctype($text);
  42568. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  42569. }
  42570. public static function ctype_graph($text)
  42571. {
  42572. $text = self::convert_int_to_char_for_ctype($text);
  42573. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  42574. }
  42575. public static function ctype_lower($text)
  42576. {
  42577. $text = self::convert_int_to_char_for_ctype($text);
  42578. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  42579. }
  42580. public static function ctype_print($text)
  42581. {
  42582. $text = self::convert_int_to_char_for_ctype($text);
  42583. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  42584. }
  42585. public static function ctype_punct($text)
  42586. {
  42587. $text = self::convert_int_to_char_for_ctype($text);
  42588. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  42589. }
  42590. public static function ctype_space($text)
  42591. {
  42592. $text = self::convert_int_to_char_for_ctype($text);
  42593. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  42594. }
  42595. public static function ctype_upper($text)
  42596. {
  42597. $text = self::convert_int_to_char_for_ctype($text);
  42598. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  42599. }
  42600. public static function ctype_xdigit($text)
  42601. {
  42602. $text = self::convert_int_to_char_for_ctype($text);
  42603. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  42604. }
  42605. private static function convert_int_to_char_for_ctype($int)
  42606. {
  42607. if (!\is_int($int)) {
  42608. return $int;
  42609. }
  42610. if ($int < -128 || $int > 255) {
  42611. return (string) $int;
  42612. }
  42613. if ($int < 0) {
  42614. $int += 256;
  42615. }
  42616. return \chr($int);
  42617. }
  42618. }
  42619. Copyright (c) 2018 Fabien Potencier
  42620. Permission is hereby granted, free of charge, to any person obtaining a copy
  42621. of this software and associated documentation files (the "Software"), to deal
  42622. in the Software without restriction, including without limitation the rights
  42623. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42624. copies of the Software, and to permit persons to whom the Software is furnished
  42625. to do so, subject to the following conditions:
  42626. The above copyright notice and this permission notice shall be included in all
  42627. copies or substantial portions of the Software.
  42628. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42629. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42630. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42631. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42632. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42633. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42634. THE SOFTWARE.
  42635. <?php
  42636. use Symfony\Polyfill\Ctype as p;
  42637. if (!function_exists('ctype_alnum')) {
  42638. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  42639. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  42640. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  42641. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  42642. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  42643. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  42644. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  42645. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  42646. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  42647. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  42648. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  42649. }
  42650. Copyright (c) 2015-2018 Fabien Potencier
  42651. Permission is hereby granted, free of charge, to any person obtaining a copy
  42652. of this software and associated documentation files (the "Software"), to deal
  42653. in the Software without restriction, including without limitation the rights
  42654. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42655. copies of the Software, and to permit persons to whom the Software is furnished
  42656. to do so, subject to the following conditions:
  42657. The above copyright notice and this permission notice shall be included in all
  42658. copies or substantial portions of the Software.
  42659. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42660. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42661. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42662. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42663. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42664. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42665. THE SOFTWARE.
  42666. <?php
  42667. namespace Symfony\Polyfill\Mbstring;
  42668. final class Mbstring
  42669. {
  42670. const MB_CASE_FOLD = PHP_INT_MAX;
  42671. private static $encodingList = array('ASCII', 'UTF-8');
  42672. private static $language = 'neutral';
  42673. private static $internalEncoding = 'UTF-8';
  42674. private static $caseFold = array(
  42675. array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
  42676. array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'),
  42677. );
  42678. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  42679. {
  42680. if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  42681. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  42682. } else {
  42683. $fromEncoding = self::getEncoding($fromEncoding);
  42684. }
  42685. $toEncoding = self::getEncoding($toEncoding);
  42686. if ('BASE64' === $fromEncoding) {
  42687. $s = base64_decode($s);
  42688. $fromEncoding = $toEncoding;
  42689. }
  42690. if ('BASE64' === $toEncoding) {
  42691. return base64_encode($s);
  42692. }
  42693. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  42694. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  42695. $fromEncoding = 'Windows-1252';
  42696. }
  42697. if ('UTF-8' !== $fromEncoding) {
  42698. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  42699. }
  42700. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  42701. }
  42702. if ('HTML-ENTITIES' === $fromEncoding) {
  42703. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  42704. $fromEncoding = 'UTF-8';
  42705. }
  42706. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  42707. }
  42708. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  42709. {
  42710. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  42711. $ok = true;
  42712. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  42713. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  42714. $ok = false;
  42715. }
  42716. });
  42717. return $ok ? $fromEncoding : false;
  42718. }
  42719. public static function mb_decode_mimeheader($s)
  42720. {
  42721. return iconv_mime_decode($s, 2, self::$internalEncoding);
  42722. }
  42723. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  42724. {
  42725. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  42726. }
  42727. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  42728. {
  42729. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  42730. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  42731. return null;
  42732. }
  42733. if (!\is_array($convmap) || !$convmap) {
  42734. return false;
  42735. }
  42736. if (null !== $encoding && !\is_scalar($encoding)) {
  42737. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  42738. return '';
  42739. }
  42740. $s = (string) $s;
  42741. if ('' === $s) {
  42742. return '';
  42743. }
  42744. $encoding = self::getEncoding($encoding);
  42745. if ('UTF-8' === $encoding) {
  42746. $encoding = null;
  42747. if (!preg_match('//u', $s)) {
  42748. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  42749. }
  42750. } else {
  42751. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42752. }
  42753. $cnt = floor(\count($convmap) / 4) * 4;
  42754. for ($i = 0; $i < $cnt; $i += 4) {
  42755. $convmap[$i] += $convmap[$i + 2];
  42756. $convmap[$i + 1] += $convmap[$i + 2];
  42757. }
  42758. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  42759. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  42760. for ($i = 0; $i < $cnt; $i += 4) {
  42761. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  42762. return Mbstring::mb_chr($c - $convmap[$i + 2]);
  42763. }
  42764. }
  42765. return $m[0];
  42766. }, $s);
  42767. if (null === $encoding) {
  42768. return $s;
  42769. }
  42770. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  42771. }
  42772. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  42773. {
  42774. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  42775. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  42776. return null;
  42777. }
  42778. if (!\is_array($convmap) || !$convmap) {
  42779. return false;
  42780. }
  42781. if (null !== $encoding && !\is_scalar($encoding)) {
  42782. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  42783. return null;
  42784. }
  42785. if (null !== $is_hex && !\is_scalar($is_hex)) {
  42786. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);
  42787. return null;
  42788. }
  42789. $s = (string) $s;
  42790. if ('' === $s) {
  42791. return '';
  42792. }
  42793. $encoding = self::getEncoding($encoding);
  42794. if ('UTF-8' === $encoding) {
  42795. $encoding = null;
  42796. if (!preg_match('//u', $s)) {
  42797. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  42798. }
  42799. } else {
  42800. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42801. }
  42802. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  42803. $cnt = floor(\count($convmap) / 4) * 4;
  42804. $i = 0;
  42805. $len = \strlen($s);
  42806. $result = '';
  42807. while ($i < $len) {
  42808. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  42809. $uchr = substr($s, $i, $ulen);
  42810. $i += $ulen;
  42811. $c = self::mb_ord($uchr);
  42812. for ($j = 0; $j < $cnt; $j += 4) {
  42813. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  42814. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  42815. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  42816. continue 2;
  42817. }
  42818. }
  42819. $result .= $uchr;
  42820. }
  42821. if (null === $encoding) {
  42822. return $result;
  42823. }
  42824. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  42825. }
  42826. public static function mb_convert_case($s, $mode, $encoding = null)
  42827. {
  42828. $s = (string) $s;
  42829. if ('' === $s) {
  42830. return '';
  42831. }
  42832. $encoding = self::getEncoding($encoding);
  42833. if ('UTF-8' === $encoding) {
  42834. $encoding = null;
  42835. if (!preg_match('//u', $s)) {
  42836. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  42837. }
  42838. } else {
  42839. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42840. }
  42841. if (MB_CASE_TITLE == $mode) {
  42842. static $titleRegexp = null;
  42843. if (null === $titleRegexp) {
  42844. $titleRegexp = self::getData('titleCaseRegexp');
  42845. }
  42846. $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
  42847. } else {
  42848. if (MB_CASE_UPPER == $mode) {
  42849. static $upper = null;
  42850. if (null === $upper) {
  42851. $upper = self::getData('upperCase');
  42852. }
  42853. $map = $upper;
  42854. } else {
  42855. if (self::MB_CASE_FOLD === $mode) {
  42856. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  42857. }
  42858. static $lower = null;
  42859. if (null === $lower) {
  42860. $lower = self::getData('lowerCase');
  42861. }
  42862. $map = $lower;
  42863. }
  42864. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  42865. $i = 0;
  42866. $len = \strlen($s);
  42867. while ($i < $len) {
  42868. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  42869. $uchr = substr($s, $i, $ulen);
  42870. $i += $ulen;
  42871. if (isset($map[$uchr])) {
  42872. $uchr = $map[$uchr];
  42873. $nlen = \strlen($uchr);
  42874. if ($nlen == $ulen) {
  42875. $nlen = $i;
  42876. do {
  42877. $s[--$nlen] = $uchr[--$ulen];
  42878. } while ($ulen);
  42879. } else {
  42880. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  42881. $len += $nlen - $ulen;
  42882. $i += $nlen - $ulen;
  42883. }
  42884. }
  42885. }
  42886. }
  42887. if (null === $encoding) {
  42888. return $s;
  42889. }
  42890. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  42891. }
  42892. public static function mb_internal_encoding($encoding = null)
  42893. {
  42894. if (null === $encoding) {
  42895. return self::$internalEncoding;
  42896. }
  42897. $encoding = self::getEncoding($encoding);
  42898. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  42899. self::$internalEncoding = $encoding;
  42900. return true;
  42901. }
  42902. return false;
  42903. }
  42904. public static function mb_language($lang = null)
  42905. {
  42906. if (null === $lang) {
  42907. return self::$language;
  42908. }
  42909. switch ($lang = strtolower($lang)) {
  42910. case 'uni':
  42911. case 'neutral':
  42912. self::$language = $lang;
  42913. return true;
  42914. }
  42915. return false;
  42916. }
  42917. public static function mb_list_encodings()
  42918. {
  42919. return array('UTF-8');
  42920. }
  42921. public static function mb_encoding_aliases($encoding)
  42922. {
  42923. switch (strtoupper($encoding)) {
  42924. case 'UTF8':
  42925. case 'UTF-8':
  42926. return array('utf8');
  42927. }
  42928. return false;
  42929. }
  42930. public static function mb_check_encoding($var = null, $encoding = null)
  42931. {
  42932. if (null === $encoding) {
  42933. if (null === $var) {
  42934. return false;
  42935. }
  42936. $encoding = self::$internalEncoding;
  42937. }
  42938. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  42939. }
  42940. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  42941. {
  42942. if (null === $encodingList) {
  42943. $encodingList = self::$encodingList;
  42944. } else {
  42945. if (!\is_array($encodingList)) {
  42946. $encodingList = array_map('trim', explode(',', $encodingList));
  42947. }
  42948. $encodingList = array_map('strtoupper', $encodingList);
  42949. }
  42950. foreach ($encodingList as $enc) {
  42951. switch ($enc) {
  42952. case 'ASCII':
  42953. if (!preg_match('/[\x80-\xFF]/', $str)) {
  42954. return $enc;
  42955. }
  42956. break;
  42957. case 'UTF8':
  42958. case 'UTF-8':
  42959. if (preg_match('//u', $str)) {
  42960. return 'UTF-8';
  42961. }
  42962. break;
  42963. default:
  42964. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  42965. return $enc;
  42966. }
  42967. }
  42968. }
  42969. return false;
  42970. }
  42971. public static function mb_detect_order($encodingList = null)
  42972. {
  42973. if (null === $encodingList) {
  42974. return self::$encodingList;
  42975. }
  42976. if (!\is_array($encodingList)) {
  42977. $encodingList = array_map('trim', explode(',', $encodingList));
  42978. }
  42979. $encodingList = array_map('strtoupper', $encodingList);
  42980. foreach ($encodingList as $enc) {
  42981. switch ($enc) {
  42982. default:
  42983. if (strncmp($enc, 'ISO-8859-', 9)) {
  42984. return false;
  42985. }
  42986. case 'ASCII':
  42987. case 'UTF8':
  42988. case 'UTF-8':
  42989. }
  42990. }
  42991. self::$encodingList = $encodingList;
  42992. return true;
  42993. }
  42994. public static function mb_strlen($s, $encoding = null)
  42995. {
  42996. $encoding = self::getEncoding($encoding);
  42997. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42998. return \strlen($s);
  42999. }
  43000. return @iconv_strlen($s, $encoding);
  43001. }
  43002. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  43003. {
  43004. $encoding = self::getEncoding($encoding);
  43005. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43006. return strpos($haystack, $needle, $offset);
  43007. }
  43008. $needle = (string) $needle;
  43009. if ('' === $needle) {
  43010. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  43011. return false;
  43012. }
  43013. return iconv_strpos($haystack, $needle, $offset, $encoding);
  43014. }
  43015. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  43016. {
  43017. $encoding = self::getEncoding($encoding);
  43018. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43019. return strrpos($haystack, $needle, $offset);
  43020. }
  43021. if ($offset != (int) $offset) {
  43022. $offset = 0;
  43023. } elseif ($offset = (int) $offset) {
  43024. if ($offset < 0) {
  43025. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  43026. $offset = 0;
  43027. } else {
  43028. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  43029. }
  43030. }
  43031. $pos = iconv_strrpos($haystack, $needle, $encoding);
  43032. return false !== $pos ? $offset + $pos : false;
  43033. }
  43034. public static function mb_strtolower($s, $encoding = null)
  43035. {
  43036. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  43037. }
  43038. public static function mb_strtoupper($s, $encoding = null)
  43039. {
  43040. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  43041. }
  43042. public static function mb_substitute_character($c = null)
  43043. {
  43044. if (0 === strcasecmp($c, 'none')) {
  43045. return true;
  43046. }
  43047. return null !== $c ? false : 'none';
  43048. }
  43049. public static function mb_substr($s, $start, $length = null, $encoding = null)
  43050. {
  43051. $encoding = self::getEncoding($encoding);
  43052. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43053. return substr($s, $start, null === $length ? 2147483647 : $length);
  43054. }
  43055. if ($start < 0) {
  43056. $start = iconv_strlen($s, $encoding) + $start;
  43057. if ($start < 0) {
  43058. $start = 0;
  43059. }
  43060. }
  43061. if (null === $length) {
  43062. $length = 2147483647;
  43063. } elseif ($length < 0) {
  43064. $length = iconv_strlen($s, $encoding) + $length - $start;
  43065. if ($length < 0) {
  43066. return '';
  43067. }
  43068. }
  43069. return (string) iconv_substr($s, $start, $length, $encoding);
  43070. }
  43071. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  43072. {
  43073. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  43074. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  43075. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  43076. }
  43077. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  43078. {
  43079. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  43080. return self::getSubpart($pos, $part, $haystack, $encoding);
  43081. }
  43082. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  43083. {
  43084. $encoding = self::getEncoding($encoding);
  43085. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43086. return strrchr($haystack, $needle, $part);
  43087. }
  43088. $needle = self::mb_substr($needle, 0, 1, $encoding);
  43089. $pos = iconv_strrpos($haystack, $needle, $encoding);
  43090. return self::getSubpart($pos, $part, $haystack, $encoding);
  43091. }
  43092. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  43093. {
  43094. $needle = self::mb_substr($needle, 0, 1, $encoding);
  43095. $pos = self::mb_strripos($haystack, $needle, $encoding);
  43096. return self::getSubpart($pos, $part, $haystack, $encoding);
  43097. }
  43098. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  43099. {
  43100. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  43101. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  43102. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  43103. }
  43104. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  43105. {
  43106. $pos = strpos($haystack, $needle);
  43107. if (false === $pos) {
  43108. return false;
  43109. }
  43110. if ($part) {
  43111. return substr($haystack, 0, $pos);
  43112. }
  43113. return substr($haystack, $pos);
  43114. }
  43115. public static function mb_get_info($type = 'all')
  43116. {
  43117. $info = array(
  43118. 'internal_encoding' => self::$internalEncoding,
  43119. 'http_output' => 'pass',
  43120. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  43121. 'func_overload' => 0,
  43122. 'func_overload_list' => 'no overload',
  43123. 'mail_charset' => 'UTF-8',
  43124. 'mail_header_encoding' => 'BASE64',
  43125. 'mail_body_encoding' => 'BASE64',
  43126. 'illegal_chars' => 0,
  43127. 'encoding_translation' => 'Off',
  43128. 'language' => self::$language,
  43129. 'detect_order' => self::$encodingList,
  43130. 'substitute_character' => 'none',
  43131. 'strict_detection' => 'Off',
  43132. );
  43133. if ('all' === $type) {
  43134. return $info;
  43135. }
  43136. if (isset($info[$type])) {
  43137. return $info[$type];
  43138. }
  43139. return false;
  43140. }
  43141. public static function mb_http_input($type = '')
  43142. {
  43143. return false;
  43144. }
  43145. public static function mb_http_output($encoding = null)
  43146. {
  43147. return null !== $encoding ? 'pass' === $encoding : 'pass';
  43148. }
  43149. public static function mb_strwidth($s, $encoding = null)
  43150. {
  43151. $encoding = self::getEncoding($encoding);
  43152. if ('UTF-8' !== $encoding) {
  43153. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43154. }
  43155. $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
  43156. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  43157. }
  43158. public static function mb_substr_count($haystack, $needle, $encoding = null)
  43159. {
  43160. return substr_count($haystack, $needle);
  43161. }
  43162. public static function mb_output_handler($contents, $status)
  43163. {
  43164. return $contents;
  43165. }
  43166. public static function mb_chr($code, $encoding = null)
  43167. {
  43168. if (0x80 > $code %= 0x200000) {
  43169. $s = \chr($code);
  43170. } elseif (0x800 > $code) {
  43171. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  43172. } elseif (0x10000 > $code) {
  43173. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  43174. } else {
  43175. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  43176. }
  43177. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  43178. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  43179. }
  43180. return $s;
  43181. }
  43182. public static function mb_ord($s, $encoding = null)
  43183. {
  43184. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  43185. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  43186. }
  43187. if (1 === \strlen($s)) {
  43188. return \ord($s);
  43189. }
  43190. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  43191. if (0xF0 <= $code) {
  43192. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  43193. }
  43194. if (0xE0 <= $code) {
  43195. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  43196. }
  43197. if (0xC0 <= $code) {
  43198. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  43199. }
  43200. return $code;
  43201. }
  43202. private static function getSubpart($pos, $part, $haystack, $encoding)
  43203. {
  43204. if (false === $pos) {
  43205. return false;
  43206. }
  43207. if ($part) {
  43208. return self::mb_substr($haystack, 0, $pos, $encoding);
  43209. }
  43210. return self::mb_substr($haystack, $pos, null, $encoding);
  43211. }
  43212. private static function html_encoding_callback(array $m)
  43213. {
  43214. $i = 1;
  43215. $entities = '';
  43216. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  43217. while (isset($m[$i])) {
  43218. if (0x80 > $m[$i]) {
  43219. $entities .= \chr($m[$i++]);
  43220. continue;
  43221. }
  43222. if (0xF0 <= $m[$i]) {
  43223. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  43224. } elseif (0xE0 <= $m[$i]) {
  43225. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  43226. } else {
  43227. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  43228. }
  43229. $entities .= '&#'.$c.';';
  43230. }
  43231. return $entities;
  43232. }
  43233. private static function title_case(array $s)
  43234. {
  43235. return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
  43236. }
  43237. private static function getData($file)
  43238. {
  43239. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  43240. return require $file;
  43241. }
  43242. return false;
  43243. }
  43244. private static function getEncoding($encoding)
  43245. {
  43246. if (null === $encoding) {
  43247. return self::$internalEncoding;
  43248. }
  43249. $encoding = strtoupper($encoding);
  43250. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  43251. return 'CP850';
  43252. }
  43253. if ('UTF8' === $encoding) {
  43254. return 'UTF-8';
  43255. }
  43256. return $encoding;
  43257. }
  43258. }
  43259. <?php
  43260. return array(
  43261. 'A' => 'a',
  43262. 'B' => 'b',
  43263. 'C' => 'c',
  43264. 'D' => 'd',
  43265. 'E' => 'e',
  43266. 'F' => 'f',
  43267. 'G' => 'g',
  43268. 'H' => 'h',
  43269. 'I' => 'i',
  43270. 'J' => 'j',
  43271. 'K' => 'k',
  43272. 'L' => 'l',
  43273. 'M' => 'm',
  43274. 'N' => 'n',
  43275. 'O' => 'o',
  43276. 'P' => 'p',
  43277. 'Q' => 'q',
  43278. 'R' => 'r',
  43279. 'S' => 's',
  43280. 'T' => 't',
  43281. 'U' => 'u',
  43282. 'V' => 'v',
  43283. 'W' => 'w',
  43284. 'X' => 'x',
  43285. 'Y' => 'y',
  43286. 'Z' => 'z',
  43287. 'À' => 'à',
  43288. '�' => 'á',
  43289. 'Â' => 'â',
  43290. 'Ã' => 'ã',
  43291. 'Ä' => 'ä',
  43292. 'Ã…' => 'Ã¥',
  43293. 'Æ' => 'æ',
  43294. 'Ç' => 'ç',
  43295. 'È' => 'è',
  43296. 'É' => 'é',
  43297. 'Ê' => 'ê',
  43298. 'Ë' => 'ë',
  43299. 'Ì' => 'ì',
  43300. '�' => 'í',
  43301. 'Î' => 'î',
  43302. '�' => 'ï',
  43303. '�' => 'ð',
  43304. 'Ñ' => 'ñ',
  43305. 'Ò' => 'ò',
  43306. 'Ó' => 'ó',
  43307. 'Ô' => 'ô',
  43308. 'Õ' => 'õ',
  43309. 'Ö' => 'ö',
  43310. 'Ø' => 'ø',
  43311. 'Ù' => 'ù',
  43312. 'Ú' => 'ú',
  43313. 'Û' => 'û',
  43314. 'Ü' => 'ü',
  43315. '�' => 'ý',
  43316. 'Þ' => 'þ',
  43317. 'Ā' => '�',
  43318. 'Ă' => 'ă',
  43319. 'Ä„' => 'Ä…',
  43320. 'Ć' => 'ć',
  43321. 'Ĉ' => 'ĉ',
  43322. 'ÄŠ' => 'Ä‹',
  43323. 'Č' => '�',
  43324. 'Ď' => '�',
  43325. '�' => 'đ',
  43326. 'Ä’' => 'Ä“',
  43327. 'Ä”' => 'Ä•',
  43328. 'Ä–' => 'Ä—',
  43329. 'Ę' => 'ę',
  43330. 'Äš' => 'Ä›',
  43331. 'Ĝ' => '�',
  43332. 'Äž' => 'ÄŸ',
  43333. 'Ä ' => 'Ä¡',
  43334. 'Ä¢' => 'Ä£',
  43335. 'Ĥ' => 'ĥ',
  43336. 'Ħ' => 'ħ',
  43337. 'Ĩ' => 'ĩ',
  43338. 'Ī' => 'ī',
  43339. 'Ĭ' => 'ĭ',
  43340. 'Į' => 'į',
  43341. 'İ' => 'i',
  43342. 'IJ' => 'ij',
  43343. 'Ĵ' => 'ĵ',
  43344. 'Ķ' => 'ķ',
  43345. 'Ĺ' => 'ĺ',
  43346. 'Ļ' => 'ļ',
  43347. 'Ľ' => 'ľ',
  43348. 'Ä¿' => 'Å€',
  43349. '�' => 'ł',
  43350. 'Ń' => 'ń',
  43351. 'Ņ' => 'ņ',
  43352. 'Ň' => 'ň',
  43353. 'ÅŠ' => 'Å‹',
  43354. 'Ō' => '�',
  43355. 'Ŏ' => '�',
  43356. '�' => 'ő',
  43357. 'Å’' => 'Å“',
  43358. 'Å”' => 'Å•',
  43359. 'Å–' => 'Å—',
  43360. 'Ř' => 'ř',
  43361. 'Åš' => 'Å›',
  43362. 'Ŝ' => '�',
  43363. 'Åž' => 'ÅŸ',
  43364. 'Å ' => 'Å¡',
  43365. 'Å¢' => 'Å£',
  43366. 'Ť' => 'ť',
  43367. 'Ŧ' => 'ŧ',
  43368. 'Ũ' => 'ũ',
  43369. 'Ū' => 'ū',
  43370. 'Ŭ' => 'ŭ',
  43371. 'Ů' => 'ů',
  43372. 'Ű' => 'ű',
  43373. 'Ų' => 'ų',
  43374. 'Ŵ' => 'ŵ',
  43375. 'Ŷ' => 'ŷ',
  43376. 'Ÿ' => 'ÿ',
  43377. 'Ź' => 'ź',
  43378. 'Ż' => 'ż',
  43379. 'Ž' => 'ž',
  43380. '�' => 'ɓ',
  43381. 'Ƃ' => 'ƃ',
  43382. 'Æ„' => 'Æ…',
  43383. 'Ɔ' => 'ɔ',
  43384. 'Ƈ' => 'ƈ',
  43385. 'Ɖ' => 'ɖ',
  43386. 'ÆŠ' => 'É—',
  43387. 'Ƌ' => 'ƌ',
  43388. 'Ǝ' => '�',
  43389. '�' => 'ə',
  43390. '�' => 'ɛ',
  43391. 'Æ‘' => 'Æ’',
  43392. 'Æ“' => 'É ',
  43393. 'Æ”' => 'É£',
  43394. 'Æ–' => 'É©',
  43395. 'Ɨ' => 'ɨ',
  43396. 'Ƙ' => 'ƙ',
  43397. 'Ɯ' => 'ɯ',
  43398. '�' => 'ɲ',
  43399. 'Ɵ' => 'ɵ',
  43400. 'Æ ' => 'Æ¡',
  43401. 'Æ¢' => 'Æ£',
  43402. 'Ƥ' => 'ƥ',
  43403. 'Ʀ' => 'ʀ',
  43404. 'Ƨ' => 'ƨ',
  43405. 'Ʃ' => 'ʃ',
  43406. 'Ƭ' => 'ƭ',
  43407. 'Ʈ' => 'ʈ',
  43408. 'Ư' => 'ư',
  43409. 'Ʊ' => 'ʊ',
  43410. 'Ʋ' => 'ʋ',
  43411. 'Ƴ' => 'ƴ',
  43412. 'Ƶ' => 'ƶ',
  43413. 'Æ·' => 'Ê’',
  43414. 'Ƹ' => 'ƹ',
  43415. 'Ƽ' => 'ƽ',
  43416. 'DŽ' => 'dž',
  43417. 'Dž' => 'dž',
  43418. 'LJ' => 'lj',
  43419. 'Lj' => 'lj',
  43420. 'NJ' => 'nj',
  43421. 'Nj' => 'nj',
  43422. '�' => 'ǎ',
  43423. '�' => '�',
  43424. 'Ç‘' => 'Ç’',
  43425. 'Ç“' => 'Ç”',
  43426. 'Ç•' => 'Ç–',
  43427. 'Ǘ' => 'ǘ',
  43428. 'Ç™' => 'Çš',
  43429. 'Ǜ' => 'ǜ',
  43430. 'Çž' => 'ÇŸ',
  43431. 'Ç ' => 'Ç¡',
  43432. 'Ç¢' => 'Ç£',
  43433. 'Ǥ' => 'ǥ',
  43434. 'Ǧ' => 'ǧ',
  43435. 'Ǩ' => 'ǩ',
  43436. 'Ǫ' => 'ǫ',
  43437. 'Ǭ' => 'ǭ',
  43438. 'Ǯ' => 'ǯ',
  43439. 'DZ' => 'dz',
  43440. 'Dz' => 'dz',
  43441. 'Ǵ' => 'ǵ',
  43442. 'Ƕ' => 'ƕ',
  43443. 'Ç·' => 'Æ¿',
  43444. 'Ǹ' => 'ǹ',
  43445. 'Ǻ' => 'ǻ',
  43446. 'Ǽ' => 'ǽ',
  43447. 'Ǿ' => 'ǿ',
  43448. 'Ȁ' => '�',
  43449. 'Ȃ' => 'ȃ',
  43450. 'È„' => 'È…',
  43451. 'Ȇ' => 'ȇ',
  43452. 'Ȉ' => 'ȉ',
  43453. 'ÈŠ' => 'È‹',
  43454. 'Ȍ' => '�',
  43455. 'Ȏ' => '�',
  43456. '�' => 'ȑ',
  43457. 'È’' => 'È“',
  43458. 'È”' => 'È•',
  43459. 'È–' => 'È—',
  43460. 'Ș' => 'ș',
  43461. 'Èš' => 'È›',
  43462. 'Ȝ' => '�',
  43463. 'Èž' => 'ÈŸ',
  43464. 'È ' => 'Æž',
  43465. 'È¢' => 'È£',
  43466. 'Ȥ' => 'ȥ',
  43467. 'Ȧ' => 'ȧ',
  43468. 'Ȩ' => 'ȩ',
  43469. 'Ȫ' => 'ȫ',
  43470. 'Ȭ' => 'ȭ',
  43471. 'Ȯ' => 'ȯ',
  43472. 'Ȱ' => 'ȱ',
  43473. 'Ȳ' => 'ȳ',
  43474. 'Ⱥ' => 'ⱥ',
  43475. 'Ȼ' => 'ȼ',
  43476. 'Ƚ' => 'ƚ',
  43477. 'Ⱦ' => 'ⱦ',
  43478. '�' => 'ɂ',
  43479. 'Ƀ' => 'ƀ',
  43480. 'Ʉ' => 'ʉ',
  43481. 'Ʌ' => 'ʌ',
  43482. 'Ɇ' => 'ɇ',
  43483. 'Ɉ' => 'ɉ',
  43484. 'ÉŠ' => 'É‹',
  43485. 'Ɍ' => '�',
  43486. 'Ɏ' => '�',
  43487. 'Ͱ' => 'ͱ',
  43488. 'Ͳ' => 'ͳ',
  43489. 'Ͷ' => 'ͷ',
  43490. 'Ϳ' => 'ϳ',
  43491. 'Ά' => 'ά',
  43492. 'Έ' => 'έ',
  43493. 'Ή' => 'ή',
  43494. 'Ί' => 'ί',
  43495. 'Ό' => 'ό',
  43496. 'Ύ' => '�',
  43497. '�' => 'ώ',
  43498. 'Α' => 'α',
  43499. 'Β' => 'β',
  43500. 'Γ' => 'γ',
  43501. 'Δ' => 'δ',
  43502. 'Ε' => 'ε',
  43503. 'Ζ' => 'ζ',
  43504. 'Η' => 'η',
  43505. 'Θ' => 'θ',
  43506. 'Ι' => 'ι',
  43507. 'Κ' => 'κ',
  43508. 'Λ' => 'λ',
  43509. 'Μ' => 'μ',
  43510. '�' => 'ν',
  43511. 'Ξ' => 'ξ',
  43512. 'Ο' => 'ο',
  43513. 'Π' => 'π',
  43514. 'Ρ' => '�',
  43515. 'Σ' => 'σ',
  43516. 'Τ' => 'τ',
  43517. 'Î¥' => 'Ï…',
  43518. 'Φ' => 'φ',
  43519. 'Χ' => 'χ',
  43520. 'Ψ' => 'ψ',
  43521. 'Ω' => 'ω',
  43522. 'Ϊ' => 'ϊ',
  43523. 'Ϋ' => 'ϋ',
  43524. '�' => 'ϗ',
  43525. 'Ϙ' => 'ϙ',
  43526. 'Ïš' => 'Ï›',
  43527. 'Ϝ' => '�',
  43528. 'Ïž' => 'ÏŸ',
  43529. 'Ï ' => 'Ï¡',
  43530. 'Ï¢' => 'Ï£',
  43531. 'Ϥ' => 'ϥ',
  43532. 'Ϧ' => 'ϧ',
  43533. 'Ϩ' => 'ϩ',
  43534. 'Ϫ' => 'ϫ',
  43535. 'Ϭ' => 'ϭ',
  43536. 'Ϯ' => 'ϯ',
  43537. 'ϴ' => 'θ',
  43538. 'Ϸ' => 'ϸ',
  43539. 'Ϲ' => 'ϲ',
  43540. 'Ϻ' => 'ϻ',
  43541. 'Ͻ' => 'ͻ',
  43542. 'Ͼ' => 'ͼ',
  43543. 'Ͽ' => 'ͽ',
  43544. 'Ѐ' => '�',
  43545. '�' => 'ё',
  43546. 'Ђ' => 'ђ',
  43547. 'Ѓ' => 'ѓ',
  43548. 'Є' => 'є',
  43549. 'Ð…' => 'Ñ•',
  43550. 'І' => 'і',
  43551. 'Ї' => 'ї',
  43552. 'Ј' => 'ј',
  43553. 'Љ' => 'љ',
  43554. 'Њ' => 'њ',
  43555. 'Ћ' => 'ћ',
  43556. 'Ќ' => 'ќ',
  43557. '�' => '�',
  43558. 'ÐŽ' => 'Ñž',
  43559. '�' => 'џ',
  43560. '�' => 'а',
  43561. 'Б' => 'б',
  43562. 'В' => 'в',
  43563. 'Г' => 'г',
  43564. 'Д' => 'д',
  43565. 'Е' => 'е',
  43566. 'Ж' => 'ж',
  43567. 'З' => 'з',
  43568. 'И' => 'и',
  43569. 'Й' => 'й',
  43570. 'К' => 'к',
  43571. 'Л' => 'л',
  43572. 'М' => 'м',
  43573. '�' => 'н',
  43574. 'О' => 'о',
  43575. 'П' => 'п',
  43576. 'Р' => 'р',
  43577. 'С' => '�',
  43578. 'Т' => 'т',
  43579. 'У' => 'у',
  43580. 'Ф' => 'ф',
  43581. 'Ð¥' => 'Ñ…',
  43582. 'Ц' => 'ц',
  43583. 'Ч' => 'ч',
  43584. 'Ш' => 'ш',
  43585. 'Щ' => 'щ',
  43586. 'Ъ' => 'ъ',
  43587. 'Ы' => 'ы',
  43588. 'Ь' => 'ь',
  43589. 'Э' => '�',
  43590. 'Ю' => 'ю',
  43591. 'Я' => '�',
  43592. 'Ñ ' => 'Ñ¡',
  43593. 'Ñ¢' => 'Ñ£',
  43594. 'Ѥ' => 'ѥ',
  43595. 'Ѧ' => 'ѧ',
  43596. 'Ѩ' => 'ѩ',
  43597. 'Ѫ' => 'ѫ',
  43598. 'Ѭ' => 'ѭ',
  43599. 'Ѯ' => 'ѯ',
  43600. 'Ѱ' => 'ѱ',
  43601. 'Ѳ' => 'ѳ',
  43602. 'Ѵ' => 'ѵ',
  43603. 'Ѷ' => 'ѷ',
  43604. 'Ѹ' => 'ѹ',
  43605. 'Ѻ' => 'ѻ',
  43606. 'Ѽ' => 'ѽ',
  43607. 'Ѿ' => 'ѿ',
  43608. 'Ò€' => 'Ò�',
  43609. 'ÒŠ' => 'Ò‹',
  43610. 'Ҍ' => '�',
  43611. 'ÒŽ' => 'Ò�',
  43612. 'Ò�' => 'Ò‘',
  43613. 'Ò’' => 'Ò“',
  43614. 'Ò”' => 'Ò•',
  43615. 'Ò–' => 'Ò—',
  43616. 'Ò˜' => 'Ò™',
  43617. 'Òš' => 'Ò›',
  43618. 'Ҝ' => '�',
  43619. 'Òž' => 'ÒŸ',
  43620. 'Ò ' => 'Ò¡',
  43621. 'Ò¢' => 'Ò£',
  43622. 'Ò¤' => 'Ò¥',
  43623. 'Ò¦' => 'Ò§',
  43624. 'Ò¨' => 'Ò©',
  43625. 'Òª' => 'Ò«',
  43626. 'Ò¬' => 'Ò­',
  43627. 'Ò®' => 'Ò¯',
  43628. 'Ò°' => 'Ò±',
  43629. 'Ò²' => 'Ò³',
  43630. 'Ò´' => 'Òµ',
  43631. 'Ò¶' => 'Ò·',
  43632. 'Ò¸' => 'Ò¹',
  43633. 'Òº' => 'Ò»',
  43634. 'Ò¼' => 'Ò½',
  43635. 'Ò¾' => 'Ò¿',
  43636. 'Ó€' => 'Ó�',
  43637. 'Ó�' => 'Ó‚',
  43638. 'Óƒ' => 'Ó„',
  43639. 'Ó…' => 'Ó†',
  43640. 'Ó‡' => 'Óˆ',
  43641. 'Ó‰' => 'ÓŠ',
  43642. 'Ӌ' => 'ӌ',
  43643. 'Ó�' => 'ÓŽ',
  43644. 'Ó�' => 'Ó‘',
  43645. 'Ó’' => 'Ó“',
  43646. 'Ó”' => 'Ó•',
  43647. 'Ó–' => 'Ó—',
  43648. 'Ó˜' => 'Ó™',
  43649. 'Óš' => 'Ó›',
  43650. 'Ӝ' => '�',
  43651. 'Óž' => 'ÓŸ',
  43652. 'Ó ' => 'Ó¡',
  43653. 'Ó¢' => 'Ó£',
  43654. 'Ó¤' => 'Ó¥',
  43655. 'Ó¦' => 'Ó§',
  43656. 'Ó¨' => 'Ó©',
  43657. 'Óª' => 'Ó«',
  43658. 'Ó¬' => 'Ó­',
  43659. 'Ó®' => 'Ó¯',
  43660. 'Ó°' => 'Ó±',
  43661. 'Ó²' => 'Ó³',
  43662. 'Ó´' => 'Óµ',
  43663. 'Ó¶' => 'Ó·',
  43664. 'Ó¸' => 'Ó¹',
  43665. 'Óº' => 'Ó»',
  43666. 'Ó¼' => 'Ó½',
  43667. 'Ó¾' => 'Ó¿',
  43668. 'Ô€' => 'Ô�',
  43669. 'Ô‚' => 'Ôƒ',
  43670. 'Ô„' => 'Ô…',
  43671. 'Ô†' => 'Ô‡',
  43672. 'Ôˆ' => 'Ô‰',
  43673. 'ÔŠ' => 'Ô‹',
  43674. 'Ԍ' => '�',
  43675. 'ÔŽ' => 'Ô�',
  43676. 'Ô�' => 'Ô‘',
  43677. 'Ô’' => 'Ô“',
  43678. 'Ô”' => 'Ô•',
  43679. 'Ô–' => 'Ô—',
  43680. 'Ô˜' => 'Ô™',
  43681. 'Ôš' => 'Ô›',
  43682. 'Ԝ' => '�',
  43683. 'Ôž' => 'ÔŸ',
  43684. 'Ô ' => 'Ô¡',
  43685. 'Ô¢' => 'Ô£',
  43686. 'Ô¤' => 'Ô¥',
  43687. 'Ô¦' => 'Ô§',
  43688. 'Ô¨' => 'Ô©',
  43689. 'Ôª' => 'Ô«',
  43690. 'Ô¬' => 'Ô­',
  43691. 'Ô®' => 'Ô¯',
  43692. 'Ô±' => 'Õ¡',
  43693. 'Ô²' => 'Õ¢',
  43694. 'Ô³' => 'Õ£',
  43695. 'Ô´' => 'Õ¤',
  43696. 'Ôµ' => 'Õ¥',
  43697. 'Ô¶' => 'Õ¦',
  43698. 'Ô·' => 'Õ§',
  43699. 'Ô¸' => 'Õ¨',
  43700. 'Ô¹' => 'Õ©',
  43701. 'Ôº' => 'Õª',
  43702. 'Ô»' => 'Õ«',
  43703. 'Ô¼' => 'Õ¬',
  43704. 'Ô½' => 'Õ­',
  43705. 'Ô¾' => 'Õ®',
  43706. 'Ô¿' => 'Õ¯',
  43707. 'Õ€' => 'Õ°',
  43708. 'Õ�' => 'Õ±',
  43709. 'Õ‚' => 'Õ²',
  43710. 'Õƒ' => 'Õ³',
  43711. 'Õ„' => 'Õ´',
  43712. 'Õ…' => 'Õµ',
  43713. 'Õ†' => 'Õ¶',
  43714. 'Õ‡' => 'Õ·',
  43715. 'Õˆ' => 'Õ¸',
  43716. 'Õ‰' => 'Õ¹',
  43717. 'ÕŠ' => 'Õº',
  43718. 'Õ‹' => 'Õ»',
  43719. 'Ռ' => 'ռ',
  43720. 'Õ�' => 'Õ½',
  43721. 'ÕŽ' => 'Õ¾',
  43722. 'Õ�' => 'Õ¿',
  43723. 'Õ�' => 'Ö€',
  43724. 'Õ‘' => 'Ö�',
  43725. 'Õ’' => 'Ö‚',
  43726. 'Õ“' => 'Öƒ',
  43727. 'Õ”' => 'Ö„',
  43728. 'Õ•' => 'Ö…',
  43729. 'Õ–' => 'Ö†',
  43730. 'á‚ ' => 'â´€',
  43731. 'á‚¡' => 'â´�',
  43732. 'á‚¢' => 'â´‚',
  43733. 'á‚£' => 'â´ƒ',
  43734. 'Ⴄ' => 'ⴄ',
  43735. 'á‚¥' => 'â´…',
  43736. 'Ⴆ' => 'ⴆ',
  43737. 'á‚§' => 'â´‡',
  43738. 'Ⴈ' => 'ⴈ',
  43739. 'á‚©' => 'â´‰',
  43740. 'Ⴊ' => 'ⴊ',
  43741. 'á‚«' => 'â´‹',
  43742. 'Ⴌ' => 'ⴌ',
  43743. 'á‚­' => 'â´�',
  43744. 'á‚®' => 'â´Ž',
  43745. 'Ⴏ' => '�',
  43746. 'á‚°' => 'â´�',
  43747. 'Ⴑ' => 'ⴑ',
  43748. 'Ⴒ' => 'ⴒ',
  43749. 'Ⴓ' => 'ⴓ',
  43750. 'á‚´' => 'â´”',
  43751. 'Ⴕ' => 'ⴕ',
  43752. 'á‚¶' => 'â´–',
  43753. 'á‚·' => 'â´—',
  43754. 'Ⴘ' => 'ⴘ',
  43755. 'Ⴙ' => 'ⴙ',
  43756. 'Ⴚ' => 'ⴚ',
  43757. 'á‚»' => 'â´›',
  43758. 'Ⴜ' => 'ⴜ',
  43759. 'Ⴝ' => '�',
  43760. 'Ⴞ' => 'ⴞ',
  43761. 'á‚¿' => 'â´Ÿ',
  43762. 'Ⴠ' => 'ⴠ',
  43763. '�' => 'ⴡ',
  43764. 'Ⴢ' => 'ⴢ',
  43765. 'Ⴣ' => 'ⴣ',
  43766. 'Ⴤ' => 'ⴤ',
  43767. 'Ⴥ' => 'ⴥ',
  43768. 'Ⴧ' => 'ⴧ',
  43769. '�' => 'ⴭ',
  43770. 'Ḁ' => '�',
  43771. 'Ḃ' => 'ḃ',
  43772. 'Ḅ' => 'ḅ',
  43773. 'Ḇ' => 'ḇ',
  43774. 'Ḉ' => 'ḉ',
  43775. 'Ḋ' => 'ḋ',
  43776. 'Ḍ' => '�',
  43777. 'Ḏ' => '�',
  43778. '�' => 'ḑ',
  43779. 'Ḓ' => 'ḓ',
  43780. 'Ḕ' => 'ḕ',
  43781. 'Ḗ' => 'ḗ',
  43782. 'Ḙ' => 'ḙ',
  43783. 'Ḛ' => 'ḛ',
  43784. 'Ḝ' => '�',
  43785. 'Ḟ' => 'ḟ',
  43786. 'Ḡ' => 'ḡ',
  43787. 'Ḣ' => 'ḣ',
  43788. 'Ḥ' => 'ḥ',
  43789. 'Ḧ' => 'ḧ',
  43790. 'Ḩ' => 'ḩ',
  43791. 'Ḫ' => 'ḫ',
  43792. 'Ḭ' => 'ḭ',
  43793. 'Ḯ' => 'ḯ',
  43794. 'Ḱ' => 'ḱ',
  43795. 'Ḳ' => 'ḳ',
  43796. 'Ḵ' => 'ḵ',
  43797. 'Ḷ' => 'ḷ',
  43798. 'Ḹ' => 'ḹ',
  43799. 'Ḻ' => 'ḻ',
  43800. 'Ḽ' => 'ḽ',
  43801. 'Ḿ' => 'ḿ',
  43802. 'Ṁ' => '�',
  43803. 'Ṃ' => 'ṃ',
  43804. 'Ṅ' => 'ṅ',
  43805. 'Ṇ' => 'ṇ',
  43806. 'Ṉ' => 'ṉ',
  43807. 'Ṋ' => 'ṋ',
  43808. 'Ṍ' => '�',
  43809. 'Ṏ' => '�',
  43810. '�' => 'ṑ',
  43811. 'Ṓ' => 'ṓ',
  43812. 'Ṕ' => 'ṕ',
  43813. 'á¹–' => 'á¹—',
  43814. 'Ṙ' => 'ṙ',
  43815. 'Ṛ' => 'ṛ',
  43816. 'Ṝ' => '�',
  43817. 'Ṟ' => 'ṟ',
  43818. 'Ṡ' => 'ṡ',
  43819. 'á¹¢' => 'á¹£',
  43820. 'Ṥ' => 'ṥ',
  43821. 'Ṧ' => 'ṧ',
  43822. 'Ṩ' => 'ṩ',
  43823. 'Ṫ' => 'ṫ',
  43824. 'Ṭ' => 'ṭ',
  43825. 'Ṯ' => 'ṯ',
  43826. 'á¹°' => 'á¹±',
  43827. 'á¹²' => 'á¹³',
  43828. 'á¹´' => 'á¹µ',
  43829. 'á¹¶' => 'á¹·',
  43830. 'Ṹ' => 'ṹ',
  43831. 'Ṻ' => 'ṻ',
  43832. 'á¹¼' => 'á¹½',
  43833. 'Ṿ' => 'ṿ',
  43834. 'Ẁ' => '�',
  43835. 'Ẃ' => 'ẃ',
  43836. 'Ẅ' => 'ẅ',
  43837. 'Ẇ' => 'ẇ',
  43838. 'Ẉ' => 'ẉ',
  43839. 'Ẋ' => 'ẋ',
  43840. 'Ẍ' => '�',
  43841. 'Ẏ' => '�',
  43842. '�' => 'ẑ',
  43843. 'Ẓ' => 'ẓ',
  43844. 'Ẕ' => 'ẕ',
  43845. 'ẞ' => 'ß',
  43846. 'Ạ' => 'ạ',
  43847. 'Ả' => 'ả',
  43848. 'Ấ' => 'ấ',
  43849. 'Ầ' => 'ầ',
  43850. 'Ẩ' => 'ẩ',
  43851. 'Ẫ' => 'ẫ',
  43852. 'Ậ' => 'ậ',
  43853. 'Ắ' => 'ắ',
  43854. 'Ằ' => 'ằ',
  43855. 'Ẳ' => 'ẳ',
  43856. 'Ẵ' => 'ẵ',
  43857. 'Ặ' => 'ặ',
  43858. 'Ẹ' => 'ẹ',
  43859. 'Ẻ' => 'ẻ',
  43860. 'Ẽ' => 'ẽ',
  43861. 'Ế' => 'ế',
  43862. 'Ề' => '�',
  43863. 'Ể' => 'ể',
  43864. 'Ễ' => 'ễ',
  43865. 'Ệ' => 'ệ',
  43866. 'Ỉ' => 'ỉ',
  43867. 'Ị' => 'ị',
  43868. 'Ọ' => '�',
  43869. 'Ỏ' => '�',
  43870. '�' => 'ố',
  43871. 'Ồ' => 'ồ',
  43872. 'Ổ' => 'ổ',
  43873. 'á»–' => 'á»—',
  43874. 'Ộ' => 'ộ',
  43875. 'Ớ' => 'ớ',
  43876. 'Ờ' => '�',
  43877. 'Ở' => 'ở',
  43878. 'Ỡ' => 'ỡ',
  43879. 'Ợ' => 'ợ',
  43880. 'Ụ' => 'ụ',
  43881. 'Ủ' => 'ủ',
  43882. 'Ứ' => 'ứ',
  43883. 'Ừ' => 'ừ',
  43884. 'Ử' => 'ử',
  43885. 'Ữ' => 'ữ',
  43886. 'á»°' => 'á»±',
  43887. 'Ỳ' => 'ỳ',
  43888. 'Ỵ' => 'ỵ',
  43889. 'á»¶' => 'á»·',
  43890. 'Ỹ' => 'ỹ',
  43891. 'Ỻ' => 'ỻ',
  43892. 'Ỽ' => 'ỽ',
  43893. 'Ỿ' => 'ỿ',
  43894. 'Ἀ' => 'ἀ',
  43895. 'Ἁ' => '�',
  43896. 'Ἂ' => 'ἂ',
  43897. 'Ἃ' => 'ἃ',
  43898. 'Ἄ' => 'ἄ',
  43899. '�' => 'ἅ',
  43900. 'Ἆ' => 'ἆ',
  43901. '�' => 'ἇ',
  43902. 'Ἐ' => '�',
  43903. 'Ἑ' => 'ἑ',
  43904. 'Ἒ' => 'ἒ',
  43905. 'Ἓ' => 'ἓ',
  43906. 'Ἔ' => 'ἔ',
  43907. '�' => 'ἕ',
  43908. 'Ἠ' => 'ἠ',
  43909. 'Ἡ' => 'ἡ',
  43910. 'Ἢ' => 'ἢ',
  43911. 'Ἣ' => 'ἣ',
  43912. 'Ἤ' => 'ἤ',
  43913. 'á¼­' => 'á¼¥',
  43914. 'Ἦ' => 'ἦ',
  43915. 'Ἧ' => 'ἧ',
  43916. 'Ἰ' => 'ἰ',
  43917. 'á¼¹' => 'á¼±',
  43918. 'Ἲ' => 'ἲ',
  43919. 'á¼»' => 'á¼³',
  43920. 'á¼¼' => 'á¼´',
  43921. 'á¼½' => 'á¼µ',
  43922. 'á¼¾' => 'á¼¶',
  43923. 'Ἷ' => 'ἷ',
  43924. 'Ὀ' => 'ὀ',
  43925. 'Ὁ' => '�',
  43926. 'Ὂ' => 'ὂ',
  43927. 'Ὃ' => 'ὃ',
  43928. 'Ὄ' => 'ὄ',
  43929. '�' => 'ὅ',
  43930. 'Ὑ' => 'ὑ',
  43931. 'Ὓ' => 'ὓ',
  43932. '�' => 'ὕ',
  43933. 'Ὗ' => 'ὗ',
  43934. 'Ὠ' => 'ὠ',
  43935. 'Ὡ' => 'ὡ',
  43936. 'Ὢ' => 'ὢ',
  43937. 'Ὣ' => 'ὣ',
  43938. 'Ὤ' => 'ὤ',
  43939. 'á½­' => 'á½¥',
  43940. 'Ὦ' => 'ὦ',
  43941. 'Ὧ' => 'ὧ',
  43942. 'ᾈ' => 'ᾀ',
  43943. 'ᾉ' => '�',
  43944. 'ᾊ' => 'ᾂ',
  43945. 'ᾋ' => 'ᾃ',
  43946. 'ᾌ' => 'ᾄ',
  43947. '�' => 'ᾅ',
  43948. 'ᾎ' => 'ᾆ',
  43949. '�' => 'ᾇ',
  43950. 'ᾘ' => '�',
  43951. 'ᾙ' => 'ᾑ',
  43952. 'ᾚ' => 'ᾒ',
  43953. 'ᾛ' => 'ᾓ',
  43954. 'ᾜ' => 'ᾔ',
  43955. '�' => 'ᾕ',
  43956. 'ᾞ' => 'ᾖ',
  43957. 'ᾟ' => 'ᾗ',
  43958. 'ᾨ' => 'ᾠ',
  43959. 'ᾩ' => 'ᾡ',
  43960. 'ᾪ' => 'ᾢ',
  43961. 'ᾫ' => 'ᾣ',
  43962. 'ᾬ' => 'ᾤ',
  43963. 'á¾­' => 'á¾¥',
  43964. 'ᾮ' => 'ᾦ',
  43965. 'ᾯ' => 'ᾧ',
  43966. 'Ᾰ' => 'ᾰ',
  43967. 'á¾¹' => 'á¾±',
  43968. 'Ὰ' => 'ὰ',
  43969. 'á¾»' => 'á½±',
  43970. 'á¾¼' => 'á¾³',
  43971. 'Ὲ' => 'ὲ',
  43972. 'Έ' => 'έ',
  43973. 'Ὴ' => 'ὴ',
  43974. 'á¿‹' => 'á½µ',
  43975. 'ῌ' => 'ῃ',
  43976. 'Ῐ' => '�',
  43977. 'á¿™' => 'á¿‘',
  43978. 'Ὶ' => 'ὶ',
  43979. 'á¿›' => 'á½·',
  43980. 'Ῠ' => 'ῠ',
  43981. 'á¿©' => 'á¿¡',
  43982. 'Ὺ' => 'ὺ',
  43983. 'á¿«' => 'á½»',
  43984. 'Ῥ' => 'ῥ',
  43985. 'Ὸ' => 'ὸ',
  43986. 'Ό' => 'ό',
  43987. 'Ὼ' => 'ὼ',
  43988. 'á¿»' => 'á½½',
  43989. 'ῼ' => 'ῳ',
  43990. 'Ω' => 'ω',
  43991. 'K' => 'k',
  43992. 'â„«' => 'Ã¥',
  43993. 'Ⅎ' => 'ⅎ',
  43994. 'â… ' => 'â…°',
  43995. 'â…¡' => 'â…±',
  43996. 'â…¢' => 'â…²',
  43997. 'â…£' => 'â…³',
  43998. 'â…¤' => 'â…´',
  43999. 'â…¥' => 'â…µ',
  44000. 'â…¦' => 'â…¶',
  44001. 'â…§' => 'â…·',
  44002. 'â…¨' => 'â…¸',
  44003. 'â…©' => 'â…¹',
  44004. 'â…ª' => 'â…º',
  44005. 'â…«' => 'â…»',
  44006. 'â…¬' => 'â…¼',
  44007. 'â…­' => 'â…½',
  44008. 'â…®' => 'â…¾',
  44009. 'â…¯' => 'â…¿',
  44010. 'Ↄ' => 'ↄ',
  44011. 'Ⓐ' => '�',
  44012. 'â’·' => 'â“‘',
  44013. 'â’¸' => 'â“’',
  44014. 'â’¹' => 'â““',
  44015. 'â’º' => 'â“”',
  44016. 'â’»' => 'â“•',
  44017. 'â’¼' => 'â“–',
  44018. 'â’½' => 'â“—',
  44019. 'Ⓘ' => 'ⓘ',
  44020. 'â’¿' => 'â“™',
  44021. 'Ⓚ' => 'ⓚ',
  44022. '�' => 'ⓛ',
  44023. 'Ⓜ' => 'ⓜ',
  44024. 'Ⓝ' => '�',
  44025. 'Ⓞ' => 'ⓞ',
  44026. 'Ⓟ' => 'ⓟ',
  44027. 'Ⓠ' => 'ⓠ',
  44028. 'Ⓡ' => 'ⓡ',
  44029. 'Ⓢ' => 'ⓢ',
  44030. 'Ⓣ' => 'ⓣ',
  44031. 'Ⓤ' => 'ⓤ',
  44032. 'â“‹' => 'â“¥',
  44033. 'Ⓦ' => 'ⓦ',
  44034. '�' => 'ⓧ',
  44035. 'Ⓨ' => 'ⓨ',
  44036. '�' => 'ⓩ',
  44037. 'â°€' => 'â°°',
  44038. 'â°�' => 'â°±',
  44039. 'â°‚' => 'â°²',
  44040. 'â°ƒ' => 'â°³',
  44041. 'â°„' => 'â°´',
  44042. 'â°…' => 'â°µ',
  44043. 'â°†' => 'â°¶',
  44044. 'â°‡' => 'â°·',
  44045. 'â°ˆ' => 'â°¸',
  44046. 'â°‰' => 'â°¹',
  44047. 'â°Š' => 'â°º',
  44048. 'â°‹' => 'â°»',
  44049. 'Ⰼ' => 'ⰼ',
  44050. 'â°�' => 'â°½',
  44051. 'â°Ž' => 'â°¾',
  44052. 'â°�' => 'â°¿',
  44053. 'â°�' => 'â±€',
  44054. 'Ⱁ' => '�',
  44055. 'Ⱂ' => 'ⱂ',
  44056. 'Ⱃ' => 'ⱃ',
  44057. 'Ⱄ' => 'ⱄ',
  44058. 'â°•' => 'â±…',
  44059. 'Ⱆ' => 'ⱆ',
  44060. 'Ⱇ' => 'ⱇ',
  44061. 'Ⱈ' => 'ⱈ',
  44062. 'Ⱉ' => 'ⱉ',
  44063. 'Ⱊ' => 'ⱊ',
  44064. 'Ⱋ' => 'ⱋ',
  44065. 'Ⱌ' => 'ⱌ',
  44066. '�' => '�',
  44067. 'Ⱎ' => 'ⱎ',
  44068. 'Ⱏ' => '�',
  44069. 'Ⱐ' => '�',
  44070. 'Ⱑ' => 'ⱑ',
  44071. 'â°¢' => 'â±’',
  44072. 'Ⱓ' => 'ⱓ',
  44073. 'â°¤' => 'â±”',
  44074. 'Ⱕ' => 'ⱕ',
  44075. 'â°¦' => 'â±–',
  44076. 'â°§' => 'â±—',
  44077. 'Ⱘ' => 'ⱘ',
  44078. 'â°©' => 'â±™',
  44079. 'Ⱚ' => 'ⱚ',
  44080. 'â°«' => 'â±›',
  44081. 'Ⱜ' => 'ⱜ',
  44082. 'Ⱝ' => '�',
  44083. 'Ⱞ' => 'ⱞ',
  44084. 'Ⱡ' => 'ⱡ',
  44085. 'â±¢' => 'É«',
  44086. 'â±£' => 'áµ½',
  44087. 'Ɽ' => 'ɽ',
  44088. 'Ⱨ' => 'ⱨ',
  44089. 'Ⱪ' => 'ⱪ',
  44090. 'Ⱬ' => 'ⱬ',
  44091. 'â±­' => 'É‘',
  44092. 'Ɱ' => 'ɱ',
  44093. 'Ɐ' => '�',
  44094. 'â±°' => 'É’',
  44095. 'â±²' => 'â±³',
  44096. 'â±µ' => 'â±¶',
  44097. 'â±¾' => 'È¿',
  44098. 'Ɀ' => 'ɀ',
  44099. 'Ⲁ' => '�',
  44100. 'Ⲃ' => 'ⲃ',
  44101. 'Ⲅ' => 'ⲅ',
  44102. 'Ⲇ' => 'ⲇ',
  44103. 'Ⲉ' => 'ⲉ',
  44104. 'Ⲋ' => 'ⲋ',
  44105. 'Ⲍ' => '�',
  44106. 'Ⲏ' => '�',
  44107. '�' => 'ⲑ',
  44108. 'Ⲓ' => 'ⲓ',
  44109. 'Ⲕ' => 'ⲕ',
  44110. 'â²–' => 'â²—',
  44111. 'Ⲙ' => 'ⲙ',
  44112. 'Ⲛ' => 'ⲛ',
  44113. 'Ⲝ' => '�',
  44114. 'Ⲟ' => 'ⲟ',
  44115. 'Ⲡ' => 'ⲡ',
  44116. 'â²¢' => 'â²£',
  44117. 'Ⲥ' => 'ⲥ',
  44118. 'Ⲧ' => 'ⲧ',
  44119. 'Ⲩ' => 'ⲩ',
  44120. 'Ⲫ' => 'ⲫ',
  44121. 'Ⲭ' => 'ⲭ',
  44122. 'Ⲯ' => 'ⲯ',
  44123. 'â²°' => 'â²±',
  44124. 'â²²' => 'â²³',
  44125. 'â²´' => 'â²µ',
  44126. 'â²¶' => 'â²·',
  44127. 'Ⲹ' => 'ⲹ',
  44128. 'Ⲻ' => 'ⲻ',
  44129. 'â²¼' => 'â²½',
  44130. 'Ⲿ' => 'ⲿ',
  44131. 'Ⳁ' => '�',
  44132. 'Ⳃ' => 'ⳃ',
  44133. 'Ⳅ' => 'ⳅ',
  44134. 'Ⳇ' => 'ⳇ',
  44135. 'Ⳉ' => 'ⳉ',
  44136. 'Ⳋ' => 'ⳋ',
  44137. 'Ⳍ' => '�',
  44138. 'Ⳏ' => '�',
  44139. '�' => 'ⳑ',
  44140. 'Ⳓ' => 'ⳓ',
  44141. 'Ⳕ' => 'ⳕ',
  44142. 'â³–' => 'â³—',
  44143. 'Ⳙ' => 'ⳙ',
  44144. 'Ⳛ' => 'ⳛ',
  44145. 'Ⳝ' => '�',
  44146. 'Ⳟ' => 'ⳟ',
  44147. 'Ⳡ' => 'ⳡ',
  44148. 'â³¢' => 'â³£',
  44149. 'Ⳬ' => 'ⳬ',
  44150. 'â³­' => 'â³®',
  44151. 'â³²' => 'â³³',
  44152. 'Ꙁ' => '�',
  44153. 'Ꙃ' => 'ꙃ',
  44154. 'Ꙅ' => 'ꙅ',
  44155. 'Ꙇ' => 'ꙇ',
  44156. 'Ꙉ' => 'ꙉ',
  44157. 'Ꙋ' => 'ꙋ',
  44158. 'Ꙍ' => '�',
  44159. 'Ꙏ' => '�',
  44160. '�' => 'ꙑ',
  44161. 'Ꙓ' => 'ꙓ',
  44162. 'Ꙕ' => 'ꙕ',
  44163. 'ê™–' => 'ê™—',
  44164. 'Ꙙ' => 'ꙙ',
  44165. 'Ꙛ' => 'ꙛ',
  44166. 'Ꙝ' => '�',
  44167. 'Ꙟ' => 'ꙟ',
  44168. 'Ꙡ' => 'ꙡ',
  44169. 'Ꙣ' => 'ꙣ',
  44170. 'Ꙥ' => 'ꙥ',
  44171. 'Ꙧ' => 'ꙧ',
  44172. 'Ꙩ' => 'ꙩ',
  44173. 'Ꙫ' => 'ꙫ',
  44174. 'Ꙭ' => 'ꙭ',
  44175. 'Ꚁ' => '�',
  44176. 'Ꚃ' => 'ꚃ',
  44177. 'êš„' => 'êš…',
  44178. 'Ꚇ' => 'ꚇ',
  44179. 'Ꚉ' => 'ꚉ',
  44180. 'Ꚋ' => 'ꚋ',
  44181. 'Ꚍ' => '�',
  44182. 'Ꚏ' => '�',
  44183. '�' => 'ꚑ',
  44184. 'êš’' => 'êš“',
  44185. 'êš”' => 'êš•',
  44186. 'êš–' => 'êš—',
  44187. 'Ꚙ' => 'ꚙ',
  44188. 'êšš' => 'êš›',
  44189. 'Ꜣ' => 'ꜣ',
  44190. 'Ꜥ' => 'ꜥ',
  44191. 'Ꜧ' => 'ꜧ',
  44192. 'Ꜩ' => 'ꜩ',
  44193. 'Ꜫ' => 'ꜫ',
  44194. 'Ꜭ' => 'ꜭ',
  44195. 'Ꜯ' => 'ꜯ',
  44196. 'Ꜳ' => 'ꜳ',
  44197. 'Ꜵ' => 'ꜵ',
  44198. 'Ꜷ' => 'ꜷ',
  44199. 'Ꜹ' => 'ꜹ',
  44200. 'Ꜻ' => 'ꜻ',
  44201. 'Ꜽ' => 'ꜽ',
  44202. 'Ꜿ' => 'ꜿ',
  44203. '�' => '�',
  44204. '�' => '�',
  44205. '�' => '�',
  44206. '�' => '�',
  44207. '�' => '�',
  44208. '�' => '�',
  44209. '�' => '�',
  44210. '�' => '�',
  44211. '�' => '�',
  44212. '�' => '�',
  44213. '�' => '�',
  44214. '�' => '�',
  44215. '�' => '�',
  44216. '�' => '�',
  44217. '�' => '�',
  44218. '�' => '�',
  44219. '�' => '�',
  44220. '�' => '�',
  44221. '�' => '�',
  44222. '�' => '�',
  44223. '�' => '�',
  44224. '�' => '�',
  44225. '�' => '�',
  44226. '�' => '�',
  44227. '�' => '�',
  44228. '�' => '�',
  44229. '�' => 'ᵹ',
  44230. '�' => '�',
  44231. 'Ꞁ' => '�',
  44232. 'Ꞃ' => 'ꞃ',
  44233. 'êž„' => 'êž…',
  44234. 'Ꞇ' => 'ꞇ',
  44235. 'Ꞌ' => 'ꞌ',
  44236. '�' => 'ɥ',
  44237. '�' => 'ꞑ',
  44238. 'êž’' => 'êž“',
  44239. 'êž–' => 'êž—',
  44240. 'Ꞙ' => 'ꞙ',
  44241. 'êžš' => 'êž›',
  44242. 'Ꞝ' => '�',
  44243. 'Ꞟ' => 'ꞟ',
  44244. 'êž ' => 'êž¡',
  44245. 'Ꞣ' => 'ꞣ',
  44246. 'Ꞥ' => 'ꞥ',
  44247. 'Ꞧ' => 'ꞧ',
  44248. 'Ꞩ' => 'ꞩ',
  44249. 'Ɦ' => 'ɦ',
  44250. 'Ɜ' => 'ɜ',
  44251. 'Ɡ' => 'ɡ',
  44252. 'Ɬ' => 'ɬ',
  44253. 'êž°' => 'Êž',
  44254. 'Ʇ' => 'ʇ',
  44255. 'A' => '�',
  44256. 'B' => 'b',
  44257. 'C' => 'c',
  44258. 'D' => 'd',
  44259. 'ï¼¥' => 'ï½…',
  44260. 'F' => 'f',
  44261. 'G' => 'g',
  44262. 'H' => 'h',
  44263. 'I' => 'i',
  44264. 'J' => 'j',
  44265. 'K' => 'k',
  44266. 'L' => 'l',
  44267. 'M' => '�',
  44268. 'N' => 'n',
  44269. 'O' => '�',
  44270. 'P' => '�',
  44271. 'Q' => 'q',
  44272. 'ï¼²' => 'ï½’',
  44273. 'S' => 's',
  44274. 'ï¼´' => 'ï½”',
  44275. 'U' => 'u',
  44276. 'ï¼¶' => 'ï½–',
  44277. 'ï¼·' => 'ï½—',
  44278. 'X' => 'x',
  44279. 'ï¼¹' => 'ï½™',
  44280. 'Z' => 'z',
  44281. '�' => '�',
  44282. '�' => '�',
  44283. '�' => '�',
  44284. '�' => '�',
  44285. '�' => '�',
  44286. '�' => '�',
  44287. '�' => '�',
  44288. '�' => '�',
  44289. '�' => '�',
  44290. '�' => '�',
  44291. '�' => '�',
  44292. '�' => '�',
  44293. '�' => '�',
  44294. '�' => '�',
  44295. '�' => '�',
  44296. '�' => '�',
  44297. '�' => '�',
  44298. '�' => '�',
  44299. '�' => '�',
  44300. '�' => '�',
  44301. '�' => '�',
  44302. '�' => '�',
  44303. '�' => '�',
  44304. '�' => '�',
  44305. '�' => '�',
  44306. '�' => '�',
  44307. '�' => '�',
  44308. '�' => '�',
  44309. '�' => '�',
  44310. '�' => '�',
  44311. '�' => '�',
  44312. '�' => '�',
  44313. '�' => '�',
  44314. '�' => '�',
  44315. '�' => '�',
  44316. '�' => '�',
  44317. '�' => '�',
  44318. '�' => '�',
  44319. '�' => '�',
  44320. '�' => '�',
  44321. 'ð‘¢ ' => 'ð‘£€',
  44322. '𑢡' => '�',
  44323. '𑢢' => '𑣂',
  44324. '𑢣' => '𑣃',
  44325. '𑢤' => '𑣄',
  44326. 'ð‘¢¥' => 'ð‘£…',
  44327. '𑢦' => '𑣆',
  44328. '𑢧' => '𑣇',
  44329. '𑢨' => '𑣈',
  44330. '𑢩' => '𑣉',
  44331. '𑢪' => '𑣊',
  44332. '𑢫' => '𑣋',
  44333. '𑢬' => '𑣌',
  44334. '𑢭' => '�',
  44335. '𑢮' => '𑣎',
  44336. '𑢯' => '�',
  44337. '𑢰' => '�',
  44338. '𑢱' => '𑣑',
  44339. 'ð‘¢²' => 'ð‘£’',
  44340. '𑢳' => '𑣓',
  44341. 'ð‘¢´' => 'ð‘£”',
  44342. '𑢵' => '𑣕',
  44343. 'ð‘¢¶' => 'ð‘£–',
  44344. 'ð‘¢·' => 'ð‘£—',
  44345. '𑢸' => '𑣘',
  44346. 'ð‘¢¹' => 'ð‘£™',
  44347. '𑢺' => '𑣚',
  44348. 'ð‘¢»' => 'ð‘£›',
  44349. '𑢼' => '𑣜',
  44350. '𑢽' => '�',
  44351. '𑢾' => '𑣞',
  44352. '𑢿' => '𑣟',
  44353. );
  44354. <?php
  44355. return '/(?<![\x{0027}\x{002E}\x{003A}\x{005E}\x{0060}\x{00A8}\x{00AD}\x{00AF}\x{00B4}\x{00B7}\x{00B8}\x{02B0}-\x{02C1}\x{02C2}-\x{02C5}\x{02C6}-\x{02D1}\x{02D2}-\x{02DF}\x{02E0}-\x{02E4}\x{02E5}-\x{02EB}\x{02EC}\x{02ED}\x{02EE}\x{02EF}-\x{02FF}\x{0300}-\x{036F}\x{0374}\x{0375}\x{037A}\x{0384}-\x{0385}\x{0387}\x{0483}-\x{0487}\x{0488}-\x{0489}\x{0559}\x{0591}-\x{05BD}\x{05BF}\x{05C1}-\x{05C2}\x{05C4}-\x{05C5}\x{05C7}\x{05F4}\x{0600}-\x{0605}\x{0610}-\x{061A}\x{061C}\x{0640}\x{064B}-\x{065F}\x{0670}\x{06D6}-\x{06DC}\x{06DD}\x{06DF}-\x{06E4}\x{06E5}-\x{06E6}\x{06E7}-\x{06E8}\x{06EA}-\x{06ED}\x{070F}\x{0711}\x{0730}-\x{074A}\x{07A6}-\x{07B0}\x{07EB}-\x{07F3}\x{07F4}-\x{07F5}\x{07FA}\x{07FD}\x{0816}-\x{0819}\x{081A}\x{081B}-\x{0823}\x{0824}\x{0825}-\x{0827}\x{0828}\x{0829}-\x{082D}\x{0859}-\x{085B}\x{08D3}-\x{08E1}\x{08E2}\x{08E3}-\x{0902}\x{093A}\x{093C}\x{0941}-\x{0948}\x{094D}\x{0951}-\x{0957}\x{0962}-\x{0963}\x{0971}\x{0981}\x{09BC}\x{09C1}-\x{09C4}\x{09CD}\x{09E2}-\x{09E3}\x{09FE}\x{0A01}-\x{0A02}\x{0A3C}\x{0A41}-\x{0A42}\x{0A47}-\x{0A48}\x{0A4B}-\x{0A4D}\x{0A51}\x{0A70}-\x{0A71}\x{0A75}\x{0A81}-\x{0A82}\x{0ABC}\x{0AC1}-\x{0AC5}\x{0AC7}-\x{0AC8}\x{0ACD}\x{0AE2}-\x{0AE3}\x{0AFA}-\x{0AFF}\x{0B01}\x{0B3C}\x{0B3F}\x{0B41}-\x{0B44}\x{0B4D}\x{0B56}\x{0B62}-\x{0B63}\x{0B82}\x{0BC0}\x{0BCD}\x{0C00}\x{0C04}\x{0C3E}-\x{0C40}\x{0C46}-\x{0C48}\x{0C4A}-\x{0C4D}\x{0C55}-\x{0C56}\x{0C62}-\x{0C63}\x{0C81}\x{0CBC}\x{0CBF}\x{0CC6}\x{0CCC}-\x{0CCD}\x{0CE2}-\x{0CE3}\x{0D00}-\x{0D01}\x{0D3B}-\x{0D3C}\x{0D41}-\x{0D44}\x{0D4D}\x{0D62}-\x{0D63}\x{0DCA}\x{0DD2}-\x{0DD4}\x{0DD6}\x{0E31}\x{0E34}-\x{0E3A}\x{0E46}\x{0E47}-\x{0E4E}\x{0EB1}\x{0EB4}-\x{0EB9}\x{0EBB}-\x{0EBC}\x{0EC6}\x{0EC8}-\x{0ECD}\x{0F18}-\x{0F19}\x{0F35}\x{0F37}\x{0F39}\x{0F71}-\x{0F7E}\x{0F80}-\x{0F84}\x{0F86}-\x{0F87}\x{0F8D}-\x{0F97}\x{0F99}-\x{0FBC}\x{0FC6}\x{102D}-\x{1030}\x{1032}-\x{1037}\x{1039}-\x{103A}\x{103D}-\x{103E}\x{1058}-\x{1059}\x{105E}-\x{1060}\x{1071}-\x{1074}\x{1082}\x{1085}-\x{1086}\x{108D}\x{109D}\x{10FC}\x{135D}-\x{135F}\x{1712}-\x{1714}\x{1732}-\x{1734}\x{1752}-\x{1753}\x{1772}-\x{1773}\x{17B4}-\x{17B5}\x{17B7}-\x{17BD}\x{17C6}\x{17C9}-\x{17D3}\x{17D7}\x{17DD}\x{180B}-\x{180D}\x{180E}\x{1843}\x{1885}-\x{1886}\x{18A9}\x{1920}-\x{1922}\x{1927}-\x{1928}\x{1932}\x{1939}-\x{193B}\x{1A17}-\x{1A18}\x{1A1B}\x{1A56}\x{1A58}-\x{1A5E}\x{1A60}\x{1A62}\x{1A65}-\x{1A6C}\x{1A73}-\x{1A7C}\x{1A7F}\x{1AA7}\x{1AB0}-\x{1ABD}\x{1ABE}\x{1B00}-\x{1B03}\x{1B34}\x{1B36}-\x{1B3A}\x{1B3C}\x{1B42}\x{1B6B}-\x{1B73}\x{1B80}-\x{1B81}\x{1BA2}-\x{1BA5}\x{1BA8}-\x{1BA9}\x{1BAB}-\x{1BAD}\x{1BE6}\x{1BE8}-\x{1BE9}\x{1BED}\x{1BEF}-\x{1BF1}\x{1C2C}-\x{1C33}\x{1C36}-\x{1C37}\x{1C78}-\x{1C7D}\x{1CD0}-\x{1CD2}\x{1CD4}-\x{1CE0}\x{1CE2}-\x{1CE8}\x{1CED}\x{1CF4}\x{1CF8}-\x{1CF9}\x{1D2C}-\x{1D6A}\x{1D78}\x{1D9B}-\x{1DBF}\x{1DC0}-\x{1DF9}\x{1DFB}-\x{1DFF}\x{1FBD}\x{1FBF}-\x{1FC1}\x{1FCD}-\x{1FCF}\x{1FDD}-\x{1FDF}\x{1FED}-\x{1FEF}\x{1FFD}-\x{1FFE}\x{200B}-\x{200F}\x{2018}\x{2019}\x{2024}\x{2027}\x{202A}-\x{202E}\x{2060}-\x{2064}\x{2066}-\x{206F}\x{2071}\x{207F}\x{2090}-\x{209C}\x{20D0}-\x{20DC}\x{20DD}-\x{20E0}\x{20E1}\x{20E2}-\x{20E4}\x{20E5}-\x{20F0}\x{2C7C}-\x{2C7D}\x{2CEF}-\x{2CF1}\x{2D6F}\x{2D7F}\x{2DE0}-\x{2DFF}\x{2E2F}\x{3005}\x{302A}-\x{302D}\x{3031}-\x{3035}\x{303B}\x{3099}-\x{309A}\x{309B}-\x{309C}\x{309D}-\x{309E}\x{30FC}-\x{30FE}\x{A015}\x{A4F8}-\x{A4FD}\x{A60C}\x{A66F}\x{A670}-\x{A672}\x{A674}-\x{A67D}\x{A67F}\x{A69C}-\x{A69D}\x{A69E}-\x{A69F}\x{A6F0}-\x{A6F1}\x{A700}-\x{A716}\x{A717}-\x{A71F}\x{A720}-\x{A721}\x{A770}\x{A788}\x{A789}-\x{A78A}\x{A7F8}-\x{A7F9}\x{A802}\x{A806}\x{A80B}\x{A825}-\x{A826}\x{A8C4}-\x{A8C5}\x{A8E0}-\x{A8F1}\x{A8FF}\x{A926}-\x{A92D}\x{A947}-\x{A951}\x{A980}-\x{A982}\x{A9B3}\x{A9B6}-\x{A9B9}\x{A9BC}\x{A9CF}\x{A9E5}\x{A9E6}\x{AA29}-\x{AA2E}\x{AA31}-\x{AA32}\x{AA35}-\x{AA36}\x{AA43}\x{AA4C}\x{AA70}\x{AA7C}\x{AAB0}\x{AAB2}-\x{AAB4}\x{AAB7}-\x{AAB8}\x{AABE}-\x{AABF}\x{AAC1}\x{AADD}\x{AAEC}-\x{AAED}\x{AAF3}-\x{AAF4}\x{AAF6}\x{AB5B}\x{AB5C}-\x{AB5F}\x{ABE5}\x{ABE8}\x{ABED}\x{FB1E}\x{FBB2}-\x{FBC1}\x{FE00}-\x{FE0F}\x{FE13}\x{FE20}-\x{FE2F}\x{FE52}\x{FE55}\x{FEFF}\x{FF07}\x{FF0E}\x{FF1A}\x{FF3E}\x{FF40}\x{FF70}\x{FF9E}-\x{FF9F}\x{FFE3}\x{FFF9}-\x{FFFB}\x{101FD}\x{102E0}\x{10376}-\x{1037A}\x{10A01}-\x{10A03}\x{10A05}-\x{10A06}\x{10A0C}-\x{10A0F}\x{10A38}-\x{10A3A}\x{10A3F}\x{10AE5}-\x{10AE6}\x{10D24}-\x{10D27}\x{10F46}-\x{10F50}\x{11001}\x{11038}-\x{11046}\x{1107F}-\x{11081}\x{110B3}-\x{110B6}\x{110B9}-\x{110BA}\x{110BD}\x{110CD}\x{11100}-\x{11102}\x{11127}-\x{1112B}\x{1112D}-\x{11134}\x{11173}\x{11180}-\x{11181}\x{111B6}-\x{111BE}\x{111C9}-\x{111CC}\x{1122F}-\x{11231}\x{11234}\x{11236}-\x{11237}\x{1123E}\x{112DF}\x{112E3}-\x{112EA}\x{11300}-\x{11301}\x{1133B}-\x{1133C}\x{11340}\x{11366}-\x{1136C}\x{11370}-\x{11374}\x{11438}-\x{1143F}\x{11442}-\x{11444}\x{11446}\x{1145E}\x{114B3}-\x{114B8}\x{114BA}\x{114BF}-\x{114C0}\x{114C2}-\x{114C3}\x{115B2}-\x{115B5}\x{115BC}-\x{115BD}\x{115BF}-\x{115C0}\x{115DC}-\x{115DD}\x{11633}-\x{1163A}\x{1163D}\x{1163F}-\x{11640}\x{116AB}\x{116AD}\x{116B0}-\x{116B5}\x{116B7}\x{1171D}-\x{1171F}\x{11722}-\x{11725}\x{11727}-\x{1172B}\x{1182F}-\x{11837}\x{11839}-\x{1183A}\x{11A01}-\x{11A0A}\x{11A33}-\x{11A38}\x{11A3B}-\x{11A3E}\x{11A47}\x{11A51}-\x{11A56}\x{11A59}-\x{11A5B}\x{11A8A}-\x{11A96}\x{11A98}-\x{11A99}\x{11C30}-\x{11C36}\x{11C38}-\x{11C3D}\x{11C3F}\x{11C92}-\x{11CA7}\x{11CAA}-\x{11CB0}\x{11CB2}-\x{11CB3}\x{11CB5}-\x{11CB6}\x{11D31}-\x{11D36}\x{11D3A}\x{11D3C}-\x{11D3D}\x{11D3F}-\x{11D45}\x{11D47}\x{11D90}-\x{11D91}\x{11D95}\x{11D97}\x{11EF3}-\x{11EF4}\x{16AF0}-\x{16AF4}\x{16B30}-\x{16B36}\x{16B40}-\x{16B43}\x{16F8F}-\x{16F92}\x{16F93}-\x{16F9F}\x{16FE0}-\x{16FE1}\x{1BC9D}-\x{1BC9E}\x{1BCA0}-\x{1BCA3}\x{1D167}-\x{1D169}\x{1D173}-\x{1D17A}\x{1D17B}-\x{1D182}\x{1D185}-\x{1D18B}\x{1D1AA}-\x{1D1AD}\x{1D242}-\x{1D244}\x{1DA00}-\x{1DA36}\x{1DA3B}-\x{1DA6C}\x{1DA75}\x{1DA84}\x{1DA9B}-\x{1DA9F}\x{1DAA1}-\x{1DAAF}\x{1E000}-\x{1E006}\x{1E008}-\x{1E018}\x{1E01B}-\x{1E021}\x{1E023}-\x{1E024}\x{1E026}-\x{1E02A}\x{1E8D0}-\x{1E8D6}\x{1E944}-\x{1E94A}\x{1F3FB}-\x{1F3FF}\x{E0001}\x{E0020}-\x{E007F}\x{E0100}-\x{E01EF}])(\pL)(\pL*+)/u';
  44356. <?php
  44357. return array(
  44358. 'a' => 'A',
  44359. 'b' => 'B',
  44360. 'c' => 'C',
  44361. 'd' => 'D',
  44362. 'e' => 'E',
  44363. 'f' => 'F',
  44364. 'g' => 'G',
  44365. 'h' => 'H',
  44366. 'i' => 'I',
  44367. 'j' => 'J',
  44368. 'k' => 'K',
  44369. 'l' => 'L',
  44370. 'm' => 'M',
  44371. 'n' => 'N',
  44372. 'o' => 'O',
  44373. 'p' => 'P',
  44374. 'q' => 'Q',
  44375. 'r' => 'R',
  44376. 's' => 'S',
  44377. 't' => 'T',
  44378. 'u' => 'U',
  44379. 'v' => 'V',
  44380. 'w' => 'W',
  44381. 'x' => 'X',
  44382. 'y' => 'Y',
  44383. 'z' => 'Z',
  44384. 'µ' => 'Μ',
  44385. 'à' => 'À',
  44386. 'á' => '�',
  44387. 'â' => 'Â',
  44388. 'ã' => 'Ã',
  44389. 'ä' => 'Ä',
  44390. 'Ã¥' => 'Ã…',
  44391. 'æ' => 'Æ',
  44392. 'ç' => 'Ç',
  44393. 'è' => 'È',
  44394. 'é' => 'É',
  44395. 'ê' => 'Ê',
  44396. 'ë' => 'Ë',
  44397. 'ì' => 'Ì',
  44398. 'í' => '�',
  44399. 'î' => 'Î',
  44400. 'ï' => '�',
  44401. 'ð' => '�',
  44402. 'ñ' => 'Ñ',
  44403. 'ò' => 'Ò',
  44404. 'ó' => 'Ó',
  44405. 'ô' => 'Ô',
  44406. 'õ' => 'Õ',
  44407. 'ö' => 'Ö',
  44408. 'ø' => 'Ø',
  44409. 'ù' => 'Ù',
  44410. 'ú' => 'Ú',
  44411. 'û' => 'Û',
  44412. 'ü' => 'Ü',
  44413. 'ý' => '�',
  44414. 'þ' => 'Þ',
  44415. 'ÿ' => 'Ÿ',
  44416. '�' => 'Ā',
  44417. 'ă' => 'Ă',
  44418. 'Ä…' => 'Ä„',
  44419. 'ć' => 'Ć',
  44420. 'ĉ' => 'Ĉ',
  44421. 'Ä‹' => 'ÄŠ',
  44422. '�' => 'Č',
  44423. '�' => 'Ď',
  44424. 'đ' => '�',
  44425. 'Ä“' => 'Ä’',
  44426. 'Ä•' => 'Ä”',
  44427. 'Ä—' => 'Ä–',
  44428. 'ę' => 'Ę',
  44429. 'Ä›' => 'Äš',
  44430. '�' => 'Ĝ',
  44431. 'ÄŸ' => 'Äž',
  44432. 'Ä¡' => 'Ä ',
  44433. 'Ä£' => 'Ä¢',
  44434. 'ĥ' => 'Ĥ',
  44435. 'ħ' => 'Ħ',
  44436. 'ĩ' => 'Ĩ',
  44437. 'ī' => 'Ī',
  44438. 'ĭ' => 'Ĭ',
  44439. 'į' => 'Į',
  44440. 'ı' => 'I',
  44441. 'ij' => 'IJ',
  44442. 'ĵ' => 'Ĵ',
  44443. 'ķ' => 'Ķ',
  44444. 'ĺ' => 'Ĺ',
  44445. 'ļ' => 'Ļ',
  44446. 'ľ' => 'Ľ',
  44447. 'Å€' => 'Ä¿',
  44448. 'ł' => '�',
  44449. 'ń' => 'Ń',
  44450. 'ņ' => 'Ņ',
  44451. 'ň' => 'Ň',
  44452. 'Å‹' => 'ÅŠ',
  44453. '�' => 'Ō',
  44454. '�' => 'Ŏ',
  44455. 'ő' => '�',
  44456. 'Å“' => 'Å’',
  44457. 'Å•' => 'Å”',
  44458. 'Å—' => 'Å–',
  44459. 'ř' => 'Ř',
  44460. 'Å›' => 'Åš',
  44461. '�' => 'Ŝ',
  44462. 'ÅŸ' => 'Åž',
  44463. 'Å¡' => 'Å ',
  44464. 'Å£' => 'Å¢',
  44465. 'ť' => 'Ť',
  44466. 'ŧ' => 'Ŧ',
  44467. 'ũ' => 'Ũ',
  44468. 'ū' => 'Ū',
  44469. 'ŭ' => 'Ŭ',
  44470. 'ů' => 'Ů',
  44471. 'ű' => 'Ű',
  44472. 'ų' => 'Ų',
  44473. 'ŵ' => 'Ŵ',
  44474. 'ŷ' => 'Ŷ',
  44475. 'ź' => 'Ź',
  44476. 'ż' => 'Ż',
  44477. 'ž' => 'Ž',
  44478. 'Å¿' => 'S',
  44479. 'ƀ' => 'Ƀ',
  44480. 'ƃ' => 'Ƃ',
  44481. 'Æ…' => 'Æ„',
  44482. 'ƈ' => 'Ƈ',
  44483. 'ƌ' => 'Ƌ',
  44484. 'Æ’' => 'Æ‘',
  44485. 'ƕ' => 'Ƕ',
  44486. 'ƙ' => 'Ƙ',
  44487. 'ƚ' => 'Ƚ',
  44488. 'Æž' => 'È ',
  44489. 'Æ¡' => 'Æ ',
  44490. 'Æ£' => 'Æ¢',
  44491. 'ƥ' => 'Ƥ',
  44492. 'ƨ' => 'Ƨ',
  44493. 'ƭ' => 'Ƭ',
  44494. 'ư' => 'Ư',
  44495. 'ƴ' => 'Ƴ',
  44496. 'ƶ' => 'Ƶ',
  44497. 'ƹ' => 'Ƹ',
  44498. 'ƽ' => 'Ƽ',
  44499. 'Æ¿' => 'Ç·',
  44500. 'Ç…' => 'Ç„',
  44501. 'dž' => 'DŽ',
  44502. 'Lj' => 'LJ',
  44503. 'lj' => 'LJ',
  44504. 'Ç‹' => 'ÇŠ',
  44505. 'nj' => 'NJ',
  44506. 'ǎ' => '�',
  44507. '�' => '�',
  44508. 'Ç’' => 'Ç‘',
  44509. 'Ç”' => 'Ç“',
  44510. 'Ç–' => 'Ç•',
  44511. 'ǘ' => 'Ǘ',
  44512. 'Çš' => 'Ç™',
  44513. 'ǜ' => 'Ǜ',
  44514. '�' => 'Ǝ',
  44515. 'ÇŸ' => 'Çž',
  44516. 'Ç¡' => 'Ç ',
  44517. 'Ç£' => 'Ç¢',
  44518. 'ǥ' => 'Ǥ',
  44519. 'ǧ' => 'Ǧ',
  44520. 'ǩ' => 'Ǩ',
  44521. 'ǫ' => 'Ǫ',
  44522. 'ǭ' => 'Ǭ',
  44523. 'ǯ' => 'Ǯ',
  44524. 'Dz' => 'DZ',
  44525. 'dz' => 'DZ',
  44526. 'ǵ' => 'Ǵ',
  44527. 'ǹ' => 'Ǹ',
  44528. 'ǻ' => 'Ǻ',
  44529. 'ǽ' => 'Ǽ',
  44530. 'ǿ' => 'Ǿ',
  44531. '�' => 'Ȁ',
  44532. 'ȃ' => 'Ȃ',
  44533. 'È…' => 'È„',
  44534. 'ȇ' => 'Ȇ',
  44535. 'ȉ' => 'Ȉ',
  44536. 'È‹' => 'ÈŠ',
  44537. '�' => 'Ȍ',
  44538. '�' => 'Ȏ',
  44539. 'ȑ' => '�',
  44540. 'È“' => 'È’',
  44541. 'È•' => 'È”',
  44542. 'È—' => 'È–',
  44543. 'ș' => 'Ș',
  44544. 'È›' => 'Èš',
  44545. '�' => 'Ȝ',
  44546. 'ÈŸ' => 'Èž',
  44547. 'È£' => 'È¢',
  44548. 'ȥ' => 'Ȥ',
  44549. 'ȧ' => 'Ȧ',
  44550. 'ȩ' => 'Ȩ',
  44551. 'ȫ' => 'Ȫ',
  44552. 'ȭ' => 'Ȭ',
  44553. 'ȯ' => 'Ȯ',
  44554. 'ȱ' => 'Ȱ',
  44555. 'ȳ' => 'Ȳ',
  44556. 'ȼ' => 'Ȼ',
  44557. 'È¿' => 'â±¾',
  44558. 'ɀ' => 'Ɀ',
  44559. 'ɂ' => '�',
  44560. 'ɇ' => 'Ɇ',
  44561. 'ɉ' => 'Ɉ',
  44562. 'É‹' => 'ÉŠ',
  44563. '�' => 'Ɍ',
  44564. '�' => 'Ɏ',
  44565. '�' => 'Ɐ',
  44566. 'É‘' => 'â±­',
  44567. 'É’' => 'â±°',
  44568. 'ɓ' => '�',
  44569. 'ɔ' => 'Ɔ',
  44570. 'ɖ' => 'Ɖ',
  44571. 'É—' => 'ÆŠ',
  44572. 'ə' => '�',
  44573. 'ɛ' => '�',
  44574. 'ɜ' => 'Ɜ',
  44575. 'É ' => 'Æ“',
  44576. 'ɡ' => 'Ɡ',
  44577. 'É£' => 'Æ”',
  44578. 'ɥ' => '�',
  44579. 'ɦ' => 'Ɦ',
  44580. 'ɨ' => 'Ɨ',
  44581. 'É©' => 'Æ–',
  44582. 'É«' => 'â±¢',
  44583. 'ɬ' => 'Ɬ',
  44584. 'ɯ' => 'Ɯ',
  44585. 'ɱ' => 'Ɱ',
  44586. 'ɲ' => '�',
  44587. 'ɵ' => 'Ɵ',
  44588. 'ɽ' => 'Ɽ',
  44589. 'ʀ' => 'Ʀ',
  44590. 'ʃ' => 'Ʃ',
  44591. 'ʇ' => 'Ʇ',
  44592. 'ʈ' => 'Ʈ',
  44593. 'ʉ' => 'Ʉ',
  44594. 'ʊ' => 'Ʊ',
  44595. 'ʋ' => 'Ʋ',
  44596. 'ʌ' => 'Ʌ',
  44597. 'Ê’' => 'Æ·',
  44598. 'Êž' => 'êž°',
  44599. 'ͅ' => 'Ι',
  44600. 'ͱ' => 'Ͱ',
  44601. 'ͳ' => 'Ͳ',
  44602. 'ͷ' => 'Ͷ',
  44603. 'ͻ' => 'Ͻ',
  44604. 'ͼ' => 'Ͼ',
  44605. 'ͽ' => 'Ͽ',
  44606. 'ά' => 'Ά',
  44607. 'έ' => 'Έ',
  44608. 'ή' => 'Ή',
  44609. 'ί' => 'Ί',
  44610. 'α' => 'Α',
  44611. 'β' => 'Β',
  44612. 'γ' => 'Γ',
  44613. 'δ' => 'Δ',
  44614. 'ε' => 'Ε',
  44615. 'ζ' => 'Ζ',
  44616. 'η' => 'Η',
  44617. 'θ' => 'Θ',
  44618. 'ι' => 'Ι',
  44619. 'κ' => 'Κ',
  44620. 'λ' => 'Λ',
  44621. 'μ' => 'Μ',
  44622. 'ν' => '�',
  44623. 'ξ' => 'Ξ',
  44624. 'ο' => 'Ο',
  44625. 'π' => 'Π',
  44626. '�' => 'Ρ',
  44627. 'ς' => 'Σ',
  44628. 'σ' => 'Σ',
  44629. 'τ' => 'Τ',
  44630. 'Ï…' => 'Î¥',
  44631. 'φ' => 'Φ',
  44632. 'χ' => 'Χ',
  44633. 'ψ' => 'Ψ',
  44634. 'ω' => 'Ω',
  44635. 'ϊ' => 'Ϊ',
  44636. 'ϋ' => 'Ϋ',
  44637. 'ό' => 'Ό',
  44638. '�' => 'Ύ',
  44639. 'ώ' => '�',
  44640. '�' => 'Β',
  44641. 'ϑ' => 'Θ',
  44642. 'ϕ' => 'Φ',
  44643. 'ϖ' => 'Π',
  44644. 'ϗ' => '�',
  44645. 'ϙ' => 'Ϙ',
  44646. 'Ï›' => 'Ïš',
  44647. '�' => 'Ϝ',
  44648. 'ÏŸ' => 'Ïž',
  44649. 'Ï¡' => 'Ï ',
  44650. 'Ï£' => 'Ï¢',
  44651. 'ϥ' => 'Ϥ',
  44652. 'ϧ' => 'Ϧ',
  44653. 'ϩ' => 'Ϩ',
  44654. 'ϫ' => 'Ϫ',
  44655. 'ϭ' => 'Ϭ',
  44656. 'ϯ' => 'Ϯ',
  44657. 'ϰ' => 'Κ',
  44658. 'ϱ' => 'Ρ',
  44659. 'ϲ' => 'Ϲ',
  44660. 'ϳ' => 'Ϳ',
  44661. 'ϵ' => 'Ε',
  44662. 'ϸ' => 'Ϸ',
  44663. 'ϻ' => 'Ϻ',
  44664. 'а' => '�',
  44665. 'б' => 'Б',
  44666. 'в' => 'В',
  44667. 'г' => 'Г',
  44668. 'д' => 'Д',
  44669. 'е' => 'Е',
  44670. 'ж' => 'Ж',
  44671. 'з' => 'З',
  44672. 'и' => 'И',
  44673. 'й' => 'Й',
  44674. 'к' => 'К',
  44675. 'л' => 'Л',
  44676. 'м' => 'М',
  44677. 'н' => '�',
  44678. 'о' => 'О',
  44679. 'п' => 'П',
  44680. 'р' => 'Р',
  44681. '�' => 'С',
  44682. 'т' => 'Т',
  44683. 'у' => 'У',
  44684. 'ф' => 'Ф',
  44685. 'Ñ…' => 'Ð¥',
  44686. 'ц' => 'Ц',
  44687. 'ч' => 'Ч',
  44688. 'ш' => 'Ш',
  44689. 'щ' => 'Щ',
  44690. 'ъ' => 'Ъ',
  44691. 'ы' => 'Ы',
  44692. 'ь' => 'Ь',
  44693. '�' => 'Э',
  44694. 'ю' => 'Ю',
  44695. '�' => 'Я',
  44696. '�' => 'Ѐ',
  44697. 'ё' => '�',
  44698. 'ђ' => 'Ђ',
  44699. 'ѓ' => 'Ѓ',
  44700. 'є' => 'Є',
  44701. 'Ñ•' => 'Ð…',
  44702. 'і' => 'І',
  44703. 'ї' => 'Ї',
  44704. 'ј' => 'Ј',
  44705. 'љ' => 'Љ',
  44706. 'њ' => 'Њ',
  44707. 'ћ' => 'Ћ',
  44708. 'ќ' => 'Ќ',
  44709. '�' => '�',
  44710. 'Ñž' => 'ÐŽ',
  44711. 'џ' => '�',
  44712. 'Ñ¡' => 'Ñ ',
  44713. 'Ñ£' => 'Ñ¢',
  44714. 'ѥ' => 'Ѥ',
  44715. 'ѧ' => 'Ѧ',
  44716. 'ѩ' => 'Ѩ',
  44717. 'ѫ' => 'Ѫ',
  44718. 'ѭ' => 'Ѭ',
  44719. 'ѯ' => 'Ѯ',
  44720. 'ѱ' => 'Ѱ',
  44721. 'ѳ' => 'Ѳ',
  44722. 'ѵ' => 'Ѵ',
  44723. 'ѷ' => 'Ѷ',
  44724. 'ѹ' => 'Ѹ',
  44725. 'ѻ' => 'Ѻ',
  44726. 'ѽ' => 'Ѽ',
  44727. 'ѿ' => 'Ѿ',
  44728. 'Ò�' => 'Ò€',
  44729. 'Ò‹' => 'ÒŠ',
  44730. '�' => 'Ҍ',
  44731. 'Ò�' => 'ÒŽ',
  44732. 'Ò‘' => 'Ò�',
  44733. 'Ò“' => 'Ò’',
  44734. 'Ò•' => 'Ò”',
  44735. 'Ò—' => 'Ò–',
  44736. 'Ò™' => 'Ò˜',
  44737. 'Ò›' => 'Òš',
  44738. '�' => 'Ҝ',
  44739. 'ÒŸ' => 'Òž',
  44740. 'Ò¡' => 'Ò ',
  44741. 'Ò£' => 'Ò¢',
  44742. 'Ò¥' => 'Ò¤',
  44743. 'Ò§' => 'Ò¦',
  44744. 'Ò©' => 'Ò¨',
  44745. 'Ò«' => 'Òª',
  44746. 'Ò­' => 'Ò¬',
  44747. 'Ò¯' => 'Ò®',
  44748. 'Ò±' => 'Ò°',
  44749. 'Ò³' => 'Ò²',
  44750. 'Òµ' => 'Ò´',
  44751. 'Ò·' => 'Ò¶',
  44752. 'Ò¹' => 'Ò¸',
  44753. 'Ò»' => 'Òº',
  44754. 'Ò½' => 'Ò¼',
  44755. 'Ò¿' => 'Ò¾',
  44756. 'Ó‚' => 'Ó�',
  44757. 'Ó„' => 'Óƒ',
  44758. 'Ó†' => 'Ó…',
  44759. 'Óˆ' => 'Ó‡',
  44760. 'ÓŠ' => 'Ó‰',
  44761. 'ӌ' => 'Ӌ',
  44762. 'ÓŽ' => 'Ó�',
  44763. 'Ó�' => 'Ó€',
  44764. 'Ó‘' => 'Ó�',
  44765. 'Ó“' => 'Ó’',
  44766. 'Ó•' => 'Ó”',
  44767. 'Ó—' => 'Ó–',
  44768. 'Ó™' => 'Ó˜',
  44769. 'Ó›' => 'Óš',
  44770. '�' => 'Ӝ',
  44771. 'ÓŸ' => 'Óž',
  44772. 'Ó¡' => 'Ó ',
  44773. 'Ó£' => 'Ó¢',
  44774. 'Ó¥' => 'Ó¤',
  44775. 'Ó§' => 'Ó¦',
  44776. 'Ó©' => 'Ó¨',
  44777. 'Ó«' => 'Óª',
  44778. 'Ó­' => 'Ó¬',
  44779. 'Ó¯' => 'Ó®',
  44780. 'Ó±' => 'Ó°',
  44781. 'Ó³' => 'Ó²',
  44782. 'Óµ' => 'Ó´',
  44783. 'Ó·' => 'Ó¶',
  44784. 'Ó¹' => 'Ó¸',
  44785. 'Ó»' => 'Óº',
  44786. 'Ó½' => 'Ó¼',
  44787. 'Ó¿' => 'Ó¾',
  44788. 'Ô�' => 'Ô€',
  44789. 'Ôƒ' => 'Ô‚',
  44790. 'Ô…' => 'Ô„',
  44791. 'Ô‡' => 'Ô†',
  44792. 'Ô‰' => 'Ôˆ',
  44793. 'Ô‹' => 'ÔŠ',
  44794. '�' => 'Ԍ',
  44795. 'Ô�' => 'ÔŽ',
  44796. 'Ô‘' => 'Ô�',
  44797. 'Ô“' => 'Ô’',
  44798. 'Ô•' => 'Ô”',
  44799. 'Ô—' => 'Ô–',
  44800. 'Ô™' => 'Ô˜',
  44801. 'Ô›' => 'Ôš',
  44802. '�' => 'Ԝ',
  44803. 'ÔŸ' => 'Ôž',
  44804. 'Ô¡' => 'Ô ',
  44805. 'Ô£' => 'Ô¢',
  44806. 'Ô¥' => 'Ô¤',
  44807. 'Ô§' => 'Ô¦',
  44808. 'Ô©' => 'Ô¨',
  44809. 'Ô«' => 'Ôª',
  44810. 'Ô­' => 'Ô¬',
  44811. 'Ô¯' => 'Ô®',
  44812. 'Õ¡' => 'Ô±',
  44813. 'Õ¢' => 'Ô²',
  44814. 'Õ£' => 'Ô³',
  44815. 'Õ¤' => 'Ô´',
  44816. 'Õ¥' => 'Ôµ',
  44817. 'Õ¦' => 'Ô¶',
  44818. 'Õ§' => 'Ô·',
  44819. 'Õ¨' => 'Ô¸',
  44820. 'Õ©' => 'Ô¹',
  44821. 'Õª' => 'Ôº',
  44822. 'Õ«' => 'Ô»',
  44823. 'Õ¬' => 'Ô¼',
  44824. 'Õ­' => 'Ô½',
  44825. 'Õ®' => 'Ô¾',
  44826. 'Õ¯' => 'Ô¿',
  44827. 'Õ°' => 'Õ€',
  44828. 'Õ±' => 'Õ�',
  44829. 'Õ²' => 'Õ‚',
  44830. 'Õ³' => 'Õƒ',
  44831. 'Õ´' => 'Õ„',
  44832. 'Õµ' => 'Õ…',
  44833. 'Õ¶' => 'Õ†',
  44834. 'Õ·' => 'Õ‡',
  44835. 'Õ¸' => 'Õˆ',
  44836. 'Õ¹' => 'Õ‰',
  44837. 'Õº' => 'ÕŠ',
  44838. 'Õ»' => 'Õ‹',
  44839. 'ռ' => 'Ռ',
  44840. 'Õ½' => 'Õ�',
  44841. 'Õ¾' => 'ÕŽ',
  44842. 'Õ¿' => 'Õ�',
  44843. 'Ö€' => 'Õ�',
  44844. 'Ö�' => 'Õ‘',
  44845. 'Ö‚' => 'Õ’',
  44846. 'Öƒ' => 'Õ“',
  44847. 'Ö„' => 'Õ”',
  44848. 'Ö…' => 'Õ•',
  44849. 'Ö†' => 'Õ–',
  44850. 'ᵹ' => '�',
  44851. 'áµ½' => 'â±£',
  44852. '�' => 'Ḁ',
  44853. 'ḃ' => 'Ḃ',
  44854. 'ḅ' => 'Ḅ',
  44855. 'ḇ' => 'Ḇ',
  44856. 'ḉ' => 'Ḉ',
  44857. 'ḋ' => 'Ḋ',
  44858. '�' => 'Ḍ',
  44859. '�' => 'Ḏ',
  44860. 'ḑ' => '�',
  44861. 'ḓ' => 'Ḓ',
  44862. 'ḕ' => 'Ḕ',
  44863. 'ḗ' => 'Ḗ',
  44864. 'ḙ' => 'Ḙ',
  44865. 'ḛ' => 'Ḛ',
  44866. '�' => 'Ḝ',
  44867. 'ḟ' => 'Ḟ',
  44868. 'ḡ' => 'Ḡ',
  44869. 'ḣ' => 'Ḣ',
  44870. 'ḥ' => 'Ḥ',
  44871. 'ḧ' => 'Ḧ',
  44872. 'ḩ' => 'Ḩ',
  44873. 'ḫ' => 'Ḫ',
  44874. 'ḭ' => 'Ḭ',
  44875. 'ḯ' => 'Ḯ',
  44876. 'ḱ' => 'Ḱ',
  44877. 'ḳ' => 'Ḳ',
  44878. 'ḵ' => 'Ḵ',
  44879. 'ḷ' => 'Ḷ',
  44880. 'ḹ' => 'Ḹ',
  44881. 'ḻ' => 'Ḻ',
  44882. 'ḽ' => 'Ḽ',
  44883. 'ḿ' => 'Ḿ',
  44884. '�' => 'Ṁ',
  44885. 'ṃ' => 'Ṃ',
  44886. 'ṅ' => 'Ṅ',
  44887. 'ṇ' => 'Ṇ',
  44888. 'ṉ' => 'Ṉ',
  44889. 'ṋ' => 'Ṋ',
  44890. '�' => 'Ṍ',
  44891. '�' => 'Ṏ',
  44892. 'ṑ' => '�',
  44893. 'ṓ' => 'Ṓ',
  44894. 'ṕ' => 'Ṕ',
  44895. 'á¹—' => 'á¹–',
  44896. 'ṙ' => 'Ṙ',
  44897. 'ṛ' => 'Ṛ',
  44898. '�' => 'Ṝ',
  44899. 'ṟ' => 'Ṟ',
  44900. 'ṡ' => 'Ṡ',
  44901. 'á¹£' => 'á¹¢',
  44902. 'ṥ' => 'Ṥ',
  44903. 'ṧ' => 'Ṧ',
  44904. 'ṩ' => 'Ṩ',
  44905. 'ṫ' => 'Ṫ',
  44906. 'ṭ' => 'Ṭ',
  44907. 'ṯ' => 'Ṯ',
  44908. 'á¹±' => 'á¹°',
  44909. 'á¹³' => 'á¹²',
  44910. 'á¹µ' => 'á¹´',
  44911. 'á¹·' => 'á¹¶',
  44912. 'ṹ' => 'Ṹ',
  44913. 'ṻ' => 'Ṻ',
  44914. 'á¹½' => 'á¹¼',
  44915. 'ṿ' => 'Ṿ',
  44916. '�' => 'Ẁ',
  44917. 'ẃ' => 'Ẃ',
  44918. 'ẅ' => 'Ẅ',
  44919. 'ẇ' => 'Ẇ',
  44920. 'ẉ' => 'Ẉ',
  44921. 'ẋ' => 'Ẋ',
  44922. '�' => 'Ẍ',
  44923. '�' => 'Ẏ',
  44924. 'ẑ' => '�',
  44925. 'ẓ' => 'Ẓ',
  44926. 'ẕ' => 'Ẕ',
  44927. 'ẛ' => 'Ṡ',
  44928. 'ạ' => 'Ạ',
  44929. 'ả' => 'Ả',
  44930. 'ấ' => 'Ấ',
  44931. 'ầ' => 'Ầ',
  44932. 'ẩ' => 'Ẩ',
  44933. 'ẫ' => 'Ẫ',
  44934. 'ậ' => 'Ậ',
  44935. 'ắ' => 'Ắ',
  44936. 'ằ' => 'Ằ',
  44937. 'ẳ' => 'Ẳ',
  44938. 'ẵ' => 'Ẵ',
  44939. 'ặ' => 'Ặ',
  44940. 'ẹ' => 'Ẹ',
  44941. 'ẻ' => 'Ẻ',
  44942. 'ẽ' => 'Ẽ',
  44943. 'ế' => 'Ế',
  44944. '�' => 'Ề',
  44945. 'ể' => 'Ể',
  44946. 'ễ' => 'Ễ',
  44947. 'ệ' => 'Ệ',
  44948. 'ỉ' => 'Ỉ',
  44949. 'ị' => 'Ị',
  44950. '�' => 'Ọ',
  44951. '�' => 'Ỏ',
  44952. 'ố' => '�',
  44953. 'ồ' => 'Ồ',
  44954. 'ổ' => 'Ổ',
  44955. 'á»—' => 'á»–',
  44956. 'ộ' => 'Ộ',
  44957. 'ớ' => 'Ớ',
  44958. '�' => 'Ờ',
  44959. 'ở' => 'Ở',
  44960. 'ỡ' => 'Ỡ',
  44961. 'ợ' => 'Ợ',
  44962. 'ụ' => 'Ụ',
  44963. 'ủ' => 'Ủ',
  44964. 'ứ' => 'Ứ',
  44965. 'ừ' => 'Ừ',
  44966. 'ử' => 'Ử',
  44967. 'ữ' => 'Ữ',
  44968. 'á»±' => 'á»°',
  44969. 'ỳ' => 'Ỳ',
  44970. 'ỵ' => 'Ỵ',
  44971. 'á»·' => 'á»¶',
  44972. 'ỹ' => 'Ỹ',
  44973. 'ỻ' => 'Ỻ',
  44974. 'ỽ' => 'Ỽ',
  44975. 'ỿ' => 'Ỿ',
  44976. 'ἀ' => 'Ἀ',
  44977. '�' => 'Ἁ',
  44978. 'ἂ' => 'Ἂ',
  44979. 'ἃ' => 'Ἃ',
  44980. 'ἄ' => 'Ἄ',
  44981. 'ἅ' => '�',
  44982. 'ἆ' => 'Ἆ',
  44983. 'ἇ' => '�',
  44984. '�' => 'Ἐ',
  44985. 'ἑ' => 'Ἑ',
  44986. 'ἒ' => 'Ἒ',
  44987. 'ἓ' => 'Ἓ',
  44988. 'ἔ' => 'Ἔ',
  44989. 'ἕ' => '�',
  44990. 'ἠ' => 'Ἠ',
  44991. 'ἡ' => 'Ἡ',
  44992. 'ἢ' => 'Ἢ',
  44993. 'ἣ' => 'Ἣ',
  44994. 'ἤ' => 'Ἤ',
  44995. 'á¼¥' => 'á¼­',
  44996. 'ἦ' => 'Ἦ',
  44997. 'ἧ' => 'Ἧ',
  44998. 'ἰ' => 'Ἰ',
  44999. 'á¼±' => 'á¼¹',
  45000. 'ἲ' => 'Ἲ',
  45001. 'á¼³' => 'á¼»',
  45002. 'á¼´' => 'á¼¼',
  45003. 'á¼µ' => 'á¼½',
  45004. 'á¼¶' => 'á¼¾',
  45005. 'ἷ' => 'Ἷ',
  45006. 'ὀ' => 'Ὀ',
  45007. '�' => 'Ὁ',
  45008. 'ὂ' => 'Ὂ',
  45009. 'ὃ' => 'Ὃ',
  45010. 'ὄ' => 'Ὄ',
  45011. 'ὅ' => '�',
  45012. 'ὑ' => 'Ὑ',
  45013. 'ὓ' => 'Ὓ',
  45014. 'ὕ' => '�',
  45015. 'ὗ' => 'Ὗ',
  45016. 'ὠ' => 'Ὠ',
  45017. 'ὡ' => 'Ὡ',
  45018. 'ὢ' => 'Ὢ',
  45019. 'ὣ' => 'Ὣ',
  45020. 'ὤ' => 'Ὤ',
  45021. 'á½¥' => 'á½­',
  45022. 'ὦ' => 'Ὦ',
  45023. 'ὧ' => 'Ὧ',
  45024. 'ὰ' => 'Ὰ',
  45025. 'á½±' => 'á¾»',
  45026. 'ὲ' => 'Ὲ',
  45027. 'έ' => 'Έ',
  45028. 'ὴ' => 'Ὴ',
  45029. 'á½µ' => 'á¿‹',
  45030. 'ὶ' => 'Ὶ',
  45031. 'á½·' => 'á¿›',
  45032. 'ὸ' => 'Ὸ',
  45033. 'ό' => 'Ό',
  45034. 'ὺ' => 'Ὺ',
  45035. 'á½»' => 'á¿«',
  45036. 'ὼ' => 'Ὼ',
  45037. 'á½½' => 'á¿»',
  45038. 'ᾀ' => 'ᾈ',
  45039. '�' => 'ᾉ',
  45040. 'ᾂ' => 'ᾊ',
  45041. 'ᾃ' => 'ᾋ',
  45042. 'ᾄ' => 'ᾌ',
  45043. 'ᾅ' => '�',
  45044. 'ᾆ' => 'ᾎ',
  45045. 'ᾇ' => '�',
  45046. '�' => 'ᾘ',
  45047. 'ᾑ' => 'ᾙ',
  45048. 'ᾒ' => 'ᾚ',
  45049. 'ᾓ' => 'ᾛ',
  45050. 'ᾔ' => 'ᾜ',
  45051. 'ᾕ' => '�',
  45052. 'ᾖ' => 'ᾞ',
  45053. 'ᾗ' => 'ᾟ',
  45054. 'ᾠ' => 'ᾨ',
  45055. 'ᾡ' => 'ᾩ',
  45056. 'ᾢ' => 'ᾪ',
  45057. 'ᾣ' => 'ᾫ',
  45058. 'ᾤ' => 'ᾬ',
  45059. 'á¾¥' => 'á¾­',
  45060. 'ᾦ' => 'ᾮ',
  45061. 'ᾧ' => 'ᾯ',
  45062. 'ᾰ' => 'Ᾰ',
  45063. 'á¾±' => 'á¾¹',
  45064. 'á¾³' => 'á¾¼',
  45065. 'ι' => 'Ι',
  45066. 'ῃ' => 'ῌ',
  45067. '�' => 'Ῐ',
  45068. 'á¿‘' => 'á¿™',
  45069. 'ῠ' => 'Ῠ',
  45070. 'á¿¡' => 'á¿©',
  45071. 'ῥ' => 'Ῥ',
  45072. 'ῳ' => 'ῼ',
  45073. 'ⅎ' => 'Ⅎ',
  45074. 'â…°' => 'â… ',
  45075. 'â…±' => 'â…¡',
  45076. 'â…²' => 'â…¢',
  45077. 'â…³' => 'â…£',
  45078. 'â…´' => 'â…¤',
  45079. 'â…µ' => 'â…¥',
  45080. 'â…¶' => 'â…¦',
  45081. 'â…·' => 'â…§',
  45082. 'â…¸' => 'â…¨',
  45083. 'â…¹' => 'â…©',
  45084. 'â…º' => 'â…ª',
  45085. 'â…»' => 'â…«',
  45086. 'â…¼' => 'â…¬',
  45087. 'â…½' => 'â…­',
  45088. 'â…¾' => 'â…®',
  45089. 'â…¿' => 'â…¯',
  45090. 'ↄ' => 'Ↄ',
  45091. '�' => 'Ⓐ',
  45092. 'â“‘' => 'â’·',
  45093. 'â“’' => 'â’¸',
  45094. 'â““' => 'â’¹',
  45095. 'â“”' => 'â’º',
  45096. 'â“•' => 'â’»',
  45097. 'â“–' => 'â’¼',
  45098. 'â“—' => 'â’½',
  45099. 'ⓘ' => 'Ⓘ',
  45100. 'â“™' => 'â’¿',
  45101. 'ⓚ' => 'Ⓚ',
  45102. 'ⓛ' => '�',
  45103. 'ⓜ' => 'Ⓜ',
  45104. '�' => 'Ⓝ',
  45105. 'ⓞ' => 'Ⓞ',
  45106. 'ⓟ' => 'Ⓟ',
  45107. 'ⓠ' => 'Ⓠ',
  45108. 'ⓡ' => 'Ⓡ',
  45109. 'ⓢ' => 'Ⓢ',
  45110. 'ⓣ' => 'Ⓣ',
  45111. 'ⓤ' => 'Ⓤ',
  45112. 'â“¥' => 'â“‹',
  45113. 'ⓦ' => 'Ⓦ',
  45114. 'ⓧ' => '�',
  45115. 'ⓨ' => 'Ⓨ',
  45116. 'ⓩ' => '�',
  45117. 'â°°' => 'â°€',
  45118. 'â°±' => 'â°�',
  45119. 'â°²' => 'â°‚',
  45120. 'â°³' => 'â°ƒ',
  45121. 'â°´' => 'â°„',
  45122. 'â°µ' => 'â°…',
  45123. 'â°¶' => 'â°†',
  45124. 'â°·' => 'â°‡',
  45125. 'â°¸' => 'â°ˆ',
  45126. 'â°¹' => 'â°‰',
  45127. 'â°º' => 'â°Š',
  45128. 'â°»' => 'â°‹',
  45129. 'ⰼ' => 'Ⰼ',
  45130. 'â°½' => 'â°�',
  45131. 'â°¾' => 'â°Ž',
  45132. 'â°¿' => 'â°�',
  45133. 'â±€' => 'â°�',
  45134. '�' => 'Ⱁ',
  45135. 'ⱂ' => 'Ⱂ',
  45136. 'ⱃ' => 'Ⱃ',
  45137. 'ⱄ' => 'Ⱄ',
  45138. 'â±…' => 'â°•',
  45139. 'ⱆ' => 'Ⱆ',
  45140. 'ⱇ' => 'Ⱇ',
  45141. 'ⱈ' => 'Ⱈ',
  45142. 'ⱉ' => 'Ⱉ',
  45143. 'ⱊ' => 'Ⱊ',
  45144. 'ⱋ' => 'Ⱋ',
  45145. 'ⱌ' => 'Ⱌ',
  45146. '�' => '�',
  45147. 'ⱎ' => 'Ⱎ',
  45148. '�' => 'Ⱏ',
  45149. '�' => 'Ⱐ',
  45150. 'ⱑ' => 'Ⱑ',
  45151. 'â±’' => 'â°¢',
  45152. 'ⱓ' => 'Ⱓ',
  45153. 'â±”' => 'â°¤',
  45154. 'ⱕ' => 'Ⱕ',
  45155. 'â±–' => 'â°¦',
  45156. 'â±—' => 'â°§',
  45157. 'ⱘ' => 'Ⱘ',
  45158. 'â±™' => 'â°©',
  45159. 'ⱚ' => 'Ⱚ',
  45160. 'â±›' => 'â°«',
  45161. 'ⱜ' => 'Ⱜ',
  45162. '�' => 'Ⱝ',
  45163. 'ⱞ' => 'Ⱞ',
  45164. 'ⱡ' => 'Ⱡ',
  45165. 'ⱥ' => 'Ⱥ',
  45166. 'ⱦ' => 'Ⱦ',
  45167. 'ⱨ' => 'Ⱨ',
  45168. 'ⱪ' => 'Ⱪ',
  45169. 'ⱬ' => 'Ⱬ',
  45170. 'â±³' => 'â±²',
  45171. 'â±¶' => 'â±µ',
  45172. '�' => 'Ⲁ',
  45173. 'ⲃ' => 'Ⲃ',
  45174. 'ⲅ' => 'Ⲅ',
  45175. 'ⲇ' => 'Ⲇ',
  45176. 'ⲉ' => 'Ⲉ',
  45177. 'ⲋ' => 'Ⲋ',
  45178. '�' => 'Ⲍ',
  45179. '�' => 'Ⲏ',
  45180. 'ⲑ' => '�',
  45181. 'ⲓ' => 'Ⲓ',
  45182. 'ⲕ' => 'Ⲕ',
  45183. 'â²—' => 'â²–',
  45184. 'ⲙ' => 'Ⲙ',
  45185. 'ⲛ' => 'Ⲛ',
  45186. '�' => 'Ⲝ',
  45187. 'ⲟ' => 'Ⲟ',
  45188. 'ⲡ' => 'Ⲡ',
  45189. 'â²£' => 'â²¢',
  45190. 'ⲥ' => 'Ⲥ',
  45191. 'ⲧ' => 'Ⲧ',
  45192. 'ⲩ' => 'Ⲩ',
  45193. 'ⲫ' => 'Ⲫ',
  45194. 'ⲭ' => 'Ⲭ',
  45195. 'ⲯ' => 'Ⲯ',
  45196. 'â²±' => 'â²°',
  45197. 'â²³' => 'â²²',
  45198. 'â²µ' => 'â²´',
  45199. 'â²·' => 'â²¶',
  45200. 'ⲹ' => 'Ⲹ',
  45201. 'ⲻ' => 'Ⲻ',
  45202. 'â²½' => 'â²¼',
  45203. 'ⲿ' => 'Ⲿ',
  45204. '�' => 'Ⳁ',
  45205. 'ⳃ' => 'Ⳃ',
  45206. 'ⳅ' => 'Ⳅ',
  45207. 'ⳇ' => 'Ⳇ',
  45208. 'ⳉ' => 'Ⳉ',
  45209. 'ⳋ' => 'Ⳋ',
  45210. '�' => 'Ⳍ',
  45211. '�' => 'Ⳏ',
  45212. 'ⳑ' => '�',
  45213. 'ⳓ' => 'Ⳓ',
  45214. 'ⳕ' => 'Ⳕ',
  45215. 'â³—' => 'â³–',
  45216. 'ⳙ' => 'Ⳙ',
  45217. 'ⳛ' => 'Ⳛ',
  45218. '�' => 'Ⳝ',
  45219. 'ⳟ' => 'Ⳟ',
  45220. 'ⳡ' => 'Ⳡ',
  45221. 'â³£' => 'â³¢',
  45222. 'ⳬ' => 'Ⳬ',
  45223. 'â³®' => 'â³­',
  45224. 'â³³' => 'â³²',
  45225. 'â´€' => 'á‚ ',
  45226. 'â´�' => 'á‚¡',
  45227. 'â´‚' => 'á‚¢',
  45228. 'â´ƒ' => 'á‚£',
  45229. 'ⴄ' => 'Ⴄ',
  45230. 'â´…' => 'á‚¥',
  45231. 'ⴆ' => 'Ⴆ',
  45232. 'â´‡' => 'á‚§',
  45233. 'ⴈ' => 'Ⴈ',
  45234. 'â´‰' => 'á‚©',
  45235. 'ⴊ' => 'Ⴊ',
  45236. 'â´‹' => 'á‚«',
  45237. 'ⴌ' => 'Ⴌ',
  45238. 'â´�' => 'á‚­',
  45239. 'â´Ž' => 'á‚®',
  45240. '�' => 'Ⴏ',
  45241. 'â´�' => 'á‚°',
  45242. 'ⴑ' => 'Ⴑ',
  45243. 'ⴒ' => 'Ⴒ',
  45244. 'ⴓ' => 'Ⴓ',
  45245. 'â´”' => 'á‚´',
  45246. 'ⴕ' => 'Ⴕ',
  45247. 'â´–' => 'á‚¶',
  45248. 'â´—' => 'á‚·',
  45249. 'ⴘ' => 'Ⴘ',
  45250. 'ⴙ' => 'Ⴙ',
  45251. 'ⴚ' => 'Ⴚ',
  45252. 'â´›' => 'á‚»',
  45253. 'ⴜ' => 'Ⴜ',
  45254. '�' => 'Ⴝ',
  45255. 'ⴞ' => 'Ⴞ',
  45256. 'â´Ÿ' => 'á‚¿',
  45257. 'ⴠ' => 'Ⴠ',
  45258. 'ⴡ' => '�',
  45259. 'ⴢ' => 'Ⴢ',
  45260. 'ⴣ' => 'Ⴣ',
  45261. 'ⴤ' => 'Ⴤ',
  45262. 'ⴥ' => 'Ⴥ',
  45263. 'ⴧ' => 'Ⴧ',
  45264. 'ⴭ' => '�',
  45265. '�' => 'Ꙁ',
  45266. 'ꙃ' => 'Ꙃ',
  45267. 'ꙅ' => 'Ꙅ',
  45268. 'ꙇ' => 'Ꙇ',
  45269. 'ꙉ' => 'Ꙉ',
  45270. 'ꙋ' => 'Ꙋ',
  45271. '�' => 'Ꙍ',
  45272. '�' => 'Ꙏ',
  45273. 'ꙑ' => '�',
  45274. 'ꙓ' => 'Ꙓ',
  45275. 'ꙕ' => 'Ꙕ',
  45276. 'ê™—' => 'ê™–',
  45277. 'ꙙ' => 'Ꙙ',
  45278. 'ꙛ' => 'Ꙛ',
  45279. '�' => 'Ꙝ',
  45280. 'ꙟ' => 'Ꙟ',
  45281. 'ꙡ' => 'Ꙡ',
  45282. 'ꙣ' => 'Ꙣ',
  45283. 'ꙥ' => 'Ꙥ',
  45284. 'ꙧ' => 'Ꙧ',
  45285. 'ꙩ' => 'Ꙩ',
  45286. 'ꙫ' => 'Ꙫ',
  45287. 'ꙭ' => 'Ꙭ',
  45288. '�' => 'Ꚁ',
  45289. 'ꚃ' => 'Ꚃ',
  45290. 'êš…' => 'êš„',
  45291. 'ꚇ' => 'Ꚇ',
  45292. 'ꚉ' => 'Ꚉ',
  45293. 'ꚋ' => 'Ꚋ',
  45294. '�' => 'Ꚍ',
  45295. '�' => 'Ꚏ',
  45296. 'ꚑ' => '�',
  45297. 'êš“' => 'êš’',
  45298. 'êš•' => 'êš”',
  45299. 'êš—' => 'êš–',
  45300. 'ꚙ' => 'Ꚙ',
  45301. 'êš›' => 'êšš',
  45302. 'ꜣ' => 'Ꜣ',
  45303. 'ꜥ' => 'Ꜥ',
  45304. 'ꜧ' => 'Ꜧ',
  45305. 'ꜩ' => 'Ꜩ',
  45306. 'ꜫ' => 'Ꜫ',
  45307. 'ꜭ' => 'Ꜭ',
  45308. 'ꜯ' => 'Ꜯ',
  45309. 'ꜳ' => 'Ꜳ',
  45310. 'ꜵ' => 'Ꜵ',
  45311. 'ꜷ' => 'Ꜷ',
  45312. 'ꜹ' => 'Ꜹ',
  45313. 'ꜻ' => 'Ꜻ',
  45314. 'ꜽ' => 'Ꜽ',
  45315. 'ꜿ' => 'Ꜿ',
  45316. '�' => '�',
  45317. '�' => '�',
  45318. '�' => '�',
  45319. '�' => '�',
  45320. '�' => '�',
  45321. '�' => '�',
  45322. '�' => '�',
  45323. '�' => '�',
  45324. '�' => '�',
  45325. '�' => '�',
  45326. '�' => '�',
  45327. '�' => '�',
  45328. '�' => '�',
  45329. '�' => '�',
  45330. '�' => '�',
  45331. '�' => '�',
  45332. '�' => '�',
  45333. '�' => '�',
  45334. '�' => '�',
  45335. '�' => '�',
  45336. '�' => '�',
  45337. '�' => '�',
  45338. '�' => '�',
  45339. '�' => '�',
  45340. '�' => '�',
  45341. '�' => '�',
  45342. '�' => '�',
  45343. '�' => 'Ꞁ',
  45344. 'ꞃ' => 'Ꞃ',
  45345. 'êž…' => 'êž„',
  45346. 'ꞇ' => 'Ꞇ',
  45347. 'ꞌ' => 'Ꞌ',
  45348. 'ꞑ' => '�',
  45349. 'êž“' => 'êž’',
  45350. 'êž—' => 'êž–',
  45351. 'ꞙ' => 'Ꞙ',
  45352. 'êž›' => 'êžš',
  45353. '�' => 'Ꞝ',
  45354. 'ꞟ' => 'Ꞟ',
  45355. 'êž¡' => 'êž ',
  45356. 'ꞣ' => 'Ꞣ',
  45357. 'ꞥ' => 'Ꞥ',
  45358. 'ꞧ' => 'Ꞧ',
  45359. 'ꞩ' => 'Ꞩ',
  45360. '�' => 'A',
  45361. 'b' => 'B',
  45362. 'c' => 'C',
  45363. 'd' => 'D',
  45364. 'ï½…' => 'ï¼¥',
  45365. 'f' => 'F',
  45366. 'g' => 'G',
  45367. 'h' => 'H',
  45368. 'i' => 'I',
  45369. 'j' => 'J',
  45370. 'k' => 'K',
  45371. 'l' => 'L',
  45372. '�' => 'M',
  45373. 'n' => 'N',
  45374. '�' => 'O',
  45375. '�' => 'P',
  45376. 'q' => 'Q',
  45377. 'ï½’' => 'ï¼²',
  45378. 's' => 'S',
  45379. 'ï½”' => 'ï¼´',
  45380. 'u' => 'U',
  45381. 'ï½–' => 'ï¼¶',
  45382. 'ï½—' => 'ï¼·',
  45383. 'x' => 'X',
  45384. 'ï½™' => 'ï¼¹',
  45385. 'z' => 'Z',
  45386. '�' => '�',
  45387. '�' => '�',
  45388. '�' => '�',
  45389. '�' => '�',
  45390. '�' => '�',
  45391. '�' => '�',
  45392. '�' => '�',
  45393. '�' => '�',
  45394. '�' => '�',
  45395. '�' => '�',
  45396. '�' => '�',
  45397. '�' => '�',
  45398. '�' => '�',
  45399. '�' => '�',
  45400. '�' => '�',
  45401. '�' => '�',
  45402. '�' => '�',
  45403. '�' => '�',
  45404. '�' => '�',
  45405. '�' => '�',
  45406. '�' => '�',
  45407. '�' => '�',
  45408. '�' => '�',
  45409. '�' => '�',
  45410. '�' => '�',
  45411. '�' => '�',
  45412. '�' => '�',
  45413. '�' => '�',
  45414. '�' => '�',
  45415. '�' => '�',
  45416. '�' => '�',
  45417. '�' => '�',
  45418. '�' => '�',
  45419. '�' => '�',
  45420. '�' => '�',
  45421. '�' => '�',
  45422. '�' => '�',
  45423. '�' => '�',
  45424. '�' => '�',
  45425. '�' => '�',
  45426. 'ð‘£€' => 'ð‘¢ ',
  45427. '�' => '𑢡',
  45428. '𑣂' => '𑢢',
  45429. '𑣃' => '𑢣',
  45430. '𑣄' => '𑢤',
  45431. 'ð‘£…' => 'ð‘¢¥',
  45432. '𑣆' => '𑢦',
  45433. '𑣇' => '𑢧',
  45434. '𑣈' => '𑢨',
  45435. '𑣉' => '𑢩',
  45436. '𑣊' => '𑢪',
  45437. '𑣋' => '𑢫',
  45438. '𑣌' => '𑢬',
  45439. '�' => '𑢭',
  45440. '𑣎' => '𑢮',
  45441. '�' => '𑢯',
  45442. '�' => '𑢰',
  45443. '𑣑' => '𑢱',
  45444. 'ð‘£’' => 'ð‘¢²',
  45445. '𑣓' => '𑢳',
  45446. 'ð‘£”' => 'ð‘¢´',
  45447. '𑣕' => '𑢵',
  45448. 'ð‘£–' => 'ð‘¢¶',
  45449. 'ð‘£—' => 'ð‘¢·',
  45450. '𑣘' => '𑢸',
  45451. 'ð‘£™' => 'ð‘¢¹',
  45452. '𑣚' => '𑢺',
  45453. 'ð‘£›' => 'ð‘¢»',
  45454. '𑣜' => '𑢼',
  45455. '�' => '𑢽',
  45456. '𑣞' => '𑢾',
  45457. '𑣟' => '𑢿',
  45458. );
  45459. <?php
  45460. use Symfony\Polyfill\Mbstring as p;
  45461. if (!function_exists('mb_strlen')) {
  45462. define('MB_CASE_UPPER', 0);
  45463. define('MB_CASE_LOWER', 1);
  45464. define('MB_CASE_TITLE', 2);
  45465. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  45466. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  45467. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  45468. function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
  45469. function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
  45470. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  45471. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  45472. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  45473. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  45474. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  45475. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  45476. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  45477. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  45478. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  45479. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  45480. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  45481. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  45482. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  45483. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  45484. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  45485. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  45486. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  45487. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  45488. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  45489. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  45490. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  45491. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  45492. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  45493. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  45494. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  45495. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  45496. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  45497. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  45498. function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
  45499. }
  45500. if (!function_exists('mb_chr')) {
  45501. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  45502. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  45503. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  45504. }
  45505. <?php
  45506. namespace Symfony\Component\Process\Exception;
  45507. interface ExceptionInterface
  45508. {
  45509. }
  45510. <?php
  45511. namespace Symfony\Component\Process\Exception;
  45512. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  45513. {
  45514. }
  45515. <?php
  45516. namespace Symfony\Component\Process\Exception;
  45517. class LogicException extends \LogicException implements ExceptionInterface
  45518. {
  45519. }
  45520. <?php
  45521. namespace Symfony\Component\Process\Exception;
  45522. use Symfony\Component\Process\Process;
  45523. class ProcessFailedException extends RuntimeException
  45524. {
  45525. private $process;
  45526. public function __construct(Process $process)
  45527. {
  45528. if ($process->isSuccessful()) {
  45529. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  45530. }
  45531. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  45532. $process->getCommandLine(),
  45533. $process->getExitCode(),
  45534. $process->getExitCodeText(),
  45535. $process->getWorkingDirectory()
  45536. );
  45537. if (!$process->isOutputDisabled()) {
  45538. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  45539. $process->getOutput(),
  45540. $process->getErrorOutput()
  45541. );
  45542. }
  45543. parent::__construct($error);
  45544. $this->process = $process;
  45545. }
  45546. public function getProcess()
  45547. {
  45548. return $this->process;
  45549. }
  45550. }
  45551. <?php
  45552. namespace Symfony\Component\Process\Exception;
  45553. use Symfony\Component\Process\Process;
  45554. class ProcessTimedOutException extends RuntimeException
  45555. {
  45556. const TYPE_GENERAL = 1;
  45557. const TYPE_IDLE = 2;
  45558. private $process;
  45559. private $timeoutType;
  45560. public function __construct(Process $process, $timeoutType)
  45561. {
  45562. $this->process = $process;
  45563. $this->timeoutType = $timeoutType;
  45564. parent::__construct(sprintf(
  45565. 'The process "%s" exceeded the timeout of %s seconds.',
  45566. $process->getCommandLine(),
  45567. $this->getExceededTimeout()
  45568. ));
  45569. }
  45570. public function getProcess()
  45571. {
  45572. return $this->process;
  45573. }
  45574. public function isGeneralTimeout()
  45575. {
  45576. return self::TYPE_GENERAL === $this->timeoutType;
  45577. }
  45578. public function isIdleTimeout()
  45579. {
  45580. return self::TYPE_IDLE === $this->timeoutType;
  45581. }
  45582. public function getExceededTimeout()
  45583. {
  45584. switch ($this->timeoutType) {
  45585. case self::TYPE_GENERAL:
  45586. return $this->process->getTimeout();
  45587. case self::TYPE_IDLE:
  45588. return $this->process->getIdleTimeout();
  45589. default:
  45590. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  45591. }
  45592. }
  45593. }
  45594. <?php
  45595. namespace Symfony\Component\Process\Exception;
  45596. class RuntimeException extends \RuntimeException implements ExceptionInterface
  45597. {
  45598. }
  45599. <?php
  45600. namespace Symfony\Component\Process;
  45601. class ExecutableFinder
  45602. {
  45603. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  45604. public function setSuffixes(array $suffixes)
  45605. {
  45606. $this->suffixes = $suffixes;
  45607. }
  45608. public function addSuffix($suffix)
  45609. {
  45610. $this->suffixes[] = $suffix;
  45611. }
  45612. public function find($name, $default = null, array $extraDirs = array())
  45613. {
  45614. if (ini_get('open_basedir')) {
  45615. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  45616. $dirs = array();
  45617. foreach ($searchPath as $path) {
  45618. if (@is_dir($path)) {
  45619. $dirs[] = $path;
  45620. } else {
  45621. if (basename($path) == $name && @is_executable($path)) {
  45622. return $path;
  45623. }
  45624. }
  45625. }
  45626. } else {
  45627. $dirs = array_merge(
  45628. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  45629. $extraDirs
  45630. );
  45631. }
  45632. $suffixes = array('');
  45633. if ('\\' === \DIRECTORY_SEPARATOR) {
  45634. $pathExt = getenv('PATHEXT');
  45635. $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  45636. }
  45637. foreach ($suffixes as $suffix) {
  45638. foreach ($dirs as $dir) {
  45639. if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
  45640. return $file;
  45641. }
  45642. }
  45643. }
  45644. return $default;
  45645. }
  45646. }
  45647. Copyright (c) 2004-2018 Fabien Potencier
  45648. Permission is hereby granted, free of charge, to any person obtaining a copy
  45649. of this software and associated documentation files (the "Software"), to deal
  45650. in the Software without restriction, including without limitation the rights
  45651. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  45652. copies of the Software, and to permit persons to whom the Software is furnished
  45653. to do so, subject to the following conditions:
  45654. The above copyright notice and this permission notice shall be included in all
  45655. copies or substantial portions of the Software.
  45656. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  45657. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  45658. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  45659. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  45660. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  45661. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  45662. THE SOFTWARE.
  45663. <?php
  45664. namespace Symfony\Component\Process;
  45665. class PhpExecutableFinder
  45666. {
  45667. private $executableFinder;
  45668. public function __construct()
  45669. {
  45670. $this->executableFinder = new ExecutableFinder();
  45671. }
  45672. public function find($includeArgs = true)
  45673. {
  45674. $args = $this->findArguments();
  45675. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  45676. if (\defined('HHVM_VERSION')) {
  45677. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  45678. }
  45679. if (\defined('PHP_BINARY') && PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
  45680. return PHP_BINARY.$args;
  45681. }
  45682. if ($php = getenv('PHP_PATH')) {
  45683. if (!@is_executable($php)) {
  45684. return false;
  45685. }
  45686. return $php;
  45687. }
  45688. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  45689. if (@is_executable($php)) {
  45690. return $php;
  45691. }
  45692. }
  45693. if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  45694. return $php;
  45695. }
  45696. $dirs = array(PHP_BINDIR);
  45697. if ('\\' === \DIRECTORY_SEPARATOR) {
  45698. $dirs[] = 'C:\xampp\php\\';
  45699. }
  45700. return $this->executableFinder->find('php', false, $dirs);
  45701. }
  45702. public function findArguments()
  45703. {
  45704. $arguments = array();
  45705. if (\defined('HHVM_VERSION')) {
  45706. $arguments[] = '--php';
  45707. } elseif ('phpdbg' === \PHP_SAPI) {
  45708. $arguments[] = '-qrr';
  45709. }
  45710. return $arguments;
  45711. }
  45712. }
  45713. <?php
  45714. namespace Symfony\Component\Process;
  45715. use Symfony\Component\Process\Exception\RuntimeException;
  45716. class PhpProcess extends Process
  45717. {
  45718. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  45719. {
  45720. $executableFinder = new PhpExecutableFinder();
  45721. if (false === $php = $executableFinder->find()) {
  45722. $php = null;
  45723. }
  45724. if ('phpdbg' === \PHP_SAPI) {
  45725. $file = tempnam(sys_get_temp_dir(), 'dbg');
  45726. file_put_contents($file, $script);
  45727. register_shutdown_function('unlink', $file);
  45728. $php .= ' '.ProcessUtils::escapeArgument($file);
  45729. $script = null;
  45730. }
  45731. if ('\\' !== \DIRECTORY_SEPARATOR && null !== $php) {
  45732. $php = 'exec '.$php;
  45733. }
  45734. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  45735. }
  45736. public function setPhpBinary($php)
  45737. {
  45738. $this->setCommandLine($php);
  45739. }
  45740. public function start($callback = null)
  45741. {
  45742. if (null === $this->getCommandLine()) {
  45743. throw new RuntimeException('Unable to find the PHP executable.');
  45744. }
  45745. parent::start($callback);
  45746. }
  45747. }
  45748. <?php
  45749. namespace Symfony\Component\Process\Pipes;
  45750. abstract class AbstractPipes implements PipesInterface
  45751. {
  45752. public $pipes = array();
  45753. private $inputBuffer = '';
  45754. private $input;
  45755. private $blocked = true;
  45756. private $lastError;
  45757. public function __construct($input)
  45758. {
  45759. if (\is_resource($input)) {
  45760. $this->input = $input;
  45761. } elseif (\is_string($input)) {
  45762. $this->inputBuffer = $input;
  45763. } else {
  45764. $this->inputBuffer = (string) $input;
  45765. }
  45766. }
  45767. public function close()
  45768. {
  45769. foreach ($this->pipes as $pipe) {
  45770. fclose($pipe);
  45771. }
  45772. $this->pipes = array();
  45773. }
  45774. protected function hasSystemCallBeenInterrupted()
  45775. {
  45776. $lastError = $this->lastError;
  45777. $this->lastError = null;
  45778. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  45779. }
  45780. protected function unblock()
  45781. {
  45782. if (!$this->blocked) {
  45783. return;
  45784. }
  45785. foreach ($this->pipes as $pipe) {
  45786. stream_set_blocking($pipe, 0);
  45787. }
  45788. if (null !== $this->input) {
  45789. stream_set_blocking($this->input, 0);
  45790. }
  45791. $this->blocked = false;
  45792. }
  45793. protected function write()
  45794. {
  45795. if (!isset($this->pipes[0])) {
  45796. return;
  45797. }
  45798. $input = $this->input;
  45799. $r = $e = array();
  45800. $w = array($this->pipes[0]);
  45801. if (false === @stream_select($r, $w, $e, 0, 0)) {
  45802. return;
  45803. }
  45804. foreach ($w as $stdin) {
  45805. if (isset($this->inputBuffer[0])) {
  45806. $written = fwrite($stdin, $this->inputBuffer);
  45807. $this->inputBuffer = substr($this->inputBuffer, $written);
  45808. if (isset($this->inputBuffer[0])) {
  45809. return array($this->pipes[0]);
  45810. }
  45811. }
  45812. if ($input) {
  45813. for (;;) {
  45814. $data = fread($input, self::CHUNK_SIZE);
  45815. if (!isset($data[0])) {
  45816. break;
  45817. }
  45818. $written = fwrite($stdin, $data);
  45819. $data = substr($data, $written);
  45820. if (isset($data[0])) {
  45821. $this->inputBuffer = $data;
  45822. return array($this->pipes[0]);
  45823. }
  45824. }
  45825. if (feof($input)) {
  45826. $this->input = null;
  45827. }
  45828. }
  45829. }
  45830. if (null === $this->input && !isset($this->inputBuffer[0])) {
  45831. fclose($this->pipes[0]);
  45832. unset($this->pipes[0]);
  45833. } elseif (!$w) {
  45834. return array($this->pipes[0]);
  45835. }
  45836. }
  45837. public function handleError($type, $msg)
  45838. {
  45839. $this->lastError = $msg;
  45840. }
  45841. }
  45842. <?php
  45843. namespace Symfony\Component\Process\Pipes;
  45844. interface PipesInterface
  45845. {
  45846. const CHUNK_SIZE = 16384;
  45847. public function getDescriptors();
  45848. public function getFiles();
  45849. public function readAndWrite($blocking, $close = false);
  45850. public function areOpen();
  45851. public function close();
  45852. }
  45853. <?php
  45854. namespace Symfony\Component\Process\Pipes;
  45855. use Symfony\Component\Process\Process;
  45856. class UnixPipes extends AbstractPipes
  45857. {
  45858. private $ttyMode;
  45859. private $ptyMode;
  45860. private $disableOutput;
  45861. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  45862. {
  45863. $this->ttyMode = (bool) $ttyMode;
  45864. $this->ptyMode = (bool) $ptyMode;
  45865. $this->disableOutput = (bool) $disableOutput;
  45866. parent::__construct($input);
  45867. }
  45868. public function __destruct()
  45869. {
  45870. $this->close();
  45871. }
  45872. public function getDescriptors()
  45873. {
  45874. if ($this->disableOutput) {
  45875. $nullstream = fopen('/dev/null', 'c');
  45876. return array(
  45877. array('pipe', 'r'),
  45878. $nullstream,
  45879. $nullstream,
  45880. );
  45881. }
  45882. if ($this->ttyMode) {
  45883. return array(
  45884. array('file', '/dev/tty', 'r'),
  45885. array('file', '/dev/tty', 'w'),
  45886. array('file', '/dev/tty', 'w'),
  45887. );
  45888. }
  45889. if ($this->ptyMode && Process::isPtySupported()) {
  45890. return array(
  45891. array('pty'),
  45892. array('pty'),
  45893. array('pty'),
  45894. );
  45895. }
  45896. return array(
  45897. array('pipe', 'r'),
  45898. array('pipe', 'w'),
  45899. array('pipe', 'w'),
  45900. );
  45901. }
  45902. public function getFiles()
  45903. {
  45904. return array();
  45905. }
  45906. public function readAndWrite($blocking, $close = false)
  45907. {
  45908. $this->unblock();
  45909. $w = $this->write();
  45910. $read = $e = array();
  45911. $r = $this->pipes;
  45912. unset($r[0]);
  45913. set_error_handler(array($this, 'handleError'));
  45914. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  45915. restore_error_handler();
  45916. if (!$this->hasSystemCallBeenInterrupted()) {
  45917. $this->pipes = array();
  45918. }
  45919. return $read;
  45920. }
  45921. restore_error_handler();
  45922. foreach ($r as $pipe) {
  45923. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  45924. do {
  45925. $data = fread($pipe, self::CHUNK_SIZE);
  45926. $read[$type] .= $data;
  45927. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  45928. if (!isset($read[$type][0])) {
  45929. unset($read[$type]);
  45930. }
  45931. if ($close && feof($pipe)) {
  45932. fclose($pipe);
  45933. unset($this->pipes[$type]);
  45934. }
  45935. }
  45936. return $read;
  45937. }
  45938. public function areOpen()
  45939. {
  45940. return (bool) $this->pipes;
  45941. }
  45942. public static function create(Process $process, $input)
  45943. {
  45944. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  45945. }
  45946. }
  45947. <?php
  45948. namespace Symfony\Component\Process\Pipes;
  45949. use Symfony\Component\Process\Exception\RuntimeException;
  45950. use Symfony\Component\Process\Process;
  45951. class WindowsPipes extends AbstractPipes
  45952. {
  45953. private $files = array();
  45954. private $fileHandles = array();
  45955. private $lockHandles = array();
  45956. private $readBytes = array(
  45957. Process::STDOUT => 0,
  45958. Process::STDERR => 0,
  45959. );
  45960. private $disableOutput;
  45961. public function __construct($disableOutput, $input)
  45962. {
  45963. $this->disableOutput = (bool) $disableOutput;
  45964. if (!$this->disableOutput) {
  45965. $pipes = array(
  45966. Process::STDOUT => Process::OUT,
  45967. Process::STDERR => Process::ERR,
  45968. );
  45969. $tmpDir = sys_get_temp_dir();
  45970. $lastError = 'unknown reason';
  45971. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  45972. for ($i = 0;; ++$i) {
  45973. foreach ($pipes as $pipe => $name) {
  45974. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  45975. if (!$h = fopen($file.'.lock', 'w')) {
  45976. restore_error_handler();
  45977. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError));
  45978. }
  45979. if (!flock($h, LOCK_EX | LOCK_NB)) {
  45980. continue 2;
  45981. }
  45982. if (isset($this->lockHandles[$pipe])) {
  45983. flock($this->lockHandles[$pipe], LOCK_UN);
  45984. fclose($this->lockHandles[$pipe]);
  45985. }
  45986. $this->lockHandles[$pipe] = $h;
  45987. if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
  45988. flock($this->lockHandles[$pipe], LOCK_UN);
  45989. fclose($this->lockHandles[$pipe]);
  45990. unset($this->lockHandles[$pipe]);
  45991. continue 2;
  45992. }
  45993. $this->fileHandles[$pipe] = $h;
  45994. $this->files[$pipe] = $file;
  45995. }
  45996. break;
  45997. }
  45998. restore_error_handler();
  45999. }
  46000. parent::__construct($input);
  46001. }
  46002. public function __destruct()
  46003. {
  46004. $this->close();
  46005. }
  46006. public function getDescriptors()
  46007. {
  46008. if ($this->disableOutput) {
  46009. $nullstream = fopen('NUL', 'c');
  46010. return array(
  46011. array('pipe', 'r'),
  46012. $nullstream,
  46013. $nullstream,
  46014. );
  46015. }
  46016. return array(
  46017. array('pipe', 'r'),
  46018. array('file', 'NUL', 'w'),
  46019. array('file', 'NUL', 'w'),
  46020. );
  46021. }
  46022. public function getFiles()
  46023. {
  46024. return $this->files;
  46025. }
  46026. public function readAndWrite($blocking, $close = false)
  46027. {
  46028. $this->unblock();
  46029. $w = $this->write();
  46030. $read = $r = $e = array();
  46031. if ($blocking) {
  46032. if ($w) {
  46033. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  46034. } elseif ($this->fileHandles) {
  46035. usleep(Process::TIMEOUT_PRECISION * 1E6);
  46036. }
  46037. }
  46038. foreach ($this->fileHandles as $type => $fileHandle) {
  46039. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  46040. if (isset($data[0])) {
  46041. $this->readBytes[$type] += \strlen($data);
  46042. $read[$type] = $data;
  46043. }
  46044. if ($close) {
  46045. ftruncate($fileHandle, 0);
  46046. fclose($fileHandle);
  46047. flock($this->lockHandles[$type], LOCK_UN);
  46048. fclose($this->lockHandles[$type]);
  46049. unset($this->fileHandles[$type], $this->lockHandles[$type]);
  46050. }
  46051. }
  46052. return $read;
  46053. }
  46054. public function areOpen()
  46055. {
  46056. return $this->pipes && $this->fileHandles;
  46057. }
  46058. public function close()
  46059. {
  46060. parent::close();
  46061. foreach ($this->fileHandles as $type => $handle) {
  46062. ftruncate($handle, 0);
  46063. fclose($handle);
  46064. flock($this->lockHandles[$type], LOCK_UN);
  46065. fclose($this->lockHandles[$type]);
  46066. }
  46067. $this->fileHandles = $this->lockHandles = array();
  46068. }
  46069. public static function create(Process $process, $input)
  46070. {
  46071. return new static($process->isOutputDisabled(), $input);
  46072. }
  46073. }
  46074. <?php
  46075. namespace Symfony\Component\Process;
  46076. use Symfony\Component\Process\Exception\InvalidArgumentException;
  46077. use Symfony\Component\Process\Exception\LogicException;
  46078. use Symfony\Component\Process\Exception\ProcessFailedException;
  46079. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  46080. use Symfony\Component\Process\Exception\RuntimeException;
  46081. use Symfony\Component\Process\Pipes\PipesInterface;
  46082. use Symfony\Component\Process\Pipes\UnixPipes;
  46083. use Symfony\Component\Process\Pipes\WindowsPipes;
  46084. class Process
  46085. {
  46086. const ERR = 'err';
  46087. const OUT = 'out';
  46088. const STATUS_READY = 'ready';
  46089. const STATUS_STARTED = 'started';
  46090. const STATUS_TERMINATED = 'terminated';
  46091. const STDIN = 0;
  46092. const STDOUT = 1;
  46093. const STDERR = 2;
  46094. const TIMEOUT_PRECISION = 0.2;
  46095. private $callback;
  46096. private $commandline;
  46097. private $cwd;
  46098. private $env;
  46099. private $input;
  46100. private $starttime;
  46101. private $lastOutputTime;
  46102. private $timeout;
  46103. private $idleTimeout;
  46104. private $options;
  46105. private $exitcode;
  46106. private $fallbackStatus = array();
  46107. private $processInformation;
  46108. private $outputDisabled = false;
  46109. private $stdout;
  46110. private $stderr;
  46111. private $enhanceWindowsCompatibility = true;
  46112. private $enhanceSigchildCompatibility;
  46113. private $process;
  46114. private $status = self::STATUS_READY;
  46115. private $incrementalOutputOffset = 0;
  46116. private $incrementalErrorOutputOffset = 0;
  46117. private $tty;
  46118. private $pty;
  46119. private $useFileHandles = false;
  46120. private $processPipes;
  46121. private $latestSignal;
  46122. private static $sigchild;
  46123. public static $exitCodes = array(
  46124. 0 => 'OK',
  46125. 1 => 'General error',
  46126. 2 => 'Misuse of shell builtins',
  46127. 126 => 'Invoked command cannot execute',
  46128. 127 => 'Command not found',
  46129. 128 => 'Invalid exit argument',
  46130. 129 => 'Hangup',
  46131. 130 => 'Interrupt',
  46132. 131 => 'Quit and dump core',
  46133. 132 => 'Illegal instruction',
  46134. 133 => 'Trace/breakpoint trap',
  46135. 134 => 'Process aborted',
  46136. 135 => 'Bus error: "access to undefined portion of memory object"',
  46137. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  46138. 137 => 'Kill (terminate immediately)',
  46139. 138 => 'User-defined 1',
  46140. 139 => 'Segmentation violation',
  46141. 140 => 'User-defined 2',
  46142. 141 => 'Write to pipe with no one reading',
  46143. 142 => 'Signal raised by alarm',
  46144. 143 => 'Termination (request to terminate)',
  46145. 145 => 'Child process terminated, stopped (or continued*)',
  46146. 146 => 'Continue if stopped',
  46147. 147 => 'Stop executing temporarily',
  46148. 148 => 'Terminal stop signal',
  46149. 149 => 'Background process attempting to read from tty ("in")',
  46150. 150 => 'Background process attempting to write to tty ("out")',
  46151. 151 => 'Urgent data available on socket',
  46152. 152 => 'CPU time limit exceeded',
  46153. 153 => 'File size limit exceeded',
  46154. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  46155. 155 => 'Profiling timer expired',
  46156. 157 => 'Pollable event',
  46157. 159 => 'Bad syscall',
  46158. );
  46159. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  46160. {
  46161. if (!\function_exists('proc_open')) {
  46162. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  46163. }
  46164. $this->commandline = $commandline;
  46165. $this->cwd = $cwd;
  46166. if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
  46167. $this->cwd = getcwd();
  46168. }
  46169. if (null !== $env) {
  46170. $this->setEnv($env);
  46171. }
  46172. $this->setInput($input);
  46173. $this->setTimeout($timeout);
  46174. $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
  46175. $this->pty = false;
  46176. $this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  46177. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  46178. }
  46179. public function __destruct()
  46180. {
  46181. $this->stop(0);
  46182. }
  46183. public function __clone()
  46184. {
  46185. $this->resetProcessData();
  46186. }
  46187. public function run($callback = null)
  46188. {
  46189. $this->start($callback);
  46190. return $this->wait();
  46191. }
  46192. public function mustRun($callback = null)
  46193. {
  46194. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46195. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  46196. }
  46197. if (0 !== $this->run($callback)) {
  46198. throw new ProcessFailedException($this);
  46199. }
  46200. return $this;
  46201. }
  46202. public function start($callback = null)
  46203. {
  46204. if ($this->isRunning()) {
  46205. throw new RuntimeException('Process is already running');
  46206. }
  46207. if ($this->outputDisabled && null !== $callback) {
  46208. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  46209. }
  46210. $this->resetProcessData();
  46211. $this->starttime = $this->lastOutputTime = microtime(true);
  46212. $this->callback = $this->buildCallback($callback);
  46213. $descriptors = $this->getDescriptors();
  46214. $commandline = $this->commandline;
  46215. if ('\\' === \DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  46216. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  46217. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  46218. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  46219. }
  46220. $commandline .= '"';
  46221. if (!isset($this->options['bypass_shell'])) {
  46222. $this->options['bypass_shell'] = true;
  46223. }
  46224. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46225. $descriptors[3] = array('pipe', 'w');
  46226. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  46227. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  46228. $ptsWorkaround = fopen(__FILE__, 'r');
  46229. }
  46230. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  46231. if (!\is_resource($this->process)) {
  46232. throw new RuntimeException('Unable to launch a new process.');
  46233. }
  46234. $this->status = self::STATUS_STARTED;
  46235. if (isset($descriptors[3])) {
  46236. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  46237. }
  46238. if ($this->tty) {
  46239. return;
  46240. }
  46241. $this->updateStatus(false);
  46242. $this->checkTimeout();
  46243. }
  46244. public function restart($callback = null)
  46245. {
  46246. if ($this->isRunning()) {
  46247. throw new RuntimeException('Process is already running');
  46248. }
  46249. $process = clone $this;
  46250. $process->start($callback);
  46251. return $process;
  46252. }
  46253. public function wait($callback = null)
  46254. {
  46255. $this->requireProcessIsStarted(__FUNCTION__);
  46256. $this->updateStatus(false);
  46257. if (null !== $callback) {
  46258. $this->callback = $this->buildCallback($callback);
  46259. }
  46260. do {
  46261. $this->checkTimeout();
  46262. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  46263. $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  46264. } while ($running);
  46265. while ($this->isRunning()) {
  46266. usleep(1000);
  46267. }
  46268. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  46269. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  46270. }
  46271. return $this->exitcode;
  46272. }
  46273. public function getPid()
  46274. {
  46275. return $this->isRunning() ? $this->processInformation['pid'] : null;
  46276. }
  46277. public function signal($signal)
  46278. {
  46279. $this->doSignal($signal, true);
  46280. return $this;
  46281. }
  46282. public function disableOutput()
  46283. {
  46284. if ($this->isRunning()) {
  46285. throw new RuntimeException('Disabling output while the process is running is not possible.');
  46286. }
  46287. if (null !== $this->idleTimeout) {
  46288. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  46289. }
  46290. $this->outputDisabled = true;
  46291. return $this;
  46292. }
  46293. public function enableOutput()
  46294. {
  46295. if ($this->isRunning()) {
  46296. throw new RuntimeException('Enabling output while the process is running is not possible.');
  46297. }
  46298. $this->outputDisabled = false;
  46299. return $this;
  46300. }
  46301. public function isOutputDisabled()
  46302. {
  46303. return $this->outputDisabled;
  46304. }
  46305. public function getOutput()
  46306. {
  46307. $this->readPipesForOutput(__FUNCTION__);
  46308. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  46309. return '';
  46310. }
  46311. return $ret;
  46312. }
  46313. public function getIncrementalOutput()
  46314. {
  46315. $this->readPipesForOutput(__FUNCTION__);
  46316. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  46317. $this->incrementalOutputOffset = ftell($this->stdout);
  46318. if (false === $latest) {
  46319. return '';
  46320. }
  46321. return $latest;
  46322. }
  46323. public function clearOutput()
  46324. {
  46325. ftruncate($this->stdout, 0);
  46326. fseek($this->stdout, 0);
  46327. $this->incrementalOutputOffset = 0;
  46328. return $this;
  46329. }
  46330. public function getErrorOutput()
  46331. {
  46332. $this->readPipesForOutput(__FUNCTION__);
  46333. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  46334. return '';
  46335. }
  46336. return $ret;
  46337. }
  46338. public function getIncrementalErrorOutput()
  46339. {
  46340. $this->readPipesForOutput(__FUNCTION__);
  46341. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  46342. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  46343. if (false === $latest) {
  46344. return '';
  46345. }
  46346. return $latest;
  46347. }
  46348. public function clearErrorOutput()
  46349. {
  46350. ftruncate($this->stderr, 0);
  46351. fseek($this->stderr, 0);
  46352. $this->incrementalErrorOutputOffset = 0;
  46353. return $this;
  46354. }
  46355. public function getExitCode()
  46356. {
  46357. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46358. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  46359. }
  46360. $this->updateStatus(false);
  46361. return $this->exitcode;
  46362. }
  46363. public function getExitCodeText()
  46364. {
  46365. if (null === $exitcode = $this->getExitCode()) {
  46366. return;
  46367. }
  46368. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  46369. }
  46370. public function isSuccessful()
  46371. {
  46372. return 0 === $this->getExitCode();
  46373. }
  46374. public function hasBeenSignaled()
  46375. {
  46376. $this->requireProcessIsTerminated(__FUNCTION__);
  46377. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46378. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  46379. }
  46380. return $this->processInformation['signaled'];
  46381. }
  46382. public function getTermSignal()
  46383. {
  46384. $this->requireProcessIsTerminated(__FUNCTION__);
  46385. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  46386. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  46387. }
  46388. return $this->processInformation['termsig'];
  46389. }
  46390. public function hasBeenStopped()
  46391. {
  46392. $this->requireProcessIsTerminated(__FUNCTION__);
  46393. return $this->processInformation['stopped'];
  46394. }
  46395. public function getStopSignal()
  46396. {
  46397. $this->requireProcessIsTerminated(__FUNCTION__);
  46398. return $this->processInformation['stopsig'];
  46399. }
  46400. public function isRunning()
  46401. {
  46402. if (self::STATUS_STARTED !== $this->status) {
  46403. return false;
  46404. }
  46405. $this->updateStatus(false);
  46406. return $this->processInformation['running'];
  46407. }
  46408. public function isStarted()
  46409. {
  46410. return self::STATUS_READY != $this->status;
  46411. }
  46412. public function isTerminated()
  46413. {
  46414. $this->updateStatus(false);
  46415. return self::STATUS_TERMINATED == $this->status;
  46416. }
  46417. public function getStatus()
  46418. {
  46419. $this->updateStatus(false);
  46420. return $this->status;
  46421. }
  46422. public function stop($timeout = 10, $signal = null)
  46423. {
  46424. $timeoutMicro = microtime(true) + $timeout;
  46425. if ($this->isRunning()) {
  46426. $this->doSignal(15, false);
  46427. do {
  46428. usleep(1000);
  46429. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  46430. if ($this->isRunning()) {
  46431. $this->doSignal($signal ?: 9, false);
  46432. }
  46433. }
  46434. if ($this->isRunning()) {
  46435. if (isset($this->fallbackStatus['pid'])) {
  46436. unset($this->fallbackStatus['pid']);
  46437. return $this->stop(0, $signal);
  46438. }
  46439. $this->close();
  46440. }
  46441. return $this->exitcode;
  46442. }
  46443. public function addOutput($line)
  46444. {
  46445. $this->lastOutputTime = microtime(true);
  46446. fseek($this->stdout, 0, SEEK_END);
  46447. fwrite($this->stdout, $line);
  46448. fseek($this->stdout, $this->incrementalOutputOffset);
  46449. }
  46450. public function addErrorOutput($line)
  46451. {
  46452. $this->lastOutputTime = microtime(true);
  46453. fseek($this->stderr, 0, SEEK_END);
  46454. fwrite($this->stderr, $line);
  46455. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  46456. }
  46457. public function getCommandLine()
  46458. {
  46459. return $this->commandline;
  46460. }
  46461. public function setCommandLine($commandline)
  46462. {
  46463. $this->commandline = $commandline;
  46464. return $this;
  46465. }
  46466. public function getTimeout()
  46467. {
  46468. return $this->timeout;
  46469. }
  46470. public function getIdleTimeout()
  46471. {
  46472. return $this->idleTimeout;
  46473. }
  46474. public function setTimeout($timeout)
  46475. {
  46476. $this->timeout = $this->validateTimeout($timeout);
  46477. return $this;
  46478. }
  46479. public function setIdleTimeout($timeout)
  46480. {
  46481. if (null !== $timeout && $this->outputDisabled) {
  46482. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  46483. }
  46484. $this->idleTimeout = $this->validateTimeout($timeout);
  46485. return $this;
  46486. }
  46487. public function setTty($tty)
  46488. {
  46489. if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  46490. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  46491. }
  46492. if ($tty) {
  46493. static $isTtySupported;
  46494. if (null === $isTtySupported) {
  46495. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);
  46496. }
  46497. if (!$isTtySupported) {
  46498. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  46499. }
  46500. }
  46501. $this->tty = (bool) $tty;
  46502. return $this;
  46503. }
  46504. public function isTty()
  46505. {
  46506. return $this->tty;
  46507. }
  46508. public function setPty($bool)
  46509. {
  46510. $this->pty = (bool) $bool;
  46511. return $this;
  46512. }
  46513. public function isPty()
  46514. {
  46515. return $this->pty;
  46516. }
  46517. public function getWorkingDirectory()
  46518. {
  46519. if (null === $this->cwd) {
  46520. return getcwd() ?: null;
  46521. }
  46522. return $this->cwd;
  46523. }
  46524. public function setWorkingDirectory($cwd)
  46525. {
  46526. $this->cwd = $cwd;
  46527. return $this;
  46528. }
  46529. public function getEnv()
  46530. {
  46531. return $this->env;
  46532. }
  46533. public function setEnv(array $env)
  46534. {
  46535. $env = array_filter($env, function ($value) {
  46536. return !\is_array($value);
  46537. });
  46538. $this->env = array();
  46539. foreach ($env as $key => $value) {
  46540. $this->env[$key] = (string) $value;
  46541. }
  46542. return $this;
  46543. }
  46544. public function getStdin()
  46545. {
  46546. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  46547. return $this->getInput();
  46548. }
  46549. public function getInput()
  46550. {
  46551. return $this->input;
  46552. }
  46553. public function setStdin($stdin)
  46554. {
  46555. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  46556. return $this->setInput($stdin);
  46557. }
  46558. public function setInput($input)
  46559. {
  46560. if ($this->isRunning()) {
  46561. throw new LogicException('Input can not be set while the process is running.');
  46562. }
  46563. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  46564. return $this;
  46565. }
  46566. public function getOptions()
  46567. {
  46568. return $this->options;
  46569. }
  46570. public function setOptions(array $options)
  46571. {
  46572. $this->options = $options;
  46573. return $this;
  46574. }
  46575. public function getEnhanceWindowsCompatibility()
  46576. {
  46577. return $this->enhanceWindowsCompatibility;
  46578. }
  46579. public function setEnhanceWindowsCompatibility($enhance)
  46580. {
  46581. $this->enhanceWindowsCompatibility = (bool) $enhance;
  46582. return $this;
  46583. }
  46584. public function getEnhanceSigchildCompatibility()
  46585. {
  46586. return $this->enhanceSigchildCompatibility;
  46587. }
  46588. public function setEnhanceSigchildCompatibility($enhance)
  46589. {
  46590. $this->enhanceSigchildCompatibility = (bool) $enhance;
  46591. return $this;
  46592. }
  46593. public function checkTimeout()
  46594. {
  46595. if (self::STATUS_STARTED !== $this->status) {
  46596. return;
  46597. }
  46598. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  46599. $this->stop(0);
  46600. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  46601. }
  46602. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  46603. $this->stop(0);
  46604. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  46605. }
  46606. }
  46607. public static function isPtySupported()
  46608. {
  46609. static $result;
  46610. if (null !== $result) {
  46611. return $result;
  46612. }
  46613. if ('\\' === \DIRECTORY_SEPARATOR) {
  46614. return $result = false;
  46615. }
  46616. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  46617. }
  46618. private function getDescriptors()
  46619. {
  46620. if ('\\' === \DIRECTORY_SEPARATOR) {
  46621. $this->processPipes = WindowsPipes::create($this, $this->input);
  46622. } else {
  46623. $this->processPipes = UnixPipes::create($this, $this->input);
  46624. }
  46625. return $this->processPipes->getDescriptors();
  46626. }
  46627. protected function buildCallback($callback)
  46628. {
  46629. $that = $this;
  46630. $out = self::OUT;
  46631. $callback = function ($type, $data) use ($that, $callback, $out) {
  46632. if ($out == $type) {
  46633. $that->addOutput($data);
  46634. } else {
  46635. $that->addErrorOutput($data);
  46636. }
  46637. if (null !== $callback) {
  46638. \call_user_func($callback, $type, $data);
  46639. }
  46640. };
  46641. return $callback;
  46642. }
  46643. protected function updateStatus($blocking)
  46644. {
  46645. if (self::STATUS_STARTED !== $this->status) {
  46646. return;
  46647. }
  46648. $this->processInformation = proc_get_status($this->process);
  46649. $running = $this->processInformation['running'];
  46650. $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  46651. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46652. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  46653. }
  46654. if (!$running) {
  46655. $this->close();
  46656. }
  46657. }
  46658. protected function isSigchildEnabled()
  46659. {
  46660. if (null !== self::$sigchild) {
  46661. return self::$sigchild;
  46662. }
  46663. if (!\function_exists('phpinfo') || \defined('HHVM_VERSION')) {
  46664. return self::$sigchild = false;
  46665. }
  46666. ob_start();
  46667. phpinfo(INFO_GENERAL);
  46668. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  46669. }
  46670. private function readPipesForOutput($caller)
  46671. {
  46672. if ($this->outputDisabled) {
  46673. throw new LogicException('Output has been disabled.');
  46674. }
  46675. $this->requireProcessIsStarted($caller);
  46676. $this->updateStatus(false);
  46677. }
  46678. private function validateTimeout($timeout)
  46679. {
  46680. $timeout = (float) $timeout;
  46681. if (0.0 === $timeout) {
  46682. $timeout = null;
  46683. } elseif ($timeout < 0) {
  46684. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  46685. }
  46686. return $timeout;
  46687. }
  46688. private function readPipes($blocking, $close)
  46689. {
  46690. $result = $this->processPipes->readAndWrite($blocking, $close);
  46691. $callback = $this->callback;
  46692. foreach ($result as $type => $data) {
  46693. if (3 !== $type) {
  46694. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  46695. } elseif (!isset($this->fallbackStatus['signaled'])) {
  46696. $this->fallbackStatus['exitcode'] = (int) $data;
  46697. }
  46698. }
  46699. }
  46700. private function close()
  46701. {
  46702. $this->processPipes->close();
  46703. if (\is_resource($this->process)) {
  46704. proc_close($this->process);
  46705. }
  46706. $this->exitcode = $this->processInformation['exitcode'];
  46707. $this->status = self::STATUS_TERMINATED;
  46708. if (-1 === $this->exitcode) {
  46709. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  46710. $this->exitcode = 128 + $this->processInformation['termsig'];
  46711. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46712. $this->processInformation['signaled'] = true;
  46713. $this->processInformation['termsig'] = -1;
  46714. }
  46715. }
  46716. $this->callback = null;
  46717. return $this->exitcode;
  46718. }
  46719. private function resetProcessData()
  46720. {
  46721. $this->starttime = null;
  46722. $this->callback = null;
  46723. $this->exitcode = null;
  46724. $this->fallbackStatus = array();
  46725. $this->processInformation = null;
  46726. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  46727. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  46728. $this->process = null;
  46729. $this->latestSignal = null;
  46730. $this->status = self::STATUS_READY;
  46731. $this->incrementalOutputOffset = 0;
  46732. $this->incrementalErrorOutputOffset = 0;
  46733. }
  46734. private function doSignal($signal, $throwException)
  46735. {
  46736. if (null === $pid = $this->getPid()) {
  46737. if ($throwException) {
  46738. throw new LogicException('Can not send signal on a non running process.');
  46739. }
  46740. return false;
  46741. }
  46742. if ('\\' === \DIRECTORY_SEPARATOR) {
  46743. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  46744. if ($exitCode && $this->isRunning()) {
  46745. if ($throwException) {
  46746. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  46747. }
  46748. return false;
  46749. }
  46750. } else {
  46751. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  46752. $ok = @proc_terminate($this->process, $signal);
  46753. } elseif (\function_exists('posix_kill')) {
  46754. $ok = @posix_kill($pid, $signal);
  46755. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  46756. $ok = false === fgets($pipes[2]);
  46757. }
  46758. if (!$ok) {
  46759. if ($throwException) {
  46760. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  46761. }
  46762. return false;
  46763. }
  46764. }
  46765. $this->latestSignal = (int) $signal;
  46766. $this->fallbackStatus['signaled'] = true;
  46767. $this->fallbackStatus['exitcode'] = -1;
  46768. $this->fallbackStatus['termsig'] = $this->latestSignal;
  46769. return true;
  46770. }
  46771. private function requireProcessIsStarted($functionName)
  46772. {
  46773. if (!$this->isStarted()) {
  46774. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  46775. }
  46776. }
  46777. private function requireProcessIsTerminated($functionName)
  46778. {
  46779. if (!$this->isTerminated()) {
  46780. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  46781. }
  46782. }
  46783. }
  46784. <?php
  46785. namespace Symfony\Component\Process;
  46786. use Symfony\Component\Process\Exception\InvalidArgumentException;
  46787. use Symfony\Component\Process\Exception\LogicException;
  46788. class ProcessBuilder
  46789. {
  46790. private $arguments;
  46791. private $cwd;
  46792. private $env = array();
  46793. private $input;
  46794. private $timeout = 60;
  46795. private $options = array();
  46796. private $inheritEnv = true;
  46797. private $prefix = array();
  46798. private $outputDisabled = false;
  46799. public function __construct(array $arguments = array())
  46800. {
  46801. $this->arguments = $arguments;
  46802. }
  46803. public static function create(array $arguments = array())
  46804. {
  46805. return new static($arguments);
  46806. }
  46807. public function add($argument)
  46808. {
  46809. $this->arguments[] = $argument;
  46810. return $this;
  46811. }
  46812. public function setPrefix($prefix)
  46813. {
  46814. $this->prefix = \is_array($prefix) ? $prefix : array($prefix);
  46815. return $this;
  46816. }
  46817. public function setArguments(array $arguments)
  46818. {
  46819. $this->arguments = $arguments;
  46820. return $this;
  46821. }
  46822. public function setWorkingDirectory($cwd)
  46823. {
  46824. $this->cwd = $cwd;
  46825. return $this;
  46826. }
  46827. public function inheritEnvironmentVariables($inheritEnv = true)
  46828. {
  46829. $this->inheritEnv = $inheritEnv;
  46830. return $this;
  46831. }
  46832. public function setEnv($name, $value)
  46833. {
  46834. $this->env[$name] = $value;
  46835. return $this;
  46836. }
  46837. public function addEnvironmentVariables(array $variables)
  46838. {
  46839. $this->env = array_replace($this->env, $variables);
  46840. return $this;
  46841. }
  46842. public function setInput($input)
  46843. {
  46844. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  46845. return $this;
  46846. }
  46847. public function setTimeout($timeout)
  46848. {
  46849. if (null === $timeout) {
  46850. $this->timeout = null;
  46851. return $this;
  46852. }
  46853. $timeout = (float) $timeout;
  46854. if ($timeout < 0) {
  46855. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  46856. }
  46857. $this->timeout = $timeout;
  46858. return $this;
  46859. }
  46860. public function setOption($name, $value)
  46861. {
  46862. $this->options[$name] = $value;
  46863. return $this;
  46864. }
  46865. public function disableOutput()
  46866. {
  46867. $this->outputDisabled = true;
  46868. return $this;
  46869. }
  46870. public function enableOutput()
  46871. {
  46872. $this->outputDisabled = false;
  46873. return $this;
  46874. }
  46875. public function getProcess()
  46876. {
  46877. if (0 === \count($this->prefix) && 0 === \count($this->arguments)) {
  46878. throw new LogicException('You must add() command arguments before calling getProcess().');
  46879. }
  46880. $options = $this->options;
  46881. $arguments = array_merge($this->prefix, $this->arguments);
  46882. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  46883. if ($this->inheritEnv) {
  46884. $env = array_replace($_ENV, $_SERVER, $this->env);
  46885. } else {
  46886. $env = $this->env;
  46887. }
  46888. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  46889. if ($this->outputDisabled) {
  46890. $process->disableOutput();
  46891. }
  46892. return $process;
  46893. }
  46894. }
  46895. <?php
  46896. namespace Symfony\Component\Process;
  46897. use Symfony\Component\Process\Exception\InvalidArgumentException;
  46898. class ProcessUtils
  46899. {
  46900. private function __construct()
  46901. {
  46902. }
  46903. public static function escapeArgument($argument)
  46904. {
  46905. if ('\\' === \DIRECTORY_SEPARATOR) {
  46906. if ('' === $argument) {
  46907. return escapeshellarg($argument);
  46908. }
  46909. $escapedArgument = '';
  46910. $quote = false;
  46911. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  46912. if ('"' === $part) {
  46913. $escapedArgument .= '\\"';
  46914. } elseif (self::isSurroundedBy($part, '%')) {
  46915. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  46916. } else {
  46917. if ('\\' === substr($part, -1)) {
  46918. $part .= '\\';
  46919. }
  46920. $quote = true;
  46921. $escapedArgument .= $part;
  46922. }
  46923. }
  46924. if ($quote) {
  46925. $escapedArgument = '"'.$escapedArgument.'"';
  46926. }
  46927. return $escapedArgument;
  46928. }
  46929. return "'".str_replace("'", "'\\''", $argument)."'";
  46930. }
  46931. public static function validateInput($caller, $input)
  46932. {
  46933. if (null !== $input) {
  46934. if (\is_resource($input)) {
  46935. return $input;
  46936. }
  46937. if (\is_string($input)) {
  46938. return $input;
  46939. }
  46940. if (is_scalar($input)) {
  46941. return (string) $input;
  46942. }
  46943. if (\is_object($input) && method_exists($input, '__toString')) {
  46944. @trigger_error('Passing an object as an input is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  46945. return (string) $input;
  46946. }
  46947. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  46948. }
  46949. return $input;
  46950. }
  46951. private static function isSurroundedBy($arg, $char)
  46952. {
  46953. return 2 < \strlen($arg) && $char === $arg[0] && $char === $arg[\strlen($arg) - 1];
  46954. }
  46955. }
  46956. Copyright (c) 2011 Jordi Boggiano
  46957. Permission is hereby granted, free of charge, to any person obtaining a copy
  46958. of this software and associated documentation files (the "Software"), to deal
  46959. in the Software without restriction, including without limitation the rights
  46960. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46961. copies of the Software, and to permit persons to whom the Software is furnished
  46962. to do so, subject to the following conditions:
  46963. The above copyright notice and this permission notice shall be included in all
  46964. copies or substantial portions of the Software.
  46965. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46966. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46967. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46968. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46969. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46970. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  46971. THE SOFTWARE.
  46972. <?php
  46973. namespace Seld\JsonLint;
  46974. class DuplicateKeyException extends ParsingException
  46975. {
  46976. public function __construct($message, $key, array $details = array())
  46977. {
  46978. $details['key'] = $key;
  46979. parent::__construct($message, $details);
  46980. }
  46981. public function getKey()
  46982. {
  46983. return $this->details['key'];
  46984. }
  46985. }
  46986. <?php
  46987. namespace Seld\JsonLint;
  46988. use stdClass;
  46989. class JsonParser
  46990. {
  46991. const DETECT_KEY_CONFLICTS = 1;
  46992. const ALLOW_DUPLICATE_KEYS = 2;
  46993. const PARSE_TO_ASSOC = 4;
  46994. private $lexer;
  46995. private $flags;
  46996. private $stack;
  46997. private $vstack;
  46998. private $lstack;
  46999. private $symbols = array(
  47000. 'error' => 2,
  47001. 'JSONString' => 3,
  47002. 'STRING' => 4,
  47003. 'JSONNumber' => 5,
  47004. 'NUMBER' => 6,
  47005. 'JSONNullLiteral' => 7,
  47006. 'NULL' => 8,
  47007. 'JSONBooleanLiteral' => 9,
  47008. 'TRUE' => 10,
  47009. 'FALSE' => 11,
  47010. 'JSONText' => 12,
  47011. 'JSONValue' => 13,
  47012. 'EOF' => 14,
  47013. 'JSONObject' => 15,
  47014. 'JSONArray' => 16,
  47015. '{' => 17,
  47016. '}' => 18,
  47017. 'JSONMemberList' => 19,
  47018. 'JSONMember' => 20,
  47019. ':' => 21,
  47020. ',' => 22,
  47021. '[' => 23,
  47022. ']' => 24,
  47023. 'JSONElementList' => 25,
  47024. '$accept' => 0,
  47025. '$end' => 1,
  47026. );
  47027. private $terminals_ = array(
  47028. 2 => "error",
  47029. 4 => "STRING",
  47030. 6 => "NUMBER",
  47031. 8 => "NULL",
  47032. 10 => "TRUE",
  47033. 11 => "FALSE",
  47034. 14 => "EOF",
  47035. 17 => "{",
  47036. 18 => "}",
  47037. 21 => ":",
  47038. 22 => ",",
  47039. 23 => "[",
  47040. 24 => "]",
  47041. );
  47042. private $productions_ = array(
  47043. 0,
  47044. array(3, 1),
  47045. array(5, 1),
  47046. array(7, 1),
  47047. array(9, 1),
  47048. array(9, 1),
  47049. array(12, 2),
  47050. array(13, 1),
  47051. array(13, 1),
  47052. array(13, 1),
  47053. array(13, 1),
  47054. array(13, 1),
  47055. array(13, 1),
  47056. array(15, 2),
  47057. array(15, 3),
  47058. array(20, 3),
  47059. array(19, 1),
  47060. array(19, 3),
  47061. array(16, 2),
  47062. array(16, 3),
  47063. array(25, 1),
  47064. array(25, 3)
  47065. );
  47066. private $table = array(array(3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 1 => array(3)), array( 14 => array(1,16)), array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)), array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)), array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)), array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)), array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)), array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)), array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)), array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)), array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)), array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)), array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)), array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ), array( 1 => array(2,6)), array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)), array( 18 => array(1,24), 22 => array(1,25)), array( 18 => array(2,16), 22 => array(2,16)), array( 21 => array(1,26)), array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)), array( 22 => array(1,28), 24 => array(1,27)), array( 22 => array(2,20), 24 => array(2,20)), array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)), array( 3 => 20, 4 => array(1,12), 20 => 29 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 18 => array(2,17), 22 => array(2,17)), array( 18 => array(2,15), 22 => array(2,15)), array( 22 => array(2,21), 24 => array(2,21)),
  47067. );
  47068. private $defaultActions = array(
  47069. 16 => array(2, 6)
  47070. );
  47071. public function lint($input, $flags = 0)
  47072. {
  47073. try {
  47074. $this->parse($input, $flags);
  47075. } catch (ParsingException $e) {
  47076. return $e;
  47077. }
  47078. }
  47079. public function parse($input, $flags = 0)
  47080. {
  47081. $this->failOnBOM($input);
  47082. $this->flags = $flags;
  47083. $this->stack = array(0);
  47084. $this->vstack = array(null);
  47085. $this->lstack = array();
  47086. $yytext = '';
  47087. $yylineno = 0;
  47088. $yyleng = 0;
  47089. $recovering = 0;
  47090. $TERROR = 2;
  47091. $EOF = 1;
  47092. $this->lexer = new Lexer();
  47093. $this->lexer->setInput($input);
  47094. $yyloc = $this->lexer->yylloc;
  47095. $this->lstack[] = $yyloc;
  47096. $symbol = null;
  47097. $preErrorSymbol = null;
  47098. $state = null;
  47099. $action = null;
  47100. $a = null;
  47101. $r = null;
  47102. $yyval = new stdClass;
  47103. $p = null;
  47104. $len = null;
  47105. $newState = null;
  47106. $expected = null;
  47107. $errStr = null;
  47108. while (true) {
  47109. $state = $this->stack[count($this->stack)-1];
  47110. if (isset($this->defaultActions[$state])) {
  47111. $action = $this->defaultActions[$state];
  47112. } else {
  47113. if ($symbol == null) {
  47114. $symbol = $this->lex();
  47115. }
  47116. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  47117. }
  47118. if (!$action || !$action[0]) {
  47119. if (!$recovering) {
  47120. $expected = array();
  47121. foreach ($this->table[$state] as $p => $ignore) {
  47122. if (isset($this->terminals_[$p]) && $p > 2) {
  47123. $expected[] = "'" . $this->terminals_[$p] . "'";
  47124. }
  47125. }
  47126. $message = null;
  47127. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  47128. $message = "Invalid string";
  47129. if ("'" === substr($this->lexer->match, 0, 1)) {
  47130. $message .= ", it appears you used single quotes instead of double quotes";
  47131. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  47132. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  47133. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  47134. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  47135. }
  47136. }
  47137. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47138. $errStr .= $this->lexer->showPosition() . "\n";
  47139. if ($message) {
  47140. $errStr .= $message;
  47141. } else {
  47142. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  47143. $errStr .= implode(', ', $expected);
  47144. }
  47145. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  47146. $errStr .= " - It appears you have an extra trailing comma";
  47147. }
  47148. $this->parseError($errStr, array(
  47149. 'text' => $this->lexer->match,
  47150. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  47151. 'line' => $this->lexer->yylineno,
  47152. 'loc' => $yyloc,
  47153. 'expected' => $expected,
  47154. ));
  47155. }
  47156. if ($recovering == 3) {
  47157. if ($symbol == $EOF) {
  47158. throw new ParsingException($errStr ?: 'Parsing halted.');
  47159. }
  47160. $yyleng = $this->lexer->yyleng;
  47161. $yytext = $this->lexer->yytext;
  47162. $yylineno = $this->lexer->yylineno;
  47163. $yyloc = $this->lexer->yylloc;
  47164. $symbol = $this->lex();
  47165. }
  47166. while (true) {
  47167. if (array_key_exists($TERROR, $this->table[$state])) {
  47168. break;
  47169. }
  47170. if ($state == 0) {
  47171. throw new ParsingException($errStr ?: 'Parsing halted.');
  47172. }
  47173. $this->popStack(1);
  47174. $state = $this->stack[count($this->stack)-1];
  47175. }
  47176. $preErrorSymbol = $symbol;
  47177. $symbol = $TERROR;
  47178. $state = $this->stack[count($this->stack)-1];
  47179. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  47180. $recovering = 3;
  47181. }
  47182. if (is_array($action[0]) && count($action) > 1) {
  47183. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  47184. }
  47185. switch ($action[0]) {
  47186. case 1:
  47187. $this->stack[] = $symbol;
  47188. $this->vstack[] = $this->lexer->yytext;
  47189. $this->lstack[] = $this->lexer->yylloc;
  47190. $this->stack[] = $action[1];
  47191. $symbol = null;
  47192. if (!$preErrorSymbol) {
  47193. $yyleng = $this->lexer->yyleng;
  47194. $yytext = $this->lexer->yytext;
  47195. $yylineno = $this->lexer->yylineno;
  47196. $yyloc = $this->lexer->yylloc;
  47197. if ($recovering > 0) {
  47198. $recovering--;
  47199. }
  47200. } else {
  47201. $symbol = $preErrorSymbol;
  47202. $preErrorSymbol = null;
  47203. }
  47204. break;
  47205. case 2:
  47206. $len = $this->productions_[$action[1]][1];
  47207. $yyval->token = $this->vstack[count($this->vstack) - $len];
  47208. $yyval->store = array(
  47209. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  47210. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  47211. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  47212. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  47213. );
  47214. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  47215. if (!$r instanceof Undefined) {
  47216. return $r;
  47217. }
  47218. if ($len) {
  47219. $this->popStack($len);
  47220. }
  47221. $this->stack[] = $this->productions_[$action[1]][0];
  47222. $this->vstack[] = $yyval->token;
  47223. $this->lstack[] = $yyval->store;
  47224. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  47225. $this->stack[] = $newState;
  47226. break;
  47227. case 3:
  47228. return true;
  47229. }
  47230. }
  47231. return true;
  47232. }
  47233. protected function parseError($str, $hash)
  47234. {
  47235. throw new ParsingException($str, $hash);
  47236. }
  47237. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  47238. {
  47239. $len = count($tokens) - 1;
  47240. switch ($yystate) {
  47241. case 1:
  47242. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  47243. $yyval->token = $yytext;
  47244. break;
  47245. case 2:
  47246. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  47247. $yyval->token = floatval($yytext);
  47248. } else {
  47249. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  47250. }
  47251. break;
  47252. case 3:
  47253. $yyval->token = null;
  47254. break;
  47255. case 4:
  47256. $yyval->token = true;
  47257. break;
  47258. case 5:
  47259. $yyval->token = false;
  47260. break;
  47261. case 6:
  47262. return $yyval->token = $tokens[$len-1];
  47263. case 13:
  47264. if ($this->flags & self::PARSE_TO_ASSOC) {
  47265. $yyval->token = array();
  47266. } else {
  47267. $yyval->token = new stdClass;
  47268. }
  47269. break;
  47270. case 14:
  47271. $yyval->token = $tokens[$len-1];
  47272. break;
  47273. case 15:
  47274. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  47275. break;
  47276. case 16:
  47277. if (PHP_VERSION_ID < 70100) {
  47278. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  47279. } else {
  47280. $property = $tokens[$len][0];
  47281. }
  47282. if ($this->flags & self::PARSE_TO_ASSOC) {
  47283. $yyval->token = array();
  47284. $yyval->token[$property] = $tokens[$len][1];
  47285. } else {
  47286. $yyval->token = new stdClass;
  47287. $yyval->token->$property = $tokens[$len][1];
  47288. }
  47289. break;
  47290. case 17:
  47291. if ($this->flags & self::PARSE_TO_ASSOC) {
  47292. $yyval->token =& $tokens[$len-2];
  47293. $key = $tokens[$len][0];
  47294. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  47295. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47296. $errStr .= $this->lexer->showPosition() . "\n";
  47297. $errStr .= "Duplicate key: ".$tokens[$len][0];
  47298. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  47299. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  47300. $duplicateCount = 1;
  47301. do {
  47302. $duplicateKey = $key . '.' . $duplicateCount++;
  47303. } while (isset($tokens[$len-2][$duplicateKey]));
  47304. $key = $duplicateKey;
  47305. }
  47306. $tokens[$len-2][$key] = $tokens[$len][1];
  47307. } else {
  47308. $yyval->token = $tokens[$len-2];
  47309. if (PHP_VERSION_ID < 70100) {
  47310. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  47311. } else {
  47312. $key = $tokens[$len][0];
  47313. }
  47314. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  47315. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47316. $errStr .= $this->lexer->showPosition() . "\n";
  47317. $errStr .= "Duplicate key: ".$tokens[$len][0];
  47318. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  47319. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  47320. $duplicateCount = 1;
  47321. do {
  47322. $duplicateKey = $key . '.' . $duplicateCount++;
  47323. } while (isset($tokens[$len-2]->$duplicateKey));
  47324. $key = $duplicateKey;
  47325. }
  47326. $tokens[$len-2]->$key = $tokens[$len][1];
  47327. }
  47328. break;
  47329. case 18:
  47330. $yyval->token = array();
  47331. break;
  47332. case 19:
  47333. $yyval->token = $tokens[$len-1];
  47334. break;
  47335. case 20:
  47336. $yyval->token = array($tokens[$len]);
  47337. break;
  47338. case 21:
  47339. $tokens[$len-2][] = $tokens[$len];
  47340. $yyval->token = $tokens[$len-2];
  47341. break;
  47342. }
  47343. return new Undefined();
  47344. }
  47345. private function stringInterpolation($match)
  47346. {
  47347. switch ($match[0]) {
  47348. case '\\\\':
  47349. return '\\';
  47350. case '\"':
  47351. return '"';
  47352. case '\b':
  47353. return chr(8);
  47354. case '\f':
  47355. return chr(12);
  47356. case '\n':
  47357. return "\n";
  47358. case '\r':
  47359. return "\r";
  47360. case '\t':
  47361. return "\t";
  47362. case '\/':
  47363. return "/";
  47364. default:
  47365. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
  47366. }
  47367. }
  47368. private function popStack($n)
  47369. {
  47370. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  47371. $this->vstack = array_slice($this->vstack, 0, - $n);
  47372. $this->lstack = array_slice($this->lstack, 0, - $n);
  47373. }
  47374. private function lex()
  47375. {
  47376. $token = $this->lexer->lex() ?: 1;
  47377. if (!is_numeric($token)) {
  47378. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  47379. }
  47380. return $token;
  47381. }
  47382. private function failOnBOM($input)
  47383. {
  47384. $bom = "\xEF\xBB\xBF";
  47385. if (substr($input, 0, 3) === $bom) {
  47386. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  47387. }
  47388. }
  47389. }
  47390. <?php
  47391. namespace Seld\JsonLint;
  47392. class Lexer
  47393. {
  47394. private $EOF = 1;
  47395. private $rules = array(
  47396. 0 => '/^\s+/',
  47397. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  47398. 2 => '{^"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  47399. 3 => '/^\{/',
  47400. 4 => '/^\}/',
  47401. 5 => '/^\[/',
  47402. 6 => '/^\]/',
  47403. 7 => '/^,/',
  47404. 8 => '/^:/',
  47405. 9 => '/^true\b/',
  47406. 10 => '/^false\b/',
  47407. 11 => '/^null\b/',
  47408. 12 => '/^$/',
  47409. 13 => '/^./',
  47410. );
  47411. private $conditions = array(
  47412. "INITIAL" => array(
  47413. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  47414. "inclusive" => true,
  47415. ),
  47416. );
  47417. private $conditionStack;
  47418. private $input;
  47419. private $more;
  47420. private $done;
  47421. private $matched;
  47422. public $match;
  47423. public $yylineno;
  47424. public $yyleng;
  47425. public $yytext;
  47426. public $yylloc;
  47427. public function lex()
  47428. {
  47429. $r = $this->next();
  47430. if (!$r instanceof Undefined) {
  47431. return $r;
  47432. }
  47433. return $this->lex();
  47434. }
  47435. public function setInput($input)
  47436. {
  47437. $this->input = $input;
  47438. $this->more = false;
  47439. $this->done = false;
  47440. $this->yylineno = $this->yyleng = 0;
  47441. $this->yytext = $this->matched = $this->match = '';
  47442. $this->conditionStack = array('INITIAL');
  47443. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  47444. return $this;
  47445. }
  47446. public function showPosition()
  47447. {
  47448. $pre = str_replace("\n", '', $this->getPastInput());
  47449. $c = str_repeat('-', max(0, strlen($pre) - 1));
  47450. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  47451. }
  47452. public function getPastInput()
  47453. {
  47454. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  47455. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  47456. }
  47457. public function getUpcomingInput()
  47458. {
  47459. $next = $this->match;
  47460. if (strlen($next) < 20) {
  47461. $next .= substr($this->input, 0, 20 - strlen($next));
  47462. }
  47463. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  47464. }
  47465. protected function parseError($str, $hash)
  47466. {
  47467. throw new \Exception($str);
  47468. }
  47469. private function next()
  47470. {
  47471. if ($this->done) {
  47472. return $this->EOF;
  47473. }
  47474. if ($this->input === '') {
  47475. $this->done = true;
  47476. }
  47477. $token = null;
  47478. $match = null;
  47479. $col = null;
  47480. $lines = null;
  47481. if (!$this->more) {
  47482. $this->yytext = '';
  47483. $this->match = '';
  47484. }
  47485. $rules = $this->getCurrentRules();
  47486. $rulesLen = count($rules);
  47487. for ($i=0; $i < $rulesLen; $i++) {
  47488. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  47489. preg_match_all('/\n.*/', $match[0], $lines);
  47490. $lines = $lines[0];
  47491. if ($lines) {
  47492. $this->yylineno += count($lines);
  47493. }
  47494. $this->yylloc = array(
  47495. 'first_line' => $this->yylloc['last_line'],
  47496. 'last_line' => $this->yylineno+1,
  47497. 'first_column' => $this->yylloc['last_column'],
  47498. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  47499. );
  47500. $this->yytext .= $match[0];
  47501. $this->match .= $match[0];
  47502. $this->yyleng = strlen($this->yytext);
  47503. $this->more = false;
  47504. $this->input = substr($this->input, strlen($match[0]));
  47505. $this->matched .= $match[0];
  47506. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  47507. if ($token) {
  47508. return $token;
  47509. }
  47510. return new Undefined();
  47511. }
  47512. }
  47513. if ($this->input === "") {
  47514. return $this->EOF;
  47515. }
  47516. $this->parseError(
  47517. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  47518. array(
  47519. 'text' => "",
  47520. 'token' => null,
  47521. 'line' => $this->yylineno,
  47522. )
  47523. );
  47524. }
  47525. private function getCurrentRules()
  47526. {
  47527. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  47528. }
  47529. private function performAction($avoiding_name_collisions, $YY_START)
  47530. {
  47531. switch ($avoiding_name_collisions) {
  47532. case 0:
  47533. break;
  47534. case 1:
  47535. return 6;
  47536. break;
  47537. case 2:
  47538. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  47539. return 4;
  47540. case 3:
  47541. return 17;
  47542. case 4:
  47543. return 18;
  47544. case 5:
  47545. return 23;
  47546. case 6:
  47547. return 24;
  47548. case 7:
  47549. return 22;
  47550. case 8:
  47551. return 21;
  47552. case 9:
  47553. return 10;
  47554. case 10:
  47555. return 11;
  47556. case 11:
  47557. return 8;
  47558. case 12:
  47559. return 14;
  47560. case 13:
  47561. return 'INVALID';
  47562. }
  47563. }
  47564. }
  47565. <?php
  47566. namespace Seld\JsonLint;
  47567. class ParsingException extends \Exception
  47568. {
  47569. protected $details;
  47570. public function __construct($message, $details = array())
  47571. {
  47572. $this->details = $details;
  47573. parent::__construct($message);
  47574. }
  47575. public function getDetails()
  47576. {
  47577. return $this->details;
  47578. }
  47579. }
  47580. <?php
  47581. namespace Seld\JsonLint;
  47582. class Undefined
  47583. {
  47584. }
  47585. MIT License
  47586. Copyright (c) 2016
  47587. Permission is hereby granted, free of charge, to any person obtaining a copy
  47588. of this software and associated documentation files (the "Software"), to deal
  47589. in the Software without restriction, including without limitation the rights
  47590. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47591. copies of the Software, and to permit persons to whom the Software is
  47592. furnished to do so, subject to the following conditions:
  47593. The above copyright notice and this permission notice shall be included in all
  47594. copies or substantial portions of the Software.
  47595. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47596. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47597. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47598. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47599. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47600. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  47601. SOFTWARE.
  47602. <?php
  47603. require __DIR__ . '/../vendor/autoload.php';
  47604. $data = json_decode(file_get_contents('data.json'));
  47605. $validator = new JsonSchema\Validator();
  47606. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  47607. if ($validator->isValid()) {
  47608. echo "The supplied JSON validates against the schema.\n";
  47609. } else {
  47610. echo "JSON does not validate. Violations:\n";
  47611. foreach ($validator->getErrors() as $error) {
  47612. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  47613. }
  47614. }
  47615. <?php
  47616. namespace JsonSchema\Constraints;
  47617. use JsonSchema\Entity\JsonPointer;
  47618. use JsonSchema\Exception\InvalidArgumentException;
  47619. use JsonSchema\Exception\ValidationException;
  47620. use JsonSchema\Validator;
  47621. class BaseConstraint
  47622. {
  47623. protected $errors = array();
  47624. protected $errorMask = Validator::ERROR_NONE;
  47625. protected $factory;
  47626. public function __construct(Factory $factory = null)
  47627. {
  47628. $this->factory = $factory ?: new Factory();
  47629. }
  47630. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  47631. {
  47632. $error = array(
  47633. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  47634. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  47635. 'message' => $message,
  47636. 'constraint' => $constraint,
  47637. 'context' => $this->factory->getErrorContext(),
  47638. );
  47639. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  47640. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  47641. }
  47642. if (is_array($more) && count($more) > 0) {
  47643. $error += $more;
  47644. }
  47645. $this->errors[] = $error;
  47646. $this->errorMask |= $error['context'];
  47647. }
  47648. public function addErrors(array $errors)
  47649. {
  47650. if ($errors) {
  47651. $this->errors = array_merge($this->errors, $errors);
  47652. $errorMask = &$this->errorMask;
  47653. array_walk($errors, function ($error) use (&$errorMask) {
  47654. if (isset($error['context'])) {
  47655. $errorMask |= $error['context'];
  47656. }
  47657. });
  47658. }
  47659. }
  47660. public function getErrors($errorContext = Validator::ERROR_ALL)
  47661. {
  47662. if ($errorContext === Validator::ERROR_ALL) {
  47663. return $this->errors;
  47664. }
  47665. return array_filter($this->errors, function ($error) use ($errorContext) {
  47666. if ($errorContext & $error['context']) {
  47667. return true;
  47668. }
  47669. });
  47670. }
  47671. public function numErrors($errorContext = Validator::ERROR_ALL)
  47672. {
  47673. if ($errorContext === Validator::ERROR_ALL) {
  47674. return count($this->errors);
  47675. }
  47676. return count($this->getErrors($errorContext));
  47677. }
  47678. public function isValid()
  47679. {
  47680. return !$this->getErrors();
  47681. }
  47682. public function reset()
  47683. {
  47684. $this->errors = array();
  47685. $this->errorMask = Validator::ERROR_NONE;
  47686. }
  47687. public function getErrorMask()
  47688. {
  47689. return $this->errorMask;
  47690. }
  47691. public static function arrayToObjectRecursive($array)
  47692. {
  47693. $json = json_encode($array);
  47694. if (json_last_error() !== \JSON_ERROR_NONE) {
  47695. $message = 'Unable to encode schema array as JSON';
  47696. if (function_exists('json_last_error_msg')) {
  47697. $message .= ': ' . json_last_error_msg();
  47698. }
  47699. throw new InvalidArgumentException($message);
  47700. }
  47701. return (object) json_decode($json);
  47702. }
  47703. }
  47704. <?php
  47705. namespace JsonSchema\Constraints;
  47706. use JsonSchema\Entity\JsonPointer;
  47707. class CollectionConstraint extends Constraint
  47708. {
  47709. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47710. {
  47711. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  47712. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  47713. }
  47714. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  47715. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  47716. }
  47717. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  47718. $unique = $value;
  47719. if (is_array($value) && count($value)) {
  47720. $unique = array_map(function ($e) {
  47721. return var_export($e, true);
  47722. }, $value);
  47723. }
  47724. if (count(array_unique($unique)) != count($value)) {
  47725. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  47726. }
  47727. }
  47728. if (isset($schema->items)) {
  47729. $this->validateItems($value, $schema, $path, $i);
  47730. }
  47731. }
  47732. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47733. {
  47734. if (is_object($schema->items)) {
  47735. if (isset($schema->items->type)
  47736. && (
  47737. $schema->items->type == 'string'
  47738. || $schema->items->type == 'number'
  47739. || $schema->items->type == 'integer'
  47740. )
  47741. && !isset($schema->additionalItems)
  47742. ) {
  47743. $type = $schema->items->type;
  47744. $typeValidator = $this->factory->createInstanceFor('type');
  47745. $validator = $this->factory->createInstanceFor($type === 'integer' ? 'number' : $type);
  47746. foreach ($value as $k => &$v) {
  47747. $k_path = $this->incrementPath($path, $k);
  47748. $typeValidator->check($v, $schema->items, $k_path, $i);
  47749. $validator->check($v, $schema->items, $k_path, $i);
  47750. }
  47751. unset($v);
  47752. $this->addErrors($typeValidator->getErrors());
  47753. $this->addErrors($validator->getErrors());
  47754. } else {
  47755. foreach ($value as $k => &$v) {
  47756. $initErrors = $this->getErrors();
  47757. $this->checkUndefined($v, $schema->items, $path, $k);
  47758. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  47759. $secondErrors = $this->getErrors();
  47760. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  47761. }
  47762. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  47763. $this->errors = $secondErrors;
  47764. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  47765. $this->errors = $initErrors;
  47766. }
  47767. }
  47768. unset($v);
  47769. }
  47770. } else {
  47771. foreach ($value as $k => &$v) {
  47772. if (array_key_exists($k, $schema->items)) {
  47773. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  47774. } else {
  47775. if (property_exists($schema, 'additionalItems')) {
  47776. if ($schema->additionalItems !== false) {
  47777. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  47778. } else {
  47779. $this->addError(
  47780. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  47781. }
  47782. } else {
  47783. $this->checkUndefined($v, new \stdClass(), $path, $k);
  47784. }
  47785. }
  47786. }
  47787. unset($v);
  47788. if (count($value) > 0) {
  47789. for ($k = count($value); $k < count($schema->items); $k++) {
  47790. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  47791. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  47792. }
  47793. }
  47794. }
  47795. }
  47796. }
  47797. <?php
  47798. namespace JsonSchema\Constraints;
  47799. use JsonSchema\Entity\JsonPointer;
  47800. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  47801. {
  47802. protected $inlineSchemaProperty = '$schema';
  47803. const CHECK_MODE_NONE = 0x00000000;
  47804. const CHECK_MODE_NORMAL = 0x00000001;
  47805. const CHECK_MODE_TYPE_CAST = 0x00000002;
  47806. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  47807. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  47808. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  47809. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  47810. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  47811. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  47812. protected function incrementPath(JsonPointer $path = null, $i)
  47813. {
  47814. $path = $path ?: new JsonPointer('');
  47815. $path = $path->withPropertyPaths(
  47816. array_merge(
  47817. $path->getPropertyPaths(),
  47818. array_filter(array($i), 'strlen')
  47819. )
  47820. );
  47821. return $path;
  47822. }
  47823. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47824. {
  47825. $validator = $this->factory->createInstanceFor('collection');
  47826. $validator->check($value, $schema, $path, $i);
  47827. $this->addErrors($validator->getErrors());
  47828. }
  47829. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  47830. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  47831. {
  47832. $validator = $this->factory->createInstanceFor('object');
  47833. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  47834. $this->addErrors($validator->getErrors());
  47835. }
  47836. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47837. {
  47838. $validator = $this->factory->createInstanceFor('type');
  47839. $validator->check($value, $schema, $path, $i);
  47840. $this->addErrors($validator->getErrors());
  47841. }
  47842. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  47843. {
  47844. $validator = $this->factory->createInstanceFor('undefined');
  47845. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  47846. $this->addErrors($validator->getErrors());
  47847. }
  47848. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  47849. {
  47850. $validator = $this->factory->createInstanceFor('string');
  47851. $validator->check($value, $schema, $path, $i);
  47852. $this->addErrors($validator->getErrors());
  47853. }
  47854. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  47855. {
  47856. $validator = $this->factory->createInstanceFor('number');
  47857. $validator->check($value, $schema, $path, $i);
  47858. $this->addErrors($validator->getErrors());
  47859. }
  47860. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  47861. {
  47862. $validator = $this->factory->createInstanceFor('enum');
  47863. $validator->check($value, $schema, $path, $i);
  47864. $this->addErrors($validator->getErrors());
  47865. }
  47866. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  47867. {
  47868. $validator = $this->factory->createInstanceFor('format');
  47869. $validator->check($value, $schema, $path, $i);
  47870. $this->addErrors($validator->getErrors());
  47871. }
  47872. protected function getTypeCheck()
  47873. {
  47874. return $this->factory->getTypeCheck();
  47875. }
  47876. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  47877. {
  47878. $result = array_map(
  47879. function ($path) {
  47880. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  47881. },
  47882. $pointer->getPropertyPaths()
  47883. );
  47884. return trim(implode('', $result), '.');
  47885. }
  47886. }
  47887. <?php
  47888. namespace JsonSchema\Constraints;
  47889. use JsonSchema\Entity\JsonPointer;
  47890. interface ConstraintInterface
  47891. {
  47892. public function getErrors();
  47893. public function addErrors(array $errors);
  47894. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  47895. public function isValid();
  47896. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  47897. }
  47898. <?php
  47899. namespace JsonSchema\Constraints;
  47900. use JsonSchema\Entity\JsonPointer;
  47901. class EnumConstraint extends Constraint
  47902. {
  47903. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47904. {
  47905. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  47906. return;
  47907. }
  47908. $type = gettype($element);
  47909. foreach ($schema->enum as $enum) {
  47910. $enumType = gettype($enum);
  47911. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  47912. if ((object) $element == $enum) {
  47913. return;
  47914. }
  47915. }
  47916. if ($type === gettype($enum)) {
  47917. if ($type == 'object') {
  47918. if ($element == $enum) {
  47919. return;
  47920. }
  47921. } elseif ($element === $enum) {
  47922. return;
  47923. }
  47924. }
  47925. }
  47926. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  47927. }
  47928. }
  47929. <?php
  47930. namespace JsonSchema\Constraints;
  47931. use JsonSchema\Exception\InvalidArgumentException;
  47932. use JsonSchema\SchemaStorage;
  47933. use JsonSchema\SchemaStorageInterface;
  47934. use JsonSchema\Uri\UriRetriever;
  47935. use JsonSchema\UriRetrieverInterface;
  47936. use JsonSchema\Validator;
  47937. class Factory
  47938. {
  47939. protected $schemaStorage;
  47940. protected $uriRetriever;
  47941. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  47942. private $typeCheck = array();
  47943. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  47944. protected $constraintMap = array(
  47945. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  47946. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  47947. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  47948. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  47949. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  47950. 'string' => 'JsonSchema\Constraints\StringConstraint',
  47951. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  47952. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  47953. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  47954. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  47955. 'validator' => 'JsonSchema\Validator'
  47956. );
  47957. private $instanceCache = array();
  47958. public function __construct(
  47959. SchemaStorageInterface $schemaStorage = null,
  47960. UriRetrieverInterface $uriRetriever = null,
  47961. $checkMode = Constraint::CHECK_MODE_NORMAL
  47962. ) {
  47963. $this->setConfig($checkMode);
  47964. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  47965. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  47966. }
  47967. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  47968. {
  47969. $this->checkMode = $checkMode;
  47970. }
  47971. public function addConfig($options)
  47972. {
  47973. $this->checkMode |= $options;
  47974. }
  47975. public function removeConfig($options)
  47976. {
  47977. $this->checkMode &= ~$options;
  47978. }
  47979. public function getConfig($options = null)
  47980. {
  47981. if ($options === null) {
  47982. return $this->checkMode;
  47983. }
  47984. return $this->checkMode & $options;
  47985. }
  47986. public function getUriRetriever()
  47987. {
  47988. return $this->uriRetriever;
  47989. }
  47990. public function getSchemaStorage()
  47991. {
  47992. return $this->schemaStorage;
  47993. }
  47994. public function getTypeCheck()
  47995. {
  47996. if (!isset($this->typeCheck[$this->checkMode])) {
  47997. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  47998. ? new TypeCheck\LooseTypeCheck()
  47999. : new TypeCheck\StrictTypeCheck();
  48000. }
  48001. return $this->typeCheck[$this->checkMode];
  48002. }
  48003. public function setConstraintClass($name, $class)
  48004. {
  48005. if (!class_exists($class)) {
  48006. throw new InvalidArgumentException('Unknown constraint ' . $name);
  48007. }
  48008. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  48009. throw new InvalidArgumentException('Invalid class ' . $name);
  48010. }
  48011. $this->constraintMap[$name] = $class;
  48012. return $this;
  48013. }
  48014. public function createInstanceFor($constraintName)
  48015. {
  48016. if (!isset($this->constraintMap[$constraintName])) {
  48017. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  48018. }
  48019. if (!isset($this->instanceCache[$constraintName])) {
  48020. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  48021. }
  48022. return clone $this->instanceCache[$constraintName];
  48023. }
  48024. public function getErrorContext()
  48025. {
  48026. return $this->errorContext;
  48027. }
  48028. public function setErrorContext($errorContext)
  48029. {
  48030. $this->errorContext = $errorContext;
  48031. }
  48032. }
  48033. <?php
  48034. namespace JsonSchema\Constraints;
  48035. use JsonSchema\Entity\JsonPointer;
  48036. use JsonSchema\Rfc3339;
  48037. class FormatConstraint extends Constraint
  48038. {
  48039. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48040. {
  48041. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  48042. return;
  48043. }
  48044. switch ($schema->format) {
  48045. case 'date':
  48046. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  48047. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  48048. }
  48049. break;
  48050. case 'time':
  48051. if (!$this->validateDateTime($element, 'H:i:s')) {
  48052. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  48053. }
  48054. break;
  48055. case 'date-time':
  48056. if (null === Rfc3339::createFromString($element)) {
  48057. $this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format));
  48058. }
  48059. break;
  48060. case 'utc-millisec':
  48061. if (!$this->validateDateTime($element, 'U')) {
  48062. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  48063. }
  48064. break;
  48065. case 'regex':
  48066. if (!$this->validateRegex($element)) {
  48067. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  48068. }
  48069. break;
  48070. case 'color':
  48071. if (!$this->validateColor($element)) {
  48072. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  48073. }
  48074. break;
  48075. case 'style':
  48076. if (!$this->validateStyle($element)) {
  48077. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  48078. }
  48079. break;
  48080. case 'phone':
  48081. if (!$this->validatePhone($element)) {
  48082. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  48083. }
  48084. break;
  48085. case 'uri':
  48086. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  48087. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  48088. }
  48089. break;
  48090. case 'uriref':
  48091. case 'uri-reference':
  48092. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  48093. if (substr($element, 0, 2) === '//') {
  48094. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48095. } elseif (substr($element, 0, 1) === '/') {
  48096. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48097. } elseif (strlen($element)) {
  48098. $pathParts = explode('/', $element, 2);
  48099. if (strpos($pathParts[0], ':') !== false) {
  48100. $validURL = null;
  48101. } else {
  48102. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48103. }
  48104. } else {
  48105. $validURL = null;
  48106. }
  48107. if ($validURL === null) {
  48108. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  48109. }
  48110. }
  48111. break;
  48112. case 'email':
  48113. $filterFlags = FILTER_NULL_ON_FAILURE;
  48114. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  48115. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  48116. }
  48117. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  48118. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  48119. }
  48120. break;
  48121. case 'ip-address':
  48122. case 'ipv4':
  48123. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  48124. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  48125. }
  48126. break;
  48127. case 'ipv6':
  48128. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  48129. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  48130. }
  48131. break;
  48132. case 'host-name':
  48133. case 'hostname':
  48134. if (!$this->validateHostname($element)) {
  48135. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  48136. }
  48137. break;
  48138. default:
  48139. break;
  48140. }
  48141. }
  48142. protected function validateDateTime($datetime, $format)
  48143. {
  48144. $dt = \DateTime::createFromFormat($format, $datetime);
  48145. if (!$dt) {
  48146. return false;
  48147. }
  48148. if ($datetime === $dt->format($format)) {
  48149. return true;
  48150. }
  48151. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  48152. return true;
  48153. }
  48154. return false;
  48155. }
  48156. protected function validateRegex($regex)
  48157. {
  48158. return false !== @preg_match('/' . $regex . '/u', '');
  48159. }
  48160. protected function validateColor($color)
  48161. {
  48162. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  48163. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  48164. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  48165. return true;
  48166. }
  48167. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  48168. }
  48169. protected function validateStyle($style)
  48170. {
  48171. $properties = explode(';', rtrim($style, ';'));
  48172. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  48173. return empty($invalidEntries);
  48174. }
  48175. protected function validatePhone($phone)
  48176. {
  48177. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  48178. }
  48179. protected function validateHostname($host)
  48180. {
  48181. $hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i';
  48182. return preg_match($hostnameRegex, $host);
  48183. }
  48184. }
  48185. <?php
  48186. namespace JsonSchema\Constraints;
  48187. use JsonSchema\Entity\JsonPointer;
  48188. class NumberConstraint extends Constraint
  48189. {
  48190. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48191. {
  48192. if (isset($schema->exclusiveMinimum)) {
  48193. if (isset($schema->minimum)) {
  48194. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  48195. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  48196. } elseif ($element < $schema->minimum) {
  48197. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  48198. }
  48199. } else {
  48200. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  48201. }
  48202. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  48203. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  48204. }
  48205. if (isset($schema->exclusiveMaximum)) {
  48206. if (isset($schema->maximum)) {
  48207. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  48208. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  48209. } elseif ($element > $schema->maximum) {
  48210. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  48211. }
  48212. } else {
  48213. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  48214. }
  48215. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  48216. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  48217. }
  48218. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  48219. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  48220. }
  48221. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  48222. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  48223. }
  48224. $this->checkFormat($element, $schema, $path, $i);
  48225. }
  48226. private function fmod($number1, $number2)
  48227. {
  48228. $number1 = abs($number1);
  48229. $modulus = fmod($number1, $number2);
  48230. $precision = abs(0.0000000001);
  48231. $diff = (float) ($modulus - $number2);
  48232. if (-$precision < $diff && $diff < $precision) {
  48233. return 0.0;
  48234. }
  48235. $decimals1 = mb_strpos($number1, '.') ? mb_strlen($number1) - mb_strpos($number1, '.') - 1 : 0;
  48236. $decimals2 = mb_strpos($number2, '.') ? mb_strlen($number2) - mb_strpos($number2, '.') - 1 : 0;
  48237. return (float) round($modulus, max($decimals1, $decimals2));
  48238. }
  48239. }
  48240. <?php
  48241. namespace JsonSchema\Constraints;
  48242. use JsonSchema\Entity\JsonPointer;
  48243. class ObjectConstraint extends Constraint
  48244. {
  48245. protected $appliedDefaults = array();
  48246. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  48247. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  48248. {
  48249. if ($element instanceof UndefinedConstraint) {
  48250. return;
  48251. }
  48252. $this->appliedDefaults = $appliedDefaults;
  48253. $matches = array();
  48254. if ($patternProperties) {
  48255. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  48256. }
  48257. if ($properties) {
  48258. $this->validateProperties($element, $properties, $path);
  48259. }
  48260. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  48261. }
  48262. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  48263. {
  48264. $try = array('/', '#', '+', '~', '%');
  48265. $matches = array();
  48266. foreach ($patternProperties as $pregex => $schema) {
  48267. $delimiter = '/';
  48268. foreach ($try as $delimiter) {
  48269. if (strpos($pregex, $delimiter) === false) {
  48270. break;
  48271. }
  48272. }
  48273. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  48274. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  48275. continue;
  48276. }
  48277. foreach ($element as $i => $value) {
  48278. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  48279. $matches[] = $i;
  48280. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  48281. }
  48282. }
  48283. }
  48284. return $matches;
  48285. }
  48286. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  48287. $properties = null, $additionalProp = null)
  48288. {
  48289. $this->validateMinMaxConstraint($element, $schema, $path);
  48290. foreach ($element as $i => $value) {
  48291. $definition = $this->getProperty($properties, $i);
  48292. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  48293. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  48294. }
  48295. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  48296. if ($additionalProp === true) {
  48297. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  48298. } else {
  48299. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  48300. }
  48301. }
  48302. $require = $this->getProperty($definition, 'requires');
  48303. if ($require && !$this->getProperty($element, $require)) {
  48304. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  48305. }
  48306. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  48307. if (is_object($property)) {
  48308. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  48309. }
  48310. }
  48311. }
  48312. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  48313. {
  48314. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  48315. foreach ($properties as $i => $value) {
  48316. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  48317. $definition = $this->getProperty($properties, $i);
  48318. if (is_object($definition)) {
  48319. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  48320. }
  48321. }
  48322. }
  48323. protected function &getProperty(&$element, $property, $fallback = null)
  48324. {
  48325. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  48326. return $element[$property];
  48327. } elseif (is_object($element) && property_exists($element, $property)) {
  48328. return $element->$property;
  48329. }
  48330. return $fallback;
  48331. }
  48332. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  48333. {
  48334. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  48335. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  48336. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  48337. }
  48338. }
  48339. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  48340. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  48341. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  48342. }
  48343. }
  48344. }
  48345. }
  48346. <?php
  48347. namespace JsonSchema\Constraints;
  48348. use JsonSchema\Entity\JsonPointer;
  48349. use JsonSchema\Exception\InvalidArgumentException;
  48350. use JsonSchema\Exception\InvalidSchemaException;
  48351. use JsonSchema\Exception\RuntimeException;
  48352. use JsonSchema\Validator;
  48353. class SchemaConstraint extends Constraint
  48354. {
  48355. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  48356. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48357. {
  48358. if ($schema !== null) {
  48359. $validationSchema = $schema;
  48360. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  48361. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  48362. } else {
  48363. throw new InvalidArgumentException('no schema found to verify against');
  48364. }
  48365. if (is_array($validationSchema)) {
  48366. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  48367. }
  48368. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  48369. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  48370. throw new RuntimeException('Cannot validate the schema of a non-object');
  48371. }
  48372. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  48373. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  48374. } else {
  48375. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  48376. }
  48377. $schemaStorage = $this->factory->getSchemaStorage();
  48378. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  48379. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  48380. }
  48381. $initialErrorCount = $this->numErrors();
  48382. $initialConfig = $this->factory->getConfig();
  48383. $initialContext = $this->factory->getErrorContext();
  48384. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  48385. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  48386. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  48387. try {
  48388. $this->check($validationSchema, $schemaSpec);
  48389. } catch (\Exception $e) {
  48390. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  48391. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  48392. }
  48393. }
  48394. if ($this->numErrors() > $initialErrorCount) {
  48395. $this->addError($path, 'Schema is not valid', 'schema');
  48396. }
  48397. $this->factory->setConfig($initialConfig);
  48398. $this->factory->setErrorContext($initialContext);
  48399. }
  48400. $this->checkUndefined($element, $validationSchema, $path, $i);
  48401. }
  48402. }
  48403. <?php
  48404. namespace JsonSchema\Constraints;
  48405. use JsonSchema\Entity\JsonPointer;
  48406. class StringConstraint extends Constraint
  48407. {
  48408. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48409. {
  48410. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  48411. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  48412. 'maxLength' => $schema->maxLength,
  48413. ));
  48414. }
  48415. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  48416. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  48417. 'minLength' => $schema->minLength,
  48418. ));
  48419. }
  48420. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  48421. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  48422. 'pattern' => $schema->pattern,
  48423. ));
  48424. }
  48425. $this->checkFormat($element, $schema, $path, $i);
  48426. }
  48427. private function strlen($string)
  48428. {
  48429. if (extension_loaded('mbstring')) {
  48430. return mb_strlen($string, mb_detect_encoding($string));
  48431. }
  48432. return strlen($string);
  48433. }
  48434. }
  48435. <?php
  48436. namespace JsonSchema\Constraints\TypeCheck;
  48437. class LooseTypeCheck implements TypeCheckInterface
  48438. {
  48439. public static function isObject($value)
  48440. {
  48441. return
  48442. is_object($value) ||
  48443. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  48444. }
  48445. public static function isArray($value)
  48446. {
  48447. return
  48448. is_array($value) &&
  48449. (count($value) == 0 || !self::isAssociativeArray($value));
  48450. }
  48451. public static function propertyGet($value, $property)
  48452. {
  48453. if (is_object($value)) {
  48454. return $value->{$property};
  48455. }
  48456. return $value[$property];
  48457. }
  48458. public static function propertySet(&$value, $property, $data)
  48459. {
  48460. if (is_object($value)) {
  48461. $value->{$property} = $data;
  48462. } else {
  48463. $value[$property] = $data;
  48464. }
  48465. }
  48466. public static function propertyExists($value, $property)
  48467. {
  48468. if (is_object($value)) {
  48469. return property_exists($value, $property);
  48470. }
  48471. return array_key_exists($property, $value);
  48472. }
  48473. public static function propertyCount($value)
  48474. {
  48475. if (is_object($value)) {
  48476. return count(get_object_vars($value));
  48477. }
  48478. return count($value);
  48479. }
  48480. private static function isAssociativeArray($arr)
  48481. {
  48482. return array_keys($arr) !== range(0, count($arr) - 1);
  48483. }
  48484. }
  48485. <?php
  48486. namespace JsonSchema\Constraints\TypeCheck;
  48487. class StrictTypeCheck implements TypeCheckInterface
  48488. {
  48489. public static function isObject($value)
  48490. {
  48491. return is_object($value);
  48492. }
  48493. public static function isArray($value)
  48494. {
  48495. return is_array($value);
  48496. }
  48497. public static function propertyGet($value, $property)
  48498. {
  48499. return $value->{$property};
  48500. }
  48501. public static function propertySet(&$value, $property, $data)
  48502. {
  48503. $value->{$property} = $data;
  48504. }
  48505. public static function propertyExists($value, $property)
  48506. {
  48507. return property_exists($value, $property);
  48508. }
  48509. public static function propertyCount($value)
  48510. {
  48511. return count(get_object_vars($value));
  48512. }
  48513. }
  48514. <?php
  48515. namespace JsonSchema\Constraints\TypeCheck;
  48516. interface TypeCheckInterface
  48517. {
  48518. public static function isObject($value);
  48519. public static function isArray($value);
  48520. public static function propertyGet($value, $property);
  48521. public static function propertySet(&$value, $property, $data);
  48522. public static function propertyExists($value, $property);
  48523. public static function propertyCount($value);
  48524. }
  48525. <?php
  48526. namespace JsonSchema\Constraints;
  48527. use JsonSchema\Entity\JsonPointer;
  48528. use JsonSchema\Exception\InvalidArgumentException;
  48529. use UnexpectedValueException as StandardUnexpectedValueException;
  48530. class TypeConstraint extends Constraint
  48531. {
  48532. public static $wording = array(
  48533. 'integer' => 'an integer',
  48534. 'number' => 'a number',
  48535. 'boolean' => 'a boolean',
  48536. 'object' => 'an object',
  48537. 'array' => 'an array',
  48538. 'string' => 'a string',
  48539. 'null' => 'a null',
  48540. 'any' => null,
  48541. 0 => null,
  48542. );
  48543. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  48544. {
  48545. $type = isset($schema->type) ? $schema->type : null;
  48546. $isValid = false;
  48547. $wording = array();
  48548. if (is_array($type)) {
  48549. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  48550. } elseif (is_object($type)) {
  48551. $this->checkUndefined($value, $type, $path);
  48552. return;
  48553. } else {
  48554. $isValid = $this->validateType($value, $type);
  48555. }
  48556. if ($isValid === false) {
  48557. if (!is_array($type)) {
  48558. $this->validateTypeNameWording($type);
  48559. $wording[] = self::$wording[$type];
  48560. }
  48561. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  48562. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  48563. }
  48564. }
  48565. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  48566. {
  48567. foreach ($type as $tp) {
  48568. if (is_object($tp)) {
  48569. if (!$isValid) {
  48570. $validator = $this->factory->createInstanceFor('type');
  48571. $subSchema = new \stdClass();
  48572. $subSchema->type = $tp;
  48573. $validator->check($value, $subSchema, $path, null);
  48574. $error = $validator->getErrors();
  48575. $isValid = !(bool) $error;
  48576. $validTypesWording[] = self::$wording['object'];
  48577. }
  48578. } else {
  48579. $this->validateTypeNameWording($tp);
  48580. $validTypesWording[] = self::$wording[$tp];
  48581. if (!$isValid) {
  48582. $isValid = $this->validateType($value, $tp);
  48583. }
  48584. }
  48585. }
  48586. }
  48587. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  48588. {
  48589. if ($listEnd === false || !isset($elements[1])) {
  48590. return implode($delimiter, $elements);
  48591. }
  48592. $lastElement = array_slice($elements, -1);
  48593. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  48594. $implodedElements = array_merge(array($firsElements), $lastElement);
  48595. return join(" $listEnd ", $implodedElements);
  48596. }
  48597. protected function validateTypeNameWording($type)
  48598. {
  48599. if (!isset(self::$wording[$type])) {
  48600. throw new StandardUnexpectedValueException(
  48601. sprintf(
  48602. 'No wording for %s available, expected wordings are: [%s]',
  48603. var_export($type, true),
  48604. implode(', ', array_filter(self::$wording)))
  48605. );
  48606. }
  48607. }
  48608. protected function validateType(&$value, $type)
  48609. {
  48610. if (!$type) {
  48611. return true;
  48612. }
  48613. if ('any' === $type) {
  48614. return true;
  48615. }
  48616. if ('object' === $type) {
  48617. return $this->getTypeCheck()->isObject($value);
  48618. }
  48619. if ('array' === $type) {
  48620. return $this->getTypeCheck()->isArray($value);
  48621. }
  48622. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  48623. if ('integer' === $type) {
  48624. if ($coerce) {
  48625. $value = $this->toInteger($value);
  48626. }
  48627. return is_int($value);
  48628. }
  48629. if ('number' === $type) {
  48630. if ($coerce) {
  48631. $value = $this->toNumber($value);
  48632. }
  48633. return is_numeric($value) && !is_string($value);
  48634. }
  48635. if ('boolean' === $type) {
  48636. if ($coerce) {
  48637. $value = $this->toBoolean($value);
  48638. }
  48639. return is_bool($value);
  48640. }
  48641. if ('string' === $type) {
  48642. return is_string($value);
  48643. }
  48644. if ('email' === $type) {
  48645. return is_string($value);
  48646. }
  48647. if ('null' === $type) {
  48648. return is_null($value);
  48649. }
  48650. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  48651. }
  48652. protected function toBoolean($value)
  48653. {
  48654. if ($value === 'true') {
  48655. return true;
  48656. }
  48657. if ($value === 'false') {
  48658. return false;
  48659. }
  48660. return $value;
  48661. }
  48662. protected function toNumber($value)
  48663. {
  48664. if (is_numeric($value)) {
  48665. return $value + 0;
  48666. }
  48667. return $value;
  48668. }
  48669. protected function toInteger($value)
  48670. {
  48671. if (is_numeric($value) && (int) $value == $value) {
  48672. return (int) $value;
  48673. }
  48674. return $value;
  48675. }
  48676. }
  48677. <?php
  48678. namespace JsonSchema\Constraints;
  48679. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  48680. use JsonSchema\Entity\JsonPointer;
  48681. use JsonSchema\Exception\ValidationException;
  48682. use JsonSchema\Uri\UriResolver;
  48683. class UndefinedConstraint extends Constraint
  48684. {
  48685. protected $appliedDefaults = array();
  48686. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  48687. {
  48688. if (is_null($schema) || !is_object($schema)) {
  48689. return;
  48690. }
  48691. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  48692. if ($fromDefault) {
  48693. $path->setFromDefault();
  48694. }
  48695. $this->validateCommonProperties($value, $schema, $path, $i);
  48696. $this->validateOfProperties($value, $schema, $path, '');
  48697. $this->validateTypes($value, $schema, $path, $i);
  48698. }
  48699. public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null)
  48700. {
  48701. if ($this->getTypeCheck()->isArray($value)) {
  48702. $this->checkArray($value, $schema, $path, $i);
  48703. }
  48704. if (LooseTypeCheck::isObject($value)) {
  48705. $this->checkObject(
  48706. $value,
  48707. $schema,
  48708. $path,
  48709. isset($schema->properties) ? $schema->properties : null,
  48710. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  48711. isset($schema->patternProperties) ? $schema->patternProperties : null,
  48712. $this->appliedDefaults
  48713. );
  48714. }
  48715. if (is_string($value)) {
  48716. $this->checkString($value, $schema, $path, $i);
  48717. }
  48718. if (is_numeric($value)) {
  48719. $this->checkNumber($value, $schema, $path, $i);
  48720. }
  48721. if (isset($schema->enum)) {
  48722. $this->checkEnum($value, $schema, $path, $i);
  48723. }
  48724. }
  48725. protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '')
  48726. {
  48727. if (isset($schema->extends)) {
  48728. if (is_string($schema->extends)) {
  48729. $schema->extends = $this->validateUri($schema, $schema->extends);
  48730. }
  48731. if (is_array($schema->extends)) {
  48732. foreach ($schema->extends as $extends) {
  48733. $this->checkUndefined($value, $extends, $path, $i);
  48734. }
  48735. } else {
  48736. $this->checkUndefined($value, $schema->extends, $path, $i);
  48737. }
  48738. }
  48739. if (!$path->fromDefault()) {
  48740. $this->applyDefaultValues($value, $schema, $path);
  48741. }
  48742. if ($this->getTypeCheck()->isObject($value)) {
  48743. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  48744. foreach ($schema->required as $required) {
  48745. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  48746. $this->addError(
  48747. $this->incrementPath($path ?: new JsonPointer(''), $required),
  48748. 'The property ' . $required . ' is required',
  48749. 'required'
  48750. );
  48751. }
  48752. }
  48753. } elseif (isset($schema->required) && !is_array($schema->required)) {
  48754. if ($schema->required && $value instanceof self) {
  48755. $propertyPaths = $path->getPropertyPaths();
  48756. $propertyName = end($propertyPaths);
  48757. $this->addError(
  48758. $path,
  48759. 'The property ' . $propertyName . ' is required',
  48760. 'required'
  48761. );
  48762. }
  48763. }
  48764. }
  48765. if (!($value instanceof self)) {
  48766. $this->checkType($value, $schema, $path, $i);
  48767. }
  48768. if (isset($schema->disallow)) {
  48769. $initErrors = $this->getErrors();
  48770. $typeSchema = new \stdClass();
  48771. $typeSchema->type = $schema->disallow;
  48772. $this->checkType($value, $typeSchema, $path);
  48773. if (count($this->getErrors()) == count($initErrors)) {
  48774. $this->addError($path, 'Disallowed value was matched', 'disallow');
  48775. } else {
  48776. $this->errors = $initErrors;
  48777. }
  48778. }
  48779. if (isset($schema->not)) {
  48780. $initErrors = $this->getErrors();
  48781. $this->checkUndefined($value, $schema->not, $path, $i);
  48782. if (count($this->getErrors()) == count($initErrors)) {
  48783. $this->addError($path, 'Matched a schema which it should not', 'not');
  48784. } else {
  48785. $this->errors = $initErrors;
  48786. }
  48787. }
  48788. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  48789. $this->validateDependencies($value, $schema->dependencies, $path);
  48790. }
  48791. }
  48792. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  48793. {
  48794. if (!$requiredOnly) {
  48795. return true;
  48796. }
  48797. if (
  48798. $name !== null
  48799. && isset($parentSchema->required)
  48800. && is_array($parentSchema->required)
  48801. && in_array($name, $parentSchema->required)
  48802. ) {
  48803. return true;
  48804. }
  48805. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  48806. return true;
  48807. }
  48808. return false;
  48809. }
  48810. protected function applyDefaultValues(&$value, $schema, $path)
  48811. {
  48812. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  48813. return;
  48814. }
  48815. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  48816. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  48817. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  48818. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  48819. if (
  48820. !LooseTypeCheck::propertyExists($value, $currentProperty)
  48821. && property_exists($propertyDefinition, 'default')
  48822. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  48823. ) {
  48824. if (is_object($propertyDefinition->default)) {
  48825. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  48826. } else {
  48827. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  48828. }
  48829. $this->appliedDefaults[] = $currentProperty;
  48830. }
  48831. }
  48832. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  48833. $items = array();
  48834. if (LooseTypeCheck::isArray($schema->items)) {
  48835. $items = $schema->items;
  48836. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  48837. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  48838. }
  48839. foreach ($items as $currentItem => $itemDefinition) {
  48840. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  48841. if (
  48842. !array_key_exists($currentItem, $value)
  48843. && property_exists($itemDefinition, 'default')
  48844. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  48845. if (is_object($itemDefinition->default)) {
  48846. $value[$currentItem] = clone $itemDefinition->default;
  48847. } else {
  48848. $value[$currentItem] = $itemDefinition->default;
  48849. }
  48850. }
  48851. $path->setFromDefault();
  48852. }
  48853. } elseif (
  48854. $value instanceof self
  48855. && property_exists($schema, 'default')
  48856. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  48857. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  48858. $path->setFromDefault();
  48859. }
  48860. }
  48861. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  48862. {
  48863. if ($value instanceof self) {
  48864. return;
  48865. }
  48866. if (isset($schema->allOf)) {
  48867. $isValid = true;
  48868. foreach ($schema->allOf as $allOf) {
  48869. $initErrors = $this->getErrors();
  48870. $this->checkUndefined($value, $allOf, $path, $i);
  48871. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  48872. }
  48873. if (!$isValid) {
  48874. $this->addError($path, 'Failed to match all schemas', 'allOf');
  48875. }
  48876. }
  48877. if (isset($schema->anyOf)) {
  48878. $isValid = false;
  48879. $startErrors = $this->getErrors();
  48880. $caughtException = null;
  48881. foreach ($schema->anyOf as $anyOf) {
  48882. $initErrors = $this->getErrors();
  48883. try {
  48884. $this->checkUndefined($value, $anyOf, $path, $i);
  48885. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  48886. break;
  48887. }
  48888. } catch (ValidationException $e) {
  48889. $isValid = false;
  48890. }
  48891. }
  48892. if (!$isValid) {
  48893. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  48894. } else {
  48895. $this->errors = $startErrors;
  48896. }
  48897. }
  48898. if (isset($schema->oneOf)) {
  48899. $allErrors = array();
  48900. $matchedSchemas = 0;
  48901. $startErrors = $this->getErrors();
  48902. foreach ($schema->oneOf as $oneOf) {
  48903. try {
  48904. $this->errors = array();
  48905. $this->checkUndefined($value, $oneOf, $path, $i);
  48906. if (count($this->getErrors()) == 0) {
  48907. $matchedSchemas++;
  48908. }
  48909. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  48910. } catch (ValidationException $e) {
  48911. }
  48912. }
  48913. if ($matchedSchemas !== 1) {
  48914. $this->addErrors(array_merge($allErrors, $startErrors));
  48915. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  48916. } else {
  48917. $this->errors = $startErrors;
  48918. }
  48919. }
  48920. }
  48921. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  48922. {
  48923. foreach ($dependencies as $key => $dependency) {
  48924. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  48925. if (is_string($dependency)) {
  48926. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  48927. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  48928. }
  48929. } elseif (is_array($dependency)) {
  48930. foreach ($dependency as $d) {
  48931. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  48932. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  48933. }
  48934. }
  48935. } elseif (is_object($dependency)) {
  48936. $this->checkUndefined($value, $dependency, $path, $i);
  48937. }
  48938. }
  48939. }
  48940. }
  48941. protected function validateUri($schema, $schemaUri = null)
  48942. {
  48943. $resolver = new UriResolver();
  48944. $retriever = $this->factory->getUriRetriever();
  48945. $jsonSchema = null;
  48946. if ($resolver->isValid($schemaUri)) {
  48947. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  48948. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  48949. }
  48950. return $jsonSchema;
  48951. }
  48952. }
  48953. <?php
  48954. namespace JsonSchema\Entity;
  48955. use JsonSchema\Exception\InvalidArgumentException;
  48956. class JsonPointer
  48957. {
  48958. private $filename;
  48959. private $propertyPaths = array();
  48960. private $fromDefault = false;
  48961. public function __construct($value)
  48962. {
  48963. if (!is_string($value)) {
  48964. throw new InvalidArgumentException('Ref value must be a string');
  48965. }
  48966. $splitRef = explode('#', $value, 2);
  48967. $this->filename = $splitRef[0];
  48968. if (array_key_exists(1, $splitRef)) {
  48969. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  48970. }
  48971. }
  48972. private function decodePropertyPaths($propertyPathString)
  48973. {
  48974. $paths = array();
  48975. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  48976. $path = $this->decodePath($path);
  48977. if (is_string($path) && '' !== $path) {
  48978. $paths[] = $path;
  48979. }
  48980. }
  48981. return $paths;
  48982. }
  48983. private function encodePropertyPaths()
  48984. {
  48985. return array_map(
  48986. array($this, 'encodePath'),
  48987. $this->getPropertyPaths()
  48988. );
  48989. }
  48990. private function decodePath($path)
  48991. {
  48992. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  48993. }
  48994. private function encodePath($path)
  48995. {
  48996. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  48997. }
  48998. public function getFilename()
  48999. {
  49000. return $this->filename;
  49001. }
  49002. public function getPropertyPaths()
  49003. {
  49004. return $this->propertyPaths;
  49005. }
  49006. public function withPropertyPaths(array $propertyPaths)
  49007. {
  49008. $new = clone $this;
  49009. $new->propertyPaths = $propertyPaths;
  49010. return $new;
  49011. }
  49012. public function getPropertyPathAsString()
  49013. {
  49014. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  49015. }
  49016. public function __toString()
  49017. {
  49018. return $this->getFilename() . $this->getPropertyPathAsString();
  49019. }
  49020. public function setFromDefault()
  49021. {
  49022. $this->fromDefault = true;
  49023. }
  49024. public function fromDefault()
  49025. {
  49026. return $this->fromDefault;
  49027. }
  49028. }
  49029. <?php
  49030. namespace JsonSchema\Exception;
  49031. interface ExceptionInterface
  49032. {
  49033. }
  49034. <?php
  49035. namespace JsonSchema\Exception;
  49036. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  49037. {
  49038. }
  49039. <?php
  49040. namespace JsonSchema\Exception;
  49041. class InvalidConfigException extends RuntimeException
  49042. {
  49043. }
  49044. <?php
  49045. namespace JsonSchema\Exception;
  49046. class InvalidSchemaException extends RuntimeException
  49047. {
  49048. }
  49049. <?php
  49050. namespace JsonSchema\Exception;
  49051. class InvalidSchemaMediaTypeException extends RuntimeException
  49052. {
  49053. }
  49054. <?php
  49055. namespace JsonSchema\Exception;
  49056. class InvalidSourceUriException extends InvalidArgumentException
  49057. {
  49058. }
  49059. <?php
  49060. namespace JsonSchema\Exception;
  49061. class JsonDecodingException extends RuntimeException
  49062. {
  49063. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  49064. {
  49065. switch ($code) {
  49066. case JSON_ERROR_DEPTH:
  49067. $message = 'The maximum stack depth has been exceeded';
  49068. break;
  49069. case JSON_ERROR_STATE_MISMATCH:
  49070. $message = 'Invalid or malformed JSON';
  49071. break;
  49072. case JSON_ERROR_CTRL_CHAR:
  49073. $message = 'Control character error, possibly incorrectly encoded';
  49074. break;
  49075. case JSON_ERROR_UTF8:
  49076. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  49077. break;
  49078. case JSON_ERROR_SYNTAX:
  49079. $message = 'JSON syntax is malformed';
  49080. break;
  49081. default:
  49082. $message = 'Syntax error';
  49083. }
  49084. parent::__construct($message, $code, $previous);
  49085. }
  49086. }
  49087. <?php
  49088. namespace JsonSchema\Exception;
  49089. class ResourceNotFoundException extends RuntimeException
  49090. {
  49091. }
  49092. <?php
  49093. namespace JsonSchema\Exception;
  49094. class RuntimeException extends \RuntimeException implements ExceptionInterface
  49095. {
  49096. }
  49097. <?php
  49098. namespace JsonSchema\Exception;
  49099. class UnresolvableJsonPointerException extends InvalidArgumentException
  49100. {
  49101. }
  49102. <?php
  49103. namespace JsonSchema\Exception;
  49104. class UriResolverException extends RuntimeException
  49105. {
  49106. }
  49107. <?php
  49108. namespace JsonSchema\Exception;
  49109. class ValidationException extends RuntimeException
  49110. {
  49111. }
  49112. <?php
  49113. namespace JsonSchema\Iterator;
  49114. class ObjectIterator implements \Iterator, \Countable
  49115. {
  49116. private $object;
  49117. private $position = 0;
  49118. private $data = array();
  49119. private $initialized = false;
  49120. public function __construct($object)
  49121. {
  49122. $this->object = $object;
  49123. }
  49124. public function current()
  49125. {
  49126. $this->initialize();
  49127. return $this->data[$this->position];
  49128. }
  49129. public function next()
  49130. {
  49131. $this->initialize();
  49132. $this->position++;
  49133. }
  49134. public function key()
  49135. {
  49136. $this->initialize();
  49137. return $this->position;
  49138. }
  49139. public function valid()
  49140. {
  49141. $this->initialize();
  49142. return isset($this->data[$this->position]);
  49143. }
  49144. public function rewind()
  49145. {
  49146. $this->initialize();
  49147. $this->position = 0;
  49148. }
  49149. public function count()
  49150. {
  49151. $this->initialize();
  49152. return count($this->data);
  49153. }
  49154. private function initialize()
  49155. {
  49156. if (!$this->initialized) {
  49157. $this->data = $this->buildDataFromObject($this->object);
  49158. $this->initialized = true;
  49159. }
  49160. }
  49161. private function buildDataFromObject($object)
  49162. {
  49163. $result = array();
  49164. $stack = new \SplStack();
  49165. $stack->push($object);
  49166. while (!$stack->isEmpty()) {
  49167. $current = $stack->pop();
  49168. if (is_object($current)) {
  49169. array_push($result, $current);
  49170. }
  49171. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  49172. if (is_object($propertyValue) || is_array($propertyValue)) {
  49173. $stack->push($propertyValue);
  49174. }
  49175. }
  49176. }
  49177. return $result;
  49178. }
  49179. private function getDataFromItem($item)
  49180. {
  49181. if (!is_object($item) && !is_array($item)) {
  49182. return array();
  49183. }
  49184. return is_object($item) ? get_object_vars($item) : $item;
  49185. }
  49186. }
  49187. <?php
  49188. namespace JsonSchema;
  49189. class Rfc3339
  49190. {
  49191. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  49192. public static function createFromString($string)
  49193. {
  49194. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  49195. return null;
  49196. }
  49197. $dateAndTime = $matches[1];
  49198. $microseconds = $matches[2] ?: '.000000';
  49199. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  49200. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  49201. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  49202. return $dateTime ?: null;
  49203. }
  49204. }
  49205. <?php
  49206. namespace JsonSchema;
  49207. use JsonSchema\Constraints\BaseConstraint;
  49208. use JsonSchema\Entity\JsonPointer;
  49209. use JsonSchema\Exception\UnresolvableJsonPointerException;
  49210. use JsonSchema\Uri\UriResolver;
  49211. use JsonSchema\Uri\UriRetriever;
  49212. class SchemaStorage implements SchemaStorageInterface
  49213. {
  49214. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  49215. protected $uriRetriever;
  49216. protected $uriResolver;
  49217. protected $schemas = array();
  49218. public function __construct(
  49219. UriRetrieverInterface $uriRetriever = null,
  49220. UriResolverInterface $uriResolver = null
  49221. ) {
  49222. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  49223. $this->uriResolver = $uriResolver ?: new UriResolver();
  49224. }
  49225. public function getUriRetriever()
  49226. {
  49227. return $this->uriRetriever;
  49228. }
  49229. public function getUriResolver()
  49230. {
  49231. return $this->uriResolver;
  49232. }
  49233. public function addSchema($id, $schema = null)
  49234. {
  49235. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  49236. $schema = $this->uriRetriever->retrieve($id);
  49237. }
  49238. if (is_array($schema)) {
  49239. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  49240. }
  49241. if (is_object($schema) && property_exists($schema, 'id')) {
  49242. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  49243. $schema->properties->id->format = 'uri-reference';
  49244. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  49245. $schema->properties->id->format = 'uri-reference';
  49246. $schema->properties->{'$ref'}->format = 'uri-reference';
  49247. }
  49248. }
  49249. $this->expandRefs($schema, $id);
  49250. $this->schemas[$id] = $schema;
  49251. }
  49252. private function expandRefs(&$schema, $base = null)
  49253. {
  49254. if (!is_object($schema)) {
  49255. if (is_array($schema)) {
  49256. foreach ($schema as &$member) {
  49257. $this->expandRefs($member, $base);
  49258. }
  49259. }
  49260. return;
  49261. }
  49262. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  49263. $base = $this->uriResolver->resolve($schema->id, $base);
  49264. }
  49265. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  49266. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  49267. $schema->{'$ref'} = (string) $refPointer;
  49268. }
  49269. foreach ($schema as &$member) {
  49270. $this->expandRefs($member, $base);
  49271. }
  49272. }
  49273. public function getSchema($id)
  49274. {
  49275. if (!array_key_exists($id, $this->schemas)) {
  49276. $this->addSchema($id);
  49277. }
  49278. return $this->schemas[$id];
  49279. }
  49280. public function resolveRef($ref)
  49281. {
  49282. $jsonPointer = new JsonPointer($ref);
  49283. $fileName = $jsonPointer->getFilename();
  49284. if (!strlen($fileName)) {
  49285. throw new UnresolvableJsonPointerException(sprintf(
  49286. "Could not resolve fragment '%s': no file is defined",
  49287. $jsonPointer->getPropertyPathAsString()
  49288. ));
  49289. }
  49290. $refSchema = $this->getSchema($fileName);
  49291. foreach ($jsonPointer->getPropertyPaths() as $path) {
  49292. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  49293. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  49294. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  49295. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  49296. } else {
  49297. throw new UnresolvableJsonPointerException(sprintf(
  49298. 'File: %s is found, but could not resolve fragment: %s',
  49299. $jsonPointer->getFilename(),
  49300. $jsonPointer->getPropertyPathAsString()
  49301. ));
  49302. }
  49303. }
  49304. return $refSchema;
  49305. }
  49306. public function resolveRefSchema($refSchema)
  49307. {
  49308. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  49309. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  49310. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  49311. unset($refSchema->{'$ref'});
  49312. }
  49313. return $refSchema;
  49314. }
  49315. }
  49316. <?php
  49317. namespace JsonSchema;
  49318. interface SchemaStorageInterface
  49319. {
  49320. public function addSchema($id, $schema = null);
  49321. public function getSchema($id);
  49322. public function resolveRef($ref);
  49323. public function resolveRefSchema($refSchema);
  49324. }
  49325. <?php
  49326. namespace JsonSchema\Uri\Retrievers;
  49327. abstract class AbstractRetriever implements UriRetrieverInterface
  49328. {
  49329. protected $contentType;
  49330. public function getContentType()
  49331. {
  49332. return $this->contentType;
  49333. }
  49334. }
  49335. <?php
  49336. namespace JsonSchema\Uri\Retrievers;
  49337. use JsonSchema\Exception\RuntimeException;
  49338. use JsonSchema\Validator;
  49339. class Curl extends AbstractRetriever
  49340. {
  49341. protected $messageBody;
  49342. public function __construct()
  49343. {
  49344. if (!function_exists('curl_init')) {
  49345. throw new RuntimeException('cURL not installed');
  49346. }
  49347. }
  49348. public function retrieve($uri)
  49349. {
  49350. $ch = curl_init();
  49351. curl_setopt($ch, CURLOPT_URL, $uri);
  49352. curl_setopt($ch, CURLOPT_HEADER, true);
  49353. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  49354. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  49355. $response = curl_exec($ch);
  49356. if (false === $response) {
  49357. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  49358. }
  49359. $this->fetchMessageBody($response);
  49360. $this->fetchContentType($response);
  49361. curl_close($ch);
  49362. return $this->messageBody;
  49363. }
  49364. private function fetchMessageBody($response)
  49365. {
  49366. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  49367. $this->messageBody = $match[1];
  49368. }
  49369. protected function fetchContentType($response)
  49370. {
  49371. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  49372. $this->contentType = trim($match[1]);
  49373. return true;
  49374. }
  49375. return false;
  49376. }
  49377. }
  49378. <?php
  49379. namespace JsonSchema\Uri\Retrievers;
  49380. use JsonSchema\Exception\ResourceNotFoundException;
  49381. class FileGetContents extends AbstractRetriever
  49382. {
  49383. protected $messageBody;
  49384. public function retrieve($uri)
  49385. {
  49386. $errorMessage = null;
  49387. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  49388. $errorMessage = $errstr;
  49389. });
  49390. $response = file_get_contents($uri);
  49391. restore_error_handler();
  49392. if ($errorMessage) {
  49393. throw new ResourceNotFoundException($errorMessage);
  49394. }
  49395. if (false === $response) {
  49396. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  49397. }
  49398. if ($response == ''
  49399. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  49400. ) {
  49401. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  49402. }
  49403. $this->messageBody = $response;
  49404. if (!empty($http_response_header)) {
  49405. $this->fetchContentType($http_response_header);
  49406. } else {
  49407. $this->contentType = null;
  49408. }
  49409. return $this->messageBody;
  49410. }
  49411. private function fetchContentType(array $headers)
  49412. {
  49413. foreach ($headers as $header) {
  49414. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  49415. return true;
  49416. }
  49417. }
  49418. return false;
  49419. }
  49420. protected static function getContentTypeMatchInHeader($header)
  49421. {
  49422. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  49423. return trim($match[1]);
  49424. }
  49425. return null;
  49426. }
  49427. }
  49428. <?php
  49429. namespace JsonSchema\Uri\Retrievers;
  49430. use JsonSchema\Validator;
  49431. class PredefinedArray extends AbstractRetriever
  49432. {
  49433. private $schemas;
  49434. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  49435. {
  49436. $this->schemas = $schemas;
  49437. $this->contentType = $contentType;
  49438. }
  49439. public function retrieve($uri)
  49440. {
  49441. if (!array_key_exists($uri, $this->schemas)) {
  49442. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  49443. 'The JSON schema "%s" was not found.',
  49444. $uri
  49445. ));
  49446. }
  49447. return $this->schemas[$uri];
  49448. }
  49449. }
  49450. <?php
  49451. namespace JsonSchema\Uri\Retrievers;
  49452. interface UriRetrieverInterface
  49453. {
  49454. public function retrieve($uri);
  49455. public function getContentType();
  49456. }
  49457. <?php
  49458. namespace JsonSchema\Uri;
  49459. use JsonSchema\Exception\UriResolverException;
  49460. use JsonSchema\UriResolverInterface;
  49461. class UriResolver implements UriResolverInterface
  49462. {
  49463. public function parse($uri)
  49464. {
  49465. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  49466. $components = array();
  49467. if (5 < count($match)) {
  49468. $components = array(
  49469. 'scheme' => $match[2],
  49470. 'authority' => $match[4],
  49471. 'path' => $match[5]
  49472. );
  49473. }
  49474. if (7 < count($match)) {
  49475. $components['query'] = $match[7];
  49476. }
  49477. if (9 < count($match)) {
  49478. $components['fragment'] = $match[9];
  49479. }
  49480. return $components;
  49481. }
  49482. public function generate(array $components)
  49483. {
  49484. $uri = $components['scheme'] . '://'
  49485. . $components['authority']
  49486. . $components['path'];
  49487. if (array_key_exists('query', $components) && strlen($components['query'])) {
  49488. $uri .= '?' . $components['query'];
  49489. }
  49490. if (array_key_exists('fragment', $components)) {
  49491. $uri .= '#' . $components['fragment'];
  49492. }
  49493. return $uri;
  49494. }
  49495. public function resolve($uri, $baseUri = null)
  49496. {
  49497. if (
  49498. !is_null($baseUri) &&
  49499. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  49500. !preg_match('|^[^/]+://|u', $baseUri)
  49501. ) {
  49502. if (is_file($baseUri)) {
  49503. $baseUri = 'file://' . realpath($baseUri);
  49504. } elseif (is_dir($baseUri)) {
  49505. $baseUri = 'file://' . realpath($baseUri) . '/';
  49506. } else {
  49507. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  49508. }
  49509. }
  49510. if ($uri == '') {
  49511. return $baseUri;
  49512. }
  49513. $components = $this->parse($uri);
  49514. $path = $components['path'];
  49515. if (!empty($components['scheme'])) {
  49516. return $uri;
  49517. }
  49518. $baseComponents = $this->parse($baseUri);
  49519. $basePath = $baseComponents['path'];
  49520. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  49521. if (isset($components['fragment'])) {
  49522. $baseComponents['fragment'] = $components['fragment'];
  49523. }
  49524. return $this->generate($baseComponents);
  49525. }
  49526. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  49527. {
  49528. $relativePath = self::normalizePath($relativePath);
  49529. if ($relativePath == '') {
  49530. return $basePath;
  49531. }
  49532. if ($relativePath[0] == '/') {
  49533. return $relativePath;
  49534. }
  49535. $basePathSegments = explode('/', $basePath);
  49536. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  49537. $numLevelUp = strlen($match[0]) /3 + 1;
  49538. if ($numLevelUp >= count($basePathSegments)) {
  49539. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  49540. }
  49541. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  49542. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  49543. return implode('/', $basePathSegments) . '/' . $path;
  49544. }
  49545. private static function normalizePath($path)
  49546. {
  49547. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  49548. $path = preg_replace('|//|', '/', $path);
  49549. return $path;
  49550. }
  49551. public function isValid($uri)
  49552. {
  49553. $components = $this->parse($uri);
  49554. return !empty($components);
  49555. }
  49556. }
  49557. <?php
  49558. namespace JsonSchema\Uri;
  49559. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  49560. use JsonSchema\Exception\JsonDecodingException;
  49561. use JsonSchema\Exception\ResourceNotFoundException;
  49562. use JsonSchema\Uri\Retrievers\FileGetContents;
  49563. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  49564. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  49565. use JsonSchema\Validator;
  49566. class UriRetriever implements BaseUriRetrieverInterface
  49567. {
  49568. protected $translationMap = array(
  49569. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  49570. );
  49571. protected $uriRetriever = null;
  49572. private $schemaCache = array();
  49573. public function confirmMediaType($uriRetriever, $uri)
  49574. {
  49575. $contentType = $uriRetriever->getContentType();
  49576. if (is_null($contentType)) {
  49577. return;
  49578. }
  49579. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  49580. return;
  49581. }
  49582. if (substr($uri, 0, 23) == 'http://json-schema.org/') {
  49583. return true;
  49584. }
  49585. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  49586. }
  49587. public function getUriRetriever()
  49588. {
  49589. if (is_null($this->uriRetriever)) {
  49590. $this->setUriRetriever(new FileGetContents());
  49591. }
  49592. return $this->uriRetriever;
  49593. }
  49594. public function resolvePointer($jsonSchema, $uri)
  49595. {
  49596. $resolver = new UriResolver();
  49597. $parsed = $resolver->parse($uri);
  49598. if (empty($parsed['fragment'])) {
  49599. return $jsonSchema;
  49600. }
  49601. $path = explode('/', $parsed['fragment']);
  49602. while ($path) {
  49603. $pathElement = array_shift($path);
  49604. if (!empty($pathElement)) {
  49605. $pathElement = str_replace('~1', '/', $pathElement);
  49606. $pathElement = str_replace('~0', '~', $pathElement);
  49607. if (!empty($jsonSchema->$pathElement)) {
  49608. $jsonSchema = $jsonSchema->$pathElement;
  49609. } else {
  49610. throw new ResourceNotFoundException(
  49611. 'Fragment "' . $parsed['fragment'] . '" not found'
  49612. . ' in ' . $uri
  49613. );
  49614. }
  49615. if (!is_object($jsonSchema)) {
  49616. throw new ResourceNotFoundException(
  49617. 'Fragment part "' . $pathElement . '" is no object '
  49618. . ' in ' . $uri
  49619. );
  49620. }
  49621. }
  49622. }
  49623. return $jsonSchema;
  49624. }
  49625. public function retrieve($uri, $baseUri = null, $translate = true)
  49626. {
  49627. $resolver = new UriResolver();
  49628. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  49629. $arParts = $resolver->parse($resolvedUri);
  49630. if (isset($arParts['fragment'])) {
  49631. unset($arParts['fragment']);
  49632. $fetchUri = $resolver->generate($arParts);
  49633. }
  49634. if ($translate) {
  49635. $fetchUri = $this->translate($fetchUri);
  49636. }
  49637. $jsonSchema = $this->loadSchema($fetchUri);
  49638. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  49639. if ($jsonSchema instanceof \stdClass) {
  49640. $jsonSchema->id = $resolvedUri;
  49641. }
  49642. return $jsonSchema;
  49643. }
  49644. protected function loadSchema($fetchUri)
  49645. {
  49646. if (isset($this->schemaCache[$fetchUri])) {
  49647. return $this->schemaCache[$fetchUri];
  49648. }
  49649. $uriRetriever = $this->getUriRetriever();
  49650. $contents = $this->uriRetriever->retrieve($fetchUri);
  49651. $this->confirmMediaType($uriRetriever, $fetchUri);
  49652. $jsonSchema = json_decode($contents);
  49653. if (JSON_ERROR_NONE < $error = json_last_error()) {
  49654. throw new JsonDecodingException($error);
  49655. }
  49656. $this->schemaCache[$fetchUri] = $jsonSchema;
  49657. return $jsonSchema;
  49658. }
  49659. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  49660. {
  49661. $this->uriRetriever = $uriRetriever;
  49662. return $this;
  49663. }
  49664. public function parse($uri)
  49665. {
  49666. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  49667. $components = array();
  49668. if (5 < count($match)) {
  49669. $components = array(
  49670. 'scheme' => $match[2],
  49671. 'authority' => $match[4],
  49672. 'path' => $match[5]
  49673. );
  49674. }
  49675. if (7 < count($match)) {
  49676. $components['query'] = $match[7];
  49677. }
  49678. if (9 < count($match)) {
  49679. $components['fragment'] = $match[9];
  49680. }
  49681. return $components;
  49682. }
  49683. public function generate(array $components)
  49684. {
  49685. $uri = $components['scheme'] . '://'
  49686. . $components['authority']
  49687. . $components['path'];
  49688. if (array_key_exists('query', $components)) {
  49689. $uri .= $components['query'];
  49690. }
  49691. if (array_key_exists('fragment', $components)) {
  49692. $uri .= $components['fragment'];
  49693. }
  49694. return $uri;
  49695. }
  49696. public function resolve($uri, $baseUri = null)
  49697. {
  49698. $components = $this->parse($uri);
  49699. $path = $components['path'];
  49700. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  49701. return $uri;
  49702. }
  49703. $baseComponents = $this->parse($baseUri);
  49704. $basePath = $baseComponents['path'];
  49705. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  49706. return $this->generate($baseComponents);
  49707. }
  49708. public function isValid($uri)
  49709. {
  49710. $components = $this->parse($uri);
  49711. return !empty($components);
  49712. }
  49713. public function setTranslation($from, $to)
  49714. {
  49715. $this->translationMap[$from] = $to;
  49716. }
  49717. public function translate($uri)
  49718. {
  49719. foreach ($this->translationMap as $from => $to) {
  49720. $uri = preg_replace($from, $to, $uri);
  49721. }
  49722. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  49723. return $uri;
  49724. }
  49725. }
  49726. <?php
  49727. namespace JsonSchema;
  49728. interface UriResolverInterface
  49729. {
  49730. public function resolve($uri, $baseUri = null);
  49731. }
  49732. <?php
  49733. namespace JsonSchema;
  49734. interface UriRetrieverInterface
  49735. {
  49736. public function retrieve($uri, $baseUri = null);
  49737. }
  49738. <?php
  49739. namespace JsonSchema;
  49740. use JsonSchema\Constraints\BaseConstraint;
  49741. use JsonSchema\Constraints\Constraint;
  49742. class Validator extends BaseConstraint
  49743. {
  49744. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  49745. const ERROR_NONE = 0x00000000;
  49746. const ERROR_ALL = 0xFFFFFFFF;
  49747. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  49748. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  49749. public function validate(&$value, $schema = null, $checkMode = null)
  49750. {
  49751. if (is_array($schema)) {
  49752. $schema = self::arrayToObjectRecursive($schema);
  49753. }
  49754. $initialCheckMode = $this->factory->getConfig();
  49755. if ($checkMode !== null) {
  49756. $this->factory->setConfig($checkMode);
  49757. }
  49758. if (is_object($schema) && property_exists($schema, 'id')) {
  49759. $schemaURI = $schema->id;
  49760. } else {
  49761. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  49762. }
  49763. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  49764. $validator = $this->factory->createInstanceFor('schema');
  49765. $validator->check(
  49766. $value,
  49767. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  49768. );
  49769. $this->factory->setConfig($initialCheckMode);
  49770. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  49771. return $validator->getErrorMask();
  49772. }
  49773. public function check($value, $schema)
  49774. {
  49775. return $this->validate($value, $schema);
  49776. }
  49777. public function coerce(&$value, $schema)
  49778. {
  49779. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  49780. }
  49781. }
  49782. Copyright (C) 2015 Composer
  49783. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49784. this software and associated documentation files (the "Software"), to deal in
  49785. the Software without restriction, including without limitation the rights to
  49786. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49787. of the Software, and to permit persons to whom the Software is furnished to do
  49788. so, subject to the following conditions:
  49789. The above copyright notice and this permission notice shall be included in all
  49790. copies or substantial portions of the Software.
  49791. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49792. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49793. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49794. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49795. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49796. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49797. SOFTWARE.
  49798. <?php
  49799. namespace Composer\Spdx;
  49800. class SpdxLicenses
  49801. {
  49802. const LICENSES_FILE = 'spdx-licenses.json';
  49803. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  49804. private $licenses;
  49805. private $licensesExpression;
  49806. private $exceptions;
  49807. private $exceptionsExpression;
  49808. public function __construct()
  49809. {
  49810. $this->loadLicenses();
  49811. $this->loadExceptions();
  49812. }
  49813. public function getLicenseByIdentifier($identifier)
  49814. {
  49815. $key = strtolower($identifier);
  49816. if (!isset($this->licenses[$key])) {
  49817. return;
  49818. }
  49819. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  49820. return array(
  49821. $name,
  49822. $isOsiApproved,
  49823. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  49824. $isDeprecatedLicenseId,
  49825. );
  49826. }
  49827. public function getLicenses()
  49828. {
  49829. return $this->licenses;
  49830. }
  49831. public function getExceptionByIdentifier($identifier)
  49832. {
  49833. $key = strtolower($identifier);
  49834. if (!isset($this->exceptions[$key])) {
  49835. return;
  49836. }
  49837. list($identifier, $name) = $this->exceptions[$key];
  49838. return array(
  49839. $name,
  49840. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  49841. );
  49842. }
  49843. public function getIdentifierByName($name)
  49844. {
  49845. foreach ($this->licenses as $licenseData) {
  49846. if ($licenseData[1] === $name) {
  49847. return $licenseData[0];
  49848. }
  49849. }
  49850. foreach ($this->exceptions as $licenseData) {
  49851. if ($licenseData[1] === $name) {
  49852. return $licenseData[0];
  49853. }
  49854. }
  49855. }
  49856. public function isOsiApprovedByIdentifier($identifier)
  49857. {
  49858. return $this->licenses[strtolower($identifier)][2];
  49859. }
  49860. public function isDeprecatedByIdentifier($identifier)
  49861. {
  49862. return $this->licenses[strtolower($identifier)][3];
  49863. }
  49864. public function validate($license)
  49865. {
  49866. if (is_array($license)) {
  49867. $count = count($license);
  49868. if ($count !== count(array_filter($license, 'is_string'))) {
  49869. throw new \InvalidArgumentException('Array of strings expected.');
  49870. }
  49871. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  49872. }
  49873. if (!is_string($license)) {
  49874. throw new \InvalidArgumentException(sprintf(
  49875. 'Array or String expected, %s given.',
  49876. gettype($license)
  49877. ));
  49878. }
  49879. return $this->isValidLicenseString($license);
  49880. }
  49881. public static function getResourcesDir()
  49882. {
  49883. return dirname(__DIR__) . '/res';
  49884. }
  49885. private function loadLicenses()
  49886. {
  49887. if (null !== $this->licenses) {
  49888. return;
  49889. }
  49890. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  49891. $this->licenses = array();
  49892. foreach (json_decode($json, true) as $identifier => $license) {
  49893. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  49894. }
  49895. }
  49896. private function loadExceptions()
  49897. {
  49898. if (null !== $this->exceptions) {
  49899. return;
  49900. }
  49901. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  49902. $this->exceptions = array();
  49903. foreach (json_decode($json, true) as $identifier => $exception) {
  49904. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  49905. }
  49906. }
  49907. private function getLicensesExpression()
  49908. {
  49909. if (null === $this->licensesExpression) {
  49910. $licenses = array_map('preg_quote', array_keys($this->licenses));
  49911. rsort($licenses);
  49912. $licenses = implode('|', $licenses);
  49913. $this->licensesExpression = $licenses;
  49914. }
  49915. return $this->licensesExpression;
  49916. }
  49917. private function getExceptionsExpression()
  49918. {
  49919. if (null === $this->exceptionsExpression) {
  49920. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  49921. rsort($exceptions);
  49922. $exceptions = implode('|', $exceptions);
  49923. $this->exceptionsExpression = $exceptions;
  49924. }
  49925. return $this->exceptionsExpression;
  49926. }
  49927. private function isValidLicenseString($license)
  49928. {
  49929. if (isset($this->licenses[strtolower($license)])) {
  49930. return true;
  49931. }
  49932. $licenses = $this->getLicensesExpression();
  49933. $exceptions = $this->getExceptionsExpression();
  49934. $regex = <<<REGEX
  49935. {
  49936. (?(DEFINE)
  49937. # idstring: 1*( ALPHA / DIGIT / - / . )
  49938. (?<idstring>[\pL\pN.-]{1,})
  49939. # license-id: taken from list
  49940. (?<licenseid>${licenses})
  49941. # license-exception-id: taken from list
  49942. (?<licenseexceptionid>${exceptions})
  49943. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  49944. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  49945. # simple-expresssion: license-id / license-id+ / license-ref
  49946. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  49947. # compound-expression: 1*(
  49948. # simple-expression /
  49949. # simple-expression WITH license-exception-id /
  49950. # compound-expression AND compound-expression /
  49951. # compound-expression OR compound-expression
  49952. # ) / ( compound-expression ) )
  49953. (?<compound_head>
  49954. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  49955. | \( \s* (?&compound_expression) \s* \)
  49956. )
  49957. (?<compound_expression>
  49958. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  49959. )
  49960. # license-expression: 1*1(simple-expression / compound-expression)
  49961. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  49962. ) # end of define
  49963. ^(NONE | NOASSERTION | (?&license_expression))$
  49964. }xi
  49965. REGEX;
  49966. $match = preg_match($regex, $license);
  49967. if (0 === $match) {
  49968. return false;
  49969. }
  49970. if (false === $match) {
  49971. throw new \RuntimeException('Regex failed to compile/run.');
  49972. }
  49973. return true;
  49974. }
  49975. }
  49976. Copyright (C) 2015 Composer
  49977. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49978. this software and associated documentation files (the "Software"), to deal in
  49979. the Software without restriction, including without limitation the rights to
  49980. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49981. of the Software, and to permit persons to whom the Software is furnished to do
  49982. so, subject to the following conditions:
  49983. The above copyright notice and this permission notice shall be included in all
  49984. copies or substantial portions of the Software.
  49985. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49986. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49987. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49988. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49989. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49990. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49991. SOFTWARE.
  49992. <?php
  49993. namespace Composer\Semver;
  49994. use Composer\Semver\Constraint\Constraint;
  49995. class Comparator
  49996. {
  49997. public static function greaterThan($version1, $version2)
  49998. {
  49999. return self::compare($version1, '>', $version2);
  50000. }
  50001. public static function greaterThanOrEqualTo($version1, $version2)
  50002. {
  50003. return self::compare($version1, '>=', $version2);
  50004. }
  50005. public static function lessThan($version1, $version2)
  50006. {
  50007. return self::compare($version1, '<', $version2);
  50008. }
  50009. public static function lessThanOrEqualTo($version1, $version2)
  50010. {
  50011. return self::compare($version1, '<=', $version2);
  50012. }
  50013. public static function equalTo($version1, $version2)
  50014. {
  50015. return self::compare($version1, '==', $version2);
  50016. }
  50017. public static function notEqualTo($version1, $version2)
  50018. {
  50019. return self::compare($version1, '!=', $version2);
  50020. }
  50021. public static function compare($version1, $operator, $version2)
  50022. {
  50023. $constraint = new Constraint($operator, $version2);
  50024. return $constraint->matches(new Constraint('==', $version1));
  50025. }
  50026. }
  50027. <?php
  50028. namespace Composer\Semver\Constraint;
  50029. trigger_error('The ' . __NAMESPACE__ . '\AbstractConstraint abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  50030. abstract class AbstractConstraint implements ConstraintInterface
  50031. {
  50032. protected $prettyString;
  50033. public function matches(ConstraintInterface $provider)
  50034. {
  50035. if ($provider instanceof $this) {
  50036. return $this->matchSpecific($provider);
  50037. }
  50038. return $provider->matches($this);
  50039. }
  50040. public function setPrettyString($prettyString)
  50041. {
  50042. $this->prettyString = $prettyString;
  50043. }
  50044. public function getPrettyString()
  50045. {
  50046. if ($this->prettyString) {
  50047. return $this->prettyString;
  50048. }
  50049. return $this->__toString();
  50050. }
  50051. }
  50052. <?php
  50053. namespace Composer\Semver\Constraint;
  50054. class Constraint implements ConstraintInterface
  50055. {
  50056. const OP_EQ = 0;
  50057. const OP_LT = 1;
  50058. const OP_LE = 2;
  50059. const OP_GT = 3;
  50060. const OP_GE = 4;
  50061. const OP_NE = 5;
  50062. private static $transOpStr = array(
  50063. '=' => self::OP_EQ,
  50064. '==' => self::OP_EQ,
  50065. '<' => self::OP_LT,
  50066. '<=' => self::OP_LE,
  50067. '>' => self::OP_GT,
  50068. '>=' => self::OP_GE,
  50069. '<>' => self::OP_NE,
  50070. '!=' => self::OP_NE,
  50071. );
  50072. private static $transOpInt = array(
  50073. self::OP_EQ => '==',
  50074. self::OP_LT => '<',
  50075. self::OP_LE => '<=',
  50076. self::OP_GT => '>',
  50077. self::OP_GE => '>=',
  50078. self::OP_NE => '!=',
  50079. );
  50080. protected $operator;
  50081. protected $version;
  50082. protected $prettyString;
  50083. public function matches(ConstraintInterface $provider)
  50084. {
  50085. if ($provider instanceof $this) {
  50086. return $this->matchSpecific($provider);
  50087. }
  50088. return $provider->matches($this);
  50089. }
  50090. public function setPrettyString($prettyString)
  50091. {
  50092. $this->prettyString = $prettyString;
  50093. }
  50094. public function getPrettyString()
  50095. {
  50096. if ($this->prettyString) {
  50097. return $this->prettyString;
  50098. }
  50099. return $this->__toString();
  50100. }
  50101. public static function getSupportedOperators()
  50102. {
  50103. return array_keys(self::$transOpStr);
  50104. }
  50105. public function __construct($operator, $version)
  50106. {
  50107. if (!isset(self::$transOpStr[$operator])) {
  50108. throw new \InvalidArgumentException(sprintf(
  50109. 'Invalid operator "%s" given, expected one of: %s',
  50110. $operator,
  50111. implode(', ', self::getSupportedOperators())
  50112. ));
  50113. }
  50114. $this->operator = self::$transOpStr[$operator];
  50115. $this->version = $version;
  50116. }
  50117. public function versionCompare($a, $b, $operator, $compareBranches = false)
  50118. {
  50119. if (!isset(self::$transOpStr[$operator])) {
  50120. throw new \InvalidArgumentException(sprintf(
  50121. 'Invalid operator "%s" given, expected one of: %s',
  50122. $operator,
  50123. implode(', ', self::getSupportedOperators())
  50124. ));
  50125. }
  50126. $aIsBranch = 'dev-' === substr($a, 0, 4);
  50127. $bIsBranch = 'dev-' === substr($b, 0, 4);
  50128. if ($aIsBranch && $bIsBranch) {
  50129. return $operator === '==' && $a === $b;
  50130. }
  50131. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  50132. return false;
  50133. }
  50134. return version_compare($a, $b, $operator);
  50135. }
  50136. public function matchSpecific(Constraint $provider, $compareBranches = false)
  50137. {
  50138. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  50139. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  50140. $isEqualOp = self::OP_EQ === $this->operator;
  50141. $isNonEqualOp = self::OP_NE === $this->operator;
  50142. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  50143. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  50144. if ($isNonEqualOp || $isProviderNonEqualOp) {
  50145. return !$isEqualOp && !$isProviderEqualOp
  50146. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  50147. }
  50148. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  50149. return true;
  50150. }
  50151. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  50152. if ($provider->version === $this->version
  50153. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  50154. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  50155. return false;
  50156. }
  50157. return true;
  50158. }
  50159. return false;
  50160. }
  50161. public function __toString()
  50162. {
  50163. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  50164. }
  50165. }
  50166. <?php
  50167. namespace Composer\Semver\Constraint;
  50168. interface ConstraintInterface
  50169. {
  50170. public function matches(ConstraintInterface $provider);
  50171. public function getPrettyString();
  50172. public function __toString();
  50173. }
  50174. <?php
  50175. namespace Composer\Semver\Constraint;
  50176. class EmptyConstraint implements ConstraintInterface
  50177. {
  50178. protected $prettyString;
  50179. public function matches(ConstraintInterface $provider)
  50180. {
  50181. return true;
  50182. }
  50183. public function setPrettyString($prettyString)
  50184. {
  50185. $this->prettyString = $prettyString;
  50186. }
  50187. public function getPrettyString()
  50188. {
  50189. if ($this->prettyString) {
  50190. return $this->prettyString;
  50191. }
  50192. return $this->__toString();
  50193. }
  50194. public function __toString()
  50195. {
  50196. return '[]';
  50197. }
  50198. }
  50199. <?php
  50200. namespace Composer\Semver\Constraint;
  50201. class MultiConstraint implements ConstraintInterface
  50202. {
  50203. protected $constraints;
  50204. protected $prettyString;
  50205. protected $conjunctive;
  50206. public function __construct(array $constraints, $conjunctive = true)
  50207. {
  50208. $this->constraints = $constraints;
  50209. $this->conjunctive = $conjunctive;
  50210. }
  50211. public function getConstraints()
  50212. {
  50213. return $this->constraints;
  50214. }
  50215. public function isConjunctive()
  50216. {
  50217. return $this->conjunctive;
  50218. }
  50219. public function isDisjunctive()
  50220. {
  50221. return !$this->conjunctive;
  50222. }
  50223. public function matches(ConstraintInterface $provider)
  50224. {
  50225. if (false === $this->conjunctive) {
  50226. foreach ($this->constraints as $constraint) {
  50227. if ($constraint->matches($provider)) {
  50228. return true;
  50229. }
  50230. }
  50231. return false;
  50232. }
  50233. foreach ($this->constraints as $constraint) {
  50234. if (!$constraint->matches($provider)) {
  50235. return false;
  50236. }
  50237. }
  50238. return true;
  50239. }
  50240. public function setPrettyString($prettyString)
  50241. {
  50242. $this->prettyString = $prettyString;
  50243. }
  50244. public function getPrettyString()
  50245. {
  50246. if ($this->prettyString) {
  50247. return $this->prettyString;
  50248. }
  50249. return $this->__toString();
  50250. }
  50251. public function __toString()
  50252. {
  50253. $constraints = array();
  50254. foreach ($this->constraints as $constraint) {
  50255. $constraints[] = (string) $constraint;
  50256. }
  50257. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  50258. }
  50259. }
  50260. <?php
  50261. namespace Composer\Semver;
  50262. use Composer\Semver\Constraint\Constraint;
  50263. class Semver
  50264. {
  50265. const SORT_ASC = 1;
  50266. const SORT_DESC = -1;
  50267. private static $versionParser;
  50268. public static function satisfies($version, $constraints)
  50269. {
  50270. if (null === self::$versionParser) {
  50271. self::$versionParser = new VersionParser();
  50272. }
  50273. $versionParser = self::$versionParser;
  50274. $provider = new Constraint('==', $versionParser->normalize($version));
  50275. $constraints = $versionParser->parseConstraints($constraints);
  50276. return $constraints->matches($provider);
  50277. }
  50278. public static function satisfiedBy(array $versions, $constraints)
  50279. {
  50280. $versions = array_filter($versions, function ($version) use ($constraints) {
  50281. return Semver::satisfies($version, $constraints);
  50282. });
  50283. return array_values($versions);
  50284. }
  50285. public static function sort(array $versions)
  50286. {
  50287. return self::usort($versions, self::SORT_ASC);
  50288. }
  50289. public static function rsort(array $versions)
  50290. {
  50291. return self::usort($versions, self::SORT_DESC);
  50292. }
  50293. private static function usort(array $versions, $direction)
  50294. {
  50295. if (null === self::$versionParser) {
  50296. self::$versionParser = new VersionParser();
  50297. }
  50298. $versionParser = self::$versionParser;
  50299. $normalized = array();
  50300. foreach ($versions as $key => $version) {
  50301. $normalized[] = array($versionParser->normalize($version), $key);
  50302. }
  50303. usort($normalized, function (array $left, array $right) use ($direction) {
  50304. if ($left[0] === $right[0]) {
  50305. return 0;
  50306. }
  50307. if (Comparator::lessThan($left[0], $right[0])) {
  50308. return -$direction;
  50309. }
  50310. return $direction;
  50311. });
  50312. $sorted = array();
  50313. foreach ($normalized as $item) {
  50314. $sorted[] = $versions[$item[1]];
  50315. }
  50316. return $sorted;
  50317. }
  50318. }
  50319. <?php
  50320. namespace Composer\Semver;
  50321. use Composer\Semver\Constraint\ConstraintInterface;
  50322. use Composer\Semver\Constraint\EmptyConstraint;
  50323. use Composer\Semver\Constraint\MultiConstraint;
  50324. use Composer\Semver\Constraint\Constraint;
  50325. class VersionParser
  50326. {
  50327. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  50328. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  50329. public static function parseStability($version)
  50330. {
  50331. $version = preg_replace('{#.+$}i', '', $version);
  50332. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  50333. return 'dev';
  50334. }
  50335. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  50336. if (!empty($match[3])) {
  50337. return 'dev';
  50338. }
  50339. if (!empty($match[1])) {
  50340. if ('beta' === $match[1] || 'b' === $match[1]) {
  50341. return 'beta';
  50342. }
  50343. if ('alpha' === $match[1] || 'a' === $match[1]) {
  50344. return 'alpha';
  50345. }
  50346. if ('rc' === $match[1]) {
  50347. return 'RC';
  50348. }
  50349. }
  50350. return 'stable';
  50351. }
  50352. public static function normalizeStability($stability)
  50353. {
  50354. $stability = strtolower($stability);
  50355. return $stability === 'rc' ? 'RC' : $stability;
  50356. }
  50357. public function normalize($version, $fullVersion = null)
  50358. {
  50359. $version = trim($version);
  50360. if (null === $fullVersion) {
  50361. $fullVersion = $version;
  50362. }
  50363. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  50364. $version = $match[1];
  50365. }
  50366. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  50367. return '9999999-dev';
  50368. }
  50369. if ('dev-' === strtolower(substr($version, 0, 4))) {
  50370. return 'dev-' . substr($version, 4);
  50371. }
  50372. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  50373. $version = $match[1];
  50374. }
  50375. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  50376. $version = $matches[1]
  50377. . (!empty($matches[2]) ? $matches[2] : '.0')
  50378. . (!empty($matches[3]) ? $matches[3] : '.0')
  50379. . (!empty($matches[4]) ? $matches[4] : '.0');
  50380. $index = 5;
  50381. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  50382. $version = preg_replace('{\D}', '.', $matches[1]);
  50383. $index = 2;
  50384. }
  50385. if (isset($index)) {
  50386. if (!empty($matches[$index])) {
  50387. if ('stable' === $matches[$index]) {
  50388. return $version;
  50389. }
  50390. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  50391. }
  50392. if (!empty($matches[$index + 2])) {
  50393. $version .= '-dev';
  50394. }
  50395. return $version;
  50396. }
  50397. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  50398. try {
  50399. return $this->normalizeBranch($match[1]);
  50400. } catch (\Exception $e) {
  50401. }
  50402. }
  50403. $extraMessage = '';
  50404. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  50405. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  50406. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  50407. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  50408. }
  50409. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  50410. }
  50411. public function parseNumericAliasPrefix($branch)
  50412. {
  50413. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  50414. return $matches['version'] . '.';
  50415. }
  50416. return false;
  50417. }
  50418. public function normalizeBranch($name)
  50419. {
  50420. $name = trim($name);
  50421. if (in_array($name, array('master', 'trunk', 'default'))) {
  50422. return $this->normalize($name);
  50423. }
  50424. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  50425. $version = '';
  50426. for ($i = 1; $i < 5; ++$i) {
  50427. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  50428. }
  50429. return str_replace('x', '9999999', $version) . '-dev';
  50430. }
  50431. return 'dev-' . $name;
  50432. }
  50433. public function parseConstraints($constraints)
  50434. {
  50435. $prettyConstraint = $constraints;
  50436. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  50437. $constraints = empty($match[1]) ? '*' : $match[1];
  50438. }
  50439. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  50440. $constraints = $match[1];
  50441. }
  50442. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  50443. $orGroups = array();
  50444. foreach ($orConstraints as $constraints) {
  50445. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  50446. if (count($andConstraints) > 1) {
  50447. $constraintObjects = array();
  50448. foreach ($andConstraints as $constraint) {
  50449. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  50450. $constraintObjects[] = $parsedConstraint;
  50451. }
  50452. }
  50453. } else {
  50454. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  50455. }
  50456. if (1 === count($constraintObjects)) {
  50457. $constraint = $constraintObjects[0];
  50458. } else {
  50459. $constraint = new MultiConstraint($constraintObjects);
  50460. }
  50461. $orGroups[] = $constraint;
  50462. }
  50463. if (1 === count($orGroups)) {
  50464. $constraint = $orGroups[0];
  50465. } elseif (2 === count($orGroups)
  50466. && $orGroups[0] instanceof MultiConstraint
  50467. && $orGroups[1] instanceof MultiConstraint
  50468. && 2 === count($orGroups[0]->getConstraints())
  50469. && 2 === count($orGroups[1]->getConstraints())
  50470. && ($a = (string) $orGroups[0])
  50471. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  50472. && ($b = (string) $orGroups[1])
  50473. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  50474. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  50475. ) {
  50476. $constraint = new MultiConstraint(array(
  50477. new Constraint('>=', substr($a, 4, $posA - 5)),
  50478. new Constraint('<', substr($b, $posB + 2, -1)),
  50479. ));
  50480. } else {
  50481. $constraint = new MultiConstraint($orGroups, false);
  50482. }
  50483. $constraint->setPrettyString($prettyConstraint);
  50484. return $constraint;
  50485. }
  50486. private function parseConstraint($constraint)
  50487. {
  50488. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  50489. $constraint = $match[1];
  50490. if ($match[2] !== 'stable') {
  50491. $stabilityModifier = $match[2];
  50492. }
  50493. }
  50494. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  50495. return array(new EmptyConstraint());
  50496. }
  50497. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  50498. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  50499. if (substr($constraint, 0, 2) === '~>') {
  50500. throw new \UnexpectedValueException(
  50501. 'Could not parse version constraint ' . $constraint . ': ' .
  50502. 'Invalid operator "~>", you probably meant to use the "~" operator'
  50503. );
  50504. }
  50505. if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
  50506. $position = 4;
  50507. } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  50508. $position = 3;
  50509. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  50510. $position = 2;
  50511. } else {
  50512. $position = 1;
  50513. }
  50514. $stabilitySuffix = '';
  50515. if (empty($matches[5]) && empty($matches[7])) {
  50516. $stabilitySuffix .= '-dev';
  50517. }
  50518. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  50519. $lowerBound = new Constraint('>=', $lowVersion);
  50520. $highPosition = max(1, $position - 1);
  50521. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  50522. $upperBound = new Constraint('<', $highVersion);
  50523. return array(
  50524. $lowerBound,
  50525. $upperBound,
  50526. );
  50527. }
  50528. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  50529. if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
  50530. $position = 1;
  50531. } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
  50532. $position = 2;
  50533. } else {
  50534. $position = 3;
  50535. }
  50536. $stabilitySuffix = '';
  50537. if (empty($matches[5]) && empty($matches[7])) {
  50538. $stabilitySuffix .= '-dev';
  50539. }
  50540. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  50541. $lowerBound = new Constraint('>=', $lowVersion);
  50542. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50543. $upperBound = new Constraint('<', $highVersion);
  50544. return array(
  50545. $lowerBound,
  50546. $upperBound,
  50547. );
  50548. }
  50549. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  50550. if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  50551. $position = 3;
  50552. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  50553. $position = 2;
  50554. } else {
  50555. $position = 1;
  50556. }
  50557. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  50558. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50559. if ($lowVersion === '0.0.0.0-dev') {
  50560. return array(new Constraint('<', $highVersion));
  50561. }
  50562. return array(
  50563. new Constraint('>=', $lowVersion),
  50564. new Constraint('<', $highVersion),
  50565. );
  50566. }
  50567. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  50568. $lowStabilitySuffix = '';
  50569. if (empty($matches[6]) && empty($matches[8])) {
  50570. $lowStabilitySuffix = '-dev';
  50571. }
  50572. $lowVersion = $this->normalize($matches['from']);
  50573. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  50574. $empty = function ($x) {
  50575. return ($x === 0 || $x === '0') ? false : empty($x);
  50576. };
  50577. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  50578. $highVersion = $this->normalize($matches['to']);
  50579. $upperBound = new Constraint('<=', $highVersion);
  50580. } else {
  50581. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  50582. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  50583. $upperBound = new Constraint('<', $highVersion);
  50584. }
  50585. return array(
  50586. $lowerBound,
  50587. $upperBound,
  50588. );
  50589. }
  50590. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  50591. try {
  50592. $version = $this->normalize($matches[2]);
  50593. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  50594. $version .= '-' . $stabilityModifier;
  50595. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  50596. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  50597. if (substr($matches[2], 0, 4) !== 'dev-') {
  50598. $version .= '-dev';
  50599. }
  50600. }
  50601. }
  50602. return array(new Constraint($matches[1] ?: '=', $version));
  50603. } catch (\Exception $e) {
  50604. }
  50605. }
  50606. $message = 'Could not parse version constraint ' . $constraint;
  50607. if (isset($e)) {
  50608. $message .= ': ' . $e->getMessage();
  50609. }
  50610. throw new \UnexpectedValueException($message);
  50611. }
  50612. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  50613. {
  50614. for ($i = 4; $i > 0; --$i) {
  50615. if ($i > $position) {
  50616. $matches[$i] = $pad;
  50617. } elseif ($i === $position && $increment) {
  50618. $matches[$i] += $increment;
  50619. if ($matches[$i] < 0) {
  50620. $matches[$i] = $pad;
  50621. --$position;
  50622. if ($i === 1) {
  50623. return;
  50624. }
  50625. }
  50626. }
  50627. }
  50628. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  50629. }
  50630. private function expandStability($stability)
  50631. {
  50632. $stability = strtolower($stability);
  50633. switch ($stability) {
  50634. case 'a':
  50635. return 'alpha';
  50636. case 'b':
  50637. return 'beta';
  50638. case 'p':
  50639. case 'pl':
  50640. return 'patch';
  50641. case 'rc':
  50642. return 'RC';
  50643. default:
  50644. return $stability;
  50645. }
  50646. }
  50647. }
  50648. Copyright (C) 2016 Composer
  50649. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50650. this software and associated documentation files (the "Software"), to deal in
  50651. the Software without restriction, including without limitation the rights to
  50652. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50653. of the Software, and to permit persons to whom the Software is furnished to do
  50654. so, subject to the following conditions:
  50655. The above copyright notice and this permission notice shall be included in all
  50656. copies or substantial portions of the Software.
  50657. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50658. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50659. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50660. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50661. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50662. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50663. SOFTWARE.
  50664. <?php
  50665. namespace Composer\CaBundle;
  50666. use Psr\Log\LoggerInterface;
  50667. use Symfony\Component\Process\PhpProcess;
  50668. class CaBundle
  50669. {
  50670. private static $caPath;
  50671. private static $caFileValidity = array();
  50672. private static $useOpensslParse;
  50673. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  50674. {
  50675. if (self::$caPath !== null) {
  50676. return self::$caPath;
  50677. }
  50678. $envCertFile = getenv('SSL_CERT_FILE');
  50679. if ($envCertFile && is_readable($envCertFile) && static::validateCaFile($envCertFile, $logger)) {
  50680. return self::$caPath = $envCertFile;
  50681. }
  50682. $envCertDir = getenv('SSL_CERT_DIR');
  50683. if ($envCertDir && is_dir($envCertDir) && is_readable($envCertDir)) {
  50684. return self::$caPath = $envCertDir;
  50685. }
  50686. $configured = ini_get('openssl.cafile');
  50687. if ($configured && strlen($configured) > 0 && is_readable($configured) && static::validateCaFile($configured, $logger)) {
  50688. return self::$caPath = $configured;
  50689. }
  50690. $configured = ini_get('openssl.capath');
  50691. if ($configured && is_dir($configured) && is_readable($configured)) {
  50692. return self::$caPath = $configured;
  50693. }
  50694. $caBundlePaths = array(
  50695. '/etc/pki/tls/certs/ca-bundle.crt',
  50696. '/etc/ssl/certs/ca-certificates.crt',
  50697. '/etc/ssl/ca-bundle.pem',
  50698. '/usr/local/share/certs/ca-root-nss.crt',
  50699. '/usr/ssl/certs/ca-bundle.crt',
  50700. '/opt/local/share/curl/curl-ca-bundle.crt',
  50701. '/usr/local/share/curl/curl-ca-bundle.crt',
  50702. '/usr/share/ssl/certs/ca-bundle.crt',
  50703. '/etc/ssl/cert.pem',
  50704. '/usr/local/etc/ssl/cert.pem',
  50705. '/usr/local/etc/openssl/cert.pem',
  50706. );
  50707. foreach ($caBundlePaths as $caBundle) {
  50708. if (@is_readable($caBundle) && static::validateCaFile($caBundle, $logger)) {
  50709. return self::$caPath = $caBundle;
  50710. }
  50711. }
  50712. foreach ($caBundlePaths as $caBundle) {
  50713. $caBundle = dirname($caBundle);
  50714. if (@is_dir($caBundle) && glob($caBundle.'/*')) {
  50715. return self::$caPath = $caBundle;
  50716. }
  50717. }
  50718. return self::$caPath = static::getBundledCaBundlePath();
  50719. }
  50720. public static function getBundledCaBundlePath()
  50721. {
  50722. $caBundleFile = __DIR__.'/../res/cacert.pem';
  50723. if (0 === strpos($caBundleFile, 'phar://')) {
  50724. file_put_contents(
  50725. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  50726. file_get_contents($caBundleFile)
  50727. );
  50728. register_shutdown_function(function() use ($tempCaBundleFile) {
  50729. @unlink($tempCaBundleFile);
  50730. });
  50731. $caBundleFile = $tempCaBundleFile;
  50732. }
  50733. return $caBundleFile;
  50734. }
  50735. public static function validateCaFile($filename, LoggerInterface $logger = null)
  50736. {
  50737. static $warned = false;
  50738. if (isset(self::$caFileValidity[$filename])) {
  50739. return self::$caFileValidity[$filename];
  50740. }
  50741. $contents = file_get_contents($filename);
  50742. if (!static::isOpensslParseSafe()) {
  50743. if (!$warned && $logger) {
  50744. $logger->warning(sprintf(
  50745. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  50746. PHP_VERSION
  50747. ));
  50748. $warned = true;
  50749. }
  50750. $isValid = !empty($contents);
  50751. } else {
  50752. $isValid = (bool) openssl_x509_parse($contents);
  50753. }
  50754. if ($logger) {
  50755. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  50756. }
  50757. return self::$caFileValidity[$filename] = $isValid;
  50758. }
  50759. public static function isOpensslParseSafe()
  50760. {
  50761. if (null !== self::$useOpensslParse) {
  50762. return self::$useOpensslParse;
  50763. }
  50764. if (PHP_VERSION_ID >= 50600) {
  50765. return self::$useOpensslParse = true;
  50766. }
  50767. if (
  50768. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  50769. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  50770. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  50771. ) {
  50772. return self::$useOpensslParse = true;
  50773. }
  50774. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  50775. return self::$useOpensslParse = false;
  50776. }
  50777. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  50778. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  50779. if (preg_match($regex, PHP_VERSION, $m)) {
  50780. return ((int) $m[1]) >= $fixedVersion;
  50781. }
  50782. return false;
  50783. };
  50784. if (
  50785. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  50786. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  50787. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  50788. ) {
  50789. return self::$useOpensslParse = true;
  50790. }
  50791. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  50792. return self::$useOpensslParse = false;
  50793. }
  50794. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  50795. $script = <<<'EOT'
  50796. error_reporting(-1);
  50797. $info = openssl_x509_parse(base64_decode('%s'));
  50798. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  50799. EOT;
  50800. $script = '<'."?php\n".sprintf($script, $cert);
  50801. try {
  50802. $process = new PhpProcess($script);
  50803. $process->mustRun();
  50804. } catch (\Exception $e) {
  50805. return self::$useOpensslParse = false;
  50806. }
  50807. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  50808. $errorOutput = trim($process->getErrorOutput());
  50809. if (
  50810. count($output) === 3
  50811. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  50812. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  50813. && $output[2] === 'int(-1)'
  50814. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  50815. ) {
  50816. return self::$useOpensslParse = true;
  50817. }
  50818. return self::$useOpensslParse = false;
  50819. }
  50820. public static function reset()
  50821. {
  50822. self::$caFileValidity = array();
  50823. self::$caPath = null;
  50824. self::$useOpensslParse = null;
  50825. }
  50826. }
  50827. MIT License
  50828. Copyright (c) 2017 Composer
  50829. Permission is hereby granted, free of charge, to any person obtaining a copy
  50830. of this software and associated documentation files (the "Software"), to deal
  50831. in the Software without restriction, including without limitation the rights
  50832. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  50833. copies of the Software, and to permit persons to whom the Software is
  50834. furnished to do so, subject to the following conditions:
  50835. The above copyright notice and this permission notice shall be included in all
  50836. copies or substantial portions of the Software.
  50837. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50838. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50839. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50840. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50841. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50842. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50843. SOFTWARE.
  50844. <?php
  50845. namespace Composer\XdebugHandler;
  50846. class PhpConfig
  50847. {
  50848. public function useOriginal()
  50849. {
  50850. $this->getDataAndReset();
  50851. return array();
  50852. }
  50853. public function useStandard()
  50854. {
  50855. if ($data = $this->getDataAndReset()) {
  50856. return array('-n', '-c', $data['tmpIni']);
  50857. }
  50858. return array();
  50859. }
  50860. public function usePersistent()
  50861. {
  50862. if ($data = $this->getDataAndReset()) {
  50863. Process::setEnv('PHPRC', $data['tmpIni']);
  50864. Process::setEnv('PHP_INI_SCAN_DIR', '');
  50865. }
  50866. return array();
  50867. }
  50868. private function getDataAndReset()
  50869. {
  50870. if ($data = XdebugHandler::getRestartSettings()) {
  50871. Process::setEnv('PHPRC', $data['phprc']);
  50872. Process::setEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  50873. }
  50874. return $data;
  50875. }
  50876. }
  50877. <?php
  50878. namespace Composer\XdebugHandler;
  50879. class Process
  50880. {
  50881. public static function addColorOption(array $args, $colorOption)
  50882. {
  50883. if (!$colorOption
  50884. || in_array($colorOption, $args)
  50885. || !preg_match('/^--([a-z]+$)|(^--[a-z]+=)/', $colorOption, $matches)) {
  50886. return $args;
  50887. }
  50888. if (isset($matches[2])) {
  50889. if (false !== ($index = array_search($matches[2].'auto', $args))) {
  50890. $args[$index] = $colorOption;
  50891. return $args;
  50892. } elseif (preg_grep('/^'.$matches[2].'/', $args)) {
  50893. return $args;
  50894. }
  50895. } elseif (in_array('--no-'.$matches[1], $args)) {
  50896. return $args;
  50897. }
  50898. if (false !== ($index = array_search('--', $args))) {
  50899. array_splice($args, $index, 0, $colorOption);
  50900. } else {
  50901. $args[] = $colorOption;
  50902. }
  50903. return $args;
  50904. }
  50905. public static function escape($arg, $meta = true, $module = false)
  50906. {
  50907. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  50908. return "'".str_replace("'", "'\\''", $arg)."'";
  50909. }
  50910. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  50911. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  50912. if ($meta) {
  50913. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  50914. if (!$meta) {
  50915. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  50916. } elseif ($module && !$dquotes && $quote) {
  50917. $meta = false;
  50918. }
  50919. }
  50920. if ($quote) {
  50921. $arg = '"'.preg_replace('/(\\\\*)$/', '$1$1', $arg).'"';
  50922. }
  50923. if ($meta) {
  50924. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  50925. }
  50926. return $arg;
  50927. }
  50928. public static function supportsColor($output)
  50929. {
  50930. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  50931. return (function_exists('sapi_windows_vt100_support')
  50932. && sapi_windows_vt100_support($output))
  50933. || false !== getenv('ANSICON')
  50934. || 'ON' === getenv('ConEmuANSI')
  50935. || 'xterm' === getenv('TERM');
  50936. }
  50937. if (function_exists('stream_isatty')) {
  50938. return stream_isatty($output);
  50939. } elseif (function_exists('posix_isatty')) {
  50940. return posix_isatty($output);
  50941. }
  50942. $stat = fstat($output);
  50943. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  50944. }
  50945. public static function setEnv($name, $value = false)
  50946. {
  50947. $unset = false === $value;
  50948. if (!putenv($unset ? $name : $name.'='.$value)) {
  50949. return false;
  50950. }
  50951. if ($unset) {
  50952. unset($_SERVER[$name]);
  50953. } else {
  50954. $_SERVER[$name] = $value;
  50955. }
  50956. return true;
  50957. }
  50958. }
  50959. <?php
  50960. namespace Composer\XdebugHandler;
  50961. use Psr\Log\LoggerInterface;
  50962. use Psr\Log\LogLevel;
  50963. class Status
  50964. {
  50965. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  50966. const CHECK = 'Check';
  50967. const ERROR = 'Error';
  50968. const INFO = 'Info';
  50969. const NORESTART = 'NoRestart';
  50970. const RESTART = 'Restart';
  50971. const RESTARTING = 'Restarting';
  50972. const RESTARTED = 'Restarted';
  50973. private $debug;
  50974. private $envAllowXdebug;
  50975. private $loaded;
  50976. private $logger;
  50977. private $time;
  50978. public function __construct($envAllowXdebug, $debug)
  50979. {
  50980. $start = getenv(self::ENV_RESTART);
  50981. Process::setEnv(self::ENV_RESTART);
  50982. $this->time = $start ? round((microtime(true) - $start) * 1000) : 0;
  50983. $this->envAllowXdebug = $envAllowXdebug;
  50984. $this->debug = $debug && defined('STDERR');
  50985. }
  50986. public function setLogger(LoggerInterface $logger)
  50987. {
  50988. $this->logger = $logger;
  50989. }
  50990. public function report($op, $data)
  50991. {
  50992. if ($this->logger || $this->debug) {
  50993. call_user_func(array($this, 'report'.$op), $data);
  50994. }
  50995. }
  50996. private function output($text, $level = null)
  50997. {
  50998. if ($this->logger) {
  50999. $this->logger->log($level ?: LogLevel::DEBUG, $text);
  51000. }
  51001. if ($this->debug) {
  51002. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  51003. }
  51004. }
  51005. private function reportCheck($loaded)
  51006. {
  51007. $this->loaded = $loaded;
  51008. $this->output('Checking '.$this->envAllowXdebug);
  51009. }
  51010. private function reportError($error)
  51011. {
  51012. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  51013. }
  51014. private function reportInfo($info)
  51015. {
  51016. $this->output($info);
  51017. }
  51018. private function reportNoRestart()
  51019. {
  51020. $this->output($this->getLoadedMessage());
  51021. if ($this->loaded) {
  51022. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  51023. if (!getenv($this->envAllowXdebug)) {
  51024. $text .= ' Allowed by application';
  51025. }
  51026. $this->output($text);
  51027. }
  51028. }
  51029. private function reportRestart()
  51030. {
  51031. $this->output($this->getLoadedMessage());
  51032. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  51033. }
  51034. private function reportRestarted()
  51035. {
  51036. $loaded = $this->getLoadedMessage();
  51037. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  51038. $level = $this->loaded ? LogLevel::WARNING : null;
  51039. $this->output($text, $level);
  51040. }
  51041. private function reportRestarting($command)
  51042. {
  51043. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  51044. $this->output($text);
  51045. $text = 'Running '.$command;
  51046. $this->output($text);
  51047. }
  51048. private function getEnvAllow()
  51049. {
  51050. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  51051. }
  51052. private function getLoadedMessage()
  51053. {
  51054. $loaded = $this->loaded ? sprintf('loaded (%s)', $this->loaded) : 'not loaded';
  51055. return 'The xdebug extension is '.$loaded;
  51056. }
  51057. }
  51058. <?php
  51059. namespace Composer\XdebugHandler;
  51060. use Psr\Log\LoggerInterface;
  51061. class XdebugHandler
  51062. {
  51063. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  51064. const SUFFIX_INIS = '_ORIGINAL_INIS';
  51065. const RESTART_ID = 'internal';
  51066. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  51067. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  51068. protected $tmpIni;
  51069. private static $inRestart;
  51070. private static $name;
  51071. private static $skipped;
  51072. private $cli;
  51073. private $colorOption;
  51074. private $debug;
  51075. private $envAllowXdebug;
  51076. private $envOriginalInis;
  51077. private $loaded;
  51078. private $persistent;
  51079. private $script;
  51080. private $statusWriter;
  51081. public function __construct($envPrefix, $colorOption = '')
  51082. {
  51083. if (!is_string($envPrefix) || empty($envPrefix) || !is_string($colorOption)) {
  51084. throw new \RuntimeException('Invalid constructor parameter');
  51085. }
  51086. self::$name = strtoupper($envPrefix);
  51087. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  51088. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  51089. $this->colorOption = $colorOption;
  51090. if (extension_loaded('xdebug')) {
  51091. $ext = new \ReflectionExtension('xdebug');
  51092. $this->loaded = $ext->getVersion() ?: 'unknown';
  51093. }
  51094. if ($this->cli = PHP_SAPI === 'cli') {
  51095. $this->debug = getenv(self::DEBUG);
  51096. }
  51097. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  51098. }
  51099. public function setLogger(LoggerInterface $logger)
  51100. {
  51101. $this->statusWriter->setLogger($logger);
  51102. return $this;
  51103. }
  51104. public function setMainScript($script)
  51105. {
  51106. $this->script = $script;
  51107. return $this;
  51108. }
  51109. public function setPersistent()
  51110. {
  51111. $this->persistent = true;
  51112. return $this;
  51113. }
  51114. public function check()
  51115. {
  51116. $this->notify(Status::CHECK, $this->loaded);
  51117. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  51118. if (empty($envArgs[0]) && $this->requiresRestart((bool) $this->loaded)) {
  51119. $this->notify(Status::RESTART);
  51120. if ($this->prepareRestart()) {
  51121. $command = $this->getCommand();
  51122. $this->notify(Status::RESTARTING, $command);
  51123. $this->restart($command);
  51124. }
  51125. return;
  51126. }
  51127. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  51128. $this->notify(Status::RESTARTED);
  51129. Process::setEnv($this->envAllowXdebug);
  51130. self::$inRestart = true;
  51131. if (!$this->loaded) {
  51132. self::$skipped = $envArgs[1];
  51133. }
  51134. $this->setEnvRestartSettings($envArgs);
  51135. return;
  51136. }
  51137. $this->notify(Status::NORESTART);
  51138. if ($settings = self::getRestartSettings()) {
  51139. $this->syncSettings($settings);
  51140. }
  51141. }
  51142. public static function getAllIniFiles()
  51143. {
  51144. if (!empty(self::$name)) {
  51145. $env = getenv(self::$name.self::SUFFIX_INIS);
  51146. if (false !== $env) {
  51147. return explode(PATH_SEPARATOR, $env);
  51148. }
  51149. }
  51150. $paths = array((string) php_ini_loaded_file());
  51151. if ($scanned = php_ini_scanned_files()) {
  51152. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  51153. }
  51154. return $paths;
  51155. }
  51156. public static function getRestartSettings()
  51157. {
  51158. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  51159. if (count($envArgs) !== 6
  51160. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  51161. return;
  51162. }
  51163. return array(
  51164. 'tmpIni' => $envArgs[0],
  51165. 'scannedInis' => (bool) $envArgs[1],
  51166. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  51167. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  51168. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  51169. 'skipped' => $envArgs[5],
  51170. );
  51171. }
  51172. public static function getSkippedVersion()
  51173. {
  51174. return (string) self::$skipped;
  51175. }
  51176. protected function requiresRestart($isLoaded)
  51177. {
  51178. return $isLoaded;
  51179. }
  51180. protected function restart($command)
  51181. {
  51182. $this->doRestart($command);
  51183. }
  51184. private function doRestart($command)
  51185. {
  51186. passthru($command, $exitCode);
  51187. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  51188. if ($this->debug === '2') {
  51189. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  51190. } else {
  51191. @unlink($this->tmpIni);
  51192. }
  51193. exit($exitCode);
  51194. }
  51195. private function prepareRestart()
  51196. {
  51197. $error = '';
  51198. $iniFiles = self::getAllIniFiles();
  51199. $scannedInis = count($iniFiles) > 1;
  51200. $tmpDir = sys_get_temp_dir();
  51201. if (!$this->cli) {
  51202. $error = 'Unsupported SAPI: '.PHP_SAPI;
  51203. } elseif (!defined('PHP_BINARY')) {
  51204. $error = 'PHP version is too old: '.PHP_VERSION;
  51205. } elseif (!$this->checkConfiguration($info)) {
  51206. $error = $info;
  51207. } elseif (!$this->checkScanDirConfig()) {
  51208. $error = 'PHP version does not report scanned inis: '.PHP_VERSION;
  51209. } elseif (!$this->checkMainScript()) {
  51210. $error = 'Unable to access main script: '.$this->script;
  51211. } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
  51212. $error = $error ?: 'Unable to create temp ini file at: '.$tmpDir;
  51213. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  51214. $error = 'Unable to set environment variables';
  51215. }
  51216. if ($error) {
  51217. $this->notify(Status::ERROR, $error);
  51218. }
  51219. return empty($error);
  51220. }
  51221. private function writeTmpIni(array $iniFiles, $tmpDir, &$error)
  51222. {
  51223. if (!$this->tmpIni = @tempnam($tmpDir, '')) {
  51224. return false;
  51225. }
  51226. if (empty($iniFiles[0])) {
  51227. array_shift($iniFiles);
  51228. }
  51229. $content = '';
  51230. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  51231. foreach ($iniFiles as $file) {
  51232. if (!$data = @file_get_contents($file)) {
  51233. $error = 'Unable to read ini: '.$file;
  51234. return false;
  51235. }
  51236. $content .= preg_replace($regex, ';$1', $data).PHP_EOL;
  51237. }
  51238. if ($config = parse_ini_string($content)) {
  51239. $loaded = ini_get_all(null, false);
  51240. $content .= $this->mergeLoadedConfig($loaded, $config);
  51241. }
  51242. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  51243. return @file_put_contents($this->tmpIni, $content);
  51244. }
  51245. private function getCommand()
  51246. {
  51247. $php = array(PHP_BINARY);
  51248. $args = array_slice($_SERVER['argv'], 1);
  51249. if (!$this->persistent) {
  51250. array_push($php, '-n', '-c', $this->tmpIni);
  51251. }
  51252. if (defined('STDOUT') && Process::supportsColor(STDOUT)) {
  51253. $args = Process::addColorOption($args, $this->colorOption);
  51254. }
  51255. $args = array_merge($php, array($this->script), $args);
  51256. $cmd = Process::escape(array_shift($args), true, true);
  51257. foreach ($args as $arg) {
  51258. $cmd .= ' '.Process::escape($arg);
  51259. }
  51260. return $cmd;
  51261. }
  51262. private function setEnvironment($scannedInis, array $iniFiles)
  51263. {
  51264. $scanDir = getenv('PHP_INI_SCAN_DIR');
  51265. $phprc = getenv('PHPRC');
  51266. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  51267. return false;
  51268. }
  51269. if ($this->persistent) {
  51270. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
  51271. return false;
  51272. }
  51273. }
  51274. $envArgs = array(
  51275. self::RESTART_ID,
  51276. $this->loaded,
  51277. (int) $scannedInis,
  51278. false === $scanDir ? '*' : $scanDir,
  51279. false === $phprc ? '*' : $phprc,
  51280. );
  51281. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  51282. }
  51283. private function notify($op, $data = null)
  51284. {
  51285. $this->statusWriter->report($op, $data);
  51286. }
  51287. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig)
  51288. {
  51289. $content = '';
  51290. foreach ($loadedConfig as $name => $value) {
  51291. if (!is_string($value)
  51292. || strpos($name, 'xdebug') === 0
  51293. || $name === 'apc.mmap_file_mask') {
  51294. continue;
  51295. }
  51296. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  51297. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  51298. }
  51299. }
  51300. return $content;
  51301. }
  51302. private function checkMainScript()
  51303. {
  51304. if (null !== $this->script) {
  51305. return file_exists($this->script) || '--' === $this->script;
  51306. }
  51307. if (file_exists($this->script = $_SERVER['argv'][0])) {
  51308. return true;
  51309. }
  51310. $options = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false;
  51311. $trace = debug_backtrace($options);
  51312. if (($main = end($trace)) && isset($main['file'])) {
  51313. return file_exists($this->script = $main['file']);
  51314. }
  51315. return false;
  51316. }
  51317. private function setEnvRestartSettings($envArgs)
  51318. {
  51319. $settings = array(
  51320. php_ini_loaded_file(),
  51321. $envArgs[2],
  51322. $envArgs[3],
  51323. $envArgs[4],
  51324. getenv($this->envOriginalInis),
  51325. self::$skipped,
  51326. );
  51327. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  51328. }
  51329. private function syncSettings(array $settings)
  51330. {
  51331. if (false === getenv($this->envOriginalInis)) {
  51332. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  51333. }
  51334. self::$skipped = $settings['skipped'];
  51335. $this->notify(Status::INFO, 'Process called with existing restart settings');
  51336. }
  51337. private function checkScanDirConfig()
  51338. {
  51339. return !(getenv('PHP_INI_SCAN_DIR')
  51340. && !PHP_CONFIG_FILE_SCAN_DIR
  51341. && (PHP_VERSION_ID < 70113
  51342. || PHP_VERSION_ID === 70200));
  51343. }
  51344. private function checkConfiguration(&$info)
  51345. {
  51346. if (false !== strpos(ini_get('disable_functions'), 'passthru')) {
  51347. $info = 'passthru function is disabled';
  51348. return false;
  51349. }
  51350. if (extension_loaded('uopz')) {
  51351. if (function_exists('uopz_allow_exit')) {
  51352. @uopz_allow_exit(true);
  51353. } else {
  51354. $info = 'uopz extension is not compatible';
  51355. return false;
  51356. }
  51357. }
  51358. return true;
  51359. }
  51360. }
  51361. Copyright (c) 2012 PHP Framework Interoperability Group
  51362. Permission is hereby granted, free of charge, to any person obtaining a copy
  51363. of this software and associated documentation files (the "Software"), to deal
  51364. in the Software without restriction, including without limitation the rights
  51365. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  51366. copies of the Software, and to permit persons to whom the Software is
  51367. furnished to do so, subject to the following conditions:
  51368. The above copyright notice and this permission notice shall be included in
  51369. all copies or substantial portions of the Software.
  51370. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51371. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51372. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51373. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51374. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51375. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  51376. THE SOFTWARE.
  51377. <?php
  51378. namespace Psr\Log;
  51379. abstract class AbstractLogger implements LoggerInterface
  51380. {
  51381. public function emergency($message, array $context = array())
  51382. {
  51383. $this->log(LogLevel::EMERGENCY, $message, $context);
  51384. }
  51385. public function alert($message, array $context = array())
  51386. {
  51387. $this->log(LogLevel::ALERT, $message, $context);
  51388. }
  51389. public function critical($message, array $context = array())
  51390. {
  51391. $this->log(LogLevel::CRITICAL, $message, $context);
  51392. }
  51393. public function error($message, array $context = array())
  51394. {
  51395. $this->log(LogLevel::ERROR, $message, $context);
  51396. }
  51397. public function warning($message, array $context = array())
  51398. {
  51399. $this->log(LogLevel::WARNING, $message, $context);
  51400. }
  51401. public function notice($message, array $context = array())
  51402. {
  51403. $this->log(LogLevel::NOTICE, $message, $context);
  51404. }
  51405. public function info($message, array $context = array())
  51406. {
  51407. $this->log(LogLevel::INFO, $message, $context);
  51408. }
  51409. public function debug($message, array $context = array())
  51410. {
  51411. $this->log(LogLevel::DEBUG, $message, $context);
  51412. }
  51413. }
  51414. <?php
  51415. namespace Psr\Log;
  51416. class InvalidArgumentException extends \InvalidArgumentException
  51417. {
  51418. }
  51419. <?php
  51420. namespace Psr\Log;
  51421. class LogLevel
  51422. {
  51423. const EMERGENCY = 'emergency';
  51424. const ALERT = 'alert';
  51425. const CRITICAL = 'critical';
  51426. const ERROR = 'error';
  51427. const WARNING = 'warning';
  51428. const NOTICE = 'notice';
  51429. const INFO = 'info';
  51430. const DEBUG = 'debug';
  51431. }
  51432. <?php
  51433. namespace Psr\Log;
  51434. interface LoggerAwareInterface
  51435. {
  51436. public function setLogger(LoggerInterface $logger);
  51437. }
  51438. <?php
  51439. namespace Psr\Log;
  51440. trait LoggerAwareTrait
  51441. {
  51442. protected $logger;
  51443. public function setLogger(LoggerInterface $logger)
  51444. {
  51445. $this->logger = $logger;
  51446. }
  51447. }
  51448. <?php
  51449. namespace Psr\Log;
  51450. interface LoggerInterface
  51451. {
  51452. public function emergency($message, array $context = array());
  51453. public function alert($message, array $context = array());
  51454. public function critical($message, array $context = array());
  51455. public function error($message, array $context = array());
  51456. public function warning($message, array $context = array());
  51457. public function notice($message, array $context = array());
  51458. public function info($message, array $context = array());
  51459. public function debug($message, array $context = array());
  51460. public function log($level, $message, array $context = array());
  51461. }
  51462. <?php
  51463. namespace Psr\Log;
  51464. trait LoggerTrait
  51465. {
  51466. public function emergency($message, array $context = array())
  51467. {
  51468. $this->log(LogLevel::EMERGENCY, $message, $context);
  51469. }
  51470. public function alert($message, array $context = array())
  51471. {
  51472. $this->log(LogLevel::ALERT, $message, $context);
  51473. }
  51474. public function critical($message, array $context = array())
  51475. {
  51476. $this->log(LogLevel::CRITICAL, $message, $context);
  51477. }
  51478. public function error($message, array $context = array())
  51479. {
  51480. $this->log(LogLevel::ERROR, $message, $context);
  51481. }
  51482. public function warning($message, array $context = array())
  51483. {
  51484. $this->log(LogLevel::WARNING, $message, $context);
  51485. }
  51486. public function notice($message, array $context = array())
  51487. {
  51488. $this->log(LogLevel::NOTICE, $message, $context);
  51489. }
  51490. public function info($message, array $context = array())
  51491. {
  51492. $this->log(LogLevel::INFO, $message, $context);
  51493. }
  51494. public function debug($message, array $context = array())
  51495. {
  51496. $this->log(LogLevel::DEBUG, $message, $context);
  51497. }
  51498. abstract public function log($level, $message, array $context = array());
  51499. }
  51500. <?php
  51501. namespace Psr\Log;
  51502. class NullLogger extends AbstractLogger
  51503. {
  51504. public function log($level, $message, array $context = array())
  51505. {
  51506. }
  51507. }
  51508. <?php
  51509. namespace Psr\Log\Test;
  51510. use Psr\Log\LoggerInterface;
  51511. use Psr\Log\LogLevel;
  51512. abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
  51513. {
  51514. abstract public function getLogger();
  51515. abstract public function getLogs();
  51516. public function testImplements()
  51517. {
  51518. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  51519. }
  51520. public function testLogsAtAllLevels($level, $message)
  51521. {
  51522. $logger = $this->getLogger();
  51523. $logger->{$level}($message, array('user' => 'Bob'));
  51524. $logger->log($level, $message, array('user' => 'Bob'));
  51525. $expected = array(
  51526. $level.' message of level '.$level.' with context: Bob',
  51527. $level.' message of level '.$level.' with context: Bob',
  51528. );
  51529. $this->assertEquals($expected, $this->getLogs());
  51530. }
  51531. public function provideLevelsAndMessages()
  51532. {
  51533. return array(
  51534. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  51535. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  51536. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  51537. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  51538. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  51539. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  51540. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  51541. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  51542. );
  51543. }
  51544. public function testThrowsOnInvalidLevel()
  51545. {
  51546. $logger = $this->getLogger();
  51547. $logger->log('invalid level', 'Foo');
  51548. }
  51549. public function testContextReplacement()
  51550. {
  51551. $logger = $this->getLogger();
  51552. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  51553. $expected = array('info {Message {nothing} Bob Bar a}');
  51554. $this->assertEquals($expected, $this->getLogs());
  51555. }
  51556. public function testObjectCastToString()
  51557. {
  51558. if (method_exists($this, 'createPartialMock')) {
  51559. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  51560. } else {
  51561. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  51562. }
  51563. $dummy->expects($this->once())
  51564. ->method('__toString')
  51565. ->will($this->returnValue('DUMMY'));
  51566. $this->getLogger()->warning($dummy);
  51567. $expected = array('warning DUMMY');
  51568. $this->assertEquals($expected, $this->getLogs());
  51569. }
  51570. public function testContextCanContainAnything()
  51571. {
  51572. $closed = fopen('php://memory', 'r');
  51573. fclose($closed);
  51574. $context = array(
  51575. 'bool' => true,
  51576. 'null' => null,
  51577. 'string' => 'Foo',
  51578. 'int' => 0,
  51579. 'float' => 0.5,
  51580. 'nested' => array('with object' => new DummyTest),
  51581. 'object' => new \DateTime,
  51582. 'resource' => fopen('php://memory', 'r'),
  51583. 'closed' => $closed,
  51584. );
  51585. $this->getLogger()->warning('Crazy context data', $context);
  51586. $expected = array('warning Crazy context data');
  51587. $this->assertEquals($expected, $this->getLogs());
  51588. }
  51589. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  51590. {
  51591. $logger = $this->getLogger();
  51592. $logger->warning('Random message', array('exception' => 'oops'));
  51593. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  51594. $expected = array(
  51595. 'warning Random message',
  51596. 'critical Uncaught Exception!'
  51597. );
  51598. $this->assertEquals($expected, $this->getLogs());
  51599. }
  51600. }
  51601. class DummyTest
  51602. {
  51603. public function __toString()
  51604. {
  51605. }
  51606. }
  51607. <?php
  51608. namespace Psr\Log\Test;
  51609. use Psr\Log\AbstractLogger;
  51610. class TestLogger extends AbstractLogger
  51611. {
  51612. public $records = [];
  51613. public $recordsByLevel = [];
  51614. public function log($level, $message, array $context = [])
  51615. {
  51616. $record = [
  51617. 'level' => $level,
  51618. 'message' => $message,
  51619. 'context' => $context,
  51620. ];
  51621. $this->recordsByLevel[$record['level']][] = $record;
  51622. $this->records[] = $record;
  51623. }
  51624. public function hasRecords($level)
  51625. {
  51626. return isset($this->recordsByLevel[$level]);
  51627. }
  51628. public function hasRecord($record, $level)
  51629. {
  51630. if (is_string($record)) {
  51631. $record = ['message' => $record];
  51632. }
  51633. return $this->hasRecordThatPasses(function ($rec) use ($record) {
  51634. if ($rec['message'] !== $record['message']) {
  51635. return false;
  51636. }
  51637. if (isset($record['context']) && $rec['context'] !== $record['context']) {
  51638. return false;
  51639. }
  51640. return true;
  51641. }, $level);
  51642. }
  51643. public function hasRecordThatContains($message, $level)
  51644. {
  51645. return $this->hasRecordThatPasses(function ($rec) use ($message) {
  51646. return strpos($rec['message'], $message) !== false;
  51647. }, $level);
  51648. }
  51649. public function hasRecordThatMatches($regex, $level)
  51650. {
  51651. return $this->hasRecordThatPasses(function ($rec) use ($regex) {
  51652. return preg_match($regex, $rec['message']) > 0;
  51653. }, $level);
  51654. }
  51655. public function hasRecordThatPasses(callable $predicate, $level)
  51656. {
  51657. if (!isset($this->recordsByLevel[$level])) {
  51658. return false;
  51659. }
  51660. foreach ($this->recordsByLevel[$level] as $i => $rec) {
  51661. if (call_user_func($predicate, $rec, $i)) {
  51662. return true;
  51663. }
  51664. }
  51665. return false;
  51666. }
  51667. public function __call($method, $args)
  51668. {
  51669. if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
  51670. $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
  51671. $level = strtolower($matches[2]);
  51672. if (method_exists($this, $genericMethod)) {
  51673. $args[] = $level;
  51674. return call_user_func_array([$this, $genericMethod], $args);
  51675. }
  51676. }
  51677. throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
  51678. }
  51679. public function reset()
  51680. {
  51681. $this->records = [];
  51682. }
  51683. }
  51684. <?php
  51685. require_once __DIR__ . '/composer/autoload_real.php';
  51686. return ComposerAutoloaderInitComposerPhar1554824808::getLoader();
  51687. <?php
  51688. $vendorDir = dirname(dirname(__FILE__));
  51689. $baseDir = dirname($vendorDir);
  51690. return array(
  51691. );
  51692. <?php
  51693. $vendorDir = dirname(dirname(__FILE__));
  51694. $baseDir = dirname($vendorDir);
  51695. return array(
  51696. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  51697. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  51698. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  51699. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  51700. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  51701. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  51702. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  51703. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  51704. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  51705. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  51706. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  51707. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  51708. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  51709. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  51710. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  51711. 'Composer\\' => array($baseDir . '/src/Composer'),
  51712. );
  51713. <?php
  51714. $vendorDir = dirname(dirname(__FILE__));
  51715. $baseDir = dirname($vendorDir);
  51716. return array(
  51717. );
  51718. <?php
  51719. $vendorDir = dirname(dirname(__FILE__));
  51720. $baseDir = dirname($vendorDir);
  51721. return array(
  51722. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  51723. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  51724. );
  51725. <?php
  51726. class ComposerAutoloaderInitComposerPhar1554824808
  51727. {
  51728. private static $loader;
  51729. public static function loadClassLoader($class)
  51730. {
  51731. if ('Composer\Autoload\ClassLoader' === $class) {
  51732. require __DIR__ . '/ClassLoader.php';
  51733. }
  51734. }
  51735. public static function getLoader()
  51736. {
  51737. if (null !== self::$loader) {
  51738. return self::$loader;
  51739. }
  51740. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1554824808', 'loadClassLoader'), true, true);
  51741. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  51742. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1554824808', 'loadClassLoader'));
  51743. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  51744. if ($useStaticLoader) {
  51745. require_once __DIR__ . '/autoload_static.php';
  51746. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1554824808::getInitializer($loader));
  51747. } else {
  51748. $map = require __DIR__ . '/autoload_namespaces.php';
  51749. foreach ($map as $namespace => $path) {
  51750. $loader->set($namespace, $path);
  51751. }
  51752. $map = require __DIR__ . '/autoload_psr4.php';
  51753. foreach ($map as $namespace => $path) {
  51754. $loader->setPsr4($namespace, $path);
  51755. }
  51756. $classMap = require __DIR__ . '/autoload_classmap.php';
  51757. if ($classMap) {
  51758. $loader->addClassMap($classMap);
  51759. }
  51760. }
  51761. $loader->register(true);
  51762. if ($useStaticLoader) {
  51763. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1554824808::$files;
  51764. } else {
  51765. $includeFiles = require __DIR__ . '/autoload_files.php';
  51766. }
  51767. foreach ($includeFiles as $fileIdentifier => $file) {
  51768. composerRequireComposerPhar1554824808($fileIdentifier, $file);
  51769. }
  51770. return $loader;
  51771. }
  51772. }
  51773. function composerRequireComposerPhar1554824808($fileIdentifier, $file)
  51774. {
  51775. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  51776. require $file;
  51777. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  51778. }
  51779. }
  51780. <?php
  51781. namespace Composer\Autoload;
  51782. class ComposerStaticInitComposerPhar1554824808
  51783. {
  51784. public static $files = array (
  51785. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  51786. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  51787. );
  51788. public static $prefixLengthsPsr4 = array (
  51789. 'S' =>
  51790. array (
  51791. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  51792. 'Symfony\\Polyfill\\Ctype\\' => 23,
  51793. 'Symfony\\Component\\Process\\' => 26,
  51794. 'Symfony\\Component\\Finder\\' => 25,
  51795. 'Symfony\\Component\\Filesystem\\' => 29,
  51796. 'Symfony\\Component\\Debug\\' => 24,
  51797. 'Symfony\\Component\\Console\\' => 26,
  51798. 'Seld\\PharUtils\\' => 15,
  51799. 'Seld\\JsonLint\\' => 14,
  51800. ),
  51801. 'P' =>
  51802. array (
  51803. 'Psr\\Log\\' => 8,
  51804. ),
  51805. 'J' =>
  51806. array (
  51807. 'JsonSchema\\' => 11,
  51808. ),
  51809. 'C' =>
  51810. array (
  51811. 'Composer\\XdebugHandler\\' => 23,
  51812. 'Composer\\Spdx\\' => 14,
  51813. 'Composer\\Semver\\' => 16,
  51814. 'Composer\\CaBundle\\' => 18,
  51815. 'Composer\\' => 9,
  51816. ),
  51817. );
  51818. public static $prefixDirsPsr4 = array (
  51819. 'Symfony\\Polyfill\\Mbstring\\' =>
  51820. array (
  51821. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  51822. ),
  51823. 'Symfony\\Polyfill\\Ctype\\' =>
  51824. array (
  51825. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  51826. ),
  51827. 'Symfony\\Component\\Process\\' =>
  51828. array (
  51829. 0 => __DIR__ . '/..' . '/symfony/process',
  51830. ),
  51831. 'Symfony\\Component\\Finder\\' =>
  51832. array (
  51833. 0 => __DIR__ . '/..' . '/symfony/finder',
  51834. ),
  51835. 'Symfony\\Component\\Filesystem\\' =>
  51836. array (
  51837. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  51838. ),
  51839. 'Symfony\\Component\\Debug\\' =>
  51840. array (
  51841. 0 => __DIR__ . '/..' . '/symfony/debug',
  51842. ),
  51843. 'Symfony\\Component\\Console\\' =>
  51844. array (
  51845. 0 => __DIR__ . '/..' . '/symfony/console',
  51846. ),
  51847. 'Seld\\PharUtils\\' =>
  51848. array (
  51849. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  51850. ),
  51851. 'Seld\\JsonLint\\' =>
  51852. array (
  51853. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  51854. ),
  51855. 'Psr\\Log\\' =>
  51856. array (
  51857. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  51858. ),
  51859. 'JsonSchema\\' =>
  51860. array (
  51861. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  51862. ),
  51863. 'Composer\\XdebugHandler\\' =>
  51864. array (
  51865. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  51866. ),
  51867. 'Composer\\Spdx\\' =>
  51868. array (
  51869. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  51870. ),
  51871. 'Composer\\Semver\\' =>
  51872. array (
  51873. 0 => __DIR__ . '/..' . '/composer/semver/src',
  51874. ),
  51875. 'Composer\\CaBundle\\' =>
  51876. array (
  51877. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  51878. ),
  51879. 'Composer\\' =>
  51880. array (
  51881. 0 => __DIR__ . '/../..' . '/src/Composer',
  51882. ),
  51883. );
  51884. public static function getInitializer(ClassLoader $loader)
  51885. {
  51886. return \Closure::bind(function () use ($loader) {
  51887. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1554824808::$prefixLengthsPsr4;
  51888. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1554824808::$prefixDirsPsr4;
  51889. }, null, ClassLoader::class);
  51890. }
  51891. }
  51892. <?php
  51893. namespace Composer\Autoload;
  51894. class ClassLoader
  51895. {
  51896. private $prefixLengthsPsr4 = array();
  51897. private $prefixDirsPsr4 = array();
  51898. private $fallbackDirsPsr4 = array();
  51899. private $prefixesPsr0 = array();
  51900. private $fallbackDirsPsr0 = array();
  51901. private $useIncludePath = false;
  51902. private $classMap = array();
  51903. private $classMapAuthoritative = false;
  51904. private $missingClasses = array();
  51905. private $apcuPrefix;
  51906. public function getPrefixes()
  51907. {
  51908. if (!empty($this->prefixesPsr0)) {
  51909. return call_user_func_array('array_merge', $this->prefixesPsr0);
  51910. }
  51911. return array();
  51912. }
  51913. public function getPrefixesPsr4()
  51914. {
  51915. return $this->prefixDirsPsr4;
  51916. }
  51917. public function getFallbackDirs()
  51918. {
  51919. return $this->fallbackDirsPsr0;
  51920. }
  51921. public function getFallbackDirsPsr4()
  51922. {
  51923. return $this->fallbackDirsPsr4;
  51924. }
  51925. public function getClassMap()
  51926. {
  51927. return $this->classMap;
  51928. }
  51929. public function addClassMap(array $classMap)
  51930. {
  51931. if ($this->classMap) {
  51932. $this->classMap = array_merge($this->classMap, $classMap);
  51933. } else {
  51934. $this->classMap = $classMap;
  51935. }
  51936. }
  51937. public function add($prefix, $paths, $prepend = false)
  51938. {
  51939. if (!$prefix) {
  51940. if ($prepend) {
  51941. $this->fallbackDirsPsr0 = array_merge(
  51942. (array) $paths,
  51943. $this->fallbackDirsPsr0
  51944. );
  51945. } else {
  51946. $this->fallbackDirsPsr0 = array_merge(
  51947. $this->fallbackDirsPsr0,
  51948. (array) $paths
  51949. );
  51950. }
  51951. return;
  51952. }
  51953. $first = $prefix[0];
  51954. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  51955. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  51956. return;
  51957. }
  51958. if ($prepend) {
  51959. $this->prefixesPsr0[$first][$prefix] = array_merge(
  51960. (array) $paths,
  51961. $this->prefixesPsr0[$first][$prefix]
  51962. );
  51963. } else {
  51964. $this->prefixesPsr0[$first][$prefix] = array_merge(
  51965. $this->prefixesPsr0[$first][$prefix],
  51966. (array) $paths
  51967. );
  51968. }
  51969. }
  51970. public function addPsr4($prefix, $paths, $prepend = false)
  51971. {
  51972. if (!$prefix) {
  51973. if ($prepend) {
  51974. $this->fallbackDirsPsr4 = array_merge(
  51975. (array) $paths,
  51976. $this->fallbackDirsPsr4
  51977. );
  51978. } else {
  51979. $this->fallbackDirsPsr4 = array_merge(
  51980. $this->fallbackDirsPsr4,
  51981. (array) $paths
  51982. );
  51983. }
  51984. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  51985. $length = strlen($prefix);
  51986. if ('\\' !== $prefix[$length - 1]) {
  51987. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  51988. }
  51989. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  51990. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  51991. } elseif ($prepend) {
  51992. $this->prefixDirsPsr4[$prefix] = array_merge(
  51993. (array) $paths,
  51994. $this->prefixDirsPsr4[$prefix]
  51995. );
  51996. } else {
  51997. $this->prefixDirsPsr4[$prefix] = array_merge(
  51998. $this->prefixDirsPsr4[$prefix],
  51999. (array) $paths
  52000. );
  52001. }
  52002. }
  52003. public function set($prefix, $paths)
  52004. {
  52005. if (!$prefix) {
  52006. $this->fallbackDirsPsr0 = (array) $paths;
  52007. } else {
  52008. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  52009. }
  52010. }
  52011. public function setPsr4($prefix, $paths)
  52012. {
  52013. if (!$prefix) {
  52014. $this->fallbackDirsPsr4 = (array) $paths;
  52015. } else {
  52016. $length = strlen($prefix);
  52017. if ('\\' !== $prefix[$length - 1]) {
  52018. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  52019. }
  52020. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  52021. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  52022. }
  52023. }
  52024. public function setUseIncludePath($useIncludePath)
  52025. {
  52026. $this->useIncludePath = $useIncludePath;
  52027. }
  52028. public function getUseIncludePath()
  52029. {
  52030. return $this->useIncludePath;
  52031. }
  52032. public function setClassMapAuthoritative($classMapAuthoritative)
  52033. {
  52034. $this->classMapAuthoritative = $classMapAuthoritative;
  52035. }
  52036. public function isClassMapAuthoritative()
  52037. {
  52038. return $this->classMapAuthoritative;
  52039. }
  52040. public function setApcuPrefix($apcuPrefix)
  52041. {
  52042. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  52043. }
  52044. public function getApcuPrefix()
  52045. {
  52046. return $this->apcuPrefix;
  52047. }
  52048. public function register($prepend = false)
  52049. {
  52050. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  52051. }
  52052. public function unregister()
  52053. {
  52054. spl_autoload_unregister(array($this, 'loadClass'));
  52055. }
  52056. public function loadClass($class)
  52057. {
  52058. if ($file = $this->findFile($class)) {
  52059. includeFile($file);
  52060. return true;
  52061. }
  52062. }
  52063. public function findFile($class)
  52064. {
  52065. if (isset($this->classMap[$class])) {
  52066. return $this->classMap[$class];
  52067. }
  52068. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  52069. return false;
  52070. }
  52071. if (null !== $this->apcuPrefix) {
  52072. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  52073. if ($hit) {
  52074. return $file;
  52075. }
  52076. }
  52077. $file = $this->findFileWithExtension($class, '.php');
  52078. if (false === $file && defined('HHVM_VERSION')) {
  52079. $file = $this->findFileWithExtension($class, '.hh');
  52080. }
  52081. if (null !== $this->apcuPrefix) {
  52082. apcu_add($this->apcuPrefix.$class, $file);
  52083. }
  52084. if (false === $file) {
  52085. $this->missingClasses[$class] = true;
  52086. }
  52087. return $file;
  52088. }
  52089. private function findFileWithExtension($class, $ext)
  52090. {
  52091. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  52092. $first = $class[0];
  52093. if (isset($this->prefixLengthsPsr4[$first])) {
  52094. $subPath = $class;
  52095. while (false !== $lastPos = strrpos($subPath, '\\')) {
  52096. $subPath = substr($subPath, 0, $lastPos);
  52097. $search = $subPath . '\\';
  52098. if (isset($this->prefixDirsPsr4[$search])) {
  52099. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  52100. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  52101. if (file_exists($file = $dir . $pathEnd)) {
  52102. return $file;
  52103. }
  52104. }
  52105. }
  52106. }
  52107. }
  52108. foreach ($this->fallbackDirsPsr4 as $dir) {
  52109. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  52110. return $file;
  52111. }
  52112. }
  52113. if (false !== $pos = strrpos($class, '\\')) {
  52114. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  52115. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  52116. } else {
  52117. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  52118. }
  52119. if (isset($this->prefixesPsr0[$first])) {
  52120. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  52121. if (0 === strpos($class, $prefix)) {
  52122. foreach ($dirs as $dir) {
  52123. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  52124. return $file;
  52125. }
  52126. }
  52127. }
  52128. }
  52129. }
  52130. foreach ($this->fallbackDirsPsr0 as $dir) {
  52131. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  52132. return $file;
  52133. }
  52134. }
  52135. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  52136. return $file;
  52137. }
  52138. return false;
  52139. }
  52140. }
  52141. function includeFile($file)
  52142. {
  52143. include $file;
  52144. }
  52145. ##
  52146. ## Bundle of CA Root Certificates
  52147. ##
  52148. ## Certificate data from Mozilla as of: Wed Jan 23 04:12:09 2019 GMT
  52149. ##
  52150. ## This is a bundle of X.509 certificates of public Certificate Authorities
  52151. ## (CA). These were automatically extracted from Mozilla's root certificates
  52152. ## file (certdata.txt). This file can be found in the mozilla source tree:
  52153. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  52154. ##
  52155. ## It contains the certificates in PEM format and therefore
  52156. ## can be directly used with curl / libcurl / php_curl, or with
  52157. ## an Apache+mod_ssl webserver for SSL client authentication.
  52158. ## Just configure this file as the SSLCACertificateFile.
  52159. ##
  52160. ## Conversion done with mk-ca-bundle.pl version 1.27.
  52161. ## SHA256: 18372117493b5b7ec006c31d966143fc95a9464a2b5f8d5188e23c5557b2292d
  52162. ##
  52163. GlobalSign Root CA
  52164. ==================
  52165. -----BEGIN CERTIFICATE-----
  52166. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  52167. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  52168. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  52169. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  52170. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  52171. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  52172. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  52173. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  52174. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  52175. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  52176. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  52177. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  52178. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  52179. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  52180. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  52181. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  52182. -----END CERTIFICATE-----
  52183. GlobalSign Root CA - R2
  52184. =======================
  52185. -----BEGIN CERTIFICATE-----
  52186. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  52187. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  52188. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  52189. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  52190. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  52191. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  52192. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  52193. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  52194. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  52195. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  52196. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  52197. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  52198. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  52199. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  52200. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  52201. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  52202. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  52203. -----END CERTIFICATE-----
  52204. Verisign Class 3 Public Primary Certification Authority - G3
  52205. ============================================================
  52206. -----BEGIN CERTIFICATE-----
  52207. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  52208. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  52209. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  52210. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  52211. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  52212. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  52213. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  52214. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  52215. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  52216. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  52217. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  52218. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  52219. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  52220. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  52221. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  52222. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  52223. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  52224. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  52225. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  52226. -----END CERTIFICATE-----
  52227. Entrust.net Premium 2048 Secure Server CA
  52228. =========================================
  52229. -----BEGIN CERTIFICATE-----
  52230. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  52231. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  52232. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  52233. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  52234. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  52235. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  52236. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  52237. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  52238. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  52239. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  52240. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  52241. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  52242. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  52243. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  52244. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  52245. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  52246. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  52247. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  52248. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  52249. -----END CERTIFICATE-----
  52250. Baltimore CyberTrust Root
  52251. =========================
  52252. -----BEGIN CERTIFICATE-----
  52253. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  52254. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  52255. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  52256. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  52257. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  52258. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  52259. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  52260. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  52261. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  52262. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  52263. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  52264. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  52265. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  52266. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  52267. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  52268. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  52269. -----END CERTIFICATE-----
  52270. AddTrust External Root
  52271. ======================
  52272. -----BEGIN CERTIFICATE-----
  52273. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  52274. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  52275. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  52276. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  52277. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  52278. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  52279. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  52280. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  52281. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  52282. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  52283. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  52284. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  52285. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  52286. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  52287. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  52288. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  52289. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  52290. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  52291. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  52292. -----END CERTIFICATE-----
  52293. Entrust Root Certification Authority
  52294. ====================================
  52295. -----BEGIN CERTIFICATE-----
  52296. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  52297. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  52298. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  52299. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  52300. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  52301. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  52302. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  52303. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  52304. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  52305. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  52306. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  52307. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  52308. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  52309. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  52310. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  52311. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  52312. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  52313. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  52314. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  52315. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  52316. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  52317. -----END CERTIFICATE-----
  52318. GeoTrust Global CA
  52319. ==================
  52320. -----BEGIN CERTIFICATE-----
  52321. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  52322. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  52323. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  52324. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  52325. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  52326. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  52327. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  52328. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  52329. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  52330. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  52331. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  52332. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  52333. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  52334. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  52335. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  52336. Mw==
  52337. -----END CERTIFICATE-----
  52338. GeoTrust Universal CA
  52339. =====================
  52340. -----BEGIN CERTIFICATE-----
  52341. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  52342. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  52343. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  52344. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  52345. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  52346. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  52347. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  52348. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  52349. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  52350. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  52351. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  52352. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  52353. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  52354. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  52355. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  52356. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  52357. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  52358. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  52359. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  52360. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  52361. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  52362. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  52363. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  52364. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  52365. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  52366. -----END CERTIFICATE-----
  52367. GeoTrust Universal CA 2
  52368. =======================
  52369. -----BEGIN CERTIFICATE-----
  52370. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  52371. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  52372. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  52373. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  52374. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  52375. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  52376. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  52377. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  52378. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  52379. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  52380. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  52381. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  52382. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  52383. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  52384. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  52385. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  52386. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  52387. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  52388. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  52389. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  52390. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  52391. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  52392. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  52393. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  52394. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  52395. -----END CERTIFICATE-----
  52396. Comodo AAA Services root
  52397. ========================
  52398. -----BEGIN CERTIFICATE-----
  52399. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  52400. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  52401. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  52402. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  52403. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  52404. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  52405. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  52406. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  52407. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  52408. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  52409. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  52410. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  52411. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  52412. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  52413. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  52414. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  52415. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  52416. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  52417. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  52418. -----END CERTIFICATE-----
  52419. QuoVadis Root CA
  52420. ================
  52421. -----BEGIN CERTIFICATE-----
  52422. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  52423. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  52424. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  52425. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  52426. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  52427. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  52428. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  52429. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  52430. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  52431. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  52432. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  52433. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  52434. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  52435. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  52436. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  52437. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  52438. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  52439. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  52440. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  52441. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  52442. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  52443. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  52444. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  52445. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  52446. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  52447. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  52448. 5nrQNiOKSnQ2+Q==
  52449. -----END CERTIFICATE-----
  52450. QuoVadis Root CA 2
  52451. ==================
  52452. -----BEGIN CERTIFICATE-----
  52453. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  52454. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  52455. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  52456. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  52457. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  52458. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  52459. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  52460. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  52461. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  52462. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  52463. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  52464. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  52465. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  52466. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  52467. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  52468. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  52469. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  52470. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  52471. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  52472. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  52473. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  52474. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  52475. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  52476. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  52477. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  52478. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  52479. -----END CERTIFICATE-----
  52480. QuoVadis Root CA 3
  52481. ==================
  52482. -----BEGIN CERTIFICATE-----
  52483. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  52484. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  52485. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  52486. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  52487. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  52488. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  52489. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  52490. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  52491. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  52492. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  52493. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  52494. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  52495. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  52496. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  52497. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  52498. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  52499. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  52500. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  52501. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  52502. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  52503. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  52504. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  52505. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  52506. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  52507. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  52508. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  52509. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  52510. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  52511. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  52512. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  52513. -----END CERTIFICATE-----
  52514. Security Communication Root CA
  52515. ==============================
  52516. -----BEGIN CERTIFICATE-----
  52517. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  52518. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  52519. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  52520. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  52521. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  52522. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  52523. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  52524. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  52525. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  52526. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  52527. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  52528. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  52529. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  52530. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  52531. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  52532. FL39vmwLAw==
  52533. -----END CERTIFICATE-----
  52534. Sonera Class 2 Root CA
  52535. ======================
  52536. -----BEGIN CERTIFICATE-----
  52537. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  52538. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  52539. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  52540. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  52541. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  52542. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  52543. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  52544. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  52545. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  52546. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  52547. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  52548. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  52549. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  52550. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  52551. llpwrN9M
  52552. -----END CERTIFICATE-----
  52553. XRamp Global CA Root
  52554. ====================
  52555. -----BEGIN CERTIFICATE-----
  52556. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  52557. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  52558. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  52559. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  52560. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  52561. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  52562. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  52563. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  52564. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  52565. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  52566. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  52567. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  52568. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  52569. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  52570. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  52571. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  52572. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  52573. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  52574. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  52575. -----END CERTIFICATE-----
  52576. Go Daddy Class 2 CA
  52577. ===================
  52578. -----BEGIN CERTIFICATE-----
  52579. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  52580. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  52581. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  52582. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  52583. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  52584. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  52585. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  52586. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  52587. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  52588. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  52589. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  52590. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  52591. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  52592. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  52593. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  52594. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  52595. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  52596. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  52597. vZ8=
  52598. -----END CERTIFICATE-----
  52599. Starfield Class 2 CA
  52600. ====================
  52601. -----BEGIN CERTIFICATE-----
  52602. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  52603. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  52604. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  52605. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  52606. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  52607. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  52608. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  52609. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  52610. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  52611. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  52612. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  52613. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  52614. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  52615. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  52616. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  52617. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  52618. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  52619. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  52620. QBFGmh95DmK/D5fs4C8fF5Q=
  52621. -----END CERTIFICATE-----
  52622. Taiwan GRCA
  52623. ===========
  52624. -----BEGIN CERTIFICATE-----
  52625. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  52626. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  52627. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  52628. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  52629. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  52630. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  52631. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  52632. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  52633. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  52634. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  52635. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  52636. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  52637. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  52638. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  52639. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  52640. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  52641. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  52642. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  52643. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  52644. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  52645. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  52646. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  52647. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  52648. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  52649. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  52650. -----END CERTIFICATE-----
  52651. DigiCert Assured ID Root CA
  52652. ===========================
  52653. -----BEGIN CERTIFICATE-----
  52654. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  52655. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  52656. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  52657. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  52658. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  52659. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  52660. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  52661. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  52662. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  52663. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  52664. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  52665. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  52666. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  52667. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  52668. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  52669. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  52670. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  52671. -----END CERTIFICATE-----
  52672. DigiCert Global Root CA
  52673. =======================
  52674. -----BEGIN CERTIFICATE-----
  52675. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  52676. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  52677. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  52678. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  52679. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  52680. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  52681. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  52682. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  52683. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  52684. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  52685. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  52686. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  52687. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  52688. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  52689. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  52690. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  52691. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  52692. -----END CERTIFICATE-----
  52693. DigiCert High Assurance EV Root CA
  52694. ==================================
  52695. -----BEGIN CERTIFICATE-----
  52696. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  52697. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  52698. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  52699. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  52700. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  52701. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  52702. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  52703. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  52704. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  52705. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  52706. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  52707. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  52708. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  52709. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  52710. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  52711. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  52712. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  52713. -----END CERTIFICATE-----
  52714. Certplus Class 2 Primary CA
  52715. ===========================
  52716. -----BEGIN CERTIFICATE-----
  52717. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  52718. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  52719. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  52720. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  52721. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  52722. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  52723. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  52724. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  52725. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  52726. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  52727. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  52728. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  52729. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  52730. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  52731. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  52732. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  52733. l7+ijrRU
  52734. -----END CERTIFICATE-----
  52735. DST Root CA X3
  52736. ==============
  52737. -----BEGIN CERTIFICATE-----
  52738. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  52739. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  52740. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  52741. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  52742. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  52743. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  52744. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  52745. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  52746. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  52747. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  52748. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  52749. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  52750. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  52751. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  52752. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  52753. -----END CERTIFICATE-----
  52754. SwissSign Gold CA - G2
  52755. ======================
  52756. -----BEGIN CERTIFICATE-----
  52757. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  52758. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  52759. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  52760. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  52761. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  52762. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  52763. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  52764. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  52765. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  52766. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  52767. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  52768. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  52769. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  52770. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  52771. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  52772. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  52773. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  52774. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  52775. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  52776. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  52777. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  52778. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  52779. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  52780. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  52781. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  52782. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  52783. -----END CERTIFICATE-----
  52784. SwissSign Silver CA - G2
  52785. ========================
  52786. -----BEGIN CERTIFICATE-----
  52787. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  52788. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  52789. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  52790. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  52791. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  52792. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  52793. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  52794. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  52795. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  52796. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  52797. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  52798. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  52799. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  52800. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  52801. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  52802. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  52803. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  52804. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  52805. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  52806. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  52807. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  52808. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  52809. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  52810. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  52811. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  52812. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  52813. -----END CERTIFICATE-----
  52814. GeoTrust Primary Certification Authority
  52815. ========================================
  52816. -----BEGIN CERTIFICATE-----
  52817. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  52818. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  52819. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  52820. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  52821. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  52822. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  52823. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  52824. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  52825. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  52826. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52827. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  52828. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  52829. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  52830. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  52831. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  52832. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  52833. -----END CERTIFICATE-----
  52834. thawte Primary Root CA
  52835. ======================
  52836. -----BEGIN CERTIFICATE-----
  52837. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  52838. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  52839. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  52840. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  52841. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  52842. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  52843. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  52844. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  52845. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  52846. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  52847. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  52848. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  52849. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  52850. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  52851. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  52852. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  52853. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  52854. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  52855. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  52856. -----END CERTIFICATE-----
  52857. VeriSign Class 3 Public Primary Certification Authority - G5
  52858. ============================================================
  52859. -----BEGIN CERTIFICATE-----
  52860. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  52861. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  52862. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  52863. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  52864. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  52865. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  52866. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  52867. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  52868. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  52869. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  52870. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  52871. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  52872. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  52873. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  52874. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  52875. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  52876. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  52877. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  52878. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  52879. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  52880. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  52881. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  52882. -----END CERTIFICATE-----
  52883. SecureTrust CA
  52884. ==============
  52885. -----BEGIN CERTIFICATE-----
  52886. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  52887. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  52888. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  52889. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  52890. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  52891. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  52892. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  52893. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  52894. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  52895. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  52896. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  52897. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  52898. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  52899. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  52900. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  52901. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  52902. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  52903. -----END CERTIFICATE-----
  52904. Secure Global CA
  52905. ================
  52906. -----BEGIN CERTIFICATE-----
  52907. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  52908. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  52909. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  52910. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  52911. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  52912. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  52913. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  52914. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  52915. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  52916. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  52917. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  52918. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  52919. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  52920. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  52921. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  52922. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  52923. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  52924. -----END CERTIFICATE-----
  52925. COMODO Certification Authority
  52926. ==============================
  52927. -----BEGIN CERTIFICATE-----
  52928. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  52929. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  52930. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  52931. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  52932. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  52933. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  52934. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  52935. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  52936. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  52937. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  52938. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  52939. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  52940. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  52941. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  52942. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  52943. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  52944. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  52945. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  52946. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  52947. -----END CERTIFICATE-----
  52948. Network Solutions Certificate Authority
  52949. =======================================
  52950. -----BEGIN CERTIFICATE-----
  52951. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  52952. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  52953. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  52954. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  52955. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  52956. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  52957. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  52958. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  52959. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  52960. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  52961. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  52962. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  52963. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  52964. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  52965. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  52966. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  52967. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  52968. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  52969. -----END CERTIFICATE-----
  52970. COMODO ECC Certification Authority
  52971. ==================================
  52972. -----BEGIN CERTIFICATE-----
  52973. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  52974. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  52975. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  52976. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  52977. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  52978. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  52979. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  52980. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  52981. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  52982. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  52983. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  52984. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  52985. -----END CERTIFICATE-----
  52986. OISTE WISeKey Global Root GA CA
  52987. ===============================
  52988. -----BEGIN CERTIFICATE-----
  52989. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  52990. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  52991. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  52992. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  52993. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  52994. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  52995. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  52996. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  52997. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  52998. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  52999. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  53000. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  53001. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  53002. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  53003. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  53004. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  53005. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  53006. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  53007. -----END CERTIFICATE-----
  53008. Certigna
  53009. ========
  53010. -----BEGIN CERTIFICATE-----
  53011. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  53012. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  53013. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  53014. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  53015. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  53016. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  53017. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  53018. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  53019. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  53020. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  53021. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  53022. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  53023. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  53024. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  53025. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  53026. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  53027. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  53028. -----END CERTIFICATE-----
  53029. Deutsche Telekom Root CA 2
  53030. ==========================
  53031. -----BEGIN CERTIFICATE-----
  53032. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  53033. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  53034. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  53035. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  53036. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  53037. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  53038. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  53039. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  53040. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  53041. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  53042. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  53043. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  53044. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  53045. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  53046. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  53047. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  53048. Cm26OWMohpLzGITY+9HPBVZkVw==
  53049. -----END CERTIFICATE-----
  53050. Cybertrust Global Root
  53051. ======================
  53052. -----BEGIN CERTIFICATE-----
  53053. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  53054. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  53055. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  53056. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  53057. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  53058. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  53059. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  53060. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  53061. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  53062. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  53063. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  53064. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  53065. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  53066. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  53067. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  53068. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  53069. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  53070. -----END CERTIFICATE-----
  53071. ePKI Root Certification Authority
  53072. =================================
  53073. -----BEGIN CERTIFICATE-----
  53074. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  53075. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  53076. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  53077. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  53078. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  53079. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  53080. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  53081. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  53082. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  53083. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  53084. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  53085. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  53086. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  53087. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  53088. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  53089. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  53090. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  53091. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  53092. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  53093. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  53094. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  53095. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  53096. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  53097. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  53098. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  53099. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  53100. -----END CERTIFICATE-----
  53101. certSIGN ROOT CA
  53102. ================
  53103. -----BEGIN CERTIFICATE-----
  53104. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  53105. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  53106. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  53107. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  53108. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  53109. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  53110. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  53111. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  53112. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  53113. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  53114. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  53115. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  53116. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  53117. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  53118. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  53119. -----END CERTIFICATE-----
  53120. GeoTrust Primary Certification Authority - G3
  53121. =============================================
  53122. -----BEGIN CERTIFICATE-----
  53123. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  53124. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  53125. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  53126. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  53127. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  53128. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  53129. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  53130. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  53131. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  53132. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  53133. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  53134. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  53135. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  53136. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  53137. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  53138. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  53139. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  53140. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  53141. -----END CERTIFICATE-----
  53142. thawte Primary Root CA - G2
  53143. ===========================
  53144. -----BEGIN CERTIFICATE-----
  53145. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  53146. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  53147. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  53148. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  53149. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  53150. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  53151. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  53152. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  53153. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  53154. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  53155. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  53156. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  53157. -----END CERTIFICATE-----
  53158. thawte Primary Root CA - G3
  53159. ===========================
  53160. -----BEGIN CERTIFICATE-----
  53161. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  53162. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  53163. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  53164. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  53165. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  53166. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  53167. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  53168. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  53169. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  53170. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  53171. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  53172. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  53173. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  53174. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  53175. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  53176. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  53177. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  53178. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  53179. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  53180. -----END CERTIFICATE-----
  53181. GeoTrust Primary Certification Authority - G2
  53182. =============================================
  53183. -----BEGIN CERTIFICATE-----
  53184. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  53185. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  53186. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  53187. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  53188. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  53189. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  53190. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  53191. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  53192. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  53193. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  53194. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  53195. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  53196. npaqBA+K
  53197. -----END CERTIFICATE-----
  53198. VeriSign Universal Root Certification Authority
  53199. ===============================================
  53200. -----BEGIN CERTIFICATE-----
  53201. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  53202. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  53203. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  53204. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  53205. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  53206. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  53207. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  53208. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  53209. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  53210. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  53211. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  53212. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  53213. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  53214. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  53215. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  53216. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  53217. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  53218. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  53219. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  53220. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  53221. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  53222. mJO37M2CYfE45k+XmCpajQ==
  53223. -----END CERTIFICATE-----
  53224. VeriSign Class 3 Public Primary Certification Authority - G4
  53225. ============================================================
  53226. -----BEGIN CERTIFICATE-----
  53227. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  53228. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  53229. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  53230. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  53231. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  53232. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  53233. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  53234. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  53235. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  53236. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  53237. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  53238. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  53239. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  53240. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  53241. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  53242. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  53243. -----END CERTIFICATE-----
  53244. NetLock Arany (Class Gold) Főtanúsítvány
  53245. ========================================
  53246. -----BEGIN CERTIFICATE-----
  53247. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  53248. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  53249. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  53250. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  53251. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  53252. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  53253. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  53254. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  53255. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  53256. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  53257. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  53258. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  53259. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  53260. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  53261. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  53262. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  53263. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  53264. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  53265. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  53266. -----END CERTIFICATE-----
  53267. Staat der Nederlanden Root CA - G2
  53268. ==================================
  53269. -----BEGIN CERTIFICATE-----
  53270. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53271. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53272. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  53273. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  53274. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  53275. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  53276. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  53277. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  53278. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  53279. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  53280. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  53281. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  53282. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  53283. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  53284. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  53285. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  53286. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  53287. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  53288. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  53289. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  53290. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  53291. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  53292. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  53293. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  53294. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  53295. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  53296. 66+KAQ==
  53297. -----END CERTIFICATE-----
  53298. Hongkong Post Root CA 1
  53299. =======================
  53300. -----BEGIN CERTIFICATE-----
  53301. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  53302. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  53303. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  53304. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  53305. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  53306. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  53307. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  53308. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  53309. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  53310. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  53311. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  53312. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  53313. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  53314. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  53315. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  53316. -----END CERTIFICATE-----
  53317. SecureSign RootCA11
  53318. ===================
  53319. -----BEGIN CERTIFICATE-----
  53320. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  53321. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  53322. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  53323. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  53324. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  53325. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  53326. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  53327. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  53328. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  53329. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  53330. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  53331. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  53332. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  53333. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  53334. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  53335. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  53336. -----END CERTIFICATE-----
  53337. Microsec e-Szigno Root CA 2009
  53338. ==============================
  53339. -----BEGIN CERTIFICATE-----
  53340. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  53341. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  53342. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  53343. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  53344. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  53345. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  53346. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  53347. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  53348. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  53349. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  53350. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  53351. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  53352. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  53353. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  53354. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  53355. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  53356. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  53357. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  53358. LXpUq3DDfSJlgnCW
  53359. -----END CERTIFICATE-----
  53360. GlobalSign Root CA - R3
  53361. =======================
  53362. -----BEGIN CERTIFICATE-----
  53363. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  53364. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  53365. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  53366. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  53367. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  53368. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  53369. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  53370. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  53371. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  53372. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  53373. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  53374. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  53375. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  53376. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  53377. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  53378. kpeDMdmztcpHWD9f
  53379. -----END CERTIFICATE-----
  53380. Autoridad de Certificacion Firmaprofesional CIF A62634068
  53381. =========================================================
  53382. -----BEGIN CERTIFICATE-----
  53383. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  53384. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  53385. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  53386. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  53387. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  53388. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  53389. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  53390. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  53391. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  53392. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  53393. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  53394. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  53395. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  53396. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  53397. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  53398. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  53399. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  53400. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  53401. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  53402. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  53403. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  53404. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  53405. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  53406. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  53407. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  53408. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  53409. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  53410. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  53411. -----END CERTIFICATE-----
  53412. Izenpe.com
  53413. ==========
  53414. -----BEGIN CERTIFICATE-----
  53415. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  53416. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  53417. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  53418. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  53419. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  53420. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  53421. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  53422. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  53423. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  53424. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  53425. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  53426. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  53427. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  53428. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  53429. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  53430. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  53431. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  53432. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  53433. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  53434. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  53435. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  53436. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  53437. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  53438. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  53439. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  53440. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  53441. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  53442. -----END CERTIFICATE-----
  53443. Chambers of Commerce Root - 2008
  53444. ================================
  53445. -----BEGIN CERTIFICATE-----
  53446. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  53447. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  53448. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  53449. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  53450. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  53451. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  53452. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  53453. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  53454. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  53455. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  53456. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  53457. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  53458. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  53459. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  53460. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  53461. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  53462. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  53463. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  53464. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  53465. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  53466. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  53467. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  53468. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  53469. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  53470. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  53471. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  53472. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  53473. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  53474. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  53475. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  53476. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  53477. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  53478. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  53479. -----END CERTIFICATE-----
  53480. Global Chambersign Root - 2008
  53481. ==============================
  53482. -----BEGIN CERTIFICATE-----
  53483. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  53484. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  53485. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  53486. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  53487. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  53488. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  53489. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  53490. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  53491. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  53492. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  53493. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  53494. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  53495. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  53496. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  53497. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  53498. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  53499. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  53500. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  53501. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  53502. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  53503. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  53504. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  53505. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  53506. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  53507. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  53508. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  53509. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  53510. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  53511. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  53512. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  53513. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  53514. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  53515. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  53516. -----END CERTIFICATE-----
  53517. Go Daddy Root Certificate Authority - G2
  53518. ========================================
  53519. -----BEGIN CERTIFICATE-----
  53520. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  53521. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  53522. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  53523. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  53524. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  53525. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  53526. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  53527. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  53528. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  53529. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  53530. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  53531. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  53532. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  53533. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  53534. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  53535. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  53536. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  53537. -----END CERTIFICATE-----
  53538. Starfield Root Certificate Authority - G2
  53539. =========================================
  53540. -----BEGIN CERTIFICATE-----
  53541. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  53542. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  53543. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  53544. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  53545. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  53546. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  53547. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  53548. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  53549. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  53550. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  53551. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  53552. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53553. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  53554. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  53555. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  53556. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  53557. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  53558. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  53559. -----END CERTIFICATE-----
  53560. Starfield Services Root Certificate Authority - G2
  53561. ==================================================
  53562. -----BEGIN CERTIFICATE-----
  53563. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  53564. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  53565. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  53566. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  53567. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  53568. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  53569. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  53570. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  53571. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  53572. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  53573. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  53574. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  53575. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  53576. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  53577. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  53578. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  53579. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  53580. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  53581. -----END CERTIFICATE-----
  53582. AffirmTrust Commercial
  53583. ======================
  53584. -----BEGIN CERTIFICATE-----
  53585. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  53586. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  53587. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  53588. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  53589. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  53590. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  53591. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  53592. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  53593. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  53594. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53595. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  53596. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  53597. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  53598. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  53599. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  53600. -----END CERTIFICATE-----
  53601. AffirmTrust Networking
  53602. ======================
  53603. -----BEGIN CERTIFICATE-----
  53604. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  53605. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  53606. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  53607. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  53608. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  53609. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  53610. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  53611. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  53612. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  53613. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  53614. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  53615. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  53616. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  53617. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  53618. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  53619. -----END CERTIFICATE-----
  53620. AffirmTrust Premium
  53621. ===================
  53622. -----BEGIN CERTIFICATE-----
  53623. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  53624. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  53625. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  53626. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  53627. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  53628. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  53629. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  53630. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  53631. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  53632. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  53633. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  53634. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  53635. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  53636. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  53637. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  53638. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  53639. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  53640. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  53641. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  53642. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  53643. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  53644. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  53645. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  53646. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  53647. -----END CERTIFICATE-----
  53648. AffirmTrust Premium ECC
  53649. =======================
  53650. -----BEGIN CERTIFICATE-----
  53651. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  53652. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  53653. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  53654. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  53655. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  53656. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  53657. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  53658. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  53659. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  53660. eQ==
  53661. -----END CERTIFICATE-----
  53662. Certum Trusted Network CA
  53663. =========================
  53664. -----BEGIN CERTIFICATE-----
  53665. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  53666. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  53667. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  53668. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  53669. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  53670. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  53671. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  53672. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  53673. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  53674. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  53675. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  53676. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  53677. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  53678. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  53679. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  53680. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  53681. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  53682. -----END CERTIFICATE-----
  53683. TWCA Root Certification Authority
  53684. =================================
  53685. -----BEGIN CERTIFICATE-----
  53686. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  53687. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  53688. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  53689. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  53690. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  53691. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  53692. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  53693. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  53694. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  53695. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  53696. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  53697. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  53698. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  53699. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  53700. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  53701. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  53702. -----END CERTIFICATE-----
  53703. Security Communication RootCA2
  53704. ==============================
  53705. -----BEGIN CERTIFICATE-----
  53706. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  53707. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  53708. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  53709. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  53710. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  53711. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  53712. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  53713. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  53714. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  53715. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  53716. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  53717. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  53718. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  53719. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  53720. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  53721. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  53722. -----END CERTIFICATE-----
  53723. EC-ACC
  53724. ======
  53725. -----BEGIN CERTIFICATE-----
  53726. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  53727. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  53728. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  53729. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  53730. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  53731. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  53732. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  53733. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  53734. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  53735. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  53736. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  53737. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  53738. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  53739. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  53740. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  53741. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  53742. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  53743. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  53744. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  53745. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  53746. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  53747. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  53748. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  53749. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  53750. 5EI=
  53751. -----END CERTIFICATE-----
  53752. Hellenic Academic and Research Institutions RootCA 2011
  53753. =======================================================
  53754. -----BEGIN CERTIFICATE-----
  53755. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  53756. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  53757. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  53758. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  53759. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  53760. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  53761. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  53762. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  53763. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  53764. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  53765. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  53766. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  53767. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  53768. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  53769. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  53770. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  53771. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  53772. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  53773. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  53774. -----END CERTIFICATE-----
  53775. Actalis Authentication Root CA
  53776. ==============================
  53777. -----BEGIN CERTIFICATE-----
  53778. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  53779. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  53780. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  53781. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  53782. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  53783. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  53784. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  53785. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  53786. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  53787. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  53788. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  53789. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  53790. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  53791. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  53792. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  53793. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  53794. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  53795. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  53796. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  53797. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  53798. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  53799. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  53800. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  53801. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  53802. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  53803. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  53804. -----END CERTIFICATE-----
  53805. Trustis FPS Root CA
  53806. ===================
  53807. -----BEGIN CERTIFICATE-----
  53808. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  53809. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  53810. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  53811. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  53812. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  53813. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  53814. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  53815. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  53816. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  53817. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  53818. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  53819. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  53820. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  53821. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  53822. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  53823. iB6XzCGcKQENZetX2fNXlrtIzYE=
  53824. -----END CERTIFICATE-----
  53825. Buypass Class 2 Root CA
  53826. =======================
  53827. -----BEGIN CERTIFICATE-----
  53828. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  53829. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  53830. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  53831. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  53832. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  53833. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  53834. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  53835. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  53836. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  53837. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  53838. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  53839. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  53840. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  53841. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  53842. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  53843. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  53844. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  53845. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  53846. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  53847. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  53848. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  53849. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  53850. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  53851. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  53852. rJgWVqA=
  53853. -----END CERTIFICATE-----
  53854. Buypass Class 3 Root CA
  53855. =======================
  53856. -----BEGIN CERTIFICATE-----
  53857. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  53858. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  53859. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  53860. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  53861. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  53862. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  53863. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  53864. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  53865. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  53866. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  53867. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  53868. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  53869. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  53870. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  53871. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  53872. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  53873. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  53874. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  53875. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  53876. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  53877. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  53878. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  53879. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  53880. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  53881. Cp/HuZc=
  53882. -----END CERTIFICATE-----
  53883. T-TeleSec GlobalRoot Class 3
  53884. ============================
  53885. -----BEGIN CERTIFICATE-----
  53886. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  53887. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  53888. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  53889. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  53890. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  53891. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  53892. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  53893. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  53894. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  53895. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  53896. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  53897. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  53898. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  53899. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  53900. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  53901. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  53902. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  53903. -----END CERTIFICATE-----
  53904. EE Certification Centre Root CA
  53905. ===============================
  53906. -----BEGIN CERTIFICATE-----
  53907. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  53908. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  53909. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  53910. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  53911. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  53912. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  53913. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  53914. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  53915. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  53916. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  53917. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  53918. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  53919. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  53920. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  53921. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  53922. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  53923. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  53924. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  53925. dcGWxZ0=
  53926. -----END CERTIFICATE-----
  53927. D-TRUST Root Class 3 CA 2 2009
  53928. ==============================
  53929. -----BEGIN CERTIFICATE-----
  53930. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  53931. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  53932. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  53933. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  53934. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  53935. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  53936. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  53937. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  53938. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  53939. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  53940. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  53941. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  53942. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  53943. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  53944. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  53945. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  53946. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  53947. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  53948. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  53949. -----END CERTIFICATE-----
  53950. D-TRUST Root Class 3 CA 2 EV 2009
  53951. =================================
  53952. -----BEGIN CERTIFICATE-----
  53953. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  53954. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  53955. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  53956. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  53957. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  53958. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  53959. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  53960. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  53961. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  53962. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  53963. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  53964. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  53965. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  53966. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  53967. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  53968. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  53969. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  53970. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  53971. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  53972. w9y4AyHqnxbxLFS1
  53973. -----END CERTIFICATE-----
  53974. CA Disig Root R2
  53975. ================
  53976. -----BEGIN CERTIFICATE-----
  53977. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  53978. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  53979. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  53980. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  53981. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  53982. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  53983. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  53984. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  53985. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  53986. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  53987. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  53988. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  53989. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  53990. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  53991. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  53992. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  53993. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  53994. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  53995. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  53996. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  53997. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  53998. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  53999. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  54000. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  54001. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  54002. -----END CERTIFICATE-----
  54003. ACCVRAIZ1
  54004. =========
  54005. -----BEGIN CERTIFICATE-----
  54006. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  54007. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  54008. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  54009. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  54010. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  54011. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  54012. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  54013. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  54014. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  54015. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  54016. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  54017. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  54018. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  54019. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  54020. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  54021. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  54022. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  54023. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  54024. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  54025. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  54026. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  54027. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  54028. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  54029. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  54030. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  54031. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  54032. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  54033. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  54034. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  54035. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  54036. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  54037. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  54038. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  54039. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  54040. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  54041. EfbRD0tVNEYqi4Y7
  54042. -----END CERTIFICATE-----
  54043. TWCA Global Root CA
  54044. ===================
  54045. -----BEGIN CERTIFICATE-----
  54046. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  54047. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  54048. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  54049. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  54050. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  54051. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  54052. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  54053. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  54054. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  54055. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  54056. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  54057. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  54058. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  54059. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  54060. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  54061. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  54062. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  54063. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  54064. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  54065. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  54066. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  54067. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  54068. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  54069. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  54070. -----END CERTIFICATE-----
  54071. TeliaSonera Root CA v1
  54072. ======================
  54073. -----BEGIN CERTIFICATE-----
  54074. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  54075. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  54076. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  54077. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  54078. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  54079. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  54080. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  54081. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  54082. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  54083. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  54084. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  54085. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  54086. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  54087. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  54088. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  54089. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  54090. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  54091. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  54092. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  54093. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  54094. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  54095. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  54096. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  54097. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  54098. -----END CERTIFICATE-----
  54099. E-Tugra Certification Authority
  54100. ===============================
  54101. -----BEGIN CERTIFICATE-----
  54102. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  54103. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  54104. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  54105. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  54106. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  54107. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  54108. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  54109. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  54110. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  54111. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  54112. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  54113. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  54114. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  54115. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  54116. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  54117. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  54118. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  54119. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  54120. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  54121. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  54122. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  54123. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  54124. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  54125. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  54126. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  54127. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  54128. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  54129. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  54130. C7TbO6Orb1wdtn7os4I07QZcJA==
  54131. -----END CERTIFICATE-----
  54132. T-TeleSec GlobalRoot Class 2
  54133. ============================
  54134. -----BEGIN CERTIFICATE-----
  54135. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  54136. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  54137. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  54138. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  54139. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  54140. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  54141. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  54142. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  54143. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  54144. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  54145. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  54146. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  54147. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  54148. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  54149. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  54150. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  54151. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  54152. -----END CERTIFICATE-----
  54153. Atos TrustedRoot 2011
  54154. =====================
  54155. -----BEGIN CERTIFICATE-----
  54156. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  54157. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  54158. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  54159. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  54160. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  54161. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  54162. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  54163. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  54164. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  54165. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  54166. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  54167. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  54168. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  54169. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  54170. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  54171. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  54172. -----END CERTIFICATE-----
  54173. QuoVadis Root CA 1 G3
  54174. =====================
  54175. -----BEGIN CERTIFICATE-----
  54176. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  54177. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54178. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  54179. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  54180. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  54181. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  54182. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  54183. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  54184. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  54185. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  54186. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  54187. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  54188. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  54189. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54190. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  54191. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  54192. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  54193. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  54194. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  54195. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  54196. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  54197. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  54198. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  54199. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  54200. hMJKzRwuJIczYOXD
  54201. -----END CERTIFICATE-----
  54202. QuoVadis Root CA 2 G3
  54203. =====================
  54204. -----BEGIN CERTIFICATE-----
  54205. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  54206. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54207. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  54208. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  54209. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  54210. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  54211. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  54212. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  54213. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  54214. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  54215. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  54216. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  54217. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  54218. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54219. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  54220. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  54221. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  54222. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  54223. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  54224. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  54225. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  54226. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  54227. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  54228. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  54229. O3jtZsSOeWmD3n+M
  54230. -----END CERTIFICATE-----
  54231. QuoVadis Root CA 3 G3
  54232. =====================
  54233. -----BEGIN CERTIFICATE-----
  54234. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  54235. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54236. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  54237. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  54238. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  54239. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  54240. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  54241. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  54242. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  54243. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  54244. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  54245. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  54246. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  54247. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54248. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  54249. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  54250. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  54251. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  54252. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  54253. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  54254. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  54255. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  54256. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  54257. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  54258. PpxxVJkES/1Y+Zj0
  54259. -----END CERTIFICATE-----
  54260. DigiCert Assured ID Root G2
  54261. ===========================
  54262. -----BEGIN CERTIFICATE-----
  54263. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  54264. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  54265. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  54266. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  54267. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  54268. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  54269. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  54270. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  54271. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  54272. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  54273. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  54274. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  54275. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  54276. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  54277. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  54278. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  54279. IhNzbM8m9Yop5w==
  54280. -----END CERTIFICATE-----
  54281. DigiCert Assured ID Root G3
  54282. ===========================
  54283. -----BEGIN CERTIFICATE-----
  54284. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  54285. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  54286. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  54287. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  54288. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  54289. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  54290. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  54291. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  54292. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  54293. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  54294. 1vUhZscv6pZjamVFkpUBtA==
  54295. -----END CERTIFICATE-----
  54296. DigiCert Global Root G2
  54297. =======================
  54298. -----BEGIN CERTIFICATE-----
  54299. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  54300. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  54301. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  54302. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  54303. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  54304. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  54305. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  54306. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  54307. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  54308. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  54309. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  54310. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  54311. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  54312. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  54313. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  54314. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  54315. MrY=
  54316. -----END CERTIFICATE-----
  54317. DigiCert Global Root G3
  54318. =======================
  54319. -----BEGIN CERTIFICATE-----
  54320. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  54321. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  54322. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  54323. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  54324. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  54325. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  54326. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  54327. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  54328. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  54329. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  54330. VOKa5Vt8sycX
  54331. -----END CERTIFICATE-----
  54332. DigiCert Trusted Root G4
  54333. ========================
  54334. -----BEGIN CERTIFICATE-----
  54335. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  54336. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  54337. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  54338. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  54339. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  54340. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  54341. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  54342. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  54343. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  54344. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  54345. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  54346. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  54347. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  54348. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  54349. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  54350. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  54351. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  54352. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  54353. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  54354. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  54355. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  54356. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  54357. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  54358. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  54359. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  54360. 82Z+
  54361. -----END CERTIFICATE-----
  54362. COMODO RSA Certification Authority
  54363. ==================================
  54364. -----BEGIN CERTIFICATE-----
  54365. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  54366. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  54367. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  54368. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  54369. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  54370. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  54371. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  54372. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  54373. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  54374. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  54375. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  54376. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  54377. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  54378. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  54379. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  54380. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  54381. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  54382. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  54383. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  54384. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  54385. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  54386. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  54387. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  54388. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  54389. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  54390. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  54391. LaZRfyHBNVOFBkpdn627G190
  54392. -----END CERTIFICATE-----
  54393. USERTrust RSA Certification Authority
  54394. =====================================
  54395. -----BEGIN CERTIFICATE-----
  54396. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  54397. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  54398. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  54399. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  54400. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  54401. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  54402. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  54403. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  54404. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  54405. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  54406. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  54407. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  54408. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  54409. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  54410. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  54411. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  54412. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  54413. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  54414. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  54415. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  54416. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  54417. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  54418. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  54419. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  54420. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  54421. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  54422. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  54423. -----END CERTIFICATE-----
  54424. USERTrust ECC Certification Authority
  54425. =====================================
  54426. -----BEGIN CERTIFICATE-----
  54427. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  54428. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  54429. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  54430. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  54431. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  54432. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  54433. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  54434. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  54435. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  54436. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  54437. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  54438. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  54439. -----END CERTIFICATE-----
  54440. GlobalSign ECC Root CA - R4
  54441. ===========================
  54442. -----BEGIN CERTIFICATE-----
  54443. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  54444. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54445. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  54446. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54447. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  54448. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  54449. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  54450. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  54451. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  54452. -----END CERTIFICATE-----
  54453. GlobalSign ECC Root CA - R5
  54454. ===========================
  54455. -----BEGIN CERTIFICATE-----
  54456. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  54457. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54458. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  54459. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54460. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  54461. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  54462. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  54463. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  54464. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  54465. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  54466. -----END CERTIFICATE-----
  54467. Staat der Nederlanden Root CA - G3
  54468. ==================================
  54469. -----BEGIN CERTIFICATE-----
  54470. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  54471. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  54472. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  54473. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  54474. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  54475. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  54476. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  54477. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  54478. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  54479. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  54480. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  54481. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  54482. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  54483. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  54484. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  54485. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  54486. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  54487. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  54488. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  54489. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  54490. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  54491. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  54492. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  54493. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  54494. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  54495. -----END CERTIFICATE-----
  54496. Staat der Nederlanden EV Root CA
  54497. ================================
  54498. -----BEGIN CERTIFICATE-----
  54499. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  54500. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  54501. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  54502. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  54503. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  54504. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  54505. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  54506. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  54507. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  54508. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  54509. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  54510. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  54511. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  54512. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  54513. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  54514. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  54515. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  54516. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  54517. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  54518. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  54519. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  54520. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  54521. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  54522. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  54523. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  54524. -----END CERTIFICATE-----
  54525. IdenTrust Commercial Root CA 1
  54526. ==============================
  54527. -----BEGIN CERTIFICATE-----
  54528. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  54529. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  54530. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  54531. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  54532. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  54533. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  54534. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  54535. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  54536. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  54537. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  54538. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  54539. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  54540. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  54541. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  54542. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  54543. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  54544. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  54545. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  54546. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  54547. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  54548. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  54549. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  54550. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  54551. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  54552. cGzM7vRX+Bi6hG6H
  54553. -----END CERTIFICATE-----
  54554. IdenTrust Public Sector Root CA 1
  54555. =================================
  54556. -----BEGIN CERTIFICATE-----
  54557. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  54558. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  54559. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  54560. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  54561. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  54562. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  54563. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  54564. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  54565. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  54566. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  54567. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  54568. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  54569. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  54570. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  54571. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  54572. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  54573. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  54574. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  54575. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  54576. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  54577. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  54578. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  54579. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  54580. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  54581. 3Wl9af0AVqW3rLatt8o+Ae+c
  54582. -----END CERTIFICATE-----
  54583. Entrust Root Certification Authority - G2
  54584. =========================================
  54585. -----BEGIN CERTIFICATE-----
  54586. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  54587. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  54588. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  54589. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  54590. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  54591. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  54592. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  54593. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  54594. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  54595. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  54596. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  54597. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  54598. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  54599. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  54600. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  54601. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  54602. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  54603. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  54604. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  54605. e4pIb4tF9g==
  54606. -----END CERTIFICATE-----
  54607. Entrust Root Certification Authority - EC1
  54608. ==========================================
  54609. -----BEGIN CERTIFICATE-----
  54610. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  54611. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  54612. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  54613. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  54614. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  54615. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  54616. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  54617. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  54618. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  54619. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  54620. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  54621. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  54622. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  54623. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  54624. -----END CERTIFICATE-----
  54625. CFCA EV ROOT
  54626. ============
  54627. -----BEGIN CERTIFICATE-----
  54628. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  54629. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  54630. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  54631. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  54632. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  54633. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  54634. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  54635. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  54636. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  54637. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  54638. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  54639. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  54640. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  54641. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  54642. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  54643. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  54644. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  54645. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  54646. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  54647. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  54648. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  54649. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  54650. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  54651. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  54652. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  54653. -----END CERTIFICATE-----
  54654. Certinomis - Root CA
  54655. ====================
  54656. -----BEGIN CERTIFICATE-----
  54657. MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  54658. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
  54659. LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
  54660. EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
  54661. ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
  54662. P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
  54663. d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
  54664. z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
  54665. 8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
  54666. RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
  54667. 6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
  54668. FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV
  54669. PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH
  54670. i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj
  54671. YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I
  54672. 6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF
  54673. AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV
  54674. WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw
  54675. Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX
  54676. lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ
  54677. y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9
  54678. Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng
  54679. DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi
  54680. I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM
  54681. cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr
  54682. hkIGuUE=
  54683. -----END CERTIFICATE-----
  54684. OISTE WISeKey Global Root GB CA
  54685. ===============================
  54686. -----BEGIN CERTIFICATE-----
  54687. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  54688. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  54689. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  54690. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  54691. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  54692. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  54693. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  54694. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  54695. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  54696. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  54697. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  54698. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  54699. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  54700. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  54701. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  54702. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  54703. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  54704. -----END CERTIFICATE-----
  54705. SZAFIR ROOT CA2
  54706. ===============
  54707. -----BEGIN CERTIFICATE-----
  54708. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  54709. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  54710. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  54711. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  54712. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  54713. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  54714. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  54715. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  54716. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  54717. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  54718. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  54719. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  54720. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  54721. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  54722. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  54723. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  54724. -----END CERTIFICATE-----
  54725. Certum Trusted Network CA 2
  54726. ===========================
  54727. -----BEGIN CERTIFICATE-----
  54728. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  54729. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  54730. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  54731. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  54732. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  54733. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  54734. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  54735. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  54736. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  54737. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  54738. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  54739. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  54740. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  54741. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  54742. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  54743. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54744. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  54745. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  54746. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  54747. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  54748. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  54749. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  54750. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  54751. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  54752. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  54753. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  54754. zAYspsbiDrW5viSP
  54755. -----END CERTIFICATE-----
  54756. Hellenic Academic and Research Institutions RootCA 2015
  54757. =======================================================
  54758. -----BEGIN CERTIFICATE-----
  54759. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  54760. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  54761. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  54762. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  54763. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  54764. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  54765. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  54766. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  54767. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  54768. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  54769. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  54770. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  54771. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  54772. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  54773. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  54774. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  54775. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54776. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  54777. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  54778. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  54779. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  54780. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  54781. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  54782. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  54783. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  54784. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  54785. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  54786. p/UsQu0yrbYhnr68
  54787. -----END CERTIFICATE-----
  54788. Hellenic Academic and Research Institutions ECC RootCA 2015
  54789. ===========================================================
  54790. -----BEGIN CERTIFICATE-----
  54791. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  54792. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  54793. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  54794. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  54795. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  54796. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  54797. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  54798. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  54799. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  54800. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  54801. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  54802. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  54803. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  54804. -----END CERTIFICATE-----
  54805. ISRG Root X1
  54806. ============
  54807. -----BEGIN CERTIFICATE-----
  54808. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  54809. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  54810. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  54811. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  54812. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  54813. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  54814. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  54815. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  54816. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  54817. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  54818. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  54819. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  54820. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  54821. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  54822. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  54823. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  54824. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  54825. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  54826. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  54827. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  54828. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  54829. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  54830. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  54831. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  54832. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  54833. -----END CERTIFICATE-----
  54834. AC RAIZ FNMT-RCM
  54835. ================
  54836. -----BEGIN CERTIFICATE-----
  54837. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  54838. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  54839. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  54840. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  54841. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  54842. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  54843. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  54844. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  54845. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  54846. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  54847. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  54848. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  54849. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  54850. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  54851. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  54852. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  54853. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  54854. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  54855. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  54856. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  54857. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  54858. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  54859. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  54860. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  54861. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  54862. -----END CERTIFICATE-----
  54863. Amazon Root CA 1
  54864. ================
  54865. -----BEGIN CERTIFICATE-----
  54866. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  54867. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  54868. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  54869. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  54870. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  54871. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  54872. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  54873. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  54874. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  54875. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  54876. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  54877. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  54878. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  54879. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  54880. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  54881. -----END CERTIFICATE-----
  54882. Amazon Root CA 2
  54883. ================
  54884. -----BEGIN CERTIFICATE-----
  54885. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  54886. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  54887. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  54888. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  54889. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  54890. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  54891. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  54892. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  54893. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  54894. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  54895. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  54896. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  54897. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  54898. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  54899. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  54900. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  54901. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  54902. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  54903. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  54904. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  54905. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  54906. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  54907. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  54908. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  54909. -----END CERTIFICATE-----
  54910. Amazon Root CA 3
  54911. ================
  54912. -----BEGIN CERTIFICATE-----
  54913. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  54914. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  54915. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  54916. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  54917. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  54918. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  54919. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  54920. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  54921. -----END CERTIFICATE-----
  54922. Amazon Root CA 4
  54923. ================
  54924. -----BEGIN CERTIFICATE-----
  54925. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  54926. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  54927. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  54928. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  54929. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  54930. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  54931. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  54932. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  54933. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  54934. -----END CERTIFICATE-----
  54935. LuxTrust Global Root 2
  54936. ======================
  54937. -----BEGIN CERTIFICATE-----
  54938. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  54939. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  54940. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  54941. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  54942. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  54943. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  54944. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  54945. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  54946. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  54947. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  54948. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  54949. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  54950. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  54951. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  54952. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  54953. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  54954. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  54955. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  54956. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  54957. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  54958. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  54959. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  54960. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  54961. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  54962. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  54963. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  54964. -----END CERTIFICATE-----
  54965. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  54966. =============================================
  54967. -----BEGIN CERTIFICATE-----
  54968. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  54969. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  54970. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  54971. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  54972. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  54973. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  54974. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  54975. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  54976. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  54977. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  54978. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  54979. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  54980. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  54981. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  54982. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  54983. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  54984. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  54985. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  54986. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  54987. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  54988. -----END CERTIFICATE-----
  54989. GDCA TrustAUTH R5 ROOT
  54990. ======================
  54991. -----BEGIN CERTIFICATE-----
  54992. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  54993. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  54994. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  54995. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  54996. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  54997. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  54998. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  54999. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  55000. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  55001. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  55002. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  55003. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  55004. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  55005. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  55006. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  55007. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  55008. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  55009. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  55010. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  55011. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  55012. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  55013. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  55014. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  55015. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  55016. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  55017. -----END CERTIFICATE-----
  55018. TrustCor RootCert CA-1
  55019. ======================
  55020. -----BEGIN CERTIFICATE-----
  55021. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  55022. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  55023. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  55024. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  55025. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  55026. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  55027. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  55028. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  55029. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  55030. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  55031. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  55032. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  55033. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  55034. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  55035. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  55036. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  55037. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  55038. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  55039. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  55040. -----END CERTIFICATE-----
  55041. TrustCor RootCert CA-2
  55042. ======================
  55043. -----BEGIN CERTIFICATE-----
  55044. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  55045. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  55046. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  55047. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  55048. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  55049. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  55050. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  55051. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  55052. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  55053. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  55054. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  55055. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  55056. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  55057. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  55058. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  55059. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  55060. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  55061. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  55062. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  55063. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  55064. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  55065. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  55066. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  55067. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  55068. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  55069. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  55070. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  55071. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  55072. -----END CERTIFICATE-----
  55073. TrustCor ECA-1
  55074. ==============
  55075. -----BEGIN CERTIFICATE-----
  55076. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  55077. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  55078. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  55079. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  55080. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  55081. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  55082. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  55083. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  55084. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  55085. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  55086. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  55087. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  55088. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  55089. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  55090. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  55091. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  55092. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  55093. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  55094. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  55095. -----END CERTIFICATE-----
  55096. SSL.com Root Certification Authority RSA
  55097. ========================================
  55098. -----BEGIN CERTIFICATE-----
  55099. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  55100. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  55101. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  55102. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  55103. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  55104. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  55105. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  55106. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  55107. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  55108. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  55109. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  55110. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  55111. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  55112. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  55113. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  55114. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  55115. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  55116. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  55117. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  55118. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  55119. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  55120. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  55121. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  55122. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  55123. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  55124. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  55125. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  55126. -----END CERTIFICATE-----
  55127. SSL.com Root Certification Authority ECC
  55128. ========================================
  55129. -----BEGIN CERTIFICATE-----
  55130. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  55131. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  55132. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  55133. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  55134. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  55135. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  55136. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  55137. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  55138. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  55139. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  55140. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  55141. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  55142. -----END CERTIFICATE-----
  55143. SSL.com EV Root Certification Authority RSA R2
  55144. ==============================================
  55145. -----BEGIN CERTIFICATE-----
  55146. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  55147. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  55148. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  55149. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  55150. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  55151. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  55152. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  55153. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  55154. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  55155. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  55156. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  55157. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  55158. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  55159. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  55160. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  55161. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  55162. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  55163. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  55164. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  55165. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  55166. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  55167. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  55168. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  55169. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  55170. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  55171. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  55172. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  55173. -----END CERTIFICATE-----
  55174. SSL.com EV Root Certification Authority ECC
  55175. ===========================================
  55176. -----BEGIN CERTIFICATE-----
  55177. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  55178. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  55179. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  55180. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  55181. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  55182. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  55183. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  55184. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  55185. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  55186. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  55187. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  55188. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  55189. -----END CERTIFICATE-----
  55190. GlobalSign Root CA - R6
  55191. =======================
  55192. -----BEGIN CERTIFICATE-----
  55193. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  55194. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  55195. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  55196. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  55197. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  55198. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  55199. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  55200. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  55201. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  55202. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  55203. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  55204. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  55205. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  55206. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  55207. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  55208. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  55209. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  55210. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  55211. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  55212. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  55213. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  55214. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  55215. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  55216. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  55217. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  55218. -----END CERTIFICATE-----
  55219. OISTE WISeKey Global Root GC CA
  55220. ===============================
  55221. -----BEGIN CERTIFICATE-----
  55222. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  55223. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  55224. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  55225. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  55226. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  55227. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  55228. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  55229. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  55230. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  55231. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  55232. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  55233. -----END CERTIFICATE-----
  55234. GTS Root R1
  55235. ===========
  55236. -----BEGIN CERTIFICATE-----
  55237. MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  55238. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  55239. b3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  55240. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIi
  55241. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx
  55242. 9vaMf/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7r
  55243. aKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnW
  55244. r4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqM
  55245. LnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly
  55246. 4cpk9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr
  55247. 06zqkUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92
  55248. wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om
  55249. 3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNu
  55250. JLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  55251. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEM
  55252. BQADggIBADiWCu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1
  55253. d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6ZXPYfcX3v73sv
  55254. fuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZRgyFmxhE+885H7pwoHyXa/6xm
  55255. ld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9b
  55256. gsiG1eGZbYwE8na6SfZu6W0eX6DvJ4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq
  55257. 4BjFbkerQUIpm/ZgDdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWEr
  55258. tXvM+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyyF62ARPBo
  55259. pY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9SQ98POyDGCBDTtWTurQ0
  55260. sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdwsE3PYJ/HQcu51OyLemGhmW/HGY0dVHLql
  55261. CFF1pkgl
  55262. -----END CERTIFICATE-----
  55263. GTS Root R2
  55264. ===========
  55265. -----BEGIN CERTIFICATE-----
  55266. MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  55267. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  55268. b3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  55269. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIi
  55270. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTuk
  55271. k3LvCvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo
  55272. 7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWI
  55273. m8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5Gm
  55274. dFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbu
  55275. ak7MkogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscsz
  55276. cTJGr61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW
  55277. Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73Vululycsl
  55278. aVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy
  55279. 5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  55280. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEM
  55281. BQADggIBALZp8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT
  55282. vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiTz9D2PGcDFWEJ
  55283. +YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiApJiS4wGWAqoC7o87xdFtCjMw
  55284. c3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvbpxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3Da
  55285. WsYDQvTtN6LwG1BUSw7YhN4ZKJmBR64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5r
  55286. n/WkhLx3+WuXrD5RRaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56Gtmwfu
  55287. Nmsk0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC5AwiWVIQ
  55288. 7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiFizoHCBy69Y9Vmhh1fuXs
  55289. gWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLnyOd/xCxgXS/Dr55FBcOEArf9LAhST4Ld
  55290. o/DUhgkC
  55291. -----END CERTIFICATE-----
  55292. GTS Root R3
  55293. ===========
  55294. -----BEGIN CERTIFICATE-----
  55295. MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  55296. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  55297. UjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  55298. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcq
  55299. hkjOPQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUU
  55300. Rout736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24Cej
  55301. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP
  55302. 0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFukfCPAlaUs3L6JbyO5o91lAFJekazInXJ0
  55303. glMLfalAvWhgxeG4VDvBNhcl2MG9AjEAnjWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOa
  55304. KaqW04MjyaR7YbPMAuhd
  55305. -----END CERTIFICATE-----
  55306. GTS Root R4
  55307. ===========
  55308. -----BEGIN CERTIFICATE-----
  55309. MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  55310. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  55311. UjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  55312. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcq
  55313. hkjOPQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa
  55314. 6zzuhXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqj
  55315. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV
  55316. 2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0CMRw3J5QdCHojXohw0+WbhXRIjVhLfoI
  55317. N+4Zba3bssx9BzT1YBkstTTZbyACMANxsbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11x
  55318. zPKwTdb+mciUqXWi4w==
  55319. -----END CERTIFICATE-----
  55320. UCA Global G2 Root
  55321. ==================
  55322. -----BEGIN CERTIFICATE-----
  55323. MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
  55324. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
  55325. NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
  55326. cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  55327. MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
  55328. oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
  55329. 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
  55330. h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
  55331. LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
  55332. R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
  55333. KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
  55334. 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
  55335. OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
  55336. 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
  55337. BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
  55338. 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
  55339. 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
  55340. Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
  55341. yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
  55342. c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
  55343. jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
  55344. bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
  55345. ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
  55346. RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
  55347. -----END CERTIFICATE-----
  55348. UCA Extended Validation Root
  55349. ============================
  55350. -----BEGIN CERTIFICATE-----
  55351. MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
  55352. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
  55353. IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
  55354. A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
  55355. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
  55356. iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
  55357. Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
  55358. eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
  55359. 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
  55360. 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
  55361. el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
  55362. B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
  55363. WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
  55364. NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
  55365. 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
  55366. BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
  55367. ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
  55368. aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
  55369. dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
  55370. +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
  55371. F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
  55372. GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
  55373. GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
  55374. djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
  55375. dhh2n1ax
  55376. -----END CERTIFICATE-----
  55377. Certigna Root CA
  55378. ================
  55379. -----BEGIN CERTIFICATE-----
  55380. MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
  55381. BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
  55382. MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
  55383. MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
  55384. MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  55385. DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
  55386. stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
  55387. KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
  55388. JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
  55389. XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
  55390. 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
  55391. wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
  55392. lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
  55393. jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
  55394. /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
  55395. HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
  55396. 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
  55397. dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
  55398. LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
  55399. cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
  55400. OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
  55401. TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
  55402. 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
  55403. 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
  55404. 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
  55405. 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
  55406. tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
  55407. aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
  55408. E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
  55409. -----END CERTIFICATE-----
  55410. <?php
  55411. if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
  55412. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  55413. }
  55414. setlocale(LC_ALL, 'C');
  55415. require __DIR__.'/../src/bootstrap.php';
  55416. use Composer\Console\Application;
  55417. use Composer\XdebugHandler\XdebugHandler;
  55418. error_reporting(-1);
  55419. // Restart without xdebug
  55420. $xdebug = new XdebugHandler('Composer', '--ansi');
  55421. $xdebug->check();
  55422. unset($xdebug);
  55423. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '4.0', '>=')) {
  55424. echo 'HHVM 4.0 has dropped support for Composer, please use PHP instead. Aborting.'.PHP_EOL;
  55425. exit(1);
  55426. }
  55427. if (function_exists('ini_set')) {
  55428. @ini_set('display_errors', 1);
  55429. $memoryInBytes = function ($value) {
  55430. $unit = strtolower(substr($value, -1, 1));
  55431. $value = (int) $value;
  55432. switch($unit) {
  55433. case 'g':
  55434. $value *= 1024;
  55435. // no break (cumulative multiplier)
  55436. case 'm':
  55437. $value *= 1024;
  55438. // no break (cumulative multiplier)
  55439. case 'k':
  55440. $value *= 1024;
  55441. }
  55442. return $value;
  55443. };
  55444. $memoryLimit = trim(ini_get('memory_limit'));
  55445. // Increase memory_limit if it is lower than 1.5GB
  55446. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  55447. @ini_set('memory_limit', '1536M');
  55448. }
  55449. // Set user defined memory limit
  55450. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  55451. @ini_set('memory_limit', $memoryLimit);
  55452. }
  55453. unset($memoryInBytes, $memoryLimit);
  55454. }
  55455. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  55456. // run the command application
  55457. $application = new Application();
  55458. $application->run();
  55459. Copyright (c) Nils Adermann, Jordi Boggiano
  55460. Permission is hereby granted, free of charge, to any person obtaining a copy
  55461. of this software and associated documentation files (the "Software"), to deal
  55462. in the Software without restriction, including without limitation the rights
  55463. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  55464. copies of the Software, and to permit persons to whom the Software is furnished
  55465. to do so, subject to the following conditions:
  55466. The above copyright notice and this permission notice shall be included in all
  55467. copies or substantial portions of the Software.
  55468. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  55469. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  55470. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  55471. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  55472. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  55473. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  55474. THE SOFTWARE.
  55475. Çý{“ÊÄYs†{¤M†Gë8���GBMB