composer.phar 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893
  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') && ini_get('apc.enable_cli') && ini_get('apc.cache_by_default')) {
  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. ?”ó composer.phar+src/Composer/Autoload/AutoloadGenerator.phppeÈ�u[pe¬ËÕi¶+src/Composer/Autoload/ClassMapGenerator.php‹È�u[‹Mè�Ķsrc/Composer/Cache.php’È�u[’­bš0¶%src/Composer/Command/AboutCommand.phpÍÈ�u[ͳ¢Ay¶'src/Composer/Command/ArchiveCommand.phpcÈ�u[c¥{ï¶$src/Composer/Command/BaseCommand.phpÜ È�u[Ü gô1¶.src/Composer/Command/BaseDependencyCommand.phpñÈ�u[ñXgFð¶1src/Composer/Command/CheckPlatformReqsCommand.php� È�u[� ŸL’ž¶*src/Composer/Command/ClearCacheCommand.php^È�u[^¨ãj¶&src/Composer/Command/ConfigCommand.php‰IÈ�u[‰Iä³ï€¶-src/Composer/Command/CreateProjectCommand.php%5È�u[%5èP-¶'src/Composer/Command/DependsCommand.php¸È�u[¸K°¶(src/Composer/Command/DiagnoseCommand.phpmIÈ�u[mI]úE!¶,src/Composer/Command/DumpAutoloadCommand.php
  25. �u[
  26. ݸ:¶$src/Composer/Command/ExecCommand.phpkÈ�u[k¼“À[¶&src/Composer/Command/GlobalCommand.php@ È�u[@ ·©ð¶$src/Composer/Command/HomeCommand.phpÄÈ�u[ÄÇH¶$src/Composer/Command/InitCommand.php•KÈ�u[•K„yŸ¶'src/Composer/Command/InstallCommand.phpÈ�u[[ š¶(src/Composer/Command/LicensesCommand.php;È�u[;™�U¶(src/Composer/Command/OutdatedCommand.php±
  27. È�u[±
  28. ¼LÓ¶)src/Composer/Command/ProhibitsCommand.phpÌÈ�u[̨[®¶&src/Composer/Command/RemoveCommand.phpœÈ�u[œQ¶�¯¶'src/Composer/Command/RequireCommand.php× È�u[× ³ª¨ß¶)src/Composer/Command/RunScriptCommand.phpãÈ�u[ã˜Ô¶+src/Composer/Command/ScriptAliasCommand.phppÈ�u[pg †(¶&src/Composer/Command/SearchCommand.php È�u[ Ò=Á‹¶*src/Composer/Command/SelfUpdateCommand.phpÌ2È�u[Ì2Ú6 ¶$src/Composer/Command/ShowCommand.php_mÈ�u[_m‚¤:a¶&src/Composer/Command/StatusCommand.php\È�u[\«In¶(src/Composer/Command/SuggestsCommand.php© È�u[© <Qþ¶&src/Composer/Command/UpdateCommand.phpµ#È�u[µ#@Š4-¶(src/Composer/Command/ValidateCommand.phpPÈ�u[P|ugü¶src/Composer/Composer.phpù È�u[ù Ù÷ƒÀ¶src/Composer/Config.phpÎ"È�u[Î")Î\¶-src/Composer/Config/ConfigSourceInterface.phpÈ�u[³ [/¶(src/Composer/Config/JsonConfigSource.phpuÈ�u[u=¤ƒ¶$src/Composer/Console/Application.phpÚ3È�u[Ú3 ý%D¶,src/Composer/Console/HtmlOutputFormatter.php3È�u[3Ú�Eu¶-src/Composer/DependencyResolver/Decisions.phpQÈ�u[Q?˜¬$¶1src/Composer/DependencyResolver/DefaultPolicy.phpÈ�u[õÝv¶/src/Composer/DependencyResolver/GenericRule.phpµÈ�u[µ᫤¶>src/Composer/DependencyResolver/Operation/InstallOperation.phpCÈ�u[C´\õ*¶Isrc/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷È�u[÷ïÎà÷¶Ksrc/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpýÈ�u[ý3#†¶@src/Composer/DependencyResolver/Operation/OperationInterface.phpÓÈ�u[ÓÙâ&ä¶=src/Composer/DependencyResolver/Operation/SolverOperation.php¹È�u[¹&¢e
  29. ¶@src/Composer/DependencyResolver/Operation/UninstallOperation.phpIÈ�u[IFûÂɶ=src/Composer/DependencyResolver/Operation/UpdateOperation.phphÈ�u[höSÕ]¶3src/Composer/DependencyResolver/PolicyInterface.php­È�u[­Ÿ‹R¶(src/Composer/DependencyResolver/Pool.php°"È�u[°" Ž%¶+src/Composer/DependencyResolver/Problem.php¤È�u[¤Þ¶+src/Composer/DependencyResolver/Request.phpƒÈ�u[ƒåVP„¶(src/Composer/DependencyResolver/Rule.php«È�u[«ôÓç´¶1src/Composer/DependencyResolver/Rule2Literals.phpÈ�u[tZÅɶ+src/Composer/DependencyResolver/RuleSet.phpª
  30. È�u[ª
  31. _΂¶4src/Composer/DependencyResolver/RuleSetGenerator.phpFÈ�u[F/Iж3src/Composer/DependencyResolver/RuleSetIterator.phpÈ�u[›Cü$¶2src/Composer/DependencyResolver/RuleWatchChain.phpiÈ�u[ihïš,¶2src/Composer/DependencyResolver/RuleWatchGraph.phpáÈ�u[á‰rôv¶1src/Composer/DependencyResolver/RuleWatchNode.phpÈ�u[�Gd7¶*src/Composer/DependencyResolver/Solver.php,:È�u[,:²ã~œ¶6src/Composer/DependencyResolver/SolverBugException.php™È�u[™Xg6¶;src/Composer/DependencyResolver/SolverProblemsException.phpôÈ�u[ô×|Ŧ¶/src/Composer/DependencyResolver/Transaction.php×È�u[×Vm쟶-src/Composer/Downloader/ArchiveDownloader.phpÆ È�u[Æ G s0¶1src/Composer/Downloader/ChangeReportInterface.phpÌÈ�u[̯ਿ¶+src/Composer/Downloader/DownloadManager.php`È�u[`#ÏX¶/src/Composer/Downloader/DownloaderInterface.phpÊÈ�u[Êgs!l¶3src/Composer/Downloader/DvcsDownloaderInterface.phpÑÈ�u[Ñ&Áœ¿¶*src/Composer/Downloader/FileDownloader.php?È�u[?"Aý¶/src/Composer/Downloader/FilesystemException.php
  32. �u[
  33. .-‹¶,src/Composer/Downloader/FossilDownloader.php‚ È�u[‚ Ü�Ii¶)src/Composer/Downloader/GitDownloader.phpq4È�u[q4ZÎÇ׶*src/Composer/Downloader/GzipDownloader.phpóÈ�u[ó}Úo¶(src/Composer/Downloader/HgDownloader.php”È�u[”ßis̶*src/Composer/Downloader/PathDownloader.phpQÈ�u[QCn¤¶0src/Composer/Downloader/PearPackageExtractor.phpuÈ�u[uz„‡¶.src/Composer/Downloader/PerforceDownloader.php§È�u[§âƒ¨¶*src/Composer/Downloader/PharDownloader.phpåÈ�u[åÞÉç¶)src/Composer/Downloader/RarDownloader.phpžÈ�u[ž6 3U¶)src/Composer/Downloader/SvnDownloader.phpGÈ�u[GM#j¶)src/Composer/Downloader/TarDownloader.phpãÈ�u[ãÍ’X?¶.src/Composer/Downloader/TransportException.php=È�u[=ZÎÈÞ¶9src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔÈ�u[Ô`§ôö¶)src/Composer/Downloader/VcsDownloader.php¡È�u[¡( à>¶(src/Composer/Downloader/XzDownloader.php§È�u[§W$;á¶)src/Composer/Downloader/ZipDownloader.phpèÈ�u[èÓ9ˆÿ¶&src/Composer/EventDispatcher/Event.php È�u[ ±™jï¶0src/Composer/EventDispatcher/EventDispatcher.php 2È�u[ 2anÕ3¶9src/Composer/EventDispatcher/EventSubscriberInterface.php©È�u[©h·0¶9src/Composer/EventDispatcher/ScriptExecutionException.phpvÈ�u[vwZ8S¶)src/Composer/Exception/NoSslException.phpfÈ�u[fËíM�¶src/Composer/Factory.phpR=È�u[R=d®¤¶src/Composer/IO/BaseIO.phpŒÈ�u[Œ(‚l‘¶src/Composer/IO/BufferIO.php*È�u[*¢®hT¶src/Composer/IO/ConsoleIO.php6È�u[6ö#$¶src/Composer/IO/IOInterface.phpìÈ�u[ìÕ�¶src/Composer/IO/NullIO.phpÀÈ�u[ÀF`sʶsrc/Composer/Installer.php�È�u[�¡q4Ŷ*src/Composer/Installer/BinaryInstaller.php×È�u[×£æq¶2src/Composer/Installer/BinaryPresenceInterface.phpËÈ�u[ËÀ5š¨¶.src/Composer/Installer/InstallationManager.php-È�u[-¾}Œ7¶)src/Composer/Installer/InstallerEvent.phpÈ�u[lÔzi¶*src/Composer/Installer/InstallerEvents.phpÞÈ�u[ÞìŸ@G¶-src/Composer/Installer/InstallerInterface.phpãÈ�u[ã^ƒ“ʶ+src/Composer/Installer/LibraryInstaller.php%È�u[% »�̶/src/Composer/Installer/MetapackageInstaller.phpœÈ�u[œÆÅ!¶(src/Composer/Installer/NoopInstaller.php+È�u[+À·M}¶'src/Composer/Installer/PackageEvent.phpeÈ�u[e;° ¶(src/Composer/Installer/PackageEvents.php¸È�u[¸dbØs¶.src/Composer/Installer/PearBinaryInstaller.phpø È�u[ø *ë•k¶(src/Composer/Installer/PearInstaller.php¢È�u[¢È‚¶Ñ¶*src/Composer/Installer/PluginInstaller.php‹È�u[‹ÒX8¶+src/Composer/Installer/ProjectInstaller.phpÈ�u[*0@P¶4src/Composer/Installer/SuggestedPackagesReporter.php:È�u[:‚´UV¶src/Composer/Json/JsonFile.phpîÈ�u[îb-~¶#src/Composer/Json/JsonFormatter.phpbÈ�u[bÝNš¶%src/Composer/Json/JsonManipulator.php’3È�u[’3é7¶-src/Composer/Json/JsonValidationException.php\È�u[\.Xóܶ%src/Composer/Package/AliasPackage.phpÈ�u[¹—~š¶7src/Composer/Package/Archiver/ArchivableFilesFilter.php È�u[ yY+¦¶7src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞÈ�u[Þ ²²¹¶0src/Composer/Package/Archiver/ArchiveManager.php† È�u[† ß5°¶3src/Composer/Package/Archiver/ArchiverInterface.phpÈ�u[ñ´> ¶3src/Composer/Package/Archiver/BaseExcludeFilter.php–È�u[–y¶=ƶ7src/Composer/Package/Archiver/ComposerExcludeFilter.phpÈ�u[‹SZ0¶2src/Composer/Package/Archiver/GitExcludeFilter.phprÈ�u[r3‘Mh¶1src/Composer/Package/Archiver/HgExcludeFilter.php È�u[  •¦S¶.src/Composer/Package/Archiver/PharArchiver.php?È�u[?®— u¶-src/Composer/Package/Archiver/ZipArchiver.php½È�u[½VÀ‚¨¶$src/Composer/Package/BasePackage.php& È�u[& 'ݶ*src/Composer/Package/Comparer/Comparer.php8È�u[8O 2¨¶(src/Composer/Package/CompletePackage.phpüÈ�u[üþM˶¶1src/Composer/Package/CompletePackageInterface.phpõÈ�u[õ¦Ê�ò¶+src/Composer/Package/Dumper/ArrayDumper.php= È�u[= T\‹7¶src/Composer/Package/Link.phpˆÈ�u[ˆå¶Y«¶7src/Composer/Package/LinkConstraint/EmptyConstraint.php‚È�u[‚é~‹¶?src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpdÈ�u[d¤ôLn¶7src/Composer/Package/LinkConstraint/MultiConstraint.php‚È�u[‚ób`ý¶:src/Composer/Package/LinkConstraint/SpecificConstraint.phpiÈ�u[iÞ”š%¶9src/Composer/Package/LinkConstraint/VersionConstraint.phpXÈ�u[X}`y¶+src/Composer/Package/Loader/ArrayLoader.phpÈ�u[n~œ›¶7src/Composer/Package/Loader/InvalidPackageException.phpEÈ�u[Exb¾¶*src/Composer/Package/Loader/JsonLoader.phpùÈ�u[ù!~ˆ{¶/src/Composer/Package/Loader/LoaderInterface.php²È�u[²¦}úζ1src/Composer/Package/Loader/RootPackageLoader.phpÈ�u[-‚£{¶5src/Composer/Package/Loader/ValidatingArrayLoader.php­6È�u[­6\æ0¶src/Composer/Package/Locker.php¥!È�u[¥!/=xö¶ src/Composer/Package/Package.phpÉÈ�u[ÉcÃ�h¶)src/Composer/Package/PackageInterface.php È�u[ ûÇ^ƶ)src/Composer/Package/RootAliasPackage.php È�u[ _€ø¶$src/Composer/Package/RootPackage.phpÈ�u[ŽÎ_¶-src/Composer/Package/RootPackageInterface.php¹È�u[¹"maV¶/src/Composer/Package/Version/VersionGuesser.phpÏÈ�u[ÏÌÂ߶.src/Composer/Package/Version/VersionParser.php¥È�u[¥ô´à¶0src/Composer/Package/Version/VersionSelector.phpK È�u[K ²<ȶ-src/Composer/Plugin/Capability/Capability.phpWÈ�u[Wæ_¨1¶2src/Composer/Plugin/Capability/CommandProvider.php—È�u[—ûOâ>¶src/Composer/Plugin/Capable.phpÈ�u[Æq+¶$src/Composer/Plugin/CommandEvent.phpâÈ�u[â³ÆÇW¶$src/Composer/Plugin/PluginEvents.phpöÈ�u[öá1=z¶'src/Composer/Plugin/PluginInterface.phpôÈ�u[ô)'*ض%src/Composer/Plugin/PluginManager.php$È�u[$‹K©¶*src/Composer/Plugin/PreCommandRunEvent.phpõÈ�u[õ:ðd¶,src/Composer/Plugin/PreFileDownloadEvent.php`È�u[`9-ζ4src/Composer/Question/StrictConfirmationQuestion.phpÈ�u['.³è¶+src/Composer/Repository/ArrayRepository.phpÈ�u[éÌt¶.src/Composer/Repository/ArtifactRepository.phpê È�u[ê a¦ˆ¶*src/Composer/Repository/BaseRepository.phpv È�u[v „ÜL¶.src/Composer/Repository/ComposerRepository.phpÐUÈ�u[ÐUü­l�¶/src/Composer/Repository/CompositeRepository.php;È�u[;¤¯S¶;src/Composer/Repository/ConfigurableRepositoryInterface.php…È�u[…±Ÿ_¶0src/Composer/Repository/FilesystemRepository.php$È�u[$¾Ãá…¶4src/Composer/Repository/InstalledArrayRepository.php£È�u[£/ö~>¶9src/Composer/Repository/InstalledFilesystemRepository.php£È�u[£V
  34. •_¶8src/Composer/Repository/InstalledRepositoryInterface.php‡È�u[‡£9p¶6src/Composer/Repository/InvalidRepositoryException.phpnÈ�u[nà“똶-src/Composer/Repository/PackageRepository.phpjÈ�u[j¥ôò̶*src/Composer/Repository/PathRepository.php– È�u[– WÛ¶2src/Composer/Repository/Pear/BaseChannelReader.phpIÈ�u[Ic6³¶,src/Composer/Repository/Pear/ChannelInfo.phpÄÈ�u[Ä:T*ɶ.src/Composer/Repository/Pear/ChannelReader.phpíÈ�u[í?ÈYT¶4src/Composer/Repository/Pear/ChannelRest10Reader.php® È�u[® ™ÖÛú¶4src/Composer/Repository/Pear/ChannelRest11Reader.php& È�u[& òUb¶5src/Composer/Repository/Pear/DependencyConstraint.phpqÈ�u[q9=¶/src/Composer/Repository/Pear/DependencyInfo.phpqÈ�u[qfºTò¶8src/Composer/Repository/Pear/PackageDependencyParser.php…È�u[…÷$Li¶,src/Composer/Repository/Pear/PackageInfo.php°È�u[°Ÿ ¸ ¶,src/Composer/Repository/Pear/ReleaseInfo.php’È�u[’o“ŠÃ¶*src/Composer/Repository/PearRepository.phpªÈ�u[ª)Ÿƒ}¶.src/Composer/Repository/PlatformRepository.phpÈ�u[4&~û¶-src/Composer/Repository/RepositoryFactory.php2È�u[2t>¶/src/Composer/Repository/RepositoryInterface.phpÛÈ�u[Û’âÁ¶-src/Composer/Repository/RepositoryManager.php2
  35. �u[2
  36. á…5#¶7src/Composer/Repository/RepositorySecurityException.phpoÈ�u[opÕ«ª¶/src/Composer/Repository/Vcs/BitbucketDriver.phpôÈ�u[ôx¤ü¶,src/Composer/Repository/Vcs/FossilDriver.php¦È�u[¦ébîd¶2src/Composer/Repository/Vcs/GitBitbucketDriver.phpêÈ�u[êÃŽ»¶)src/Composer/Repository/Vcs/GitDriver.php¼È�u[¼Š©Ðê¶,src/Composer/Repository/Vcs/GitHubDriver.php\)È�u[\)'›•#¶,src/Composer/Repository/Vcs/GitLabDriver.phpÍ#È�u[Í#ßNìʶ1src/Composer/Repository/Vcs/HgBitbucketDriver.phpäÈ�u[äi›üà¶(src/Composer/Repository/Vcs/HgDriver.phpVÈ�u[VIÁFò¶.src/Composer/Repository/Vcs/PerforceDriver.php' È�u[' ÙóH¶)src/Composer/Repository/Vcs/SvnDriver.php‰È�u[‰ÍßǬ¶)src/Composer/Repository/Vcs/VcsDriver.phpæ
  37. È�u[æ
  38. eׯ-¶2src/Composer/Repository/Vcs/VcsDriverInterface.php÷È�u[÷ÇX[‰¶)src/Composer/Repository/VcsRepository.php !È�u[ !cÕK¶3src/Composer/Repository/WritableArrayRepository.phpÈ�u[¾G*¶7src/Composer/Repository/WritableRepositoryInterface.php‰È�u[‰‘/sï¶$src/Composer/Script/CommandEvent.phpWÈ�u[W£VZt¶src/Composer/Script/Event.phpµÈ�u[µlt¦M¶$src/Composer/Script/PackageEvent.phpœÈ�u[œ§ÿÉ ¶$src/Composer/Script/ScriptEvents.phpPÈ�u[P‡�¶¶ src/Composer/SelfUpdate/Keys.php�È�u[� îÊN¶$src/Composer/SelfUpdate/Versions.phpìÈ�u[ì͵‘ƒ¶ src/Composer/Util/AuthHelper.phpËÈ�u[Ë>zx–¶src/Composer/Util/Bitbucket.php%È�u[%n=gÓ¶$src/Composer/Util/ComposerMirror.php±È�u[±­½øض%src/Composer/Util/ConfigValidator.php÷È�u[÷v•Í¶"src/Composer/Util/ErrorHandler.php‡È�u[‡He"¶ src/Composer/Util/Filesystem.phpg/È�u[g/|Îq÷¶src/Composer/Util/Git.phpg&È�u[g&]ó²´¶src/Composer/Util/GitHub.phpw È�u[w -SE¶src/Composer/Util/GitLab.php™ È�u[™ BLF¶src/Composer/Util/Hg.php¾È�u[¾LÓ �¶src/Composer/Util/IniHelper.phphÈ�u[h;FP¶$src/Composer/Util/NoProxyPattern.php¾È�u[¾Z+°m¶src/Composer/Util/Perforce.php‚1È�u[‚1,œbx¶src/Composer/Util/Platform.phpüÈ�u[üs­fç¶%src/Composer/Util/ProcessExecutor.phpÚ È�u[Ú £ÒÙ¶&src/Composer/Util/RemoteFilesystem.php
  39. j�u[
  40. j�Å ´¶src/Composer/Util/Silencer.phpéÈ�u[é“Vjf¶!src/Composer/Util/SpdxLicense.phpÈ�u[¾7
  41. ñ¶*src/Composer/Util/StreamContextFactory.phpÈ�u[ŸÁI¶src/Composer/Util/Svn.php'È�u['|×x‰¶src/Composer/Util/TlsHelper.phpn
  42. �u[n
  43. S¯Í:¶src/Composer/Util/Url.php£È�u[£3œÉܶsrc/Composer/XdebugHandler.phpðÈ�u[ðzÓf~¶src/bootstrap.php¹È�u[¹I}œ¶%src/Composer/Autoload/ClassLoader.phpn4È�u[n4êíÌ;¶#res/composer-repository-schema.jsonðÈ�u[ð�GÐà¶res/composer-schema.jsonÏ•È�u[Ï•&�R¶6vendor/composer/spdx-licenses/res/spdx-exceptions.json È�u[ º¯¶4vendor/composer/spdx-licenses/res/spdx-licenses.jsonŸ�È�u[Ÿ�J*B¶4vendor/symfony/console/Resources/bin/hiddeninput.exe$È�u[$•�¥v¶&vendor/symfony/console/Application.php‚WÈ�u[‚WâPáz¶*vendor/symfony/console/Command/Command.phpñ"È�u[ñ"Øô¶.vendor/symfony/console/Command/HelpCommand.phpØÈ�u[Ø$Y«¶.vendor/symfony/console/Command/ListCommand.phpZÈ�u[ZÉ£ ¶(vendor/symfony/console/ConsoleEvents.phpéÈ�u[éRÛÔe¶<vendor/symfony/console/Descriptor/ApplicationDescription.phpÐÈ�u[ЙŽ5°¶0vendor/symfony/console/Descriptor/Descriptor.phpŽÈ�u[Žéð8Ÿ¶9vendor/symfony/console/Descriptor/DescriptorInterface.phpüÈ�u[ü±Qµ¶4vendor/symfony/console/Descriptor/JsonDescriptor.phpÜ È�u[Ü *û�ɶ8vendor/symfony/console/Descriptor/MarkdownDescriptor.php´È�u[´�!³g¶4vendor/symfony/console/Descriptor/TextDescriptor.php²È�u[²�­ùâ¶3vendor/symfony/console/Descriptor/XmlDescriptor.phpýÈ�u[ý
  44. G1¿¶4vendor/symfony/console/Event/ConsoleCommandEvent.php°È�u[°!ȶ-vendor/symfony/console/Event/ConsoleEvent.phpÅÈ�u[ÅÒxÛ\¶6vendor/symfony/console/Event/ConsoleExceptionEvent.phpÈ�u[á2é¶6vendor/symfony/console/Event/ConsoleTerminateEvent.phpzÈ�u[z³,îL¶=vendor/symfony/console/Exception/CommandNotFoundException.phpÔÈ�u[ÔÈ÷ L¶7vendor/symfony/console/Exception/ExceptionInterface.phpfÈ�u[f¡ABª¶=vendor/symfony/console/Exception/InvalidArgumentException.php¦È�u[¦Ö̽Z¶;vendor/symfony/console/Exception/InvalidOptionException.php¦È�u[¦Ë×H¶3vendor/symfony/console/Exception/LogicException.php’È�u[’ÍO\e¶5vendor/symfony/console/Exception/RuntimeException.php–È�u[–Ùí,6¶4vendor/symfony/console/Formatter/OutputFormatter.php2È�u[2RÌYh¶=vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒÈ�u[ŒòññÀ¶9vendor/symfony/console/Formatter/OutputFormatterStyle.phpJÈ�u[JÏDSȶBvendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„È�u[„÷½G¶>vendor/symfony/console/Formatter/OutputFormatterStyleStack.php>È�u[>[†¿–¶6vendor/symfony/console/Helper/DebugFormatterHelper.phpxÈ�u[xN©Ø¼¶2vendor/symfony/console/Helper/DescriptorHelper.phpwÈ�u[wÅHð.¶.vendor/symfony/console/Helper/DialogHelper.phpúÈ�u[ú "8m¶1vendor/symfony/console/Helper/FormatterHelper.phpcÈ�u[c“ý«N¶(vendor/symfony/console/Helper/Helper.php¨È�u[¨œoû3¶1vendor/symfony/console/Helper/HelperInterface.phpåÈ�u[加¶+vendor/symfony/console/Helper/HelperSet.phpÉÈ�u[É?ã 2¶2vendor/symfony/console/Helper/InputAwareHelper.phpcÈ�u[cñø�|¶/vendor/symfony/console/Helper/ProcessHelper.phpÑ È�u[Ñ @±ã�¶-vendor/symfony/console/Helper/ProgressBar.phpk%È�u[k%H]„ȶ0vendor/symfony/console/Helper/ProgressHelper.php\È�u[\èK+¶3vendor/symfony/console/Helper/ProgressIndicator.phpKÈ�u[KíÍ°¶0vendor/symfony/console/Helper/QuestionHelper.phpmÈ�u[mùÓ/¶7vendor/symfony/console/Helper/SymfonyQuestionHelper.phpl
  45. �u[l
  46. ÷ÞL¶'vendor/symfony/console/Helper/Table.phpª*È�u[ª*í8ïM¶+vendor/symfony/console/Helper/TableCell.php€È�u[€Ìî*Û¶-vendor/symfony/console/Helper/TableHelper.php È�u[ ƒu®¹¶0vendor/symfony/console/Helper/TableSeparator.phpÊÈ�u[Êaz¶,vendor/symfony/console/Helper/TableStyle.php
  47. �u[
  48. PÞµ¦¶*vendor/symfony/console/Input/ArgvInput.php™È�u[™,»Bô¶+vendor/symfony/console/Input/ArrayInput.php" È�u[" uô™X¶&vendor/symfony/console/Input/Input.php¢ È�u[¢ ”‡B"¶.vendor/symfony/console/Input/InputArgument.phpÈ�u[&<¦¯¶4vendor/symfony/console/Input/InputAwareInterface.phpšÈ�u[š‡jTŸ¶0vendor/symfony/console/Input/InputDefinition.phpŠÈ�u[Šœäf²¶/vendor/symfony/console/Input/InputInterface.php¡È�u[¡,t^>¶,vendor/symfony/console/Input/InputOption.php È�u[ ¸¬�_¶,vendor/symfony/console/Input/StringInput.php–È�u[–cì\(¶vendor/symfony/console/LICENSE)È�u[)NUN½¶/vendor/symfony/console/Logger/ConsoleLogger.php. È�u[. ¤Œ…ζ0vendor/symfony/console/Output/BufferedOutput.php_È�u[_‹ >P¶/vendor/symfony/console/Output/ConsoleOutput.php°È�u[°]k~o¶8vendor/symfony/console/Output/ConsoleOutputInterface.phpàÈ�u[à‡†Æʶ,vendor/symfony/console/Output/NullOutput.phpÏÈ�u[Ï®˜‹Z¶(vendor/symfony/console/Output/Output.php˜ È�u[˜ pf\¶1vendor/symfony/console/Output/OutputInterface.phpÈ�u[ì&¶.vendor/symfony/console/Output/StreamOutput.php­È�u[­Îs6­¶2vendor/symfony/console/Question/ChoiceQuestion.phpw
  49. �u[w
  50. 2t¶8vendor/symfony/console/Question/ConfirmationQuestion.phpçÈ�u[ç ­òf¶,vendor/symfony/console/Question/Question.phpË È�u[Ë ÒqµR¶ vendor/symfony/console/Shell.phpåÈ�u[å•šxS¶,vendor/symfony/console/Style/OutputStyle.php\È�u[\wפ¶/vendor/symfony/console/Style/StyleInterface.phpÏÈ�u[Ï&nÅѶ-vendor/symfony/console/Style/SymfonyStyle.phpÜÈ�u[Üj®|R¶3vendor/symfony/console/Tester/ApplicationTester.phpÏÈ�u[Ïsž9i¶/vendor/symfony/console/Tester/CommandTester.phpªÈ�u[ªµ.âr¶(vendor/symfony/debug/BufferingLogger.phptÈ�u[t=hܶvendor/symfony/debug/Debug.phpÈ�u[˜'Ķ)vendor/symfony/debug/DebugClassLoader.php¡È�u[¡tÅÍT¶%vendor/symfony/debug/ErrorHandler.phpHÈ�u[H‚vÌJ¶9vendor/symfony/debug/Exception/ClassNotFoundException.php–È�u[–i‰æô¶8vendor/symfony/debug/Exception/ContextErrorException.php˜È�u[˜-
  51. d2¶1vendor/symfony/debug/Exception/DummyException.phpÈ�u[®+Ãê¶6vendor/symfony/debug/Exception/FatalErrorException.php È�u[ ˆ93?¶6vendor/symfony/debug/Exception/FatalThrowableError.phpWÈ�u[W?àèK¶3vendor/symfony/debug/Exception/FlattenException.php²È�u[²HòѶ7vendor/symfony/debug/Exception/OutOfMemoryException.php~È�u[~ë¨oâ¶=vendor/symfony/debug/Exception/UndefinedFunctionException.phpšÈ�u[š�ñJÀ¶;vendor/symfony/debug/Exception/UndefinedMethodException.php˜È�u[˜nöêض)vendor/symfony/debug/ExceptionHandler.php!3È�u[!3 Ïq ¶Ivendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php7È�u[7Ñj/=¶Evendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.phpÈ�u[ĹBV¶Mvendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpuÈ�u[uéj¶Kvendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpNÈ�u[NÇo-ç¶vendor/symfony/debug/LICENSE)È�u[)NUN½¶:vendor/symfony/filesystem/Exception/ExceptionInterface.phpiÈ�u[i$ ÿ›¶=vendor/symfony/filesystem/Exception/FileNotFoundException.php¼È�u[¼pí\¶¶3vendor/symfony/filesystem/Exception/IOException.php‡È�u[‡€ü#Ѷ<vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦È�u[¦jÙwM¶(vendor/symfony/filesystem/Filesystem.phpK4È�u[K4½oC·¶!vendor/symfony/filesystem/LICENSE)È�u[)NUN½¶)vendor/symfony/filesystem/LockHandler.phpöÈ�u[öŸZµ1¶1vendor/symfony/finder/Adapter/AbstractAdapter.php\ È�u[\ hˆB¶5vendor/symfony/finder/Adapter/AbstractFindAdapter.php‹È�u[‹…Ôж2vendor/symfony/finder/Adapter/AdapterInterface.php›È�u[›Mþ¶0vendor/symfony/finder/Adapter/BsdFindAdapter.php2È�u[2+Eì¶0vendor/symfony/finder/Adapter/GnuFindAdapter.phpÈ�u[è„JL¶,vendor/symfony/finder/Adapter/PhpAdapter.phpôÈ�u[ôÞdè;¶/vendor/symfony/finder/Comparator/Comparator.phpŒÈ�u[ŒwþT¶3vendor/symfony/finder/Comparator/DateComparator.php#È�u[#°ζ5vendor/symfony/finder/Comparator/NumberComparator.php|È�u[|ITÇͶ9vendor/symfony/finder/Exception/AccessDeniedException.php„È�u[„½¾sœ¶;vendor/symfony/finder/Exception/AdapterFailureException.php¬È�u[¬wR¶6vendor/symfony/finder/Exception/ExceptionInterface.php„È�u[„Gz-¶Avendor/symfony/finder/Exception/OperationNotPermitedException.php)È�u[)x§e¶@vendor/symfony/finder/Exception/ShellCommandFailureException.phpºÈ�u[º˜þ˜¶/vendor/symfony/finder/Expression/Expression.phpÈ�u[i¥:Ŷ)vendor/symfony/finder/Expression/Glob.phpfÈ�u[fDÞcj¶*vendor/symfony/finder/Expression/Regex.phpÈ�u[ü(Ã϶3vendor/symfony/finder/Expression/ValueInterface.phpÍÈ�u[Í\p4†¶ vendor/symfony/finder/Finder.php].È�u[].dìÇ¿¶vendor/symfony/finder/Glob.phpKÈ�u[Kjá±n¶7vendor/symfony/finder/Iterator/CustomFilterIterator.php[È�u[[­åW¶:vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpxÈ�u[xôP¶;vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpîÈ�u[îüÍ�q¶Avendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpíÈ�u[ínõH¶4vendor/symfony/finder/Iterator/FilePathsIterator.php È�u[ ^ÁkF¶9vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZÈ�u[Z(&ø¶<vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5È�u[5ší¶9vendor/symfony/finder/Iterator/FilenameFilterIterator.phprÈ�u[rtu¶1vendor/symfony/finder/Iterator/FilterIterator.phpÃÈ�u[Ú+µÞ¶=vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-È�u[-ºÎÒ_¶5vendor/symfony/finder/Iterator/PathFilterIterator.phpÏÈ�u[ϺªÇ¶=vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php È�u[ ÿ¶:vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpeÈ�u[eŸ’áé¶3vendor/symfony/finder/Iterator/SortableIterator.php*È�u[*€õ´^¶vendor/symfony/finder/LICENSE)È�u[)NUN½¶'vendor/symfony/finder/Shell/Command.php< È�u[< „RŸ¶%vendor/symfony/finder/Shell/Shell.phppÈ�u[pQT�¶%vendor/symfony/finder/SplFileInfo.phpÈ�u[þíù¶'vendor/symfony/polyfill-ctype/Ctype.phpH È�u[H ³�Õݶ%vendor/symfony/polyfill-ctype/LICENSE$È�u[$?‡s:¶+vendor/symfony/polyfill-ctype/bootstrap.phpIÈ�u[I�D!e¶(vendor/symfony/polyfill-mbstring/LICENSE)È�u[)±íж-vendor/symfony/polyfill-mbstring/Mbstring.phpCÈ�u[Cæø¶@vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php2AÈ�u[2A½=¨¶@vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php¡AÈ�u[¡AÚ Í¶.vendor/symfony/polyfill-mbstring/bootstrap.phpËÈ�u[Ëó<Ë¢¶7vendor/symfony/process/Exception/ExceptionInterface.phpfÈ�u[f]ö>T¶=vendor/symfony/process/Exception/InvalidArgumentException.php¨È�u[¨ÐÀ+_¶3vendor/symfony/process/Exception/LogicException.php”È�u[” ³ãñ¶;vendor/symfony/process/Exception/ProcessFailedException.phpxÈ�u[x¨Ìzy¶=vendor/symfony/process/Exception/ProcessTimedOutException.phpÈ�u[﫶5vendor/symfony/process/Exception/RuntimeException.php˜È�u[˜¢Ø:¶+vendor/symfony/process/ExecutableFinder.phpšÈ�u[šT’³É¶vendor/symfony/process/LICENSE)È�u[)NUN½¶.vendor/symfony/process/PhpExecutableFinder.phpÈÈ�u[Èš(À®¶%vendor/symfony/process/PhpProcess.phpúÈ�u[ú¯“Õ�¶.vendor/symfony/process/Pipes/AbstractPipes.php»È�u[» Vw¶/vendor/symfony/process/Pipes/PipesInterface.phpDÈ�u[DvØ*vendor/symfony/process/Pipes/UnixPipes.php>È�u[>ª•ir¶-vendor/symfony/process/Pipes/WindowsPipes.php‰ È�u[‰ À"¢¶"vendor/symfony/process/Process.php£RÈ�u[£RÁÜÕ(¶)vendor/symfony/process/ProcessBuilder.phpß
  52. È�u[ß
  53. ^ƒ8¶'vendor/symfony/process/ProcessUtils.phpKÈ�u[K2ÁÞg¶vendor/seld/jsonlint/LICENSE"È�u["aƒsy¶@vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*È�u[*•pñ¶5vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php/2È�u[/2­ß˜ö¶0vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.phpÈ�u[%ÿ3N¶;vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.phpÈ�u[‰²ñ¶4vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>È�u[>ÿqŸŸ¶(vendor/justinrainbow/json-schema/LICENSE È�u[ ºç©¶.vendor/justinrainbow/json-schema/demo/demo.phpñÈ�u[ñfC¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ È�u[¡ †wÌl¶Tvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php) È�u[) #©¶Jvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ È�u[§ ›VضSvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼È�u[¼ÿ Qœ¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]È�u[]VŽU<¶Gvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã È�u[ã á0;¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…È�u[…“TœÚ¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpš
  54. È�u[š
  55. z&¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃÈ�u[éżx¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 È�u[0 ×j´˜¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.phpÈ�u[¥wš‡¶Xvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpaÈ�u[a qöYvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.phppÈ�u[prë¶\vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰È�u[‰“µ+j¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&È�u[&4˜©T¶Svendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php,"È�u[,"ulÙ·¶Fvendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpèÈ�u[è{N–¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpIÈ�u[I%|°¶Vvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•È�u[•‹àG¶Tvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phplÈ�u[lA!L׶Tvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phplÈ�u[lè2÷þ¶]vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpuÈ�u[u=hç¶Wvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpwÈ�u[wN-ò[¶Svendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞÈ�u[Þ\¸
  56. ¶Wvendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpoÈ�u[opíÛù¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…È�u[…%…—¶^vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€È�u[€u-#1¶Rvendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpjÈ�u[jå>�¶Qvendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpfÈ�u[f¬¤„þ¶Kvendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþÈ�u[þM�„õ¶;vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php È�u[ f4÷³¶Avendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ È�u[œ åfO¶Jvendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.phpÈ�u[oŠ+}¶Tvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpáÈ�u[á[þA�¶Gvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥È�u[¥Ô§Lb¶Rvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%È�u[%5" ¶Rvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,È�u[,1•5þ¶Xvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®È�u[®ÿ‹Áå¶Cvendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php È�u[ £Ÿ)à¶Dvendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php&È�u[&¼î‚¢¶Hvendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒÈ�u[ƒJ€¶Ivendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…È�u[…íæe¶=vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpxÈ�u[xeÃþ¶%vendor/composer/spdx-licenses/LICENSEÈ�u[Bhí¶2vendor/composer/spdx-licenses/src/SpdxLicenses.phpHÈ�u[H͉T¶vendor/composer/semver/LICENSEÈ�u[Bhí¶)vendor/composer/semver/src/Comparator.phpÈ�u[wlƒï¶<vendor/composer/semver/src/Constraint/AbstractConstraint.php×È�u[×õî>Ž¶4vendor/composer/semver/src/Constraint/Constraint.phpª È�u[ª ÇO7²¶=vendor/composer/semver/src/Constraint/ConstraintInterface.phpßÈ�u[ß0C,‡¶9vendor/composer/semver/src/Constraint/EmptyConstraint.phpéÈ�u[é!-Ø™¶9vendor/composer/semver/src/Constraint/MultiConstraint.php1È�u[1í xU¶%vendor/composer/semver/src/Semver.phpvÈ�u[v‹×È›¶,vendor/composer/semver/src/VersionParser.php¿*È�u[¿*)mƶ!vendor/composer/ca-bundle/LICENSEÈ�u[*!^`¶*vendor/composer/ca-bundle/src/CaBundle.phpÈ�u[Ê ~Ķ&vendor/composer/xdebug-handler/LICENSE)È�u[)#Ô;^¶0vendor/composer/xdebug-handler/src/PhpConfig.php´È�u[´*D’¶.vendor/composer/xdebug-handler/src/Process.phptÈ�u[tÛŒú&¶-vendor/composer/xdebug-handler/src/Status.phpì È�u[ì je¿û¶4vendor/composer/xdebug-handler/src/XdebugHandler.phpšÈ�u[šÞéE?¶vendor/psr/log/LICENSE=È�u[=p±ŽO¶)vendor/psr/log/Psr/Log/AbstractLogger.php;È�u[;ñ>3[¶3vendor/psr/log/Psr/Log/InvalidArgumentException.php`È�u[` ˆX1¶#vendor/psr/log/Psr/Log/LogLevel.phpûÈ�u[ûjðñ8¶/vendor/psr/log/Psr/Log/LoggerAwareInterface.php|È�u[|$£ˆ¶+vendor/psr/log/Psr/Log/LoggerAwareTrait.php§È�u[§T½úB¶*vendor/psr/log/Psr/Log/LoggerInterface.phpÆÈ�u[Æ»sg¶&vendor/psr/log/Psr/Log/LoggerTrait.phpiÈ�u[i35§Þ¶%vendor/psr/log/Psr/Log/NullLogger.phpžÈ�u[žÇö3vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpü È�u[ü iq0ضvendor/autoload.php‚È�u[‚Z”Ÿ¶'vendor/composer/autoload_namespaces.phpdÈ�u[dZ¡¦H¶!vendor/composer/autoload_psr4.php÷È�u[÷Å*š¶%vendor/composer/autoload_classmap.phpdÈ�u[dZ¡¦H¶"vendor/composer/autoload_files.phpÈ�u[¥ ®¶!vendor/composer/autoload_real.phpIÈ�u[If]ÿ¶#vendor/composer/autoload_static.php§
  57. È�u[§
  58. ë Î¶vendor/composer/ClassLoader.phpƒÈ�u[ƒ«Ñëæ¶(vendor/composer/ca-bundle/res/cacert.pem»CÈ�u[»Cf.À¬¶ bin/composeróÈ�u[ó]UÌ€¶LICENSE.È�u[. Õ¶<?php
  59. namespace Composer\Autoload;
  60. use Composer\Config;
  61. use Composer\EventDispatcher\EventDispatcher;
  62. use Composer\Installer\InstallationManager;
  63. use Composer\IO\IOInterface;
  64. use Composer\Package\AliasPackage;
  65. use Composer\Package\PackageInterface;
  66. use Composer\Repository\InstalledRepositoryInterface;
  67. use Composer\Util\Filesystem;
  68. use Composer\Script\ScriptEvents;
  69. class AutoloadGenerator
  70. {
  71. private $eventDispatcher;
  72. private $io;
  73. private $devMode = false;
  74. private $classMapAuthoritative = false;
  75. private $apcu = false;
  76. private $runScripts = false;
  77. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  78. {
  79. $this->eventDispatcher = $eventDispatcher;
  80. $this->io = $io;
  81. }
  82. public function setDevMode($devMode = true)
  83. {
  84. $this->devMode = (bool) $devMode;
  85. }
  86. public function setClassMapAuthoritative($classMapAuthoritative)
  87. {
  88. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  89. }
  90. public function setApcu($apcu)
  91. {
  92. $this->apcu = (bool) $apcu;
  93. }
  94. public function setRunScripts($runScripts = true)
  95. {
  96. $this->runScripts = (bool) $runScripts;
  97. }
  98. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  99. {
  100. if ($this->classMapAuthoritative) {
  101. $scanPsr0Packages = true;
  102. }
  103. if ($this->runScripts) {
  104. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  105. 'optimize' => (bool) $scanPsr0Packages,
  106. ));
  107. }
  108. $filesystem = new Filesystem();
  109. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  110. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  111. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  112. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  113. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  114. $targetDir = $vendorPath.'/'.$targetDir;
  115. $filesystem->ensureDirectoryExists($targetDir);
  116. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  117. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  118. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  119. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  120. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  121. $namespacesFile = <<<EOF
  122. <?php
  123. // autoload_namespaces.php @generated by Composer
  124. \$vendorDir = $vendorPathCode52;
  125. \$baseDir = $appBaseDirCode;
  126. return array(
  127. EOF;
  128. $psr4File = <<<EOF
  129. <?php
  130. // autoload_psr4.php @generated by Composer
  131. \$vendorDir = $vendorPathCode52;
  132. \$baseDir = $appBaseDirCode;
  133. return array(
  134. EOF;
  135. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  136. $autoloads = $this->parseAutoloads($packageMap, $mainPackage, $this->devMode === false);
  137. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  138. $exportedPaths = array();
  139. foreach ($paths as $path) {
  140. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  141. }
  142. $exportedPrefix = var_export($namespace, true);
  143. $namespacesFile .= " $exportedPrefix => ";
  144. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  145. }
  146. $namespacesFile .= ");\n";
  147. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  148. $exportedPaths = array();
  149. foreach ($paths as $path) {
  150. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  151. }
  152. $exportedPrefix = var_export($namespace, true);
  153. $psr4File .= " $exportedPrefix => ";
  154. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  155. }
  156. $psr4File .= ");\n";
  157. $classmapFile = <<<EOF
  158. <?php
  159. // autoload_classmap.php @generated by Composer
  160. \$vendorDir = $vendorPathCode52;
  161. \$baseDir = $appBaseDirCode;
  162. return array(
  163. EOF;
  164. $targetDirLoader = null;
  165. $mainAutoload = $mainPackage->getAutoload();
  166. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  167. $levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
  168. $prefixes = implode(', ', array_map(function ($prefix) {
  169. return var_export($prefix, true);
  170. }, array_keys($mainAutoload['psr-0'])));
  171. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  172. $targetDirLoader = <<<EOF
  173. public static function autoload(\$class)
  174. {
  175. \$dir = $baseDirFromTargetDirCode . '/';
  176. \$prefixes = array($prefixes);
  177. foreach (\$prefixes as \$prefix) {
  178. if (0 !== strpos(\$class, \$prefix)) {
  179. continue;
  180. }
  181. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  182. if (!\$path = stream_resolve_include_path(\$path)) {
  183. return false;
  184. }
  185. require \$path;
  186. return true;
  187. }
  188. }
  189. EOF;
  190. }
  191. $blacklist = null;
  192. if (!empty($autoloads['exclude-from-classmap'])) {
  193. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  194. }
  195. $classMap = array();
  196. if ($scanPsr0Packages) {
  197. $namespacesToScan = array();
  198. foreach (array('psr-0', 'psr-4') as $psrType) {
  199. foreach ($autoloads[$psrType] as $namespace => $paths) {
  200. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  201. }
  202. }
  203. krsort($namespacesToScan);
  204. foreach ($namespacesToScan as $namespace => $groups) {
  205. foreach ($groups as $group) {
  206. foreach ($group['paths'] as $dir) {
  207. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  208. if (!is_dir($dir)) {
  209. continue;
  210. }
  211. $namespaceFilter = $namespace === '' ? null : $namespace;
  212. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  213. }
  214. }
  215. }
  216. }
  217. foreach ($autoloads['classmap'] as $dir) {
  218. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  219. }
  220. ksort($classMap);
  221. foreach ($classMap as $class => $code) {
  222. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  223. }
  224. $classmapFile .= ");\n";
  225. if (!$suffix) {
  226. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  227. $content = file_get_contents($vendorPath.'/autoload.php');
  228. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  229. $suffix = $match[1];
  230. }
  231. }
  232. if (!$suffix) {
  233. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  234. }
  235. }
  236. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  237. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  238. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  239. $includePathFilePath = $targetDir.'/include_paths.php';
  240. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  241. file_put_contents($includePathFilePath, $includePathFileContents);
  242. } elseif (file_exists($includePathFilePath)) {
  243. unlink($includePathFilePath);
  244. }
  245. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  246. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  247. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  248. } elseif (file_exists($includeFilesFilePath)) {
  249. unlink($includeFilesFilePath);
  250. }
  251. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  252. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  253. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  254. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  255. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  256. if ($this->runScripts) {
  257. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  258. 'optimize' => (bool) $scanPsr0Packages,
  259. ));
  260. }
  261. }
  262. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
  263. {
  264. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
  265. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  266. if (!isset($classMap[$class])) {
  267. $classMap[$class] = $pathCode;
  268. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  269. $this->io->writeError(
  270. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  271. ' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
  272. );
  273. }
  274. }
  275. return $classMap;
  276. }
  277. private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
  278. {
  279. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
  280. }
  281. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  282. {
  283. $packageMap = array(array($mainPackage, ''));
  284. foreach ($packages as $package) {
  285. if ($package instanceof AliasPackage) {
  286. continue;
  287. }
  288. $this->validatePackage($package);
  289. $packageMap[] = array(
  290. $package,
  291. $installationManager->getInstallPath($package),
  292. );
  293. }
  294. return $packageMap;
  295. }
  296. protected function validatePackage(PackageInterface $package)
  297. {
  298. $autoload = $package->getAutoload();
  299. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  300. $name = $package->getName();
  301. $package->getTargetDir();
  302. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  303. }
  304. if (!empty($autoload['psr-4'])) {
  305. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  306. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  307. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  308. }
  309. }
  310. }
  311. }
  312. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage, $filterOutRequireDevPackages = false)
  313. {
  314. $mainPackageMap = array_shift($packageMap);
  315. if ($filterOutRequireDevPackages) {
  316. $packageMap = $this->filterPackageMap($packageMap, $mainPackage);
  317. }
  318. $sortedPackageMap = $this->sortPackageMap($packageMap);
  319. $sortedPackageMap[] = $mainPackageMap;
  320. array_unshift($packageMap, $mainPackageMap);
  321. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  322. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  323. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  324. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  325. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  326. krsort($psr0);
  327. krsort($psr4);
  328. return array(
  329. 'psr-0' => $psr0,
  330. 'psr-4' => $psr4,
  331. 'classmap' => $classmap,
  332. 'files' => $files,
  333. 'exclude-from-classmap' => $exclude,
  334. );
  335. }
  336. public function createLoader(array $autoloads)
  337. {
  338. $loader = new ClassLoader();
  339. if (isset($autoloads['psr-0'])) {
  340. foreach ($autoloads['psr-0'] as $namespace => $path) {
  341. $loader->add($namespace, $path);
  342. }
  343. }
  344. if (isset($autoloads['psr-4'])) {
  345. foreach ($autoloads['psr-4'] as $namespace => $path) {
  346. $loader->addPsr4($namespace, $path);
  347. }
  348. }
  349. if (isset($autoloads['classmap'])) {
  350. $blacklist = null;
  351. if (!empty($autoloads['exclude-from-classmap'])) {
  352. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  353. }
  354. foreach ($autoloads['classmap'] as $dir) {
  355. try {
  356. $loader->addClassMap($this->generateClassMap($dir, $blacklist, null, false));
  357. } catch (\RuntimeException $e) {
  358. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  359. }
  360. }
  361. }
  362. return $loader;
  363. }
  364. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  365. {
  366. $includePaths = array();
  367. foreach ($packageMap as $item) {
  368. list($package, $installPath) = $item;
  369. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  370. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  371. }
  372. foreach ($package->getIncludePaths() as $includePath) {
  373. $includePath = trim($includePath, '/');
  374. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  375. }
  376. }
  377. if (!$includePaths) {
  378. return;
  379. }
  380. $includePathsCode = '';
  381. foreach ($includePaths as $path) {
  382. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  383. }
  384. return <<<EOF
  385. <?php
  386. // include_paths.php @generated by Composer
  387. \$vendorDir = $vendorPathCode;
  388. \$baseDir = $appBaseDirCode;
  389. return array(
  390. $includePathsCode);
  391. EOF;
  392. }
  393. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  394. {
  395. $filesCode = '';
  396. foreach ($files as $fileIdentifier => $functionFile) {
  397. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  398. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  399. }
  400. if (!$filesCode) {
  401. return false;
  402. }
  403. return <<<EOF
  404. <?php
  405. // autoload_files.php @generated by Composer
  406. \$vendorDir = $vendorPathCode;
  407. \$baseDir = $appBaseDirCode;
  408. return array(
  409. $filesCode);
  410. EOF;
  411. }
  412. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  413. {
  414. if (!$filesystem->isAbsolutePath($path)) {
  415. $path = $basePath . '/' . $path;
  416. }
  417. $path = $filesystem->normalizePath($path);
  418. $baseDir = '';
  419. if (strpos($path.'/', $vendorPath.'/') === 0) {
  420. $path = substr($path, strlen($vendorPath));
  421. $baseDir = '$vendorDir';
  422. if ($path !== false) {
  423. $baseDir .= " . ";
  424. }
  425. } else {
  426. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  427. if (!$filesystem->isAbsolutePath($path)) {
  428. $baseDir = '$baseDir . ';
  429. $path = '/' . $path;
  430. }
  431. }
  432. if (preg_match('/\.phar.+$/', $path)) {
  433. $baseDir = "'phar://' . " . $baseDir;
  434. }
  435. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  436. }
  437. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  438. {
  439. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  440. if ("'" === $lastChar || '"' === $lastChar) {
  441. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  442. } else {
  443. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  444. }
  445. return <<<AUTOLOAD
  446. <?php
  447. // autoload.php @generated by Composer
  448. require_once $vendorPathToTargetDirCode;
  449. return ComposerAutoloaderInit$suffix::getLoader();
  450. AUTOLOAD;
  451. }
  452. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  453. {
  454. $file = <<<HEADER
  455. <?php
  456. // autoload_real.php @generated by Composer
  457. class ComposerAutoloaderInit$suffix
  458. {
  459. private static \$loader;
  460. public static function loadClassLoader(\$class)
  461. {
  462. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  463. require __DIR__ . '/ClassLoader.php';
  464. }
  465. }
  466. public static function getLoader()
  467. {
  468. if (null !== self::\$loader) {
  469. return self::\$loader;
  470. }
  471. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  472. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  473. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  474. HEADER;
  475. if ($useIncludePath) {
  476. $file .= <<<'INCLUDE_PATH'
  477. $includePaths = require __DIR__ . '/include_paths.php';
  478. $includePaths[] = get_include_path();
  479. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  480. INCLUDE_PATH;
  481. }
  482. $file .= <<<STATIC_INIT
  483. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  484. if (\$useStaticLoader) {
  485. require_once __DIR__ . '/autoload_static.php';
  486. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  487. } else {
  488. STATIC_INIT;
  489. if (!$this->classMapAuthoritative) {
  490. $file .= <<<'PSR04'
  491. $map = require __DIR__ . '/autoload_namespaces.php';
  492. foreach ($map as $namespace => $path) {
  493. $loader->set($namespace, $path);
  494. }
  495. $map = require __DIR__ . '/autoload_psr4.php';
  496. foreach ($map as $namespace => $path) {
  497. $loader->setPsr4($namespace, $path);
  498. }
  499. PSR04;
  500. }
  501. if ($useClassMap) {
  502. $file .= <<<'CLASSMAP'
  503. $classMap = require __DIR__ . '/autoload_classmap.php';
  504. if ($classMap) {
  505. $loader->addClassMap($classMap);
  506. }
  507. CLASSMAP;
  508. }
  509. $file .= " }\n\n";
  510. if ($this->classMapAuthoritative) {
  511. $file .= <<<'CLASSMAPAUTHORITATIVE'
  512. $loader->setClassMapAuthoritative(true);
  513. CLASSMAPAUTHORITATIVE;
  514. }
  515. if ($this->apcu) {
  516. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  517. $file .= <<<APCU
  518. \$loader->setApcuPrefix('$apcuPrefix');
  519. APCU;
  520. }
  521. if ($useGlobalIncludePath) {
  522. $file .= <<<'INCLUDEPATH'
  523. $loader->setUseIncludePath(true);
  524. INCLUDEPATH;
  525. }
  526. if ($targetDirLoader) {
  527. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  528. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  529. REGISTER_TARGET_DIR_AUTOLOAD;
  530. }
  531. $file .= <<<REGISTER_LOADER
  532. \$loader->register($prependAutoloader);
  533. REGISTER_LOADER;
  534. if ($useIncludeFiles) {
  535. $file .= <<<INCLUDE_FILES
  536. if (\$useStaticLoader) {
  537. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  538. } else {
  539. \$includeFiles = require __DIR__ . '/autoload_files.php';
  540. }
  541. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  542. composerRequire$suffix(\$fileIdentifier, \$file);
  543. }
  544. INCLUDE_FILES;
  545. }
  546. $file .= <<<METHOD_FOOTER
  547. return \$loader;
  548. }
  549. METHOD_FOOTER;
  550. $file .= $targetDirLoader;
  551. if ($useIncludeFiles) {
  552. return $file . <<<FOOTER
  553. }
  554. function composerRequire$suffix(\$fileIdentifier, \$file)
  555. {
  556. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  557. require \$file;
  558. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  559. }
  560. }
  561. FOOTER;
  562. }
  563. return $file . <<<FOOTER
  564. }
  565. FOOTER;
  566. }
  567. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  568. {
  569. $staticPhpVersion = 50600;
  570. $file = <<<HEADER
  571. <?php
  572. // autoload_static.php @generated by Composer
  573. namespace Composer\Autoload;
  574. class ComposerStaticInit$suffix
  575. {
  576. HEADER;
  577. $loader = new ClassLoader();
  578. $map = require $targetDir . '/autoload_namespaces.php';
  579. foreach ($map as $namespace => $path) {
  580. $loader->set($namespace, $path);
  581. }
  582. $map = require $targetDir . '/autoload_psr4.php';
  583. foreach ($map as $namespace => $path) {
  584. $loader->setPsr4($namespace, $path);
  585. }
  586. $classMap = require $targetDir . '/autoload_classmap.php';
  587. if ($classMap) {
  588. $loader->addClassMap($classMap);
  589. }
  590. $filesystem = new Filesystem();
  591. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  592. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  593. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  594. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  595. $initializer = '';
  596. $prefix = "\0Composer\Autoload\ClassLoader\0";
  597. $prefixLen = strlen($prefix);
  598. if (file_exists($targetDir . '/autoload_files.php')) {
  599. $maps = array('files' => require $targetDir . '/autoload_files.php');
  600. } else {
  601. $maps = array();
  602. }
  603. foreach ((array) $loader as $prop => $value) {
  604. if ($value && 0 === strpos($prop, $prefix)) {
  605. $maps[substr($prop, $prefixLen)] = $value;
  606. }
  607. }
  608. foreach ($maps as $prop => $value) {
  609. if (count($value) > 32767) {
  610. $staticPhpVersion = 70000;
  611. }
  612. $value = var_export($value, true);
  613. $value = str_replace($absoluteVendorPathCode, $vendorPathCode, $value);
  614. $value = str_replace($absoluteAppBaseDirCode, $appBaseDirCode, $value);
  615. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  616. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  617. if ('files' !== $prop) {
  618. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  619. }
  620. }
  621. return $file . <<<INITIALIZER
  622. public static function getInitializer(ClassLoader \$loader)
  623. {
  624. return \Closure::bind(function () use (\$loader) {
  625. $initializer
  626. }, null, ClassLoader::class);
  627. }
  628. }
  629. INITIALIZER;
  630. }
  631. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  632. {
  633. $autoloads = array();
  634. foreach ($packageMap as $item) {
  635. list($package, $installPath) = $item;
  636. $autoload = $package->getAutoload();
  637. if ($this->devMode && $package === $mainPackage) {
  638. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  639. }
  640. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  641. continue;
  642. }
  643. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  644. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  645. }
  646. foreach ($autoload[$type] as $namespace => $paths) {
  647. foreach ((array) $paths as $path) {
  648. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  649. if ($package === $mainPackage) {
  650. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  651. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  652. } else {
  653. $path = $package->getTargetDir() . '/' . $path;
  654. }
  655. }
  656. if ($type === 'exclude-from-classmap') {
  657. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  658. $path = str_replace('\\*\\*', '.+?', $path);
  659. $path = str_replace('\\*', '[^/]+?', $path);
  660. $updir = null;
  661. $path = preg_replace_callback(
  662. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  663. function ($matches) use (&$updir) {
  664. if (isset($matches[1])) {
  665. $updir = str_replace('\\.', '.', $matches[1]);
  666. }
  667. return '';
  668. },
  669. $path
  670. );
  671. if (empty($installPath)) {
  672. $installPath = strtr(getcwd(), '\\', '/');
  673. }
  674. $resolvedPath = realpath($installPath . '/' . $updir);
  675. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  676. continue;
  677. }
  678. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  679. if ($type === 'files') {
  680. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  681. continue;
  682. } elseif ($type === 'classmap') {
  683. $autoloads[] = $relativePath;
  684. continue;
  685. }
  686. $autoloads[$namespace][] = $relativePath;
  687. }
  688. }
  689. }
  690. return $autoloads;
  691. }
  692. protected function getFileIdentifier(PackageInterface $package, $path)
  693. {
  694. return md5($package->getName() . ':' . $path);
  695. }
  696. protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
  697. {
  698. $packages = array();
  699. $include = array();
  700. foreach ($packageMap as $item) {
  701. $package = $item[0];
  702. $name = $package->getName();
  703. $packages[$name] = $package;
  704. }
  705. $add = function (PackageInterface $package) use (&$add, $packages, &$include) {
  706. foreach ($package->getRequires() as $link) {
  707. $target = $link->getTarget();
  708. if (!isset($include[$target])) {
  709. $include[$target] = true;
  710. if (isset($packages[$target])) {
  711. $add($packages[$target]);
  712. }
  713. }
  714. }
  715. };
  716. $add($mainPackage);
  717. return array_filter(
  718. $packageMap,
  719. function ($item) use ($include) {
  720. $package = $item[0];
  721. $name = $package->getName();
  722. return isset($include[$name]);
  723. }
  724. );
  725. }
  726. protected function sortPackageMap(array $packageMap)
  727. {
  728. $packages = array();
  729. $paths = array();
  730. $usageList = array();
  731. foreach ($packageMap as $item) {
  732. list($package, $path) = $item;
  733. $name = $package->getName();
  734. $packages[$name] = $package;
  735. $paths[$name] = $path;
  736. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  737. $target = $link->getTarget();
  738. $usageList[$target][] = $name;
  739. }
  740. }
  741. $computing = array();
  742. $computed = array();
  743. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  744. if (isset($computed[$name])) {
  745. return $computed[$name];
  746. }
  747. if (isset($computing[$name])) {
  748. return 0;
  749. }
  750. $computing[$name] = true;
  751. $weight = 0;
  752. if (isset($usageList[$name])) {
  753. foreach ($usageList[$name] as $user) {
  754. $weight -= 1 - $computeImportance($user);
  755. }
  756. }
  757. unset($computing[$name]);
  758. $computed[$name] = $weight;
  759. return $weight;
  760. };
  761. $weightList = array();
  762. foreach ($packages as $name => $package) {
  763. $weight = $computeImportance($name);
  764. $weightList[$name] = $weight;
  765. }
  766. $stable_sort = function (&$array) {
  767. static $transform, $restore;
  768. $i = 0;
  769. if (!$transform) {
  770. $transform = function (&$v, $k) use (&$i) {
  771. $v = array($v, ++$i, $k, $v);
  772. };
  773. $restore = function (&$v, $k) {
  774. $v = $v[3];
  775. };
  776. }
  777. array_walk($array, $transform);
  778. asort($array);
  779. array_walk($array, $restore);
  780. };
  781. $stable_sort($weightList);
  782. $sortedPackageMap = array();
  783. foreach (array_keys($weightList) as $name) {
  784. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  785. }
  786. return $sortedPackageMap;
  787. }
  788. protected function safeCopy($source, $target)
  789. {
  790. $source = fopen($source, 'r');
  791. $target = fopen($target, 'w+');
  792. stream_copy_to_stream($source, $target);
  793. fclose($source);
  794. fclose($target);
  795. }
  796. }
  797. <?php
  798. namespace Composer\Autoload;
  799. use Symfony\Component\Finder\Finder;
  800. use Composer\IO\IOInterface;
  801. use Composer\Util\Filesystem;
  802. class ClassMapGenerator
  803. {
  804. public static function dump($dirs, $file)
  805. {
  806. $maps = array();
  807. foreach ($dirs as $dir) {
  808. $maps = array_merge($maps, static::createMap($dir));
  809. }
  810. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  811. }
  812. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  813. {
  814. if (is_string($path)) {
  815. if (is_file($path)) {
  816. $path = array(new \SplFileInfo($path));
  817. } elseif (is_dir($path)) {
  818. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  819. } else {
  820. throw new \RuntimeException(
  821. 'Could not scan for classes inside "'.$path.
  822. '" which does not appear to be a file nor a folder'
  823. );
  824. }
  825. }
  826. $map = array();
  827. $filesystem = new Filesystem();
  828. $cwd = realpath(getcwd());
  829. foreach ($path as $file) {
  830. $filePath = $file->getPathname();
  831. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  832. continue;
  833. }
  834. if (!$filesystem->isAbsolutePath($filePath)) {
  835. $filePath = $cwd . '/' . $filePath;
  836. $filePath = $filesystem->normalizePath($filePath);
  837. } else {
  838. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  839. }
  840. if ($blacklist && preg_match($blacklist, strtr(realpath($filePath), '\\', '/'))) {
  841. continue;
  842. }
  843. if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
  844. continue;
  845. }
  846. $classes = self::findClasses($filePath);
  847. foreach ($classes as $class) {
  848. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  849. continue;
  850. }
  851. if (!isset($map[$class])) {
  852. $map[$class] = $filePath;
  853. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  854. $io->writeError(
  855. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  856. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  857. );
  858. }
  859. }
  860. }
  861. return $map;
  862. }
  863. private static function findClasses($path)
  864. {
  865. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  866. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  867. $extraTypes .= '|enum';
  868. }
  869. $contents = @php_strip_whitespace($path);
  870. if (!$contents) {
  871. if (!file_exists($path)) {
  872. $message = 'File at "%s" does not exist, check your classmap definitions';
  873. } elseif (!is_readable($path)) {
  874. $message = 'File at "%s" is not readable, check its permissions';
  875. } elseif ('' === trim(file_get_contents($path))) {
  876. return array();
  877. } else {
  878. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  879. }
  880. $error = error_get_last();
  881. if (isset($error['message'])) {
  882. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  883. }
  884. throw new \RuntimeException(sprintf($message, $path));
  885. }
  886. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  887. return array();
  888. }
  889. $contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
  890. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  891. if (substr($contents, 0, 2) !== '<?') {
  892. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  893. if ($replacements === 0) {
  894. return array();
  895. }
  896. }
  897. $contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
  898. $pos = strrpos($contents, '?>');
  899. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  900. $contents = substr($contents, 0, $pos);
  901. }
  902. if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
  903. $contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
  904. }
  905. preg_match_all('{
  906. (?:
  907. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  908. | \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*+ [\{;]
  909. )
  910. }ix', $contents, $matches);
  911. $classes = array();
  912. $namespace = '';
  913. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  914. if (!empty($matches['ns'][$i])) {
  915. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  916. } else {
  917. $name = $matches['name'][$i];
  918. if ($name === 'extends' || $name === 'implements') {
  919. continue;
  920. }
  921. if ($name[0] === ':') {
  922. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  923. } elseif ($matches['type'][$i] === 'enum') {
  924. $name = rtrim($name, ':');
  925. }
  926. $classes[] = ltrim($namespace . $name, '\\');
  927. }
  928. }
  929. return $classes;
  930. }
  931. }
  932. <?php
  933. namespace Composer;
  934. use Composer\IO\IOInterface;
  935. use Composer\Util\Filesystem;
  936. use Composer\Util\Silencer;
  937. use Symfony\Component\Finder\Finder;
  938. class Cache
  939. {
  940. private static $cacheCollected = false;
  941. private $io;
  942. private $root;
  943. private $enabled = true;
  944. private $whitelist;
  945. private $filesystem;
  946. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  947. {
  948. $this->io = $io;
  949. $this->root = rtrim($cacheDir, '/\\') . '/';
  950. $this->whitelist = $whitelist;
  951. $this->filesystem = $filesystem ?: new Filesystem();
  952. if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
  953. $this->enabled = false;
  954. return;
  955. }
  956. if (
  957. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  958. || !is_writable($this->root)
  959. ) {
  960. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  961. $this->enabled = false;
  962. }
  963. }
  964. public function isEnabled()
  965. {
  966. return $this->enabled;
  967. }
  968. public function getRoot()
  969. {
  970. return $this->root;
  971. }
  972. public function read($file)
  973. {
  974. if ($this->enabled) {
  975. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  976. if (file_exists($this->root . $file)) {
  977. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  978. return file_get_contents($this->root . $file);
  979. }
  980. }
  981. return false;
  982. }
  983. public function write($file, $contents)
  984. {
  985. if ($this->enabled) {
  986. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  987. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  988. try {
  989. return file_put_contents($this->root . $file, $contents);
  990. } catch (\ErrorException $e) {
  991. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  992. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  993. unlink($this->root . $file);
  994. $message = sprintf(
  995. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  996. $this->root . $file,
  997. $m[1],
  998. $m[2],
  999. @disk_free_space($this->root . dirname($file))
  1000. );
  1001. $this->io->writeError($message);
  1002. return false;
  1003. }
  1004. throw $e;
  1005. }
  1006. }
  1007. return false;
  1008. }
  1009. public function copyFrom($file, $source)
  1010. {
  1011. if ($this->enabled) {
  1012. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1013. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1014. if (!file_exists($source)) {
  1015. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1016. } elseif ($this->io->isDebug()) {
  1017. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1018. }
  1019. return copy($source, $this->root . $file);
  1020. }
  1021. return false;
  1022. }
  1023. public function copyTo($file, $target)
  1024. {
  1025. if ($this->enabled) {
  1026. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1027. if (file_exists($this->root . $file)) {
  1028. try {
  1029. touch($this->root . $file, filemtime($this->root . $file), time());
  1030. } catch (\ErrorException $e) {
  1031. Silencer::call('touch', $this->root . $file);
  1032. }
  1033. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1034. return copy($this->root . $file, $target);
  1035. }
  1036. }
  1037. return false;
  1038. }
  1039. public function gcIsNecessary()
  1040. {
  1041. return (!self::$cacheCollected && !mt_rand(0, 50));
  1042. }
  1043. public function remove($file)
  1044. {
  1045. if ($this->enabled) {
  1046. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1047. if (file_exists($this->root . $file)) {
  1048. return $this->filesystem->unlink($this->root . $file);
  1049. }
  1050. }
  1051. return false;
  1052. }
  1053. public function clear()
  1054. {
  1055. if ($this->enabled) {
  1056. return $this->filesystem->removeDirectory($this->root);
  1057. }
  1058. return false;
  1059. }
  1060. public function gc($ttl, $maxSize)
  1061. {
  1062. if ($this->enabled) {
  1063. $expire = new \DateTime();
  1064. $expire->modify('-'.$ttl.' seconds');
  1065. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1066. foreach ($finder as $file) {
  1067. $this->filesystem->unlink($file->getPathname());
  1068. }
  1069. $totalSize = $this->filesystem->size($this->root);
  1070. if ($totalSize > $maxSize) {
  1071. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1072. while ($totalSize > $maxSize && $iterator->valid()) {
  1073. $filepath = $iterator->current()->getPathname();
  1074. $totalSize -= $this->filesystem->size($filepath);
  1075. $this->filesystem->unlink($filepath);
  1076. $iterator->next();
  1077. }
  1078. }
  1079. self::$cacheCollected = true;
  1080. return true;
  1081. }
  1082. return false;
  1083. }
  1084. public function sha1($file)
  1085. {
  1086. if ($this->enabled) {
  1087. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1088. if (file_exists($this->root . $file)) {
  1089. return sha1_file($this->root . $file);
  1090. }
  1091. }
  1092. return false;
  1093. }
  1094. public function sha256($file)
  1095. {
  1096. if ($this->enabled) {
  1097. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1098. if (file_exists($this->root . $file)) {
  1099. return hash_file('sha256', $this->root . $file);
  1100. }
  1101. }
  1102. return false;
  1103. }
  1104. protected function getFinder()
  1105. {
  1106. return Finder::create()->in($this->root)->files();
  1107. }
  1108. }
  1109. <?php
  1110. namespace Composer\Command;
  1111. use Symfony\Component\Console\Input\InputInterface;
  1112. use Symfony\Component\Console\Output\OutputInterface;
  1113. class AboutCommand extends BaseCommand
  1114. {
  1115. protected function configure()
  1116. {
  1117. $this
  1118. ->setName('about')
  1119. ->setDescription('Shows the short information about Composer.')
  1120. ->setHelp(
  1121. <<<EOT
  1122. <info>php composer.phar about</info>
  1123. EOT
  1124. )
  1125. ;
  1126. }
  1127. protected function execute(InputInterface $input, OutputInterface $output)
  1128. {
  1129. $this->getIO()->write(
  1130. <<<EOT
  1131. <info>Composer - Package Management for PHP</info>
  1132. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1133. See https://getcomposer.org/ for more information.</comment>
  1134. EOT
  1135. );
  1136. }
  1137. }
  1138. <?php
  1139. namespace Composer\Command;
  1140. use Composer\Factory;
  1141. use Composer\IO\IOInterface;
  1142. use Composer\Config;
  1143. use Composer\Composer;
  1144. use Composer\Repository\CompositeRepository;
  1145. use Composer\Repository\RepositoryFactory;
  1146. use Composer\Script\ScriptEvents;
  1147. use Composer\Plugin\CommandEvent;
  1148. use Composer\Plugin\PluginEvents;
  1149. use Composer\Util\Filesystem;
  1150. use Symfony\Component\Console\Input\InputArgument;
  1151. use Symfony\Component\Console\Input\InputInterface;
  1152. use Symfony\Component\Console\Input\InputOption;
  1153. use Symfony\Component\Console\Output\OutputInterface;
  1154. class ArchiveCommand extends BaseCommand
  1155. {
  1156. protected function configure()
  1157. {
  1158. $this
  1159. ->setName('archive')
  1160. ->setDescription('Creates an archive of this composer package.')
  1161. ->setDefinition(array(
  1162. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1163. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1164. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1165. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1166. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1167. .' Note that the format will be appended.'),
  1168. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1169. ))
  1170. ->setHelp(
  1171. <<<EOT
  1172. The <info>archive</info> command creates an archive of the specified format
  1173. containing the files and directories of the Composer project or the specified
  1174. package in the specified version and writes it to the specified directory.
  1175. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1176. EOT
  1177. )
  1178. ;
  1179. }
  1180. protected function execute(InputInterface $input, OutputInterface $output)
  1181. {
  1182. $config = Factory::createConfig();
  1183. $composer = $this->getComposer(false);
  1184. if ($composer) {
  1185. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1186. $eventDispatcher = $composer->getEventDispatcher();
  1187. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1188. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1189. }
  1190. if (null === $input->getOption('format')) {
  1191. $input->setOption('format', $config->get('archive-format'));
  1192. }
  1193. if (null === $input->getOption('dir')) {
  1194. $input->setOption('dir', $config->get('archive-dir'));
  1195. }
  1196. $returnCode = $this->archive(
  1197. $this->getIO(),
  1198. $config,
  1199. $input->getArgument('package'),
  1200. $input->getArgument('version'),
  1201. $input->getOption('format'),
  1202. $input->getOption('dir'),
  1203. $input->getOption('file'),
  1204. $input->getOption('ignore-filters'),
  1205. $composer
  1206. );
  1207. if (0 === $returnCode && $composer) {
  1208. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1209. }
  1210. return $returnCode;
  1211. }
  1212. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1213. {
  1214. if ($composer) {
  1215. $archiveManager = $composer->getArchiveManager();
  1216. } else {
  1217. $factory = new Factory;
  1218. $downloadManager = $factory->createDownloadManager($io, $config);
  1219. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1220. }
  1221. if ($packageName) {
  1222. $package = $this->selectPackage($io, $packageName, $version);
  1223. if (!$package) {
  1224. return 1;
  1225. }
  1226. } else {
  1227. $package = $this->getComposer()->getPackage();
  1228. }
  1229. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1230. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1231. $fs = new Filesystem;
  1232. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1233. $io->writeError('Created: ', false);
  1234. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1235. return 0;
  1236. }
  1237. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1238. {
  1239. $io->writeError('<info>Searching for the specified package.</info>');
  1240. if ($composer = $this->getComposer(false)) {
  1241. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1242. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1243. } else {
  1244. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1245. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1246. $repo = new CompositeRepository($defaultRepos);
  1247. }
  1248. $packages = $repo->findPackages($packageName, $version);
  1249. if (count($packages) > 1) {
  1250. $package = reset($packages);
  1251. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1252. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1253. return $p->getPrettyString();
  1254. }, $packages)).'.');
  1255. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1256. } elseif ($packages) {
  1257. $package = reset($packages);
  1258. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1259. } else {
  1260. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1261. return false;
  1262. }
  1263. return $package;
  1264. }
  1265. }
  1266. <?php
  1267. namespace Composer\Command;
  1268. use Composer\Composer;
  1269. use Composer\Config;
  1270. use Composer\Console\Application;
  1271. use Composer\Factory;
  1272. use Composer\IO\IOInterface;
  1273. use Composer\IO\NullIO;
  1274. use Composer\Plugin\PreCommandRunEvent;
  1275. use Composer\Plugin\PluginEvents;
  1276. use Symfony\Component\Console\Input\InputInterface;
  1277. use Symfony\Component\Console\Output\OutputInterface;
  1278. use Symfony\Component\Console\Command\Command;
  1279. abstract class BaseCommand extends Command
  1280. {
  1281. private $composer;
  1282. private $io;
  1283. public function getComposer($required = true, $disablePlugins = null)
  1284. {
  1285. if (null === $this->composer) {
  1286. $application = $this->getApplication();
  1287. if ($application instanceof Application) {
  1288. $this->composer = $application->getComposer($required, $disablePlugins);
  1289. } elseif ($required) {
  1290. throw new \RuntimeException(
  1291. 'Could not create a Composer\Composer instance, you must inject '.
  1292. 'one if this command is not used with a Composer\Console\Application instance'
  1293. );
  1294. }
  1295. }
  1296. return $this->composer;
  1297. }
  1298. public function setComposer(Composer $composer)
  1299. {
  1300. $this->composer = $composer;
  1301. }
  1302. public function resetComposer()
  1303. {
  1304. $this->composer = null;
  1305. $this->getApplication()->resetComposer();
  1306. }
  1307. public function isProxyCommand()
  1308. {
  1309. return false;
  1310. }
  1311. public function getIO()
  1312. {
  1313. if (null === $this->io) {
  1314. $application = $this->getApplication();
  1315. if ($application instanceof Application) {
  1316. $this->io = $application->getIO();
  1317. } else {
  1318. $this->io = new NullIO();
  1319. }
  1320. }
  1321. return $this->io;
  1322. }
  1323. public function setIO(IOInterface $io)
  1324. {
  1325. $this->io = $io;
  1326. }
  1327. protected function initialize(InputInterface $input, OutputInterface $output)
  1328. {
  1329. $disablePlugins = $input->hasParameterOption('--no-plugins');
  1330. $composer = $this->getComposer(false, $disablePlugins);
  1331. if (null === $composer) {
  1332. $composer = Factory::createGlobal($this->getIO(), $disablePlugins);
  1333. }
  1334. if ($composer) {
  1335. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1336. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1337. }
  1338. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1339. $input->setOption('no-progress', true);
  1340. }
  1341. parent::initialize($input, $output);
  1342. }
  1343. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1344. {
  1345. $preferSource = false;
  1346. $preferDist = false;
  1347. switch ($config->get('preferred-install')) {
  1348. case 'source':
  1349. $preferSource = true;
  1350. break;
  1351. case 'dist':
  1352. $preferDist = true;
  1353. break;
  1354. case 'auto':
  1355. default:
  1356. break;
  1357. }
  1358. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1359. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1360. $preferDist = $input->getOption('prefer-dist');
  1361. }
  1362. return array($preferSource, $preferDist);
  1363. }
  1364. }
  1365. <?php
  1366. namespace Composer\Command;
  1367. use Composer\DependencyResolver\Pool;
  1368. use Composer\Package\Link;
  1369. use Composer\Package\PackageInterface;
  1370. use Composer\Repository\ArrayRepository;
  1371. use Composer\Repository\CompositeRepository;
  1372. use Composer\Repository\PlatformRepository;
  1373. use Composer\Repository\RepositoryFactory;
  1374. use Composer\Plugin\CommandEvent;
  1375. use Composer\Plugin\PluginEvents;
  1376. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1377. use Composer\Package\Version\VersionParser;
  1378. use Symfony\Component\Console\Helper\Table;
  1379. use Symfony\Component\Console\Input\InputArgument;
  1380. use Symfony\Component\Console\Input\InputInterface;
  1381. use Symfony\Component\Console\Input\InputOption;
  1382. use Symfony\Component\Console\Output\OutputInterface;
  1383. class BaseDependencyCommand extends BaseCommand
  1384. {
  1385. const ARGUMENT_PACKAGE = 'package';
  1386. const ARGUMENT_CONSTRAINT = 'constraint';
  1387. const OPTION_RECURSIVE = 'recursive';
  1388. const OPTION_TREE = 'tree';
  1389. protected $colors;
  1390. protected function configure()
  1391. {
  1392. $this->setDefinition(array(
  1393. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1394. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1395. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1396. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1397. ));
  1398. }
  1399. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1400. {
  1401. $composer = $this->getComposer();
  1402. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1403. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1404. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1405. $repository = new CompositeRepository(array(
  1406. new ArrayRepository(array($composer->getPackage())),
  1407. $composer->getRepositoryManager()->getLocalRepository(),
  1408. new PlatformRepository(array(), $platformOverrides),
  1409. ));
  1410. $pool = new Pool();
  1411. $pool->addRepository($repository);
  1412. list($needle, $textConstraint) = array_pad(
  1413. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1414. 2,
  1415. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1416. );
  1417. $packages = $pool->whatProvides(strtolower($needle));
  1418. if (empty($packages)) {
  1419. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1420. }
  1421. if (!$repository->findPackage($needle, $textConstraint)) {
  1422. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1423. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1424. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1425. }
  1426. }
  1427. $needles = array($needle);
  1428. if ($inverted) {
  1429. foreach ($packages as $package) {
  1430. $needles = array_merge($needles, array_map(function (Link $link) {
  1431. return $link->getTarget();
  1432. }, $package->getReplaces()));
  1433. }
  1434. }
  1435. if ('*' !== $textConstraint) {
  1436. $versionParser = new VersionParser();
  1437. $constraint = $versionParser->parseConstraints($textConstraint);
  1438. } else {
  1439. $constraint = null;
  1440. }
  1441. $renderTree = $input->getOption(self::OPTION_TREE);
  1442. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1443. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1444. if (empty($results)) {
  1445. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1446. $this->getIO()->writeError(sprintf(
  1447. '<info>There is no installed package depending on "%s"%s</info>',
  1448. $needle,
  1449. $extra
  1450. ));
  1451. } elseif ($renderTree) {
  1452. $this->initStyles($output);
  1453. $root = $packages[0];
  1454. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1455. $this->printTree($results);
  1456. } else {
  1457. $this->printTable($output, $results);
  1458. }
  1459. return 0;
  1460. }
  1461. protected function printTable(OutputInterface $output, $results)
  1462. {
  1463. $table = array();
  1464. $doubles = array();
  1465. do {
  1466. $queue = array();
  1467. $rows = array();
  1468. foreach ($results as $result) {
  1469. list($package, $link, $children) = $result;
  1470. $unique = (string) $link;
  1471. if (isset($doubles[$unique])) {
  1472. continue;
  1473. }
  1474. $doubles[$unique] = true;
  1475. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1476. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1477. if ($children) {
  1478. $queue = array_merge($queue, $children);
  1479. }
  1480. }
  1481. $results = $queue;
  1482. $table = array_merge($rows, $table);
  1483. } while (!empty($results));
  1484. $renderer = new Table($output);
  1485. $renderer->setStyle('compact');
  1486. $rendererStyle = $renderer->getStyle();
  1487. $rendererStyle->setVerticalBorderChar('');
  1488. $rendererStyle->setCellRowContentFormat('%s ');
  1489. $renderer->setRows($table)->render();
  1490. }
  1491. protected function initStyles(OutputInterface $output)
  1492. {
  1493. $this->colors = array(
  1494. 'green',
  1495. 'yellow',
  1496. 'cyan',
  1497. 'magenta',
  1498. 'blue',
  1499. );
  1500. foreach ($this->colors as $color) {
  1501. $style = new OutputFormatterStyle($color);
  1502. $output->getFormatter()->setStyle($color, $style);
  1503. }
  1504. }
  1505. protected function printTree($results, $prefix = '', $level = 1)
  1506. {
  1507. $count = count($results);
  1508. $idx = 0;
  1509. foreach ($results as $result) {
  1510. list($package, $link, $children) = $result;
  1511. $color = $this->colors[$level % count($this->colors)];
  1512. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1513. $isLast = (++$idx == $count);
  1514. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1515. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1516. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1517. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1518. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1519. if ($children) {
  1520. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1521. }
  1522. }
  1523. }
  1524. private function writeTreeLine($line)
  1525. {
  1526. $io = $this->getIO();
  1527. if (!$io->isDecorated()) {
  1528. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1529. }
  1530. $io->write($line);
  1531. }
  1532. }
  1533. <?php
  1534. namespace Composer\Command;
  1535. use Composer\Package\Link;
  1536. use Composer\Package\PackageInterface;
  1537. use Composer\Semver\Constraint\Constraint;
  1538. use Symfony\Component\Console\Helper\Table;
  1539. use Symfony\Component\Console\Input\InputInterface;
  1540. use Symfony\Component\Console\Output\OutputInterface;
  1541. use Composer\Repository\PlatformRepository;
  1542. class CheckPlatformReqsCommand extends BaseCommand
  1543. {
  1544. protected function configure()
  1545. {
  1546. $this->setName('check-platform-reqs')
  1547. ->setDescription('Check that platform requirements are satisfied.')
  1548. ->setHelp(
  1549. <<<EOT
  1550. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1551. <info>php composer.phar check-platform-reqs</info>
  1552. EOT
  1553. );
  1554. }
  1555. protected function execute(InputInterface $input, OutputInterface $output)
  1556. {
  1557. $composer = $this->getComposer();
  1558. $repos = $composer->getRepositoryManager()->getLocalRepository();
  1559. $allPackages = array_merge(array($composer->getPackage()), $repos->getPackages());
  1560. $requires = $composer->getPackage()->getDevRequires();
  1561. foreach ($requires as $require => $link) {
  1562. $requires[$require] = array($link);
  1563. }
  1564. foreach ($allPackages as $package) {
  1565. foreach ($package->getRequires() as $require => $link) {
  1566. $requires[$require][] = $link;
  1567. }
  1568. }
  1569. ksort($requires);
  1570. $platformRepo = new PlatformRepository(array(), array());
  1571. $currentPlatformPackages = $platformRepo->getPackages();
  1572. $currentPlatformPackageMap = array();
  1573. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1574. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1575. }
  1576. $results = array();
  1577. $exitCode = 0;
  1578. foreach ($requires as $require => $links) {
  1579. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1580. if (isset($currentPlatformPackageMap[$require])) {
  1581. $pass = true;
  1582. $version = $currentPlatformPackageMap[$require]->getVersion();
  1583. foreach ($links as $link) {
  1584. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1585. $results[] = array(
  1586. $currentPlatformPackageMap[$require]->getPrettyName(),
  1587. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1588. $link,
  1589. '<error>failed</error>',
  1590. );
  1591. $pass = false;
  1592. $exitCode = max($exitCode, 1);
  1593. }
  1594. }
  1595. if ($pass) {
  1596. $results[] = array(
  1597. $currentPlatformPackageMap[$require]->getPrettyName(),
  1598. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1599. null,
  1600. '<info>success</info>',
  1601. );
  1602. }
  1603. } else {
  1604. $results[] = array(
  1605. $require,
  1606. 'n/a',
  1607. $links[0],
  1608. '<error>missing</error>',
  1609. );
  1610. $exitCode = max($exitCode, 2);
  1611. }
  1612. }
  1613. }
  1614. $this->printTable($output, $results);
  1615. return $exitCode;
  1616. }
  1617. protected function printTable(OutputInterface $output, $results)
  1618. {
  1619. $table = array();
  1620. $rows = array();
  1621. foreach ($results as $result) {
  1622. list($platformPackage, $version, $link, $status) = $result;
  1623. $rows[] = array(
  1624. $platformPackage,
  1625. $version,
  1626. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1627. $status,
  1628. );
  1629. }
  1630. $table = array_merge($rows, $table);
  1631. $renderer = new Table($output);
  1632. $renderer->setStyle('compact');
  1633. $rendererStyle = $renderer->getStyle();
  1634. $rendererStyle->setVerticalBorderChar('');
  1635. $rendererStyle->setCellRowContentFormat('%s ');
  1636. $renderer->setRows($table)->render();
  1637. }
  1638. }
  1639. <?php
  1640. namespace Composer\Command;
  1641. use Composer\Cache;
  1642. use Composer\Factory;
  1643. use Symfony\Component\Console\Input\InputInterface;
  1644. use Symfony\Component\Console\Output\OutputInterface;
  1645. class ClearCacheCommand extends BaseCommand
  1646. {
  1647. protected function configure()
  1648. {
  1649. $this
  1650. ->setName('clear-cache')
  1651. ->setAliases(array('clearcache'))
  1652. ->setDescription('Clears composer\'s internal package cache.')
  1653. ->setHelp(
  1654. <<<EOT
  1655. The <info>clear-cache</info> deletes all cached packages from composer's
  1656. cache directory.
  1657. EOT
  1658. )
  1659. ;
  1660. }
  1661. protected function execute(InputInterface $input, OutputInterface $output)
  1662. {
  1663. $config = Factory::createConfig();
  1664. $io = $this->getIO();
  1665. $cachePaths = array(
  1666. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1667. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1668. 'cache-files-dir' => $config->get('cache-files-dir'),
  1669. 'cache-dir' => $config->get('cache-dir'),
  1670. );
  1671. foreach ($cachePaths as $key => $cachePath) {
  1672. $cachePath = realpath($cachePath);
  1673. if (!$cachePath) {
  1674. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1675. continue;
  1676. }
  1677. $cache = new Cache($io, $cachePath);
  1678. if (!$cache->isEnabled()) {
  1679. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1680. continue;
  1681. }
  1682. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1683. $cache->clear();
  1684. }
  1685. $io->writeError('<info>All caches cleared.</info>');
  1686. }
  1687. }
  1688. <?php
  1689. namespace Composer\Command;
  1690. use Composer\Util\Platform;
  1691. use Composer\Util\Silencer;
  1692. use Symfony\Component\Console\Input\InputInterface;
  1693. use Symfony\Component\Console\Input\InputArgument;
  1694. use Symfony\Component\Console\Input\InputOption;
  1695. use Symfony\Component\Console\Output\OutputInterface;
  1696. use Composer\Config;
  1697. use Composer\Config\JsonConfigSource;
  1698. use Composer\Factory;
  1699. use Composer\Json\JsonFile;
  1700. use Composer\Semver\VersionParser;
  1701. use Composer\Package\BasePackage;
  1702. class ConfigCommand extends BaseCommand
  1703. {
  1704. protected $config;
  1705. protected $configFile;
  1706. protected $configSource;
  1707. protected $authConfigFile;
  1708. protected $authConfigSource;
  1709. protected function configure()
  1710. {
  1711. $this
  1712. ->setName('config')
  1713. ->setDescription('Sets config options.')
  1714. ->setDefinition(array(
  1715. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1716. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1717. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1718. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1719. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1720. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1721. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1722. new InputArgument('setting-key', null, 'Setting key'),
  1723. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1724. ))
  1725. ->setHelp(
  1726. <<<EOT
  1727. This command allows you to edit composer config settings and repositories
  1728. in either the local composer.json file or the global config.json file.
  1729. Additionally it lets you edit most properties in the local composer.json.
  1730. To set a config setting:
  1731. <comment>%command.full_name% bin-dir bin/</comment>
  1732. To read a config setting:
  1733. <comment>%command.full_name% bin-dir</comment>
  1734. Outputs: <info>bin</info>
  1735. To edit the global config.json file:
  1736. <comment>%command.full_name% --global</comment>
  1737. To add a repository:
  1738. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1739. To remove a repository (repo is a short alias for repositories):
  1740. <comment>%command.full_name% --unset repo.foo</comment>
  1741. To disable packagist:
  1742. <comment>%command.full_name% repo.packagist false</comment>
  1743. You can alter repositories in the global config.json file by passing in the
  1744. <info>--global</info> option.
  1745. To edit the file in an external editor:
  1746. <comment>%command.full_name% --editor</comment>
  1747. To choose your editor you can set the "EDITOR" env variable.
  1748. To get a list of configuration values in the file:
  1749. <comment>%command.full_name% --list</comment>
  1750. You can always pass more than one option. As an example, if you want to edit the
  1751. global config.json file.
  1752. <comment>%command.full_name% --editor --global</comment>
  1753. EOT
  1754. )
  1755. ;
  1756. }
  1757. protected function initialize(InputInterface $input, OutputInterface $output)
  1758. {
  1759. parent::initialize($input, $output);
  1760. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1761. throw new \RuntimeException('--file and --global can not be combined');
  1762. }
  1763. $io = $this->getIO();
  1764. $this->config = Factory::createConfig($io);
  1765. $configFile = $input->getOption('global')
  1766. ? ($this->config->get('home') . '/config.json')
  1767. : ($input->getOption('file') ?: Factory::getComposerFile());
  1768. if (
  1769. ($configFile === 'composer.json' || $configFile === './composer.json')
  1770. && !file_exists($configFile)
  1771. && realpath(getcwd()) === realpath($this->config->get('home'))
  1772. ) {
  1773. file_put_contents($configFile, "{\n}\n");
  1774. }
  1775. $this->configFile = new JsonFile($configFile, null, $io);
  1776. $this->configSource = new JsonConfigSource($this->configFile);
  1777. $authConfigFile = $input->getOption('global')
  1778. ? ($this->config->get('home') . '/auth.json')
  1779. : dirname(realpath($configFile)) . '/auth.json';
  1780. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1781. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1782. if ($input->getOption('global') && !$this->configFile->exists()) {
  1783. touch($this->configFile->getPath());
  1784. $this->configFile->write(array('config' => new \ArrayObject));
  1785. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1786. }
  1787. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1788. touch($this->authConfigFile->getPath());
  1789. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1790. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1791. }
  1792. if (!$this->configFile->exists()) {
  1793. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1794. }
  1795. }
  1796. protected function execute(InputInterface $input, OutputInterface $output)
  1797. {
  1798. if ($input->getOption('editor')) {
  1799. $editor = escapeshellcmd(getenv('EDITOR'));
  1800. if (!$editor) {
  1801. if (Platform::isWindows()) {
  1802. $editor = 'notepad';
  1803. } else {
  1804. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1805. if (exec('which '.$candidate)) {
  1806. $editor = $candidate;
  1807. break;
  1808. }
  1809. }
  1810. }
  1811. }
  1812. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1813. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1814. return 0;
  1815. }
  1816. if (!$input->getOption('global')) {
  1817. $this->config->merge($this->configFile->read());
  1818. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1819. }
  1820. if ($input->getOption('list')) {
  1821. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1822. return 0;
  1823. }
  1824. $settingKey = $input->getArgument('setting-key');
  1825. if (!$settingKey) {
  1826. return 0;
  1827. }
  1828. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1829. throw new \RuntimeException('You can not combine a setting value with --unset');
  1830. }
  1831. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1832. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1833. $rawData = $this->configFile->read();
  1834. $data = $this->config->all();
  1835. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1836. if (!isset($matches[1]) || $matches[1] === '') {
  1837. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1838. } else {
  1839. if (!isset($data['repositories'][$matches[1]])) {
  1840. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1841. }
  1842. $value = $data['repositories'][$matches[1]];
  1843. }
  1844. } elseif (strpos($settingKey, '.')) {
  1845. $bits = explode('.', $settingKey);
  1846. if ($bits[0] === 'extra') {
  1847. $data = $rawData;
  1848. } else {
  1849. $data = $data['config'];
  1850. }
  1851. $match = false;
  1852. foreach ($bits as $bit) {
  1853. $key = isset($key) ? $key.'.'.$bit : $bit;
  1854. $match = false;
  1855. if (isset($data[$key])) {
  1856. $match = true;
  1857. $data = $data[$key];
  1858. unset($key);
  1859. }
  1860. }
  1861. if (!$match) {
  1862. throw new \RuntimeException($settingKey.' is not defined.');
  1863. }
  1864. $value = $data;
  1865. } elseif (isset($data['config'][$settingKey])) {
  1866. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1867. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1868. $value = $rawData[$settingKey];
  1869. } else {
  1870. throw new \RuntimeException($settingKey.' is not defined');
  1871. }
  1872. if (is_array($value)) {
  1873. $value = json_encode($value);
  1874. }
  1875. $this->getIO()->write($value);
  1876. return 0;
  1877. }
  1878. $values = $input->getArgument('setting-value');
  1879. $booleanValidator = function ($val) {
  1880. return in_array($val, array('true', 'false', '1', '0'), true);
  1881. };
  1882. $booleanNormalizer = function ($val) {
  1883. return $val !== 'false' && (bool) $val;
  1884. };
  1885. $uniqueConfigValues = array(
  1886. 'process-timeout' => array('is_numeric', 'intval'),
  1887. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1888. 'preferred-install' => array(
  1889. function ($val) {
  1890. return in_array($val, array('auto', 'source', 'dist'), true);
  1891. },
  1892. function ($val) {
  1893. return $val;
  1894. },
  1895. ),
  1896. 'store-auths' => array(
  1897. function ($val) {
  1898. return in_array($val, array('true', 'false', 'prompt'), true);
  1899. },
  1900. function ($val) {
  1901. if ('prompt' === $val) {
  1902. return 'prompt';
  1903. }
  1904. return $val !== 'false' && (bool) $val;
  1905. },
  1906. ),
  1907. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1908. 'vendor-dir' => array('is_string', function ($val) {
  1909. return $val;
  1910. }),
  1911. 'bin-dir' => array('is_string', function ($val) {
  1912. return $val;
  1913. }),
  1914. 'archive-dir' => array('is_string', function ($val) {
  1915. return $val;
  1916. }),
  1917. 'archive-format' => array('is_string', function ($val) {
  1918. return $val;
  1919. }),
  1920. 'data-dir' => array('is_string', function ($val) {
  1921. return $val;
  1922. }),
  1923. 'cache-dir' => array('is_string', function ($val) {
  1924. return $val;
  1925. }),
  1926. 'cache-files-dir' => array('is_string', function ($val) {
  1927. return $val;
  1928. }),
  1929. 'cache-repo-dir' => array('is_string', function ($val) {
  1930. return $val;
  1931. }),
  1932. 'cache-vcs-dir' => array('is_string', function ($val) {
  1933. return $val;
  1934. }),
  1935. 'cache-ttl' => array('is_numeric', 'intval'),
  1936. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1937. 'cache-files-maxsize' => array(
  1938. function ($val) {
  1939. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  1940. },
  1941. function ($val) {
  1942. return $val;
  1943. },
  1944. ),
  1945. 'bin-compat' => array(
  1946. function ($val) {
  1947. return in_array($val, array('auto', 'full'));
  1948. },
  1949. function ($val) {
  1950. return $val;
  1951. },
  1952. ),
  1953. 'discard-changes' => array(
  1954. function ($val) {
  1955. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  1956. },
  1957. function ($val) {
  1958. if ('stash' === $val) {
  1959. return 'stash';
  1960. }
  1961. return $val !== 'false' && (bool) $val;
  1962. },
  1963. ),
  1964. 'autoloader-suffix' => array('is_string', function ($val) {
  1965. return $val === 'null' ? null : $val;
  1966. }),
  1967. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1968. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1969. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1970. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  1971. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1972. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1973. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  1974. 'cafile' => array(
  1975. function ($val) {
  1976. return file_exists($val) && is_readable($val);
  1977. },
  1978. function ($val) {
  1979. return $val === 'null' ? null : $val;
  1980. },
  1981. ),
  1982. 'capath' => array(
  1983. function ($val) {
  1984. return is_dir($val) && is_readable($val);
  1985. },
  1986. function ($val) {
  1987. return $val === 'null' ? null : $val;
  1988. },
  1989. ),
  1990. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  1991. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  1992. );
  1993. $multiConfigValues = array(
  1994. 'github-protocols' => array(
  1995. function ($vals) {
  1996. if (!is_array($vals)) {
  1997. return 'array expected';
  1998. }
  1999. foreach ($vals as $val) {
  2000. if (!in_array($val, array('git', 'https', 'ssh'))) {
  2001. return 'valid protocols include: git, https, ssh';
  2002. }
  2003. }
  2004. return true;
  2005. },
  2006. function ($vals) {
  2007. return $vals;
  2008. },
  2009. ),
  2010. 'github-domains' => array(
  2011. function ($vals) {
  2012. if (!is_array($vals)) {
  2013. return 'array expected';
  2014. }
  2015. return true;
  2016. },
  2017. function ($vals) {
  2018. return $vals;
  2019. },
  2020. ),
  2021. 'gitlab-domains' => array(
  2022. function ($vals) {
  2023. if (!is_array($vals)) {
  2024. return 'array expected';
  2025. }
  2026. return true;
  2027. },
  2028. function ($vals) {
  2029. return $vals;
  2030. },
  2031. ),
  2032. );
  2033. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  2034. return $this->configSource->removeConfigSetting($settingKey);
  2035. }
  2036. if (isset($uniqueConfigValues[$settingKey])) {
  2037. return $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  2038. }
  2039. if (isset($multiConfigValues[$settingKey])) {
  2040. return $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  2041. }
  2042. $uniqueProps = array(
  2043. 'name' => array('is_string', function ($val) {
  2044. return $val;
  2045. }),
  2046. 'type' => array('is_string', function ($val) {
  2047. return $val;
  2048. }),
  2049. 'description' => array('is_string', function ($val) {
  2050. return $val;
  2051. }),
  2052. 'homepage' => array('is_string', function ($val) {
  2053. return $val;
  2054. }),
  2055. 'version' => array('is_string', function ($val) {
  2056. return $val;
  2057. }),
  2058. 'minimum-stability' => array(
  2059. function ($val) {
  2060. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2061. },
  2062. function ($val) {
  2063. return VersionParser::normalizeStability($val);
  2064. },
  2065. ),
  2066. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2067. );
  2068. $multiProps = array(
  2069. 'keywords' => array(
  2070. function ($vals) {
  2071. if (!is_array($vals)) {
  2072. return 'array expected';
  2073. }
  2074. return true;
  2075. },
  2076. function ($vals) {
  2077. return $vals;
  2078. },
  2079. ),
  2080. 'license' => array(
  2081. function ($vals) {
  2082. if (!is_array($vals)) {
  2083. return 'array expected';
  2084. }
  2085. return true;
  2086. },
  2087. function ($vals) {
  2088. return $vals;
  2089. },
  2090. ),
  2091. );
  2092. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2093. 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');
  2094. }
  2095. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2096. return $this->configSource->removeProperty($settingKey);
  2097. }
  2098. if (isset($uniqueProps[$settingKey])) {
  2099. return $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2100. }
  2101. if (isset($multiProps[$settingKey])) {
  2102. return $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2103. }
  2104. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2105. if ($input->getOption('unset')) {
  2106. return $this->configSource->removeRepository($matches[1]);
  2107. }
  2108. if (2 === count($values)) {
  2109. return $this->configSource->addRepository($matches[1], array(
  2110. 'type' => $values[0],
  2111. 'url' => $values[1],
  2112. ));
  2113. }
  2114. if (1 === count($values)) {
  2115. $value = strtolower($values[0]);
  2116. if (true === $booleanValidator($value)) {
  2117. if (false === $booleanNormalizer($value)) {
  2118. return $this->configSource->addRepository($matches[1], false);
  2119. }
  2120. } else {
  2121. $value = JsonFile::parseJson($values[0]);
  2122. return $this->configSource->addRepository($matches[1], $value);
  2123. }
  2124. }
  2125. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2126. }
  2127. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2128. if ($input->getOption('unset')) {
  2129. return $this->configSource->removeProperty($settingKey);
  2130. }
  2131. return $this->configSource->addProperty($settingKey, $values[0]);
  2132. }
  2133. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2134. if ($input->getOption('unset')) {
  2135. return $this->configSource->removeConfigSetting($settingKey);
  2136. }
  2137. return $this->configSource->addConfigSetting($settingKey, $values[0]);
  2138. }
  2139. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2140. return $this->configSource->removeConfigSetting($settingKey);
  2141. }
  2142. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
  2143. if ($input->getOption('unset')) {
  2144. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2145. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2146. return;
  2147. }
  2148. if ($matches[1] === 'bitbucket-oauth') {
  2149. if (2 !== count($values)) {
  2150. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2151. }
  2152. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2153. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2154. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
  2155. if (1 !== count($values)) {
  2156. throw new \RuntimeException('Too many arguments, expected only one token');
  2157. }
  2158. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2159. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2160. } elseif ($matches[1] === 'http-basic') {
  2161. if (2 !== count($values)) {
  2162. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2163. }
  2164. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2165. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2166. }
  2167. return;
  2168. }
  2169. if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
  2170. if ($input->getOption('unset')) {
  2171. return $this->configSource->removeProperty($settingKey);
  2172. }
  2173. return $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  2174. }
  2175. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2176. }
  2177. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2178. {
  2179. list($validator, $normalizer) = $callbacks;
  2180. if (1 !== count($values)) {
  2181. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2182. }
  2183. if (true !== $validation = $validator($values[0])) {
  2184. throw new \RuntimeException(sprintf(
  2185. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2186. $values[0]
  2187. ));
  2188. }
  2189. return call_user_func(array($this->configSource, $method), $key, $normalizer($values[0]));
  2190. }
  2191. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2192. {
  2193. list($validator, $normalizer) = $callbacks;
  2194. if (true !== $validation = $validator($values)) {
  2195. throw new \RuntimeException(sprintf(
  2196. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2197. json_encode($values)
  2198. ));
  2199. }
  2200. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2201. }
  2202. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2203. {
  2204. $origK = $k;
  2205. $io = $this->getIO();
  2206. foreach ($contents as $key => $value) {
  2207. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2208. continue;
  2209. }
  2210. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2211. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2212. $k .= preg_replace('{^config\.}', '', $key . '.');
  2213. $this->listConfiguration($value, $rawVal, $output, $k);
  2214. $k = $origK;
  2215. continue;
  2216. }
  2217. if (is_array($value)) {
  2218. $value = array_map(function ($val) {
  2219. return is_array($val) ? json_encode($val) : $val;
  2220. }, $value);
  2221. $value = '['.implode(', ', $value).']';
  2222. }
  2223. if (is_bool($value)) {
  2224. $value = var_export($value, true);
  2225. }
  2226. if (is_string($rawVal) && $rawVal != $value) {
  2227. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>');
  2228. } else {
  2229. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
  2230. }
  2231. }
  2232. }
  2233. }
  2234. <?php
  2235. namespace Composer\Command;
  2236. use Composer\Config;
  2237. use Composer\Factory;
  2238. use Composer\Installer;
  2239. use Composer\Installer\ProjectInstaller;
  2240. use Composer\Installer\InstallationManager;
  2241. use Composer\Installer\SuggestedPackagesReporter;
  2242. use Composer\IO\IOInterface;
  2243. use Composer\Package\BasePackage;
  2244. use Composer\DependencyResolver\Pool;
  2245. use Composer\DependencyResolver\Operation\InstallOperation;
  2246. use Composer\Package\Version\VersionSelector;
  2247. use Composer\Package\AliasPackage;
  2248. use Composer\Repository\RepositoryFactory;
  2249. use Composer\Repository\CompositeRepository;
  2250. use Composer\Repository\PlatformRepository;
  2251. use Composer\Repository\InstalledFilesystemRepository;
  2252. use Composer\Script\ScriptEvents;
  2253. use Composer\Util\Silencer;
  2254. use Symfony\Component\Console\Input\InputArgument;
  2255. use Symfony\Component\Console\Input\InputInterface;
  2256. use Symfony\Component\Console\Input\InputOption;
  2257. use Symfony\Component\Console\Output\OutputInterface;
  2258. use Symfony\Component\Finder\Finder;
  2259. use Composer\Json\JsonFile;
  2260. use Composer\Config\JsonConfigSource;
  2261. use Composer\Util\Filesystem;
  2262. use Composer\Package\Version\VersionParser;
  2263. class CreateProjectCommand extends BaseCommand
  2264. {
  2265. protected $suggestedPackagesReporter;
  2266. protected function configure()
  2267. {
  2268. $this
  2269. ->setName('create-project')
  2270. ->setDescription('Creates new project from a package into given directory.')
  2271. ->setDefinition(array(
  2272. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2273. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2274. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2275. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2276. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2277. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2278. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2279. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2280. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2281. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2282. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2283. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2284. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2285. 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.'),
  2286. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2287. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2288. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2289. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2290. ))
  2291. ->setHelp(
  2292. <<<EOT
  2293. The <info>create-project</info> command creates a new project from a given
  2294. package into a new directory. If executed without params and in a directory
  2295. with a composer.json file it installs the packages for the current project.
  2296. You can use this command to bootstrap new projects or setup a clean
  2297. version-controlled installation for developers of your project.
  2298. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2299. You can also specify the version with the package name using = or : as separator.
  2300. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2301. To install unstable packages, either specify the version you want, or use the
  2302. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2303. To setup a developer workable version you should create the project using the source
  2304. controlled code by appending the <info>'--prefer-source'</info> flag.
  2305. To install a package from another repository than the default one you
  2306. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2307. EOT
  2308. )
  2309. ;
  2310. }
  2311. protected function execute(InputInterface $input, OutputInterface $output)
  2312. {
  2313. $config = Factory::createConfig();
  2314. $io = $this->getIO();
  2315. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2316. if ($input->getOption('dev')) {
  2317. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2318. }
  2319. if ($input->getOption('no-custom-installers')) {
  2320. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2321. $input->setOption('no-plugins', true);
  2322. }
  2323. return $this->installProject(
  2324. $io,
  2325. $config,
  2326. $input,
  2327. $input->getArgument('package'),
  2328. $input->getArgument('directory'),
  2329. $input->getArgument('version'),
  2330. $input->getOption('stability'),
  2331. $preferSource,
  2332. $preferDist,
  2333. !$input->getOption('no-dev'),
  2334. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2335. $input->getOption('no-plugins'),
  2336. $input->getOption('no-scripts'),
  2337. $input->getOption('no-progress'),
  2338. $input->getOption('no-install'),
  2339. $input->getOption('ignore-platform-reqs'),
  2340. !$input->getOption('no-secure-http')
  2341. );
  2342. }
  2343. 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)
  2344. {
  2345. $oldCwd = getcwd();
  2346. $io->loadConfiguration($config);
  2347. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2348. if ($packageName !== null) {
  2349. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $noProgress, $ignorePlatformReqs, $secureHttp);
  2350. } else {
  2351. $installedFromVcs = false;
  2352. }
  2353. $composer = Factory::create($io, null, $disablePlugins);
  2354. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2355. $fs = new Filesystem();
  2356. if ($noScripts === false) {
  2357. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2358. }
  2359. $config = $composer->getConfig();
  2360. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2361. if ($noInstall === false) {
  2362. $installer = Installer::create($io, $composer);
  2363. $installer->setPreferSource($preferSource)
  2364. ->setPreferDist($preferDist)
  2365. ->setDevMode($installDevPackages)
  2366. ->setRunScripts(!$noScripts)
  2367. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2368. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2369. ->setOptimizeAutoloader($config->get('optimize-autoloader'));
  2370. if ($disablePlugins) {
  2371. $installer->disablePlugins();
  2372. }
  2373. $status = $installer->run();
  2374. if (0 !== $status) {
  2375. return $status;
  2376. }
  2377. }
  2378. $hasVcs = $installedFromVcs;
  2379. if (
  2380. !$input->getOption('keep-vcs')
  2381. && $installedFromVcs
  2382. && (
  2383. $input->getOption('remove-vcs')
  2384. || !$io->isInteractive()
  2385. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2386. )
  2387. ) {
  2388. $finder = new Finder();
  2389. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2390. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2391. $finder->name($vcsName);
  2392. }
  2393. try {
  2394. $dirs = iterator_to_array($finder);
  2395. unset($finder);
  2396. foreach ($dirs as $dir) {
  2397. if (!$fs->removeDirectory($dir)) {
  2398. throw new \RuntimeException('Could not remove '.$dir);
  2399. }
  2400. }
  2401. } catch (\Exception $e) {
  2402. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2403. }
  2404. $hasVcs = false;
  2405. }
  2406. if (!$hasVcs) {
  2407. $package = $composer->getPackage();
  2408. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2409. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2410. foreach ($package->{'get'.$meta['method']}() as $link) {
  2411. if ($link->getPrettyConstraint() === 'self.version') {
  2412. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2413. }
  2414. }
  2415. }
  2416. }
  2417. if ($noScripts === false) {
  2418. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2419. }
  2420. chdir($oldCwd);
  2421. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2422. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2423. Silencer::call('rmdir', $vendorComposerDir);
  2424. $vendorDir = $config->get('vendor-dir');
  2425. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2426. Silencer::call('rmdir', $vendorDir);
  2427. }
  2428. }
  2429. return 0;
  2430. }
  2431. 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)
  2432. {
  2433. if (!$secureHttp) {
  2434. $config->merge(array('config' => array('secure-http' => false)));
  2435. }
  2436. if (null === $repository) {
  2437. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2438. } else {
  2439. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2440. }
  2441. $parser = new VersionParser();
  2442. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2443. $name = strtolower($requirements[0]['name']);
  2444. if (!$packageVersion && isset($requirements[0]['version'])) {
  2445. $packageVersion = $requirements[0]['version'];
  2446. }
  2447. if (null === $stability) {
  2448. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2449. $stability = $match[1];
  2450. } else {
  2451. $stability = VersionParser::parseStability($packageVersion);
  2452. }
  2453. }
  2454. $stability = VersionParser::normalizeStability($stability);
  2455. if (!isset(BasePackage::$stabilities[$stability])) {
  2456. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2457. }
  2458. $pool = new Pool($stability);
  2459. $pool->addRepository($sourceRepo);
  2460. $phpVersion = null;
  2461. $prettyPhpVersion = null;
  2462. if (!$ignorePlatformReqs) {
  2463. $platformOverrides = $config->get('platform') ?: array();
  2464. $platform = new PlatformRepository(array(), $platformOverrides);
  2465. $phpPackage = $platform->findPackage('php', '*');
  2466. $phpVersion = $phpPackage->getVersion();
  2467. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2468. }
  2469. $versionSelector = new VersionSelector($pool);
  2470. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2471. if (!$package) {
  2472. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2473. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2474. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2475. }
  2476. throw new \InvalidArgumentException($errorMessage .'.');
  2477. }
  2478. if (null === $directory) {
  2479. $parts = explode("/", $name, 2);
  2480. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2481. }
  2482. if (function_exists('pcntl_async_signals')) {
  2483. @mkdir($directory, 0777, true);
  2484. if ($realDir = realpath($directory)) {
  2485. pcntl_async_signals(true);
  2486. pcntl_signal(SIGINT, function () use ($realDir) {
  2487. $fs = new Filesystem();
  2488. $fs->removeDirectory($realDir);
  2489. exit(130);
  2490. });
  2491. }
  2492. }
  2493. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2494. if ($disablePlugins) {
  2495. $io->writeError('<info>Plugins have been disabled.</info>');
  2496. }
  2497. if ($package instanceof AliasPackage) {
  2498. $package = $package->getAliasOf();
  2499. }
  2500. $dm = $this->createDownloadManager($io, $config);
  2501. $dm->setPreferSource($preferSource)
  2502. ->setPreferDist($preferDist)
  2503. ->setOutputProgress(!$noProgress);
  2504. $projectInstaller = new ProjectInstaller($directory, $dm);
  2505. $im = $this->createInstallationManager();
  2506. $im->addInstaller($projectInstaller);
  2507. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2508. $im->notifyInstalls($io);
  2509. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2510. $installedFromVcs = 'source' === $package->getInstallationSource();
  2511. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2512. chdir($directory);
  2513. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2514. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2515. return $installedFromVcs;
  2516. }
  2517. protected function createDownloadManager(IOInterface $io, Config $config)
  2518. {
  2519. $factory = new Factory();
  2520. return $factory->createDownloadManager($io, $config);
  2521. }
  2522. protected function createInstallationManager()
  2523. {
  2524. return new InstallationManager();
  2525. }
  2526. }
  2527. <?php
  2528. namespace Composer\Command;
  2529. use Symfony\Component\Console\Input\InputInterface;
  2530. use Symfony\Component\Console\Output\OutputInterface;
  2531. class DependsCommand extends BaseDependencyCommand
  2532. {
  2533. protected function configure()
  2534. {
  2535. parent::configure();
  2536. $this
  2537. ->setName('depends')
  2538. ->setAliases(array('why'))
  2539. ->setDescription('Shows which packages cause the given package to be installed.')
  2540. ->setHelp(
  2541. <<<EOT
  2542. Displays detailed information about where a package is referenced.
  2543. <info>php composer.phar depends composer/composer</info>
  2544. EOT
  2545. )
  2546. ;
  2547. }
  2548. protected function execute(InputInterface $input, OutputInterface $output)
  2549. {
  2550. return parent::doExecute($input, $output, false);
  2551. }
  2552. }
  2553. <?php
  2554. namespace Composer\Command;
  2555. use Composer\Composer;
  2556. use Composer\Factory;
  2557. use Composer\Config;
  2558. use Composer\Downloader\TransportException;
  2559. use Composer\Repository\PlatformRepository;
  2560. use Composer\Plugin\CommandEvent;
  2561. use Composer\Plugin\PluginEvents;
  2562. use Composer\Util\ConfigValidator;
  2563. use Composer\Util\IniHelper;
  2564. use Composer\Util\ProcessExecutor;
  2565. use Composer\Util\RemoteFilesystem;
  2566. use Composer\Util\StreamContextFactory;
  2567. use Composer\SelfUpdate\Keys;
  2568. use Composer\SelfUpdate\Versions;
  2569. use Composer\IO\NullIO;
  2570. use Symfony\Component\Console\Input\InputInterface;
  2571. use Symfony\Component\Console\Output\OutputInterface;
  2572. class DiagnoseCommand extends BaseCommand
  2573. {
  2574. protected $rfs;
  2575. protected $process;
  2576. protected $exitCode = 0;
  2577. protected function configure()
  2578. {
  2579. $this
  2580. ->setName('diagnose')
  2581. ->setDescription('Diagnoses the system to identify common errors.')
  2582. ->setHelp(
  2583. <<<EOT
  2584. The <info>diagnose</info> command checks common errors to help debugging problems.
  2585. The process exit code will be 1 in case of warnings and 2 for errors.
  2586. EOT
  2587. )
  2588. ;
  2589. }
  2590. protected function execute(InputInterface $input, OutputInterface $output)
  2591. {
  2592. $composer = $this->getComposer(false);
  2593. $io = $this->getIO();
  2594. if ($composer) {
  2595. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2596. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2597. $io->write('Checking composer.json: ', false);
  2598. $this->outputResult($this->checkComposerSchema());
  2599. }
  2600. if ($composer) {
  2601. $config = $composer->getConfig();
  2602. } else {
  2603. $config = Factory::createConfig();
  2604. }
  2605. $config->merge(array('config' => array('secure-http' => false)));
  2606. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  2607. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2608. $this->process = new ProcessExecutor($io);
  2609. $io->write('Checking platform settings: ', false);
  2610. $this->outputResult($this->checkPlatform());
  2611. $io->write('Checking git settings: ', false);
  2612. $this->outputResult($this->checkGit());
  2613. $io->write('Checking http connectivity to packagist: ', false);
  2614. $this->outputResult($this->checkHttp('http', $config));
  2615. $io->write('Checking https connectivity to packagist: ', false);
  2616. $this->outputResult($this->checkHttp('https', $config));
  2617. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2618. if (!empty($opts['http']['proxy'])) {
  2619. $io->write('Checking HTTP proxy: ', false);
  2620. $this->outputResult($this->checkHttpProxy());
  2621. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2622. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2623. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2624. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2625. }
  2626. if ($oauth = $config->get('github-oauth')) {
  2627. foreach ($oauth as $domain => $token) {
  2628. $io->write('Checking '.$domain.' oauth access: ', false);
  2629. $this->outputResult($this->checkGithubOauth($domain, $token));
  2630. }
  2631. } else {
  2632. $io->write('Checking github.com rate limit: ', false);
  2633. try {
  2634. $rate = $this->getGithubRateLimit('github.com');
  2635. $this->outputResult(true);
  2636. if (10 > $rate['remaining']) {
  2637. $io->write('<warning>WARNING</warning>');
  2638. $io->write(sprintf(
  2639. '<comment>Github has a rate limit on their API. '
  2640. . 'You currently have <options=bold>%u</options=bold> '
  2641. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2642. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2643. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2644. $rate['remaining'],
  2645. $rate['limit']
  2646. ));
  2647. }
  2648. } catch (\Exception $e) {
  2649. if ($e instanceof TransportException && $e->getCode() === 401) {
  2650. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2651. } else {
  2652. $this->outputResult($e);
  2653. }
  2654. }
  2655. }
  2656. $io->write('Checking disk free space: ', false);
  2657. $this->outputResult($this->checkDiskSpace($config));
  2658. if ('phar:' === substr(__FILE__, 0, 5)) {
  2659. $io->write('Checking pubkeys: ', false);
  2660. $this->outputResult($this->checkPubKeys($config));
  2661. $io->write('Checking composer version: ', false);
  2662. $this->outputResult($this->checkVersion($config));
  2663. }
  2664. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2665. $platformOverrides = $config->get('platform') ?: array();
  2666. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  2667. $phpPkg = $platformRepo->findPackage('php', '*');
  2668. $phpVersion = $phpPkg->getPrettyVersion();
  2669. if (false !== strpos($phpPkg->getDescription(), 'overridden')) {
  2670. $phpVersion .= ' - ' . $phpPkg->getDescription();
  2671. }
  2672. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  2673. if (defined('PHP_BINARY')) {
  2674. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2675. }
  2676. return $this->exitCode;
  2677. }
  2678. private function checkComposerSchema()
  2679. {
  2680. $validator = new ConfigValidator($this->getIO());
  2681. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2682. if ($errors || $warnings) {
  2683. $messages = array(
  2684. 'error' => $errors,
  2685. 'warning' => $warnings,
  2686. );
  2687. $output = '';
  2688. foreach ($messages as $style => $msgs) {
  2689. foreach ($msgs as $msg) {
  2690. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2691. }
  2692. }
  2693. return rtrim($output);
  2694. }
  2695. return true;
  2696. }
  2697. private function checkGit()
  2698. {
  2699. $this->process->execute('git config color.ui', $output);
  2700. if (strtolower(trim($output)) === 'always') {
  2701. 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>';
  2702. }
  2703. return true;
  2704. }
  2705. private function checkHttp($proto, Config $config)
  2706. {
  2707. $disableTls = false;
  2708. $result = array();
  2709. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2710. $disableTls = true;
  2711. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2712. }
  2713. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2714. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2715. }
  2716. try {
  2717. $this->rfs->getContents('packagist.org', $proto . '://repo.packagist.org/packages.json', false);
  2718. } catch (TransportException $e) {
  2719. if (false !== strpos($e->getMessage(), 'cafile')) {
  2720. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2721. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2722. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2723. } else {
  2724. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2725. }
  2726. }
  2727. if (count($result) > 0) {
  2728. return $result;
  2729. }
  2730. return true;
  2731. }
  2732. private function checkHttpProxy()
  2733. {
  2734. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2735. try {
  2736. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/packages.json', false), true);
  2737. $hash = reset($json['provider-includes']);
  2738. $hash = $hash['sha256'];
  2739. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2740. $provider = $this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/'.$path, false);
  2741. if (hash('sha256', $provider) !== $hash) {
  2742. return 'It seems that your proxy is modifying http traffic on the fly';
  2743. }
  2744. } catch (\Exception $e) {
  2745. return $e;
  2746. }
  2747. return true;
  2748. }
  2749. private function checkHttpProxyFullUriRequestParam()
  2750. {
  2751. $url = 'http://repo.packagist.org/packages.json';
  2752. try {
  2753. $this->rfs->getContents('packagist.org', $url, false);
  2754. } catch (TransportException $e) {
  2755. try {
  2756. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2757. } catch (TransportException $e) {
  2758. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2759. }
  2760. 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"';
  2761. }
  2762. return true;
  2763. }
  2764. private function checkHttpsProxyFullUriRequestParam()
  2765. {
  2766. if (!extension_loaded('openssl')) {
  2767. return 'You need the openssl extension installed for this check';
  2768. }
  2769. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2770. try {
  2771. $this->rfs->getContents('github.com', $url, false);
  2772. } catch (TransportException $e) {
  2773. try {
  2774. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2775. } catch (TransportException $e) {
  2776. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2777. }
  2778. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2779. }
  2780. return true;
  2781. }
  2782. private function checkGithubOauth($domain, $token)
  2783. {
  2784. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2785. try {
  2786. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2787. return $this->rfs->getContents($domain, $url, false, array(
  2788. 'retry-auth-failure' => false,
  2789. )) ? true : 'Unexpected error';
  2790. } catch (\Exception $e) {
  2791. if ($e instanceof TransportException && $e->getCode() === 401) {
  2792. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2793. }
  2794. return $e;
  2795. }
  2796. }
  2797. private function getGithubRateLimit($domain, $token = null)
  2798. {
  2799. if ($token) {
  2800. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2801. }
  2802. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2803. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2804. $data = json_decode($json, true);
  2805. return $data['resources']['core'];
  2806. }
  2807. private function checkDiskSpace($config)
  2808. {
  2809. $minSpaceFree = 1024 * 1024;
  2810. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2811. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2812. ) {
  2813. return '<error>The disk hosting '.$dir.' is full</error>';
  2814. }
  2815. return true;
  2816. }
  2817. private function checkPubKeys($config)
  2818. {
  2819. $home = $config->get('home');
  2820. $errors = array();
  2821. $io = $this->getIO();
  2822. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2823. $io->write('');
  2824. }
  2825. if (file_exists($home.'/keys.tags.pub')) {
  2826. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2827. } else {
  2828. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2829. }
  2830. if (file_exists($home.'/keys.dev.pub')) {
  2831. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2832. } else {
  2833. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2834. }
  2835. if ($errors) {
  2836. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2837. }
  2838. return $errors ?: true;
  2839. }
  2840. private function checkVersion($config)
  2841. {
  2842. $versionsUtil = new Versions($config, $this->rfs);
  2843. $latest = $versionsUtil->getLatest();
  2844. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2845. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2846. }
  2847. return true;
  2848. }
  2849. private function outputResult($result)
  2850. {
  2851. $io = $this->getIO();
  2852. if (true === $result) {
  2853. $io->write('<info>OK</info>');
  2854. return;
  2855. }
  2856. $hadError = false;
  2857. if ($result instanceof \Exception) {
  2858. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2859. }
  2860. if (!$result) {
  2861. $hadError = true;
  2862. } else {
  2863. if (!is_array($result)) {
  2864. $result = array($result);
  2865. }
  2866. foreach ($result as $message) {
  2867. if (false !== strpos($message, '<error>')) {
  2868. $hadError = true;
  2869. }
  2870. }
  2871. }
  2872. if ($hadError) {
  2873. $io->write('<error>FAIL</error>');
  2874. $this->exitCode = 2;
  2875. } else {
  2876. $io->write('<warning>WARNING</warning>');
  2877. $this->exitCode = 1;
  2878. }
  2879. if ($result) {
  2880. foreach ($result as $message) {
  2881. $io->write($message);
  2882. }
  2883. }
  2884. }
  2885. private function checkPlatform()
  2886. {
  2887. $output = '';
  2888. $out = function ($msg, $style) use (&$output) {
  2889. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2890. };
  2891. $errors = array();
  2892. $warnings = array();
  2893. $displayIniMessage = false;
  2894. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  2895. $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.';
  2896. if (!function_exists('json_decode')) {
  2897. $errors['json'] = true;
  2898. }
  2899. if (!extension_loaded('Phar')) {
  2900. $errors['phar'] = true;
  2901. }
  2902. if (!extension_loaded('filter')) {
  2903. $errors['filter'] = true;
  2904. }
  2905. if (!extension_loaded('hash')) {
  2906. $errors['hash'] = true;
  2907. }
  2908. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2909. $errors['iconv_mbstring'] = true;
  2910. }
  2911. if (!ini_get('allow_url_fopen')) {
  2912. $errors['allow_url_fopen'] = true;
  2913. }
  2914. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2915. $errors['ioncube'] = ioncube_loader_version();
  2916. }
  2917. if (PHP_VERSION_ID < 50302) {
  2918. $errors['php'] = PHP_VERSION;
  2919. }
  2920. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2921. $warnings['php'] = PHP_VERSION;
  2922. }
  2923. if (!extension_loaded('openssl')) {
  2924. $errors['openssl'] = true;
  2925. }
  2926. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2927. $warnings['openssl_version'] = true;
  2928. }
  2929. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
  2930. $warnings['apc_cli'] = true;
  2931. }
  2932. if (!extension_loaded('zlib')) {
  2933. $warnings['zlib'] = true;
  2934. }
  2935. ob_start();
  2936. phpinfo(INFO_GENERAL);
  2937. $phpinfo = ob_get_clean();
  2938. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  2939. $configure = $match[1];
  2940. if (false !== strpos($configure, '--enable-sigchild')) {
  2941. $warnings['sigchild'] = true;
  2942. }
  2943. if (false !== strpos($configure, '--with-curlwrappers')) {
  2944. $warnings['curlwrappers'] = true;
  2945. }
  2946. }
  2947. if (ini_get('xdebug.profiler_enabled')) {
  2948. $warnings['xdebug_profile'] = true;
  2949. } elseif (extension_loaded('xdebug')) {
  2950. $warnings['xdebug_loaded'] = true;
  2951. }
  2952. if (!empty($errors)) {
  2953. foreach ($errors as $error => $current) {
  2954. switch ($error) {
  2955. case 'json':
  2956. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  2957. $text .= "Install it or recompile php without --disable-json";
  2958. break;
  2959. case 'phar':
  2960. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  2961. $text .= "Install it or recompile php without --disable-phar";
  2962. break;
  2963. case 'filter':
  2964. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  2965. $text .= "Install it or recompile php without --disable-filter";
  2966. break;
  2967. case 'hash':
  2968. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  2969. $text .= "Install it or recompile php without --disable-hash";
  2970. break;
  2971. case 'iconv_mbstring':
  2972. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  2973. $text .= "Install either of them or recompile php without --disable-iconv";
  2974. break;
  2975. case 'unicode':
  2976. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  2977. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2978. $text .= " detect_unicode = Off";
  2979. $displayIniMessage = true;
  2980. break;
  2981. case 'suhosin':
  2982. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  2983. $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;
  2984. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  2985. $displayIniMessage = true;
  2986. break;
  2987. case 'php':
  2988. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  2989. break;
  2990. case 'allow_url_fopen':
  2991. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  2992. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2993. $text .= " allow_url_fopen = On";
  2994. $displayIniMessage = true;
  2995. break;
  2996. case 'ioncube':
  2997. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  2998. $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;
  2999. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  3000. $displayIniMessage = true;
  3001. break;
  3002. case 'openssl':
  3003. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  3004. $text .= "If possible you should enable it or recompile php with --with-openssl";
  3005. break;
  3006. }
  3007. $out($text, 'error');
  3008. }
  3009. $output .= PHP_EOL;
  3010. }
  3011. if (!empty($warnings)) {
  3012. foreach ($warnings as $warning => $current) {
  3013. switch ($warning) {
  3014. case 'apc_cli':
  3015. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  3016. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3017. $text .= " apc.enable_cli = Off";
  3018. $displayIniMessage = true;
  3019. break;
  3020. case 'zlib':
  3021. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  3022. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  3023. $displayIniMessage = true;
  3024. break;
  3025. case 'sigchild':
  3026. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  3027. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  3028. $text .= " https://bugs.php.net/bug.php?id=22999";
  3029. break;
  3030. case 'curlwrappers':
  3031. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  3032. $text .= " Recompile it without this flag if possible";
  3033. break;
  3034. case 'php':
  3035. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  3036. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  3037. break;
  3038. case 'openssl_version':
  3039. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  3040. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  3041. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  3042. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  3043. break;
  3044. case 'xdebug_loaded':
  3045. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  3046. $text .= " Disabling it when using Composer is recommended.";
  3047. break;
  3048. case 'xdebug_profile':
  3049. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  3050. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  3051. $text .= " xdebug.profiler_enabled = 0";
  3052. $displayIniMessage = true;
  3053. break;
  3054. }
  3055. $out($text, 'comment');
  3056. }
  3057. }
  3058. if ($displayIniMessage) {
  3059. $out($iniMessage, 'comment');
  3060. }
  3061. return !$warnings && !$errors ? true : $output;
  3062. }
  3063. }
  3064. <?php
  3065. namespace Composer\Command;
  3066. use Composer\Plugin\CommandEvent;
  3067. use Composer\Plugin\PluginEvents;
  3068. use Symfony\Component\Console\Input\InputInterface;
  3069. use Symfony\Component\Console\Input\InputOption;
  3070. use Symfony\Component\Console\Output\OutputInterface;
  3071. class DumpAutoloadCommand extends BaseCommand
  3072. {
  3073. protected function configure()
  3074. {
  3075. $this
  3076. ->setName('dump-autoload')
  3077. ->setAliases(array('dumpautoload'))
  3078. ->setDescription('Dumps the autoloader.')
  3079. ->setDefinition(array(
  3080. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3081. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3082. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3083. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3084. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3085. ))
  3086. ->setHelp(
  3087. <<<EOT
  3088. <info>php composer.phar dump-autoload</info>
  3089. EOT
  3090. )
  3091. ;
  3092. }
  3093. protected function execute(InputInterface $input, OutputInterface $output)
  3094. {
  3095. $composer = $this->getComposer();
  3096. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3097. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3098. $installationManager = $composer->getInstallationManager();
  3099. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3100. $package = $composer->getPackage();
  3101. $config = $composer->getConfig();
  3102. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3103. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3104. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3105. if ($authoritative) {
  3106. $this->getIO()->writeError('<info>Generating optimized autoload files (authoritative)</info>');
  3107. } elseif ($optimize) {
  3108. $this->getIO()->writeError('<info>Generating optimized autoload files</info>');
  3109. } else {
  3110. $this->getIO()->writeError('<info>Generating autoload files</info>');
  3111. }
  3112. $generator = $composer->getAutoloadGenerator();
  3113. $generator->setDevMode(!$input->getOption('no-dev'));
  3114. $generator->setClassMapAuthoritative($authoritative);
  3115. $generator->setApcu($apcu);
  3116. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3117. $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3118. }
  3119. }
  3120. <?php
  3121. namespace Composer\Command;
  3122. use Symfony\Component\Console\Input\InputInterface;
  3123. use Symfony\Component\Console\Input\InputOption;
  3124. use Symfony\Component\Console\Output\OutputInterface;
  3125. use Symfony\Component\Console\Input\InputArgument;
  3126. class ExecCommand extends BaseCommand
  3127. {
  3128. protected function configure()
  3129. {
  3130. $this
  3131. ->setName('exec')
  3132. ->setDescription('Executes a vendored binary/script.')
  3133. ->setDefinition(array(
  3134. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3135. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3136. new InputArgument(
  3137. 'args',
  3138. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3139. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3140. ),
  3141. ))
  3142. ;
  3143. }
  3144. protected function execute(InputInterface $input, OutputInterface $output)
  3145. {
  3146. $composer = $this->getComposer();
  3147. $binDir = $composer->getConfig()->get('bin-dir');
  3148. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3149. $bins = glob($binDir . '/*');
  3150. $bins = array_merge($bins, array_map(function ($e) {
  3151. return "$e (local)";
  3152. }, $composer->getPackage()->getBinaries()));
  3153. if (!$bins) {
  3154. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3155. }
  3156. $this->getIO()->write(
  3157. <<<EOT
  3158. <comment>Available binaries:</comment>
  3159. EOT
  3160. );
  3161. foreach ($bins as $bin) {
  3162. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3163. continue;
  3164. }
  3165. $previousBin = $bin;
  3166. $bin = basename($bin);
  3167. $this->getIO()->write(
  3168. <<<EOT
  3169. <info>- $bin</info>
  3170. EOT
  3171. );
  3172. }
  3173. return 0;
  3174. }
  3175. $binary = $input->getArgument('binary');
  3176. $dispatcher = $composer->getEventDispatcher();
  3177. $dispatcher->addListener('__exec_command', $binary);
  3178. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3179. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3180. }
  3181. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3182. }
  3183. }
  3184. <?php
  3185. namespace Composer\Command;
  3186. use Composer\Factory;
  3187. use Composer\Util\Filesystem;
  3188. use Symfony\Component\Console\Input\InputInterface;
  3189. use Symfony\Component\Console\Input\InputArgument;
  3190. use Symfony\Component\Console\Input\StringInput;
  3191. use Symfony\Component\Console\Output\OutputInterface;
  3192. class GlobalCommand extends BaseCommand
  3193. {
  3194. protected function configure()
  3195. {
  3196. $this
  3197. ->setName('global')
  3198. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3199. ->setDefinition(array(
  3200. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3201. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3202. ))
  3203. ->setHelp(
  3204. <<<EOT
  3205. Use this command as a wrapper to run other Composer commands
  3206. within the global context of COMPOSER_HOME.
  3207. You can use this to install CLI utilities globally, all you need
  3208. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3209. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3210. and /home/<user>/.composer on unix systems.
  3211. If your system uses freedesktop.org standards, then it will first check
  3212. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3213. Note: This path may vary depending on customizations to bin-dir in
  3214. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3215. EOT
  3216. )
  3217. ;
  3218. }
  3219. public function run(InputInterface $input, OutputInterface $output)
  3220. {
  3221. $tokens = preg_split('{\s+}', $input->__toString());
  3222. $args = array();
  3223. foreach ($tokens as $token) {
  3224. if ($token && $token[0] !== '-') {
  3225. $args[] = $token;
  3226. if (count($args) >= 2) {
  3227. break;
  3228. }
  3229. }
  3230. }
  3231. if (count($args) < 2) {
  3232. return parent::run($input, $output);
  3233. }
  3234. $config = Factory::createConfig();
  3235. $home = $config->get('home');
  3236. if (!is_dir($home)) {
  3237. $fs = new Filesystem();
  3238. $fs->ensureDirectoryExists($home);
  3239. if (!is_dir($home)) {
  3240. throw new \RuntimeException('Could not create home directory');
  3241. }
  3242. }
  3243. try {
  3244. chdir($home);
  3245. } catch (\Exception $e) {
  3246. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  3247. }
  3248. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  3249. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3250. $this->getApplication()->resetComposer();
  3251. return $this->getApplication()->run($input, $output);
  3252. }
  3253. public function isProxyCommand()
  3254. {
  3255. return true;
  3256. }
  3257. }
  3258. <?php
  3259. namespace Composer\Command;
  3260. use Composer\Package\CompletePackageInterface;
  3261. use Composer\Repository\RepositoryInterface;
  3262. use Composer\Repository\ArrayRepository;
  3263. use Composer\Repository\RepositoryFactory;
  3264. use Composer\Util\Platform;
  3265. use Composer\Util\ProcessExecutor;
  3266. use Symfony\Component\Console\Input\InputArgument;
  3267. use Symfony\Component\Console\Input\InputOption;
  3268. use Symfony\Component\Console\Input\InputInterface;
  3269. use Symfony\Component\Console\Output\OutputInterface;
  3270. class HomeCommand extends BaseCommand
  3271. {
  3272. protected function configure()
  3273. {
  3274. $this
  3275. ->setName('browse')
  3276. ->setAliases(array('home'))
  3277. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3278. ->setDefinition(array(
  3279. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3280. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3281. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3282. ))
  3283. ->setHelp(
  3284. <<<EOT
  3285. The home command opens or shows a package's repository URL or
  3286. homepage in your default browser.
  3287. To open the homepage by default, use -H or --homepage.
  3288. To show instead of open the repository or homepage URL, use -s or --show.
  3289. EOT
  3290. );
  3291. }
  3292. protected function execute(InputInterface $input, OutputInterface $output)
  3293. {
  3294. $repos = $this->initializeRepos();
  3295. $io = $this->getIO();
  3296. $return = 0;
  3297. $packages = $input->getArgument('packages');
  3298. if (!$packages) {
  3299. $io->writeError('No package specified, opening homepage for the root package');
  3300. $packages = array($this->getComposer()->getPackage()->getName());
  3301. }
  3302. foreach ($packages as $packageName) {
  3303. $handled = false;
  3304. $packageExists = false;
  3305. foreach ($repos as $repo) {
  3306. foreach ($repo->findPackages($packageName) as $package) {
  3307. $packageExists = true;
  3308. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3309. $handled = true;
  3310. break 2;
  3311. }
  3312. }
  3313. }
  3314. if (!$packageExists) {
  3315. $return = 1;
  3316. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3317. }
  3318. if (!$handled) {
  3319. $return = 1;
  3320. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3321. }
  3322. }
  3323. return $return;
  3324. }
  3325. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3326. {
  3327. $support = $package->getSupport();
  3328. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3329. if (!$url || $showHomepage) {
  3330. $url = $package->getHomepage();
  3331. }
  3332. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3333. return false;
  3334. }
  3335. if ($showOnly) {
  3336. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3337. } else {
  3338. $this->openBrowser($url);
  3339. }
  3340. return true;
  3341. }
  3342. private function openBrowser($url)
  3343. {
  3344. $url = ProcessExecutor::escape($url);
  3345. $process = new ProcessExecutor($this->getIO());
  3346. if (Platform::isWindows()) {
  3347. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3348. }
  3349. $linux = $process->execute('which xdg-open', $output);
  3350. $osx = $process->execute('which open', $output);
  3351. if (0 === $linux) {
  3352. $process->execute('xdg-open ' . $url, $output);
  3353. } elseif (0 === $osx) {
  3354. $process->execute('open ' . $url, $output);
  3355. } else {
  3356. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3357. }
  3358. }
  3359. private function initializeRepos()
  3360. {
  3361. $composer = $this->getComposer(false);
  3362. if ($composer) {
  3363. return array_merge(
  3364. array(new ArrayRepository(array($composer->getPackage()))),
  3365. array($composer->getRepositoryManager()->getLocalRepository()),
  3366. $composer->getRepositoryManager()->getRepositories()
  3367. );
  3368. }
  3369. return RepositoryFactory::defaultRepos($this->getIO());
  3370. }
  3371. }
  3372. <?php
  3373. namespace Composer\Command;
  3374. use Composer\DependencyResolver\Pool;
  3375. use Composer\Factory;
  3376. use Composer\Json\JsonFile;
  3377. use Composer\Package\BasePackage;
  3378. use Composer\Package\Version\VersionParser;
  3379. use Composer\Package\Version\VersionSelector;
  3380. use Composer\Repository\CompositeRepository;
  3381. use Composer\Repository\PlatformRepository;
  3382. use Composer\Repository\RepositoryFactory;
  3383. use Composer\Util\ProcessExecutor;
  3384. use Symfony\Component\Console\Input\InputInterface;
  3385. use Symfony\Component\Console\Input\InputOption;
  3386. use Symfony\Component\Console\Output\OutputInterface;
  3387. use Symfony\Component\Process\ExecutableFinder;
  3388. use Symfony\Component\Process\Process;
  3389. class InitCommand extends BaseCommand
  3390. {
  3391. protected $repos;
  3392. private $gitConfig;
  3393. private $pools;
  3394. protected function configure()
  3395. {
  3396. $this
  3397. ->setName('init')
  3398. ->setDescription('Creates a basic composer.json file in current directory.')
  3399. ->setDefinition(array(
  3400. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3401. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3402. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3403. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3404. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3405. 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"'),
  3406. 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"'),
  3407. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3408. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3409. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3410. ))
  3411. ->setHelp(
  3412. <<<EOT
  3413. The <info>init</info> command creates a basic composer.json file
  3414. in the current directory.
  3415. <info>php composer.phar init</info>
  3416. EOT
  3417. )
  3418. ;
  3419. }
  3420. protected function execute(InputInterface $input, OutputInterface $output)
  3421. {
  3422. $io = $this->getIO();
  3423. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3424. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3425. if (isset($options['author'])) {
  3426. $options['authors'] = $this->formatAuthors($options['author']);
  3427. unset($options['author']);
  3428. }
  3429. $repositories = $input->getOption('repository');
  3430. if ($repositories) {
  3431. $config = Factory::createConfig($io);
  3432. foreach ($repositories as $repo) {
  3433. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3434. }
  3435. }
  3436. if (isset($options['stability'])) {
  3437. $options['minimum-stability'] = $options['stability'];
  3438. unset($options['stability']);
  3439. }
  3440. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3441. if (array() === $options['require']) {
  3442. $options['require'] = new \stdClass;
  3443. }
  3444. if (isset($options['require-dev'])) {
  3445. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3446. if (array() === $options['require-dev']) {
  3447. $options['require-dev'] = new \stdClass;
  3448. }
  3449. }
  3450. $file = new JsonFile(Factory::getComposerFile());
  3451. $json = $file->encode($options);
  3452. if ($input->isInteractive()) {
  3453. $io->writeError(array('', $json, ''));
  3454. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3455. $io->writeError('<error>Command aborted</error>');
  3456. return 1;
  3457. }
  3458. }
  3459. $file->write($options);
  3460. if ($input->isInteractive() && is_dir('.git')) {
  3461. $ignoreFile = realpath('.gitignore');
  3462. if (false === $ignoreFile) {
  3463. $ignoreFile = realpath('.') . '/.gitignore';
  3464. }
  3465. if (!$this->hasVendorIgnore($ignoreFile)) {
  3466. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3467. if ($io->askConfirmation($question, true)) {
  3468. $this->addVendorIgnore($ignoreFile);
  3469. }
  3470. }
  3471. }
  3472. }
  3473. protected function interact(InputInterface $input, OutputInterface $output)
  3474. {
  3475. $git = $this->getGitConfig();
  3476. $io = $this->getIO();
  3477. $formatter = $this->getHelperSet()->get('formatter');
  3478. $repositories = $input->getOption('repository');
  3479. if ($repositories) {
  3480. $config = Factory::createConfig($io);
  3481. $repos = array(new PlatformRepository);
  3482. foreach ($repositories as $repo) {
  3483. $repos[] = RepositoryFactory::fromString($io, $config, $repo);
  3484. }
  3485. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3486. 'type' => 'composer',
  3487. 'url' => 'https://repo.packagist.org',
  3488. ));
  3489. $this->repos = new CompositeRepository($repos);
  3490. unset($repos, $config, $repositories);
  3491. }
  3492. $io->writeError(array(
  3493. '',
  3494. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3495. '',
  3496. ));
  3497. $io->writeError(array(
  3498. '',
  3499. 'This command will guide you through creating your composer.json config.',
  3500. '',
  3501. ));
  3502. $cwd = realpath(".");
  3503. if (!$name = $input->getOption('name')) {
  3504. $name = basename($cwd);
  3505. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3506. $name = strtolower($name);
  3507. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3508. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3509. } elseif (isset($git['github.user'])) {
  3510. $name = $git['github.user'] . '/' . $name;
  3511. } elseif (!empty($_SERVER['USERNAME'])) {
  3512. $name = $_SERVER['USERNAME'] . '/' . $name;
  3513. } elseif (!empty($_SERVER['USER'])) {
  3514. $name = $_SERVER['USER'] . '/' . $name;
  3515. } elseif (get_current_user()) {
  3516. $name = get_current_user() . '/' . $name;
  3517. } else {
  3518. $name = $name . '/' . $name;
  3519. }
  3520. $name = strtolower($name);
  3521. } else {
  3522. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) {
  3523. throw new \InvalidArgumentException(
  3524. '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_.-]+'
  3525. );
  3526. }
  3527. }
  3528. $name = $io->askAndValidate(
  3529. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3530. function ($value) use ($name) {
  3531. if (null === $value) {
  3532. return $name;
  3533. }
  3534. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $value)) {
  3535. throw new \InvalidArgumentException(
  3536. '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_.-]+'
  3537. );
  3538. }
  3539. return $value;
  3540. },
  3541. null,
  3542. $name
  3543. );
  3544. $input->setOption('name', $name);
  3545. $description = $input->getOption('description') ?: false;
  3546. $description = $io->ask(
  3547. 'Description [<comment>'.$description.'</comment>]: ',
  3548. $description
  3549. );
  3550. $input->setOption('description', $description);
  3551. if (null === $author = $input->getOption('author')) {
  3552. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3553. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3554. } elseif (isset($git['user.name'])) {
  3555. $author_name = $git['user.name'];
  3556. }
  3557. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3558. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3559. } elseif (isset($git['user.email'])) {
  3560. $author_email = $git['user.email'];
  3561. }
  3562. if (isset($author_name) && isset($author_email)) {
  3563. $author = sprintf('%s <%s>', $author_name, $author_email);
  3564. }
  3565. }
  3566. $self = $this;
  3567. $author = $io->askAndValidate(
  3568. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3569. function ($value) use ($self, $author) {
  3570. if ($value === 'n' || $value === 'no') {
  3571. return;
  3572. }
  3573. $value = $value ?: $author;
  3574. $author = $self->parseAuthorString($value);
  3575. return sprintf('%s <%s>', $author['name'], $author['email']);
  3576. },
  3577. null,
  3578. $author
  3579. );
  3580. $input->setOption('author', $author);
  3581. $minimumStability = $input->getOption('stability') ?: null;
  3582. $minimumStability = $io->askAndValidate(
  3583. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3584. function ($value) use ($minimumStability) {
  3585. if (null === $value) {
  3586. return $minimumStability;
  3587. }
  3588. if (!isset(BasePackage::$stabilities[$value])) {
  3589. throw new \InvalidArgumentException(
  3590. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3591. implode(', ', array_keys(BasePackage::$stabilities))
  3592. );
  3593. }
  3594. return $value;
  3595. },
  3596. null,
  3597. $minimumStability
  3598. );
  3599. $input->setOption('stability', $minimumStability);
  3600. $type = $input->getOption('type') ?: false;
  3601. $type = $io->ask(
  3602. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3603. $type
  3604. );
  3605. $input->setOption('type', $type);
  3606. if (null === $license = $input->getOption('license')) {
  3607. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3608. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3609. }
  3610. }
  3611. $license = $io->ask(
  3612. 'License [<comment>'.$license.'</comment>]: ',
  3613. $license
  3614. );
  3615. $input->setOption('license', $license);
  3616. $io->writeError(array('', 'Define your dependencies.', ''));
  3617. $repos = $this->getRepos();
  3618. $preferredStability = $minimumStability ?: 'stable';
  3619. $phpVersion = $repos->findPackage('php', '*')->getPrettyVersion();
  3620. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3621. $require = $input->getOption('require');
  3622. $requirements = array();
  3623. if ($require || $io->askConfirmation($question, true)) {
  3624. $requirements = $this->determineRequirements($input, $output, $require, $phpVersion, $preferredStability);
  3625. }
  3626. $input->setOption('require', $requirements);
  3627. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3628. $requireDev = $input->getOption('require-dev');
  3629. $devRequirements = array();
  3630. if ($requireDev || $io->askConfirmation($question, true)) {
  3631. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $phpVersion, $preferredStability);
  3632. }
  3633. $input->setOption('require-dev', $devRequirements);
  3634. }
  3635. public function parseAuthorString($author)
  3636. {
  3637. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3638. if ($this->isValidEmail($match['email'])) {
  3639. return array(
  3640. 'name' => trim($match['name']),
  3641. 'email' => $match['email'],
  3642. );
  3643. }
  3644. }
  3645. throw new \InvalidArgumentException(
  3646. 'Invalid author string. Must be in the format: '.
  3647. 'John Smith <john@example.com>'
  3648. );
  3649. }
  3650. protected function findPackages($name)
  3651. {
  3652. return $this->getRepos()->search($name);
  3653. }
  3654. protected function getRepos()
  3655. {
  3656. if (!$this->repos) {
  3657. $this->repos = new CompositeRepository(array_merge(
  3658. array(new PlatformRepository),
  3659. RepositoryFactory::defaultRepos($this->getIO())
  3660. ));
  3661. }
  3662. return $this->repos;
  3663. }
  3664. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable')
  3665. {
  3666. if ($requires) {
  3667. $requires = $this->normalizeRequirements($requires);
  3668. $result = array();
  3669. $io = $this->getIO();
  3670. foreach ($requires as $requirement) {
  3671. if (!isset($requirement['version'])) {
  3672. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability);
  3673. $requirement['version'] = $version;
  3674. $requirement['name'] = $name;
  3675. $io->writeError(sprintf(
  3676. 'Using version <info>%s</info> for <info>%s</info>',
  3677. $requirement['version'],
  3678. $requirement['name']
  3679. ));
  3680. } else {
  3681. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $requirement['version'], 'dev');
  3682. $requirement['name'] = $name;
  3683. }
  3684. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3685. }
  3686. return $result;
  3687. }
  3688. $versionParser = new VersionParser();
  3689. $io = $this->getIO();
  3690. while (null !== $package = $io->ask('Search for a package: ')) {
  3691. $matches = $this->findPackages($package);
  3692. if (count($matches)) {
  3693. $exactMatch = null;
  3694. $choices = array();
  3695. foreach ($matches as $position => $foundPackage) {
  3696. $abandoned = '';
  3697. if (isset($foundPackage['abandoned'])) {
  3698. if (is_string($foundPackage['abandoned'])) {
  3699. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  3700. } else {
  3701. $replacement = 'No replacement was suggested';
  3702. }
  3703. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  3704. }
  3705. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  3706. if ($foundPackage['name'] === $package) {
  3707. $exactMatch = true;
  3708. break;
  3709. }
  3710. }
  3711. if (!$exactMatch) {
  3712. $io->writeError(array(
  3713. '',
  3714. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3715. '',
  3716. ));
  3717. $io->writeError($choices);
  3718. $io->writeError('');
  3719. $validator = function ($selection) use ($matches, $versionParser) {
  3720. if ('' === $selection) {
  3721. return false;
  3722. }
  3723. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3724. $package = $matches[(int) $selection];
  3725. return $package['name'];
  3726. }
  3727. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3728. if (isset($packageMatches['version'])) {
  3729. $versionParser->parseConstraints($packageMatches['version']);
  3730. return $packageMatches['name'].' '.$packageMatches['version'];
  3731. }
  3732. return $packageMatches['name'];
  3733. }
  3734. throw new \Exception('Not a valid selection');
  3735. };
  3736. $package = $io->askAndValidate(
  3737. 'Enter package # to add, or the complete package name if it is not listed: ',
  3738. $validator,
  3739. 3,
  3740. false
  3741. );
  3742. }
  3743. if (false !== $package && false === strpos($package, ' ')) {
  3744. $validator = function ($input) {
  3745. $input = trim($input);
  3746. return $input ?: false;
  3747. };
  3748. $constraint = $io->askAndValidate(
  3749. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3750. $validator,
  3751. 3,
  3752. false
  3753. );
  3754. if (false === $constraint) {
  3755. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  3756. $io->writeError(sprintf(
  3757. 'Using version <info>%s</info> for <info>%s</info>',
  3758. $constraint,
  3759. $package
  3760. ));
  3761. }
  3762. $package .= ' '.$constraint;
  3763. }
  3764. if (false !== $package) {
  3765. $requires[] = $package;
  3766. }
  3767. }
  3768. }
  3769. return $requires;
  3770. }
  3771. protected function formatAuthors($author)
  3772. {
  3773. return array($this->parseAuthorString($author));
  3774. }
  3775. protected function formatRequirements(array $requirements)
  3776. {
  3777. $requires = array();
  3778. $requirements = $this->normalizeRequirements($requirements);
  3779. foreach ($requirements as $requirement) {
  3780. $requires[$requirement['name']] = $requirement['version'];
  3781. }
  3782. return $requires;
  3783. }
  3784. protected function getGitConfig()
  3785. {
  3786. if (null !== $this->gitConfig) {
  3787. return $this->gitConfig;
  3788. }
  3789. $finder = new ExecutableFinder();
  3790. $gitBin = $finder->find('git');
  3791. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3792. $cmd->run();
  3793. if ($cmd->isSuccessful()) {
  3794. $this->gitConfig = array();
  3795. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3796. foreach ($matches as $match) {
  3797. $this->gitConfig[$match[1]] = $match[2];
  3798. }
  3799. return $this->gitConfig;
  3800. }
  3801. return $this->gitConfig = array();
  3802. }
  3803. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3804. {
  3805. if (!file_exists($ignoreFile)) {
  3806. return false;
  3807. }
  3808. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3809. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3810. foreach ($lines as $line) {
  3811. if (preg_match($pattern, $line)) {
  3812. return true;
  3813. }
  3814. }
  3815. return false;
  3816. }
  3817. protected function normalizeRequirements(array $requirements)
  3818. {
  3819. $parser = new VersionParser();
  3820. return $parser->parseNameVersionPairs($requirements);
  3821. }
  3822. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3823. {
  3824. $contents = "";
  3825. if (file_exists($ignoreFile)) {
  3826. $contents = file_get_contents($ignoreFile);
  3827. if ("\n" !== substr($contents, 0, -1)) {
  3828. $contents .= "\n";
  3829. }
  3830. }
  3831. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3832. }
  3833. protected function isValidEmail($email)
  3834. {
  3835. if (!function_exists('filter_var')) {
  3836. return true;
  3837. }
  3838. if (PHP_VERSION_ID < 50303) {
  3839. return true;
  3840. }
  3841. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3842. }
  3843. private function getPool(InputInterface $input, $minimumStability = null)
  3844. {
  3845. $key = $minimumStability ?: 'default';
  3846. if (!isset($this->pools[$key])) {
  3847. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  3848. $pool->addRepository($this->getRepos());
  3849. }
  3850. return $this->pools[$key];
  3851. }
  3852. private function getMinimumStability(InputInterface $input)
  3853. {
  3854. if ($input->hasOption('stability')) {
  3855. return $input->getOption('stability') ?: 'stable';
  3856. }
  3857. $file = Factory::getComposerFile();
  3858. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3859. if (!empty($composer['minimum-stability'])) {
  3860. return $composer['minimum-stability'];
  3861. }
  3862. }
  3863. return 'stable';
  3864. }
  3865. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null)
  3866. {
  3867. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  3868. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3869. if ($input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs')) {
  3870. $phpVersion = null;
  3871. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3872. }
  3873. if (!$package) {
  3874. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  3875. throw new \InvalidArgumentException(sprintf(
  3876. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)',
  3877. $name,
  3878. $requiredVersion,
  3879. $phpVersion
  3880. ));
  3881. }
  3882. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  3883. throw new \InvalidArgumentException(sprintf(
  3884. 'Could not find package %s in a version matching %s',
  3885. $name,
  3886. $requiredVersion
  3887. ));
  3888. }
  3889. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  3890. throw new \InvalidArgumentException(sprintf(
  3891. 'Could not find package %s in any version matching your PHP version (%s)',
  3892. $name,
  3893. $phpVersion
  3894. ));
  3895. }
  3896. $similar = $this->findSimilar($name);
  3897. if ($similar) {
  3898. if ($requiredVersion === null && in_array($name, $similar, true)) {
  3899. throw new \InvalidArgumentException(sprintf(
  3900. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  3901. $name,
  3902. $this->getMinimumStability($input)
  3903. ));
  3904. }
  3905. throw new \InvalidArgumentException(sprintf(
  3906. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  3907. $name,
  3908. implode("\n ", $similar)
  3909. ));
  3910. }
  3911. throw new \InvalidArgumentException(sprintf(
  3912. '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).',
  3913. $name,
  3914. $this->getMinimumStability($input)
  3915. ));
  3916. }
  3917. return array(
  3918. $package->getPrettyName(),
  3919. $versionSelector->findRecommendedRequireVersion($package),
  3920. );
  3921. }
  3922. private function findSimilar($package)
  3923. {
  3924. try {
  3925. $results = $this->repos->search($package);
  3926. } catch (\Exception $e) {
  3927. return array();
  3928. }
  3929. $similarPackages = array();
  3930. foreach ($results as $result) {
  3931. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  3932. }
  3933. asort($similarPackages);
  3934. return array_keys(array_slice($similarPackages, 0, 5));
  3935. }
  3936. }
  3937. <?php
  3938. namespace Composer\Command;
  3939. use Composer\Installer;
  3940. use Composer\Plugin\CommandEvent;
  3941. use Composer\Plugin\PluginEvents;
  3942. use Symfony\Component\Console\Input\InputInterface;
  3943. use Symfony\Component\Console\Input\InputOption;
  3944. use Symfony\Component\Console\Input\InputArgument;
  3945. use Symfony\Component\Console\Output\OutputInterface;
  3946. class InstallCommand extends BaseCommand
  3947. {
  3948. protected function configure()
  3949. {
  3950. $this
  3951. ->setName('install')
  3952. ->setAliases(array('i'))
  3953. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  3954. ->setDefinition(array(
  3955. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3956. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  3957. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  3958. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  3959. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  3960. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  3961. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  3962. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3963. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3964. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  3965. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  3966. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3967. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3968. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3969. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3970. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  3971. ))
  3972. ->setHelp(
  3973. <<<EOT
  3974. The <info>install</info> command reads the composer.lock file from
  3975. the current directory, processes it, and downloads and installs all the
  3976. libraries and dependencies outlined in that file. If the file does not
  3977. exist it will look for composer.json and do the same.
  3978. <info>php composer.phar install</info>
  3979. EOT
  3980. )
  3981. ;
  3982. }
  3983. protected function execute(InputInterface $input, OutputInterface $output)
  3984. {
  3985. $io = $this->getIO();
  3986. if ($args = $input->getArgument('packages')) {
  3987. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  3988. return 1;
  3989. }
  3990. if ($input->getOption('no-custom-installers')) {
  3991. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  3992. $input->setOption('no-plugins', true);
  3993. }
  3994. if ($input->getOption('dev')) {
  3995. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  3996. }
  3997. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3998. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3999. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  4000. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4001. $install = Installer::create($io, $composer);
  4002. $config = $composer->getConfig();
  4003. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  4004. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  4005. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4006. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  4007. $install
  4008. ->setDryRun($input->getOption('dry-run'))
  4009. ->setVerbose($input->getOption('verbose'))
  4010. ->setPreferSource($preferSource)
  4011. ->setPreferDist($preferDist)
  4012. ->setDevMode(!$input->getOption('no-dev'))
  4013. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  4014. ->setRunScripts(!$input->getOption('no-scripts'))
  4015. ->setSkipSuggest($input->getOption('no-suggest'))
  4016. ->setOptimizeAutoloader($optimize)
  4017. ->setClassMapAuthoritative($authoritative)
  4018. ->setApcuAutoloader($apcu)
  4019. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4020. ;
  4021. if ($input->getOption('no-plugins')) {
  4022. $install->disablePlugins();
  4023. }
  4024. return $install->run();
  4025. }
  4026. }
  4027. <?php
  4028. namespace Composer\Command;
  4029. use Composer\Json\JsonFile;
  4030. use Composer\Plugin\CommandEvent;
  4031. use Composer\Plugin\PluginEvents;
  4032. use Composer\Package\PackageInterface;
  4033. use Composer\Repository\RepositoryInterface;
  4034. use Symfony\Component\Console\Helper\Table;
  4035. use Symfony\Component\Console\Input\InputInterface;
  4036. use Symfony\Component\Console\Input\InputOption;
  4037. use Symfony\Component\Console\Output\OutputInterface;
  4038. class LicensesCommand extends BaseCommand
  4039. {
  4040. protected function configure()
  4041. {
  4042. $this
  4043. ->setName('licenses')
  4044. ->setDescription('Shows information about licenses of dependencies.')
  4045. ->setDefinition(array(
  4046. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4047. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  4048. ))
  4049. ->setHelp(
  4050. <<<EOT
  4051. The license command displays detailed information about the licenses of
  4052. the installed dependencies.
  4053. EOT
  4054. )
  4055. ;
  4056. }
  4057. protected function execute(InputInterface $input, OutputInterface $output)
  4058. {
  4059. $composer = $this->getComposer();
  4060. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  4061. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4062. $root = $composer->getPackage();
  4063. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4064. if ($input->getOption('no-dev')) {
  4065. $packages = $this->filterRequiredPackages($repo, $root);
  4066. } else {
  4067. $packages = $this->appendPackages($repo->getPackages(), array());
  4068. }
  4069. ksort($packages);
  4070. $io = $this->getIO();
  4071. switch ($format = $input->getOption('format')) {
  4072. case 'text':
  4073. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  4074. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  4075. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  4076. $io->write('Dependencies:');
  4077. $io->write('');
  4078. $table = new Table($output);
  4079. $table->setStyle('compact');
  4080. $tableStyle = $table->getStyle();
  4081. $tableStyle->setVerticalBorderChar('');
  4082. $tableStyle->setCellRowContentFormat('%s ');
  4083. $table->setHeaders(array('Name', 'Version', 'License'));
  4084. foreach ($packages as $package) {
  4085. $table->addRow(array(
  4086. $package->getPrettyName(),
  4087. $package->getFullPrettyVersion(),
  4088. implode(', ', $package->getLicense()) ?: 'none',
  4089. ));
  4090. }
  4091. $table->render();
  4092. break;
  4093. case 'json':
  4094. $dependencies = array();
  4095. foreach ($packages as $package) {
  4096. $dependencies[$package->getPrettyName()] = array(
  4097. 'version' => $package->getFullPrettyVersion(),
  4098. 'license' => $package->getLicense(),
  4099. );
  4100. }
  4101. $io->write(JsonFile::encode(array(
  4102. 'name' => $root->getPrettyName(),
  4103. 'version' => $root->getFullPrettyVersion(),
  4104. 'license' => $root->getLicense(),
  4105. 'dependencies' => $dependencies,
  4106. )));
  4107. break;
  4108. default:
  4109. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4110. }
  4111. }
  4112. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4113. {
  4114. $requires = array_keys($package->getRequires());
  4115. $packageListNames = array_keys($bucket);
  4116. $packages = array_filter(
  4117. $repo->getPackages(),
  4118. function ($package) use ($requires, $packageListNames) {
  4119. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4120. }
  4121. );
  4122. $bucket = $this->appendPackages($packages, $bucket);
  4123. foreach ($packages as $package) {
  4124. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4125. }
  4126. return $bucket;
  4127. }
  4128. public function appendPackages(array $packages, array $bucket)
  4129. {
  4130. foreach ($packages as $package) {
  4131. $bucket[$package->getName()] = $package;
  4132. }
  4133. return $bucket;
  4134. }
  4135. }
  4136. <?php
  4137. namespace Composer\Command;
  4138. use Symfony\Component\Console\Input\InputInterface;
  4139. use Symfony\Component\Console\Input\InputArgument;
  4140. use Symfony\Component\Console\Input\ArrayInput;
  4141. use Symfony\Component\Console\Input\InputOption;
  4142. use Symfony\Component\Console\Output\OutputInterface;
  4143. class OutdatedCommand extends ShowCommand
  4144. {
  4145. protected function configure()
  4146. {
  4147. $this
  4148. ->setName('outdated')
  4149. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4150. ->setDefinition(array(
  4151. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4152. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4153. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4154. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4155. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4156. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4157. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4158. ))
  4159. ->setHelp(
  4160. <<<EOT
  4161. The outdated command is just a proxy for `composer show -l`
  4162. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4163. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4164. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4165. compatibility breaks according to semver, so upgrade when you can but it
  4166. may involve work.
  4167. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4168. EOT
  4169. )
  4170. ;
  4171. }
  4172. protected function execute(InputInterface $input, OutputInterface $output)
  4173. {
  4174. $args = array(
  4175. 'show',
  4176. '--latest' => true,
  4177. );
  4178. if (!$input->getOption('all')) {
  4179. $args['--outdated'] = true;
  4180. }
  4181. if ($input->getOption('direct')) {
  4182. $args['--direct'] = true;
  4183. }
  4184. if ($input->getArgument('package')) {
  4185. $args['package'] = $input->getArgument('package');
  4186. }
  4187. if ($input->getOption('strict')) {
  4188. $args['--strict'] = true;
  4189. }
  4190. if ($input->getOption('minor-only')) {
  4191. $args['--minor-only'] = true;
  4192. }
  4193. $args['--format'] = $input->getOption('format');
  4194. $input = new ArrayInput($args);
  4195. return $this->getApplication()->run($input, $output);
  4196. }
  4197. public function isProxyCommand()
  4198. {
  4199. return true;
  4200. }
  4201. }
  4202. <?php
  4203. namespace Composer\Command;
  4204. use Symfony\Component\Console\Input\InputInterface;
  4205. use Symfony\Component\Console\Output\OutputInterface;
  4206. class ProhibitsCommand extends BaseDependencyCommand
  4207. {
  4208. protected function configure()
  4209. {
  4210. parent::configure();
  4211. $this
  4212. ->setName('prohibits')
  4213. ->setAliases(array('why-not'))
  4214. ->setDescription('Shows which packages prevent the given package from being installed.')
  4215. ->setHelp(
  4216. <<<EOT
  4217. Displays detailed information about why a package cannot be installed.
  4218. <info>php composer.phar prohibits composer/composer</info>
  4219. EOT
  4220. )
  4221. ;
  4222. }
  4223. protected function execute(InputInterface $input, OutputInterface $output)
  4224. {
  4225. return parent::doExecute($input, $output, true);
  4226. }
  4227. }
  4228. <?php
  4229. namespace Composer\Command;
  4230. use Composer\Config\JsonConfigSource;
  4231. use Composer\Installer;
  4232. use Composer\Plugin\CommandEvent;
  4233. use Composer\Plugin\PluginEvents;
  4234. use Composer\Json\JsonFile;
  4235. use Composer\Factory;
  4236. use Symfony\Component\Console\Input\InputInterface;
  4237. use Symfony\Component\Console\Input\InputOption;
  4238. use Symfony\Component\Console\Input\InputArgument;
  4239. use Symfony\Component\Console\Output\OutputInterface;
  4240. class RemoveCommand extends BaseCommand
  4241. {
  4242. protected function configure()
  4243. {
  4244. $this
  4245. ->setName('remove')
  4246. ->setDescription('Removes a package from the require or require-dev.')
  4247. ->setDefinition(array(
  4248. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4249. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4250. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4251. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4252. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4253. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4254. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4255. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4256. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4257. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4258. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4259. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4260. ))
  4261. ->setHelp(
  4262. <<<EOT
  4263. The <info>remove</info> command removes a package from the current
  4264. list of installed packages
  4265. <info>php composer.phar remove</info>
  4266. EOT
  4267. )
  4268. ;
  4269. }
  4270. protected function execute(InputInterface $input, OutputInterface $output)
  4271. {
  4272. $packages = $input->getArgument('packages');
  4273. $packages = array_map('strtolower', $packages);
  4274. $file = Factory::getComposerFile();
  4275. $jsonFile = new JsonFile($file);
  4276. $composer = $jsonFile->read();
  4277. $composerBackup = file_get_contents($jsonFile->getPath());
  4278. $json = new JsonConfigSource($jsonFile);
  4279. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4280. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4281. $io = $this->getIO();
  4282. if ($input->getOption('update-with-dependencies')) {
  4283. $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>');
  4284. }
  4285. foreach (array('require', 'require-dev') as $linkType) {
  4286. if (isset($composer[$linkType])) {
  4287. foreach ($composer[$linkType] as $name => $version) {
  4288. $composer[$linkType][strtolower($name)] = $name;
  4289. }
  4290. }
  4291. }
  4292. foreach ($packages as $package) {
  4293. if (isset($composer[$type][$package])) {
  4294. $json->removeLink($type, $composer[$type][$package]);
  4295. } elseif (isset($composer[$altType][$package])) {
  4296. $io->writeError('<warning>'.$composer[$altType][$package].' could not be found in '.$type.' but it is present in '.$altType.'</warning>');
  4297. if ($io->isInteractive()) {
  4298. if ($io->askConfirmation('Do you want to remove it from '.$altType.' [<comment>yes</comment>]? ', true)) {
  4299. $json->removeLink($altType, $composer[$altType][$package]);
  4300. }
  4301. }
  4302. } else {
  4303. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4304. }
  4305. }
  4306. if ($input->getOption('no-update')) {
  4307. return 0;
  4308. }
  4309. $this->resetComposer();
  4310. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4311. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4312. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4313. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4314. $install = Installer::create($io, $composer);
  4315. $updateDevMode = !$input->getOption('update-no-dev');
  4316. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4317. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4318. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4319. $install
  4320. ->setVerbose($input->getOption('verbose'))
  4321. ->setDevMode($updateDevMode)
  4322. ->setOptimizeAutoloader($optimize)
  4323. ->setClassMapAuthoritative($authoritative)
  4324. ->setApcuAutoloader($apcu)
  4325. ->setUpdate(true)
  4326. ->setUpdateWhitelist($packages)
  4327. ->setWhitelistTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4328. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4329. ->setRunScripts(!$input->getOption('no-scripts'))
  4330. ;
  4331. $status = $install->run();
  4332. if ($status !== 0) {
  4333. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4334. file_put_contents($jsonFile->getPath(), $composerBackup);
  4335. }
  4336. return $status;
  4337. }
  4338. }
  4339. <?php
  4340. namespace Composer\Command;
  4341. use Symfony\Component\Console\Input\InputInterface;
  4342. use Symfony\Component\Console\Input\InputArgument;
  4343. use Symfony\Component\Console\Input\InputOption;
  4344. use Symfony\Component\Console\Output\OutputInterface;
  4345. use Composer\Factory;
  4346. use Composer\Installer;
  4347. use Composer\Json\JsonFile;
  4348. use Composer\Json\JsonManipulator;
  4349. use Composer\Package\Version\VersionParser;
  4350. use Composer\Plugin\CommandEvent;
  4351. use Composer\Plugin\PluginEvents;
  4352. use Composer\Repository\CompositeRepository;
  4353. use Composer\Repository\PlatformRepository;
  4354. class RequireCommand extends InitCommand
  4355. {
  4356. protected function configure()
  4357. {
  4358. $this
  4359. ->setName('require')
  4360. ->setDescription('Adds required packages to your composer.json and installs them.')
  4361. ->setDefinition(array(
  4362. 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"'),
  4363. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4364. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4365. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4366. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4367. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4368. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4369. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4370. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4371. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4372. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4373. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4374. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4375. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4376. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4377. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4378. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4379. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4380. ))
  4381. ->setHelp(
  4382. <<<EOT
  4383. The require command adds required packages to your composer.json and installs them.
  4384. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4385. matches to require.
  4386. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4387. If you do not want to install the new dependencies immediately you can call it with --no-update
  4388. EOT
  4389. )
  4390. ;
  4391. }
  4392. protected function execute(InputInterface $input, OutputInterface $output)
  4393. {
  4394. $file = Factory::getComposerFile();
  4395. $io = $this->getIO();
  4396. $newlyCreated = !file_exists($file);
  4397. if ($newlyCreated && !file_put_contents($file, "{\n}\n")) {
  4398. $io->writeError('<error>'.$file.' could not be created.</error>');
  4399. return 1;
  4400. }
  4401. if (!is_readable($file)) {
  4402. $io->writeError('<error>'.$file.' is not readable.</error>');
  4403. return 1;
  4404. }
  4405. if (!is_writable($file)) {
  4406. $io->writeError('<error>'.$file.' is not writable.</error>');
  4407. return 1;
  4408. }
  4409. if (filesize($file) === 0) {
  4410. file_put_contents($file, "{\n}\n");
  4411. }
  4412. $json = new JsonFile($file);
  4413. $composerBackup = file_get_contents($json->getPath());
  4414. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4415. $repos = $composer->getRepositoryManager()->getRepositories();
  4416. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4417. $this->repos = new CompositeRepository(array_merge(
  4418. array(new PlatformRepository(array(), $platformOverrides)),
  4419. $repos
  4420. ));
  4421. if ($composer->getPackage()->getPreferStable()) {
  4422. $preferredStability = 'stable';
  4423. } else {
  4424. $preferredStability = $composer->getPackage()->getMinimumStability();
  4425. }
  4426. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4427. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability);
  4428. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4429. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4430. $requirements = $this->formatRequirements($requirements);
  4431. $versionParser = new VersionParser();
  4432. foreach ($requirements as $constraint) {
  4433. $versionParser->parseConstraints($constraint);
  4434. }
  4435. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4436. if (!$this->updateFileCleanly($json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4437. $composerDefinition = $json->read();
  4438. foreach ($requirements as $package => $version) {
  4439. $composerDefinition[$requireKey][$package] = $version;
  4440. unset($composerDefinition[$removeKey][$package]);
  4441. }
  4442. $json->write($composerDefinition);
  4443. }
  4444. $io->writeError('<info>'.$file.' has been '.($newlyCreated ? 'created' : 'updated').'</info>');
  4445. if ($input->getOption('no-update')) {
  4446. return 0;
  4447. }
  4448. $updateDevMode = !$input->getOption('update-no-dev');
  4449. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4450. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4451. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4452. $this->resetComposer();
  4453. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4454. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4455. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4456. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4457. $install = Installer::create($io, $composer);
  4458. $install
  4459. ->setVerbose($input->getOption('verbose'))
  4460. ->setPreferSource($input->getOption('prefer-source'))
  4461. ->setPreferDist($input->getOption('prefer-dist'))
  4462. ->setDevMode($updateDevMode)
  4463. ->setRunScripts(!$input->getOption('no-scripts'))
  4464. ->setSkipSuggest($input->getOption('no-suggest'))
  4465. ->setOptimizeAutoloader($optimize)
  4466. ->setClassMapAuthoritative($authoritative)
  4467. ->setApcuAutoloader($apcu)
  4468. ->setUpdate(true)
  4469. ->setUpdateWhitelist(array_keys($requirements))
  4470. ->setWhitelistTransitiveDependencies($input->getOption('update-with-dependencies'))
  4471. ->setWhitelistAllDependencies($input->getOption('update-with-all-dependencies'))
  4472. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4473. ->setPreferStable($input->getOption('prefer-stable'))
  4474. ->setPreferLowest($input->getOption('prefer-lowest'))
  4475. ;
  4476. $status = $install->run();
  4477. if ($status !== 0) {
  4478. if ($newlyCreated) {
  4479. $io->writeError("\n".'<error>Installation failed, deleting '.$file.'.</error>');
  4480. unlink($json->getPath());
  4481. } else {
  4482. $io->writeError("\n".'<error>Installation failed, reverting '.$file.' to its original content.</error>');
  4483. file_put_contents($json->getPath(), $composerBackup);
  4484. }
  4485. }
  4486. return $status;
  4487. }
  4488. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4489. {
  4490. $contents = file_get_contents($json->getPath());
  4491. $manipulator = new JsonManipulator($contents);
  4492. foreach ($new as $package => $constraint) {
  4493. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4494. return false;
  4495. }
  4496. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4497. return false;
  4498. }
  4499. }
  4500. file_put_contents($json->getPath(), $manipulator->getContents());
  4501. return true;
  4502. }
  4503. protected function interact(InputInterface $input, OutputInterface $output)
  4504. {
  4505. return;
  4506. }
  4507. }
  4508. <?php
  4509. namespace Composer\Command;
  4510. use Composer\Script\Event as ScriptEvent;
  4511. use Composer\Script\ScriptEvents;
  4512. use Composer\Util\ProcessExecutor;
  4513. use Symfony\Component\Console\Input\InputInterface;
  4514. use Symfony\Component\Console\Input\InputOption;
  4515. use Symfony\Component\Console\Input\InputArgument;
  4516. use Symfony\Component\Console\Output\OutputInterface;
  4517. use Symfony\Component\Console\Helper\Table;
  4518. class RunScriptCommand extends BaseCommand
  4519. {
  4520. protected $scriptEvents = array(
  4521. ScriptEvents::PRE_INSTALL_CMD,
  4522. ScriptEvents::POST_INSTALL_CMD,
  4523. ScriptEvents::PRE_UPDATE_CMD,
  4524. ScriptEvents::POST_UPDATE_CMD,
  4525. ScriptEvents::PRE_STATUS_CMD,
  4526. ScriptEvents::POST_STATUS_CMD,
  4527. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4528. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4529. ScriptEvents::PRE_ARCHIVE_CMD,
  4530. ScriptEvents::POST_ARCHIVE_CMD,
  4531. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4532. ScriptEvents::POST_AUTOLOAD_DUMP,
  4533. );
  4534. protected function configure()
  4535. {
  4536. $this
  4537. ->setName('run-script')
  4538. ->setDescription('Runs the scripts defined in composer.json.')
  4539. ->setDefinition(array(
  4540. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4541. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4542. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4543. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4544. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4545. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4546. ))
  4547. ->setHelp(
  4548. <<<EOT
  4549. The <info>run-script</info> command runs scripts defined in composer.json:
  4550. <info>php composer.phar run-script post-update-cmd</info>
  4551. EOT
  4552. )
  4553. ;
  4554. }
  4555. protected function execute(InputInterface $input, OutputInterface $output)
  4556. {
  4557. if ($input->getOption('list')) {
  4558. return $this->listScripts($output);
  4559. } elseif (!$input->getArgument('script')) {
  4560. throw new \RuntimeException('Missing required argument "script"');
  4561. }
  4562. $script = $input->getArgument('script');
  4563. if (!in_array($script, $this->scriptEvents)) {
  4564. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4565. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4566. }
  4567. }
  4568. $composer = $this->getComposer();
  4569. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  4570. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  4571. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  4572. if (!$hasListeners) {
  4573. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4574. }
  4575. $args = $input->getArgument('args');
  4576. if (null !== $timeout = $input->getOption('timeout')) {
  4577. if (!ctype_digit($timeout)) {
  4578. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4579. }
  4580. ProcessExecutor::setTimeout((int) $timeout);
  4581. }
  4582. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  4583. }
  4584. protected function listScripts(OutputInterface $output)
  4585. {
  4586. $scripts = $this->getComposer()->getPackage()->getScripts();
  4587. if (!count($scripts)) {
  4588. return 0;
  4589. }
  4590. $io = $this->getIO();
  4591. $io->writeError('<info>scripts:</info>');
  4592. $table = array();
  4593. foreach ($scripts as $name => $script) {
  4594. $description = '';
  4595. try {
  4596. $cmd = $this->getApplication()->find($name);
  4597. if ($cmd instanceof ScriptAliasCommand) {
  4598. $description = $cmd->getDescription();
  4599. }
  4600. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  4601. }
  4602. $table[] = array(' '.$name, $description);
  4603. }
  4604. $renderer = new Table($output);
  4605. $renderer->setStyle('compact');
  4606. $rendererStyle = $renderer->getStyle();
  4607. $rendererStyle->setVerticalBorderChar('');
  4608. $rendererStyle->setCellRowContentFormat('%s ');
  4609. $renderer->setRows($table)->render();
  4610. return 0;
  4611. }
  4612. }
  4613. <?php
  4614. namespace Composer\Command;
  4615. use Symfony\Component\Console\Input\InputInterface;
  4616. use Symfony\Component\Console\Input\InputOption;
  4617. use Symfony\Component\Console\Input\InputArgument;
  4618. use Symfony\Component\Console\Output\OutputInterface;
  4619. class ScriptAliasCommand extends BaseCommand
  4620. {
  4621. private $script;
  4622. private $description;
  4623. public function __construct($script, $description)
  4624. {
  4625. $this->script = $script;
  4626. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  4627. parent::__construct();
  4628. }
  4629. protected function configure()
  4630. {
  4631. $this
  4632. ->setName($this->script)
  4633. ->setDescription($this->description)
  4634. ->setDefinition(array(
  4635. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4636. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4637. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4638. ))
  4639. ->setHelp(
  4640. <<<EOT
  4641. The <info>run-script</info> command runs scripts defined in composer.json:
  4642. <info>php composer.phar run-script post-update-cmd</info>
  4643. EOT
  4644. )
  4645. ;
  4646. }
  4647. protected function execute(InputInterface $input, OutputInterface $output)
  4648. {
  4649. $composer = $this->getComposer();
  4650. $args = $input->getArguments();
  4651. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4652. }
  4653. }
  4654. <?php
  4655. namespace Composer\Command;
  4656. use Composer\Factory;
  4657. use Symfony\Component\Console\Input\InputInterface;
  4658. use Symfony\Component\Console\Input\InputArgument;
  4659. use Symfony\Component\Console\Input\InputOption;
  4660. use Symfony\Component\Console\Output\OutputInterface;
  4661. use Composer\Repository\CompositeRepository;
  4662. use Composer\Repository\PlatformRepository;
  4663. use Composer\Repository\RepositoryInterface;
  4664. use Composer\Plugin\CommandEvent;
  4665. use Composer\Plugin\PluginEvents;
  4666. class SearchCommand extends BaseCommand
  4667. {
  4668. protected $matches;
  4669. protected $lowMatches = array();
  4670. protected $tokens;
  4671. protected $output;
  4672. protected $onlyName;
  4673. protected function configure()
  4674. {
  4675. $this
  4676. ->setName('search')
  4677. ->setDescription('Searches for packages.')
  4678. ->setDefinition(array(
  4679. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4680. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4681. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4682. ))
  4683. ->setHelp(
  4684. <<<EOT
  4685. The search command searches for packages by its name
  4686. <info>php composer.phar search symfony composer</info>
  4687. EOT
  4688. )
  4689. ;
  4690. }
  4691. protected function execute(InputInterface $input, OutputInterface $output)
  4692. {
  4693. $platformRepo = new PlatformRepository;
  4694. $io = $this->getIO();
  4695. if (!($composer = $this->getComposer(false))) {
  4696. $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
  4697. }
  4698. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4699. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4700. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4701. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4702. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4703. $onlyName = $input->getOption('only-name');
  4704. $type = $input->getOption('type') ?: null;
  4705. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4706. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4707. foreach ($results as $result) {
  4708. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4709. }
  4710. }
  4711. }
  4712. <?php
  4713. namespace Composer\Command;
  4714. use Composer\Composer;
  4715. use Composer\Factory;
  4716. use Composer\Config;
  4717. use Composer\Util\Filesystem;
  4718. use Composer\SelfUpdate\Keys;
  4719. use Composer\SelfUpdate\Versions;
  4720. use Composer\IO\IOInterface;
  4721. use Composer\Downloader\FilesystemException;
  4722. use Symfony\Component\Console\Input\InputInterface;
  4723. use Symfony\Component\Console\Input\InputOption;
  4724. use Symfony\Component\Console\Input\InputArgument;
  4725. use Symfony\Component\Console\Output\OutputInterface;
  4726. use Symfony\Component\Finder\Finder;
  4727. class SelfUpdateCommand extends BaseCommand
  4728. {
  4729. const HOMEPAGE = 'getcomposer.org';
  4730. const OLD_INSTALL_EXT = '-old.phar';
  4731. protected function configure()
  4732. {
  4733. $this
  4734. ->setName('self-update')
  4735. ->setAliases(array('selfupdate'))
  4736. ->setDescription('Updates composer.phar to the latest version.')
  4737. ->setDefinition(array(
  4738. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4739. 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'),
  4740. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4741. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4742. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4743. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  4744. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  4745. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  4746. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  4747. ))
  4748. ->setHelp(
  4749. <<<EOT
  4750. The <info>self-update</info> command checks getcomposer.org for newer
  4751. versions of composer and if found, installs the latest.
  4752. <info>php composer.phar self-update</info>
  4753. EOT
  4754. )
  4755. ;
  4756. }
  4757. protected function execute(InputInterface $input, OutputInterface $output)
  4758. {
  4759. $config = Factory::createConfig();
  4760. if ($config->get('disable-tls') === true) {
  4761. $baseUrl = 'http://' . self::HOMEPAGE;
  4762. } else {
  4763. $baseUrl = 'https://' . self::HOMEPAGE;
  4764. }
  4765. $io = $this->getIO();
  4766. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4767. $versionsUtil = new Versions($config, $remoteFilesystem);
  4768. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  4769. if ($input->getOption($channel)) {
  4770. $versionsUtil->setChannel($channel);
  4771. }
  4772. }
  4773. if ($input->getOption('set-channel-only')) {
  4774. return 0;
  4775. }
  4776. $cacheDir = $config->get('cache-dir');
  4777. $rollbackDir = $config->get('data-dir');
  4778. $home = $config->get('home');
  4779. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4780. if ($input->getOption('update-keys')) {
  4781. return $this->fetchKeys($io, $config);
  4782. }
  4783. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4784. if (!is_writable($tmpDir)) {
  4785. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4786. }
  4787. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  4788. $composeUser = posix_getpwuid(posix_geteuid());
  4789. $homeOwner = posix_getpwuid(fileowner($home));
  4790. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  4791. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  4792. }
  4793. }
  4794. if ($input->getOption('rollback')) {
  4795. return $this->rollback($output, $rollbackDir, $localFilename);
  4796. }
  4797. $latest = $versionsUtil->getLatest();
  4798. $latestVersion = $latest['version'];
  4799. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4800. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4801. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4802. return 1;
  4803. }
  4804. if (Composer::VERSION === $updateVersion) {
  4805. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  4806. if ($input->getOption('clean-backups')) {
  4807. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  4808. }
  4809. return 0;
  4810. }
  4811. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  4812. $backupFile = sprintf(
  4813. '%s/%s-%s%s',
  4814. $rollbackDir,
  4815. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  4816. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  4817. self::OLD_INSTALL_EXT
  4818. );
  4819. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  4820. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  4821. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  4822. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  4823. $io->writeError(' ', false);
  4824. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  4825. $io->writeError('');
  4826. if (!file_exists($tempFilename) || !$signature) {
  4827. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  4828. return 1;
  4829. }
  4830. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  4831. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  4832. } else {
  4833. if (!extension_loaded('openssl')) {
  4834. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  4835. . '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.');
  4836. }
  4837. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  4838. if (!file_exists($sigFile)) {
  4839. file_put_contents(
  4840. $home.'/keys.dev.pub',
  4841. <<<DEVPUBKEY
  4842. -----BEGIN PUBLIC KEY-----
  4843. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  4844. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  4845. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  4846. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  4847. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  4848. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  4849. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  4850. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  4851. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  4852. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  4853. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  4854. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  4855. -----END PUBLIC KEY-----
  4856. DEVPUBKEY
  4857. );
  4858. file_put_contents(
  4859. $home.'/keys.tags.pub',
  4860. <<<TAGSPUBKEY
  4861. -----BEGIN PUBLIC KEY-----
  4862. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  4863. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  4864. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  4865. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  4866. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  4867. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  4868. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  4869. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  4870. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  4871. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  4872. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  4873. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  4874. -----END PUBLIC KEY-----
  4875. TAGSPUBKEY
  4876. );
  4877. }
  4878. $pubkeyid = openssl_pkey_get_public($sigFile);
  4879. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  4880. if (!in_array('SHA384', openssl_get_md_methods())) {
  4881. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  4882. }
  4883. $signature = json_decode($signature, true);
  4884. $signature = base64_decode($signature['sha384']);
  4885. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  4886. openssl_free_key($pubkeyid);
  4887. if (!$verified) {
  4888. 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');
  4889. }
  4890. }
  4891. if ($input->getOption('clean-backups')) {
  4892. $this->cleanBackups($rollbackDir);
  4893. }
  4894. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  4895. @unlink($tempFilename);
  4896. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  4897. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  4898. return 1;
  4899. }
  4900. if (file_exists($backupFile)) {
  4901. $io->writeError(sprintf(
  4902. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  4903. Composer::VERSION
  4904. ));
  4905. } else {
  4906. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  4907. }
  4908. }
  4909. protected function fetchKeys(IOInterface $io, Config $config)
  4910. {
  4911. if (!$io->isInteractive()) {
  4912. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  4913. }
  4914. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  4915. $validator = function ($value) {
  4916. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  4917. throw new \UnexpectedValueException('Invalid input');
  4918. }
  4919. return trim($value)."\n";
  4920. };
  4921. $devKey = '';
  4922. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  4923. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  4924. while ($line = $io->ask('')) {
  4925. $devKey .= trim($line)."\n";
  4926. if (trim($line) === '-----END PUBLIC KEY-----') {
  4927. break;
  4928. }
  4929. }
  4930. }
  4931. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  4932. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4933. $tagsKey = '';
  4934. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  4935. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  4936. while ($line = $io->ask('')) {
  4937. $tagsKey .= trim($line)."\n";
  4938. if (trim($line) === '-----END PUBLIC KEY-----') {
  4939. break;
  4940. }
  4941. }
  4942. }
  4943. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  4944. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4945. $io->write('Public keys stored in '.$config->get('home'));
  4946. }
  4947. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  4948. {
  4949. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  4950. if (!$rollbackVersion) {
  4951. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  4952. }
  4953. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  4954. if (!is_file($oldFile)) {
  4955. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  4956. }
  4957. if (!is_readable($oldFile)) {
  4958. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  4959. }
  4960. $io = $this->getIO();
  4961. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  4962. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  4963. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  4964. return 1;
  4965. }
  4966. return 0;
  4967. }
  4968. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  4969. {
  4970. try {
  4971. @chmod($newFilename, fileperms($localFilename));
  4972. if (!ini_get('phar.readonly')) {
  4973. $phar = new \Phar($newFilename);
  4974. unset($phar);
  4975. }
  4976. if ($backupTarget && file_exists($localFilename)) {
  4977. @copy($localFilename, $backupTarget);
  4978. }
  4979. rename($newFilename, $localFilename);
  4980. return null;
  4981. } catch (\Exception $e) {
  4982. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  4983. throw $e;
  4984. }
  4985. return $e;
  4986. }
  4987. }
  4988. protected function cleanBackups($rollbackDir, $except = null)
  4989. {
  4990. $finder = $this->getOldInstallationFinder($rollbackDir);
  4991. $io = $this->getIO();
  4992. $fs = new Filesystem;
  4993. foreach ($finder as $file) {
  4994. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  4995. continue;
  4996. }
  4997. $file = (string) $file;
  4998. $io->writeError('<info>Removing: '.$file.'</info>');
  4999. $fs->remove($file);
  5000. }
  5001. }
  5002. protected function getLastBackupVersion($rollbackDir)
  5003. {
  5004. $finder = $this->getOldInstallationFinder($rollbackDir);
  5005. $finder->sortByName();
  5006. $files = iterator_to_array($finder);
  5007. if (count($files)) {
  5008. return basename(end($files), self::OLD_INSTALL_EXT);
  5009. }
  5010. return false;
  5011. }
  5012. protected function getOldInstallationFinder($rollbackDir)
  5013. {
  5014. $finder = Finder::create()
  5015. ->depth(0)
  5016. ->files()
  5017. ->name('*' . self::OLD_INSTALL_EXT)
  5018. ->in($rollbackDir);
  5019. return $finder;
  5020. }
  5021. }
  5022. <?php
  5023. namespace Composer\Command;
  5024. use Composer\Composer;
  5025. use Composer\DependencyResolver\DefaultPolicy;
  5026. use Composer\DependencyResolver\Pool;
  5027. use Composer\Json\JsonFile;
  5028. use Composer\Package\BasePackage;
  5029. use Composer\Package\CompletePackageInterface;
  5030. use Composer\Package\PackageInterface;
  5031. use Composer\Package\Version\VersionParser;
  5032. use Composer\Package\Version\VersionSelector;
  5033. use Composer\Plugin\CommandEvent;
  5034. use Composer\Plugin\PluginEvents;
  5035. use Composer\Repository\ArrayRepository;
  5036. use Composer\Repository\ComposerRepository;
  5037. use Composer\Repository\CompositeRepository;
  5038. use Composer\Repository\PlatformRepository;
  5039. use Composer\Repository\RepositoryFactory;
  5040. use Composer\Repository\RepositoryInterface;
  5041. use Composer\Semver\Constraint\ConstraintInterface;
  5042. use Composer\Semver\Semver;
  5043. use Composer\Spdx\SpdxLicenses;
  5044. use Composer\Util\Platform;
  5045. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  5046. use Symfony\Component\Console\Input\InputArgument;
  5047. use Symfony\Component\Console\Input\InputInterface;
  5048. use Symfony\Component\Console\Input\InputOption;
  5049. use Symfony\Component\Console\Output\OutputInterface;
  5050. use Symfony\Component\Console\Terminal;
  5051. class ShowCommand extends BaseCommand
  5052. {
  5053. protected $versionParser;
  5054. protected $colors;
  5055. private $pool;
  5056. protected function configure()
  5057. {
  5058. $this
  5059. ->setName('show')
  5060. ->setAliases(array('info'))
  5061. ->setDescription('Shows information about packages.')
  5062. ->setDefinition(array(
  5063. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  5064. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  5065. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  5066. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  5067. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  5068. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  5069. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  5070. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  5071. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  5072. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  5073. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  5074. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  5075. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  5076. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  5077. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  5078. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  5079. ))
  5080. ->setHelp(
  5081. <<<EOT
  5082. The show command displays detailed information about a package, or
  5083. lists all packages available.
  5084. EOT
  5085. )
  5086. ;
  5087. }
  5088. protected function execute(InputInterface $input, OutputInterface $output)
  5089. {
  5090. $this->versionParser = new VersionParser;
  5091. if ($input->getOption('tree')) {
  5092. $this->initStyles($output);
  5093. }
  5094. $composer = $this->getComposer(false);
  5095. $io = $this->getIO();
  5096. if ($input->getOption('installed')) {
  5097. $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>');
  5098. }
  5099. if ($input->getOption('outdated')) {
  5100. $input->setOption('latest', true);
  5101. }
  5102. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  5103. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  5104. return 1;
  5105. }
  5106. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  5107. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  5108. return 1;
  5109. }
  5110. if ($input->getOption('tree') && $input->getOption('latest')) {
  5111. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  5112. return 1;
  5113. }
  5114. $format = $input->getOption('format');
  5115. if (!in_array($format, array('text', 'json'))) {
  5116. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5117. return 1;
  5118. }
  5119. $platformOverrides = array();
  5120. if ($composer) {
  5121. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  5122. }
  5123. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  5124. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  5125. if ($input->getOption('self')) {
  5126. $package = $this->getComposer()->getPackage();
  5127. $repos = $installedRepo = new ArrayRepository(array($package));
  5128. } elseif ($input->getOption('platform')) {
  5129. $repos = $installedRepo = $platformRepo;
  5130. } elseif ($input->getOption('available')) {
  5131. $installedRepo = $platformRepo;
  5132. if ($composer) {
  5133. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5134. } else {
  5135. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5136. $repos = new CompositeRepository($defaultRepos);
  5137. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5138. }
  5139. } elseif ($input->getOption('all') && $composer) {
  5140. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5141. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5142. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5143. } elseif ($input->getOption('all')) {
  5144. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5145. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5146. $installedRepo = $platformRepo;
  5147. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5148. } else {
  5149. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5150. $rootPkg = $this->getComposer()->getPackage();
  5151. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5152. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5153. }
  5154. }
  5155. if ($composer) {
  5156. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5157. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5158. }
  5159. if ($input->getOption('latest') && null === $composer) {
  5160. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5161. $input->setOption('latest', false);
  5162. }
  5163. $packageFilter = $input->getArgument('package');
  5164. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5165. if (empty($package)) {
  5166. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5167. if (empty($package)) {
  5168. $options = $input->getOptions();
  5169. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5170. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5171. }
  5172. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5173. return 1;
  5174. }
  5175. } else {
  5176. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5177. }
  5178. $exitCode = 0;
  5179. if ($input->getOption('tree')) {
  5180. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  5181. if ('json' === $format) {
  5182. $io->write(JsonFile::encode(array('installed' => array($arrayTree))));
  5183. } else {
  5184. $this->displayPackageTree(array($arrayTree));
  5185. }
  5186. } else {
  5187. $latestPackage = null;
  5188. if ($input->getOption('latest')) {
  5189. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5190. }
  5191. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5192. $exitCode = 1;
  5193. }
  5194. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  5195. $this->printLinks($package, 'requires');
  5196. $this->printLinks($package, 'devRequires', 'requires (dev)');
  5197. if ($package->getSuggests()) {
  5198. $io->write("\n<info>suggests</info>");
  5199. foreach ($package->getSuggests() as $suggested => $reason) {
  5200. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  5201. }
  5202. }
  5203. $this->printLinks($package, 'provides');
  5204. $this->printLinks($package, 'conflicts');
  5205. $this->printLinks($package, 'replaces');
  5206. }
  5207. return $exitCode;
  5208. }
  5209. if ($input->getOption('tree')) {
  5210. $rootRequires = $this->getRootRequires();
  5211. $packages = $installedRepo->getPackages();
  5212. usort($packages, 'strcmp');
  5213. $arrayTree = array();
  5214. foreach ($packages as $package) {
  5215. if (in_array($package->getName(), $rootRequires, true)) {
  5216. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  5217. }
  5218. }
  5219. if ('json' === $format) {
  5220. $io->write(JsonFile::encode(array('installed' => $arrayTree)));
  5221. } else {
  5222. $this->displayPackageTree($arrayTree);
  5223. }
  5224. return 0;
  5225. }
  5226. if ($repos instanceof CompositeRepository) {
  5227. $repos = $repos->getRepositories();
  5228. } elseif (!is_array($repos)) {
  5229. $repos = array($repos);
  5230. }
  5231. $packages = array();
  5232. if (null !== $packageFilter) {
  5233. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5234. }
  5235. $packageListFilter = array();
  5236. if ($input->getOption('direct')) {
  5237. $packageListFilter = $this->getRootRequires();
  5238. }
  5239. if (class_exists('Symfony\Component\Console\Terminal')) {
  5240. $terminal = new Terminal();
  5241. $width = $terminal->getWidth();
  5242. } else {
  5243. list($width) = $this->getApplication()->getTerminalDimensions();
  5244. }
  5245. if (null === $width) {
  5246. $width = PHP_INT_MAX;
  5247. }
  5248. if (Platform::isWindows()) {
  5249. $width--;
  5250. } else {
  5251. $width = max(80, $width);
  5252. }
  5253. if ($input->getOption('path') && null === $composer) {
  5254. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5255. $input->setOption('path', false);
  5256. }
  5257. foreach ($repos as $repo) {
  5258. if ($repo === $platformRepo) {
  5259. $type = 'platform';
  5260. } elseif (
  5261. $repo === $installedRepo
  5262. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5263. ) {
  5264. $type = 'installed';
  5265. } else {
  5266. $type = 'available';
  5267. }
  5268. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5269. foreach ($repo->getProviderNames() as $name) {
  5270. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5271. $packages[$type][$name] = $name;
  5272. }
  5273. }
  5274. } else {
  5275. foreach ($repo->getPackages() as $package) {
  5276. if (!isset($packages[$type][$package->getName()])
  5277. || !is_object($packages[$type][$package->getName()])
  5278. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5279. ) {
  5280. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5281. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5282. $packages[$type][$package->getName()] = $package;
  5283. }
  5284. }
  5285. }
  5286. }
  5287. }
  5288. }
  5289. $showAllTypes = $input->getOption('all');
  5290. $showLatest = $input->getOption('latest');
  5291. $showMinorOnly = $input->getOption('minor-only');
  5292. $indent = $showAllTypes ? ' ' : '';
  5293. $latestPackages = array();
  5294. $exitCode = 0;
  5295. $viewData = array();
  5296. $viewMetaData = array();
  5297. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5298. if (isset($packages[$type])) {
  5299. ksort($packages[$type]);
  5300. $nameLength = $versionLength = $latestLength = 0;
  5301. if ($showLatest && $showVersion) {
  5302. foreach ($packages[$type] as $package) {
  5303. if (is_object($package)) {
  5304. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5305. if ($latestPackage === false) {
  5306. continue;
  5307. }
  5308. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5309. }
  5310. }
  5311. }
  5312. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5313. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5314. $writeLatest = $writeVersion && $showLatest;
  5315. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5316. $hasOutdatedPackages = false;
  5317. $viewData[$type] = array();
  5318. foreach ($packages[$type] as $package) {
  5319. $packageViewData = array();
  5320. if (is_object($package)) {
  5321. $latestPackage = null;
  5322. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5323. $latestPackage = $latestPackages[$package->getPrettyName()];
  5324. }
  5325. if ($input->getOption('outdated') && $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5326. continue;
  5327. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5328. $hasOutdatedPackages = true;
  5329. }
  5330. $packageViewData['name'] = $package->getPrettyName();
  5331. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5332. if ($writeVersion) {
  5333. $packageViewData['version'] = $package->getFullPrettyVersion();
  5334. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5335. }
  5336. if ($writeLatest && $latestPackage) {
  5337. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5338. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5339. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5340. }
  5341. if ($writeDescription) {
  5342. $packageViewData['description'] = $package->getDescription();
  5343. }
  5344. if ($writePath) {
  5345. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5346. }
  5347. if ($latestPackage && $latestPackage->isAbandoned()) {
  5348. $replacement = is_string($latestPackage->getReplacementPackage())
  5349. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5350. : 'No replacement was suggested';
  5351. $packageWarning = sprintf(
  5352. 'Package %s is abandoned, you should avoid using it. %s.',
  5353. $package->getPrettyName(),
  5354. $replacement
  5355. );
  5356. $packageViewData['warning'] = $packageWarning;
  5357. }
  5358. } else {
  5359. $packageViewData['name'] = $package;
  5360. $nameLength = max($nameLength, strlen($package));
  5361. }
  5362. $viewData[$type][] = $packageViewData;
  5363. }
  5364. $viewMetaData[$type] = array(
  5365. 'nameLength' => $nameLength,
  5366. 'versionLength' => $versionLength,
  5367. 'latestLength' => $latestLength,
  5368. );
  5369. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5370. $exitCode = 1;
  5371. break;
  5372. }
  5373. }
  5374. }
  5375. if ('json' === $format) {
  5376. $io->write(JsonFile::encode($viewData));
  5377. } else {
  5378. foreach ($viewData as $type => $packages) {
  5379. $nameLength = $viewMetaData[$type]['nameLength'];
  5380. $versionLength = $viewMetaData[$type]['versionLength'];
  5381. $latestLength = $viewMetaData[$type]['latestLength'];
  5382. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5383. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5384. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  5385. if ($writeLatest && !$io->isDecorated()) {
  5386. $latestLength += 2;
  5387. }
  5388. if ($showAllTypes) {
  5389. if ('available' === $type) {
  5390. $io->write('<comment>' . $type . '</comment>:');
  5391. } else {
  5392. $io->write('<info>' . $type . '</info>:');
  5393. }
  5394. }
  5395. foreach ($packages as $package) {
  5396. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  5397. if (isset($package['version']) && $writeVersion) {
  5398. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  5399. }
  5400. if (isset($package['latest']) && $writeLatest) {
  5401. $latestVersion = $package['latest'];
  5402. $updateStatus = $package['latest-status'];
  5403. $style = $this->updateStatusToVersionStyle($updateStatus);
  5404. if (!$io->isDecorated()) {
  5405. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  5406. }
  5407. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  5408. }
  5409. if (isset($package['description']) && $writeDescription) {
  5410. $description = strtok($package['description'], "\r\n");
  5411. $remaining = $width - $nameLength - $versionLength - 4;
  5412. if ($writeLatest) {
  5413. $remaining -= $latestLength;
  5414. }
  5415. if (strlen($description) > $remaining) {
  5416. $description = substr($description, 0, $remaining - 3) . '...';
  5417. }
  5418. $io->write(' ' . $description, false);
  5419. }
  5420. if (isset($package['path'])) {
  5421. $io->write(' ' . $package['path'], false);
  5422. }
  5423. $io->write('');
  5424. if (isset($package['warning'])) {
  5425. $io->writeError('<warning>' . $package['warning'] . '</warning>');
  5426. }
  5427. }
  5428. if ($showAllTypes) {
  5429. $io->write('');
  5430. }
  5431. }
  5432. }
  5433. return $exitCode;
  5434. }
  5435. protected function getRootRequires()
  5436. {
  5437. $rootPackage = $this->getComposer()->getPackage();
  5438. return array_map(
  5439. 'strtolower',
  5440. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  5441. );
  5442. }
  5443. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  5444. {
  5445. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  5446. }
  5447. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  5448. {
  5449. $name = strtolower($name);
  5450. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  5451. $policy = new DefaultPolicy();
  5452. $pool = new Pool('dev');
  5453. $pool->addRepository($repos);
  5454. $matchedPackage = null;
  5455. $versions = array();
  5456. $matches = $pool->whatProvides($name, $constraint);
  5457. foreach ($matches as $index => $package) {
  5458. if ($package->getName() !== $name) {
  5459. unset($matches[$index]);
  5460. continue;
  5461. }
  5462. if (null === $version && $installedRepo->hasPackage($package)) {
  5463. $matchedPackage = $package;
  5464. }
  5465. $versions[$package->getPrettyVersion()] = $package->getVersion();
  5466. $matches[$index] = $package->getId();
  5467. }
  5468. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  5469. $matchedPackage = $pool->literalToPackage($preferred[0]);
  5470. }
  5471. return array($matchedPackage, $versions);
  5472. }
  5473. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  5474. {
  5475. $io = $this->getIO();
  5476. $io->write('<info>name</info> : ' . $package->getPrettyName());
  5477. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  5478. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  5479. $this->printVersions($package, $versions, $installedRepo);
  5480. if ($latestPackage) {
  5481. $style = $this->getVersionStyle($latestPackage, $package);
  5482. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  5483. } else {
  5484. $latestPackage = $package;
  5485. }
  5486. $io->write('<info>type</info> : ' . $package->getType());
  5487. $this->printLicenses($package);
  5488. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  5489. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  5490. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  5491. if ($latestPackage->isAbandoned()) {
  5492. $replacement = ($latestPackage->getReplacementPackage() !== null)
  5493. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  5494. : null;
  5495. $io->writeError(
  5496. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  5497. );
  5498. }
  5499. if ($package->getSupport()) {
  5500. $io->write("\n<info>support</info>");
  5501. foreach ($package->getSupport() as $type => $value) {
  5502. $io->write('<comment>' . $type . '</comment> : '.$value);
  5503. }
  5504. }
  5505. if ($package->getAutoload()) {
  5506. $io->write("\n<info>autoload</info>");
  5507. foreach ($package->getAutoload() as $type => $autoloads) {
  5508. $io->write('<comment>' . $type . '</comment>');
  5509. if ($type === 'psr-0') {
  5510. foreach ($autoloads as $name => $path) {
  5511. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5512. }
  5513. } elseif ($type === 'psr-4') {
  5514. foreach ($autoloads as $name => $path) {
  5515. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5516. }
  5517. } elseif ($type === 'classmap') {
  5518. $io->write(implode(', ', $autoloads));
  5519. }
  5520. }
  5521. if ($package->getIncludePaths()) {
  5522. $io->write('<comment>include-path</comment>');
  5523. $io->write(implode(', ', $package->getIncludePaths()));
  5524. }
  5525. }
  5526. }
  5527. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  5528. {
  5529. uasort($versions, 'version_compare');
  5530. $versions = array_keys(array_reverse($versions));
  5531. if ($installedRepo->hasPackage($package)) {
  5532. $installedVersion = $package->getPrettyVersion();
  5533. $key = array_search($installedVersion, $versions);
  5534. if (false !== $key) {
  5535. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  5536. }
  5537. }
  5538. $versions = implode(', ', $versions);
  5539. $this->getIO()->write('<info>versions</info> : ' . $versions);
  5540. }
  5541. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  5542. {
  5543. $title = $title ?: $linkType;
  5544. $io = $this->getIO();
  5545. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  5546. $io->write("\n<info>" . $title . "</info>");
  5547. foreach ($links as $link) {
  5548. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  5549. }
  5550. }
  5551. }
  5552. protected function printLicenses(CompletePackageInterface $package)
  5553. {
  5554. $spdxLicenses = new SpdxLicenses();
  5555. $licenses = $package->getLicense();
  5556. $io = $this->getIO();
  5557. foreach ($licenses as $licenseId) {
  5558. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  5559. if (!$license) {
  5560. $out = $licenseId;
  5561. } else {
  5562. if ($license[1] === true) {
  5563. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  5564. } else {
  5565. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  5566. }
  5567. }
  5568. $io->write('<info>license</info> : ' . $out);
  5569. }
  5570. }
  5571. protected function initStyles(OutputInterface $output)
  5572. {
  5573. $this->colors = array(
  5574. 'green',
  5575. 'yellow',
  5576. 'cyan',
  5577. 'magenta',
  5578. 'blue',
  5579. );
  5580. foreach ($this->colors as $color) {
  5581. $style = new OutputFormatterStyle($color);
  5582. $output->getFormatter()->setStyle($color, $style);
  5583. }
  5584. }
  5585. protected function displayPackageTree(array $arrayTree)
  5586. {
  5587. $io = $this->getIO();
  5588. foreach ($arrayTree as $package) {
  5589. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  5590. $io->write(' ' . $package['version'], false);
  5591. $io->write(' ' . strtok($package['description'], "\r\n"));
  5592. if (isset($package['requires'])) {
  5593. $requires = $package['requires'];
  5594. $treeBar = '├';
  5595. $j = 0;
  5596. $total = count($requires);
  5597. foreach ($requires as $require) {
  5598. $requireName = $require['name'];
  5599. $j++;
  5600. if ($j === $total) {
  5601. $treeBar = 'â””';
  5602. }
  5603. $level = 1;
  5604. $color = $this->colors[$level];
  5605. $info = sprintf(
  5606. '%s──<%s>%s</%s> %s',
  5607. $treeBar,
  5608. $color,
  5609. $requireName,
  5610. $color,
  5611. $require['version']
  5612. );
  5613. $this->writeTreeLine($info);
  5614. $treeBar = str_replace('â””', ' ', $treeBar);
  5615. $packagesInTree = array($package['name'], $requireName);
  5616. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  5617. }
  5618. }
  5619. }
  5620. }
  5621. protected function generatePackageTree(
  5622. PackageInterface $package,
  5623. RepositoryInterface $installedRepo,
  5624. RepositoryInterface $distantRepos
  5625. ) {
  5626. if (is_object($package)) {
  5627. $requires = $package->getRequires();
  5628. ksort($requires);
  5629. $children = array();
  5630. foreach ($requires as $requireName => $require) {
  5631. $packagesInTree = array($package->getName(), $requireName);
  5632. $treeChildDesc = array(
  5633. 'name' => $requireName,
  5634. 'version' => $require->getPrettyConstraint(),
  5635. );
  5636. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
  5637. if ($deepChildren) {
  5638. $treeChildDesc['requires'] = $deepChildren;
  5639. }
  5640. $children[] = $treeChildDesc;
  5641. }
  5642. $tree = array(
  5643. 'name' => $package->getPrettyName(),
  5644. 'version' => $package->getPrettyVersion(),
  5645. 'description' => $package->getDescription(),
  5646. );
  5647. if ($children) {
  5648. $tree['requires'] = $children;
  5649. }
  5650. return $tree;
  5651. }
  5652. }
  5653. protected function displayTree(
  5654. $package,
  5655. array $packagesInTree,
  5656. $previousTreeBar = '├',
  5657. $level = 1
  5658. ) {
  5659. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5660. if (isset($package['requires'])) {
  5661. $requires = $package['requires'];
  5662. $treeBar = $previousTreeBar . ' ├';
  5663. $i = 0;
  5664. $total = count($requires);
  5665. foreach ($requires as $require) {
  5666. $currentTree = $packagesInTree;
  5667. $i++;
  5668. if ($i === $total) {
  5669. $treeBar = $previousTreeBar . ' â””';
  5670. }
  5671. $colorIdent = $level % count($this->colors);
  5672. $color = $this->colors[$colorIdent];
  5673. $circularWarn = in_array(
  5674. $require['name'],
  5675. $currentTree,
  5676. true
  5677. ) ? '(circular dependency aborted here)' : '';
  5678. $info = rtrim(sprintf(
  5679. '%s──<%s>%s</%s> %s %s',
  5680. $treeBar,
  5681. $color,
  5682. $require['name'],
  5683. $color,
  5684. $require['version'],
  5685. $circularWarn
  5686. ));
  5687. $this->writeTreeLine($info);
  5688. $treeBar = str_replace('â””', ' ', $treeBar);
  5689. $currentTree[] = $require['name'];
  5690. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  5691. }
  5692. }
  5693. }
  5694. protected function addTree(
  5695. $name,
  5696. $package,
  5697. RepositoryInterface $installedRepo,
  5698. RepositoryInterface $distantRepos,
  5699. array $packagesInTree
  5700. ) {
  5701. $children = array();
  5702. list($package, $versions) = $this->getPackage(
  5703. $installedRepo,
  5704. $distantRepos,
  5705. $name,
  5706. $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint()
  5707. );
  5708. if (is_object($package)) {
  5709. $requires = $package->getRequires();
  5710. ksort($requires);
  5711. foreach ($requires as $requireName => $require) {
  5712. $currentTree = $packagesInTree;
  5713. $treeChildDesc = array(
  5714. 'name' => $requireName,
  5715. 'version' => $require->getPrettyConstraint(),
  5716. );
  5717. if (!in_array($requireName, $currentTree, true)) {
  5718. $currentTree[] = $requireName;
  5719. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $currentTree);
  5720. if ($deepChildren) {
  5721. $treeChildDesc['requires'] = $deepChildren;
  5722. }
  5723. }
  5724. $children[] = $treeChildDesc;
  5725. }
  5726. }
  5727. return $children;
  5728. }
  5729. private function updateStatusToVersionStyle($updateStatus)
  5730. {
  5731. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  5732. }
  5733. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  5734. {
  5735. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  5736. return 'up-to-date';
  5737. }
  5738. $constraint = $package->getVersion();
  5739. if (0 !== strpos($constraint, 'dev-')) {
  5740. $constraint = '^'.$constraint;
  5741. }
  5742. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  5743. return 'semver-safe-update';
  5744. }
  5745. return 'update-possible';
  5746. }
  5747. private function writeTreeLine($line)
  5748. {
  5749. $io = $this->getIO();
  5750. if (!$io->isDecorated()) {
  5751. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  5752. }
  5753. $io->write($line);
  5754. }
  5755. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  5756. {
  5757. $name = $package->getName();
  5758. $versionSelector = new VersionSelector($this->getPool($composer));
  5759. $stability = $composer->getPackage()->getMinimumStability();
  5760. $flags = $composer->getPackage()->getStabilityFlags();
  5761. if (isset($flags[$name])) {
  5762. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  5763. }
  5764. $bestStability = $stability;
  5765. if ($composer->getPackage()->getPreferStable()) {
  5766. $bestStability = $package->getStability();
  5767. }
  5768. $targetVersion = null;
  5769. if (0 === strpos($package->getVersion(), 'dev-')) {
  5770. $targetVersion = $package->getVersion();
  5771. }
  5772. if ($targetVersion === null && $minorOnly) {
  5773. $targetVersion = '^' . $package->getVersion();
  5774. }
  5775. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  5776. }
  5777. private function getPool(Composer $composer)
  5778. {
  5779. if (!$this->pool) {
  5780. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  5781. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  5782. }
  5783. return $this->pool;
  5784. }
  5785. }
  5786. <?php
  5787. namespace Composer\Command;
  5788. use Symfony\Component\Console\Input\InputInterface;
  5789. use Symfony\Component\Console\Input\InputOption;
  5790. use Symfony\Component\Console\Output\OutputInterface;
  5791. use Composer\Downloader\ChangeReportInterface;
  5792. use Composer\Downloader\DvcsDownloaderInterface;
  5793. use Composer\Downloader\VcsCapableDownloaderInterface;
  5794. use Composer\Package\Dumper\ArrayDumper;
  5795. use Composer\Package\Version\VersionGuesser;
  5796. use Composer\Package\Version\VersionParser;
  5797. use Composer\Plugin\CommandEvent;
  5798. use Composer\Plugin\PluginEvents;
  5799. use Composer\Script\ScriptEvents;
  5800. use Composer\Util\ProcessExecutor;
  5801. class StatusCommand extends BaseCommand
  5802. {
  5803. const EXIT_CODE_ERRORS = 1;
  5804. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  5805. const EXIT_CODE_VERSION_CHANGES = 4;
  5806. protected function configure()
  5807. {
  5808. $this
  5809. ->setName('status')
  5810. ->setDescription('Shows a list of locally modified packages, for packages installed from source.')
  5811. ->setDefinition(array(
  5812. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  5813. ))
  5814. ->setHelp(
  5815. <<<EOT
  5816. The status command displays a list of dependencies that have
  5817. been modified locally.
  5818. EOT
  5819. )
  5820. ;
  5821. }
  5822. protected function execute(InputInterface $input, OutputInterface $output)
  5823. {
  5824. $composer = $this->getComposer();
  5825. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  5826. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5827. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  5828. $dm = $composer->getDownloadManager();
  5829. $im = $composer->getInstallationManager();
  5830. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  5831. $errors = array();
  5832. $io = $this->getIO();
  5833. $unpushedChanges = array();
  5834. $vcsVersionChanges = array();
  5835. $parser = new VersionParser;
  5836. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  5837. $dumper = new ArrayDumper;
  5838. foreach ($installedRepo->getCanonicalPackages() as $package) {
  5839. $downloader = $dm->getDownloaderForInstalledPackage($package);
  5840. $targetDir = $im->getInstallPath($package);
  5841. if ($downloader instanceof ChangeReportInterface) {
  5842. if (is_link($targetDir)) {
  5843. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  5844. }
  5845. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  5846. $errors[$targetDir] = $changes;
  5847. }
  5848. }
  5849. if ($downloader instanceof VcsCapableDownloaderInterface) {
  5850. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  5851. switch ($package->getInstallationSource()) {
  5852. case 'source':
  5853. $previousRef = $package->getSourceReference();
  5854. break;
  5855. case 'dist':
  5856. $previousRef = $package->getDistReference();
  5857. break;
  5858. default:
  5859. $previousRef = null;
  5860. }
  5861. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  5862. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  5863. $vcsVersionChanges[$targetDir] = array(
  5864. 'previous' => array(
  5865. 'version' => $package->getPrettyVersion(),
  5866. 'ref' => $previousRef,
  5867. ),
  5868. 'current' => array(
  5869. 'version' => $currentVersion['pretty_version'],
  5870. 'ref' => $currentVersion['commit'],
  5871. ),
  5872. );
  5873. }
  5874. }
  5875. }
  5876. if ($downloader instanceof DvcsDownloaderInterface) {
  5877. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  5878. $unpushedChanges[$targetDir] = $unpushed;
  5879. }
  5880. }
  5881. }
  5882. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  5883. $io->writeError('<info>No local changes</info>');
  5884. return 0;
  5885. }
  5886. if ($errors) {
  5887. $io->writeError('<error>You have changes in the following dependencies:</error>');
  5888. foreach ($errors as $path => $changes) {
  5889. if ($input->getOption('verbose')) {
  5890. $indentedChanges = implode("\n", array_map(function ($line) {
  5891. return ' ' . ltrim($line);
  5892. }, explode("\n", $changes)));
  5893. $io->write('<info>'.$path.'</info>:');
  5894. $io->write($indentedChanges);
  5895. } else {
  5896. $io->write($path);
  5897. }
  5898. }
  5899. }
  5900. if ($unpushedChanges) {
  5901. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  5902. foreach ($unpushedChanges as $path => $changes) {
  5903. if ($input->getOption('verbose')) {
  5904. $indentedChanges = implode("\n", array_map(function ($line) {
  5905. return ' ' . ltrim($line);
  5906. }, explode("\n", $changes)));
  5907. $io->write('<info>'.$path.'</info>:');
  5908. $io->write($indentedChanges);
  5909. } else {
  5910. $io->write($path);
  5911. }
  5912. }
  5913. }
  5914. if ($vcsVersionChanges) {
  5915. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  5916. foreach ($vcsVersionChanges as $path => $changes) {
  5917. if ($input->getOption('verbose')) {
  5918. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  5919. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  5920. if ($io->isVeryVerbose()) {
  5921. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  5922. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  5923. }
  5924. $io->write('<info>'.$path.'</info>:');
  5925. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  5926. } else {
  5927. $io->write($path);
  5928. }
  5929. }
  5930. }
  5931. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  5932. $io->writeError('Use --verbose (-v) to see a list of files');
  5933. }
  5934. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  5935. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  5936. }
  5937. }
  5938. <?php
  5939. namespace Composer\Command;
  5940. use Composer\Repository\PlatformRepository;
  5941. use Symfony\Component\Console\Input\InputArgument;
  5942. use Symfony\Component\Console\Input\InputInterface;
  5943. use Symfony\Component\Console\Input\InputOption;
  5944. use Symfony\Component\Console\Output\OutputInterface;
  5945. class SuggestsCommand extends BaseCommand
  5946. {
  5947. protected function configure()
  5948. {
  5949. $this
  5950. ->setName('suggests')
  5951. ->setDescription('Shows package suggestions.')
  5952. ->setDefinition(array(
  5953. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  5954. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  5955. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  5956. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  5957. ))
  5958. ->setHelp(
  5959. <<<EOT
  5960. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  5961. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  5962. EOT
  5963. )
  5964. ;
  5965. }
  5966. protected function execute(InputInterface $input, OutputInterface $output)
  5967. {
  5968. $lock = $this->getComposer()->getLocker()->getLockData();
  5969. if (empty($lock)) {
  5970. throw new \RuntimeException('Lockfile seems to be empty?');
  5971. }
  5972. $packages = $lock['packages'];
  5973. if (!$input->getOption('no-dev')) {
  5974. $packages += $lock['packages-dev'];
  5975. }
  5976. $filter = $input->getArgument('packages');
  5977. $installed = array();
  5978. foreach ($packages as $package) {
  5979. $installed[] = $package['name'];
  5980. if (!empty($package['provide'])) {
  5981. $installed = array_merge($installed, array_keys($package['provide']));
  5982. }
  5983. if (!empty($package['replace'])) {
  5984. $installed = array_merge($installed, array_keys($package['replace']));
  5985. }
  5986. }
  5987. $installed = array_flip($installed);
  5988. ksort($installed);
  5989. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  5990. $suggesters = array();
  5991. $suggested = array();
  5992. foreach ($packages as $package) {
  5993. $packageName = $package['name'];
  5994. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  5995. continue;
  5996. }
  5997. foreach ($package['suggest'] as $suggestion => $reason) {
  5998. if (false === strpos('/', $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  5999. continue;
  6000. }
  6001. if (!isset($installed[$suggestion])) {
  6002. $suggesters[$packageName][$suggestion] = $reason;
  6003. $suggested[$suggestion][$packageName] = $reason;
  6004. }
  6005. }
  6006. }
  6007. ksort($suggesters);
  6008. ksort($suggested);
  6009. $mode = 0;
  6010. $io = $this->getIO();
  6011. if ($input->getOption('by-package') || $io->isVerbose()) {
  6012. $mode |= 1;
  6013. }
  6014. if ($input->getOption('by-suggestion')) {
  6015. $mode |= 2;
  6016. }
  6017. if ($mode === 0) {
  6018. foreach (array_keys($suggested) as $suggestion) {
  6019. $io->write(sprintf('<info>%s</info>', $suggestion));
  6020. }
  6021. return;
  6022. }
  6023. if ($mode & 1) {
  6024. foreach ($suggesters as $suggester => $suggestions) {
  6025. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  6026. foreach ($suggestions as $suggestion => $reason) {
  6027. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  6028. }
  6029. $io->write('');
  6030. }
  6031. }
  6032. if ($mode & 2) {
  6033. if ($mode & 1) {
  6034. $io->write(str_repeat('-', 78));
  6035. }
  6036. foreach ($suggested as $suggestion => $suggesters) {
  6037. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  6038. foreach ($suggesters as $suggester => $reason) {
  6039. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  6040. }
  6041. $io->write('');
  6042. }
  6043. }
  6044. }
  6045. }
  6046. <?php
  6047. namespace Composer\Command;
  6048. use Composer\Composer;
  6049. use Composer\Installer;
  6050. use Composer\IO\IOInterface;
  6051. use Composer\Plugin\CommandEvent;
  6052. use Composer\Plugin\PluginEvents;
  6053. use Symfony\Component\Console\Helper\Table;
  6054. use Symfony\Component\Console\Input\InputInterface;
  6055. use Symfony\Component\Console\Input\InputOption;
  6056. use Symfony\Component\Console\Input\InputArgument;
  6057. use Symfony\Component\Console\Output\OutputInterface;
  6058. use Symfony\Component\Console\Question\Question;
  6059. class UpdateCommand extends BaseCommand
  6060. {
  6061. protected function configure()
  6062. {
  6063. $this
  6064. ->setName('update')
  6065. ->setAliases(array('u', 'upgrade'))
  6066. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  6067. ->setDefinition(array(
  6068. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  6069. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6070. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  6071. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6072. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  6073. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  6074. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  6075. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  6076. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6077. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  6078. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6079. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  6080. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of whitelisted packages to the whitelist, except those defined in root package.'),
  6081. 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.'),
  6082. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  6083. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  6084. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6085. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6086. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  6087. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  6088. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  6089. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  6090. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  6091. ))
  6092. ->setHelp(
  6093. <<<EOT
  6094. The <info>update</info> command reads the composer.json file from the
  6095. current directory, processes it, and updates, removes or installs all the
  6096. dependencies.
  6097. <info>php composer.phar update</info>
  6098. To limit the update operation to a few packages, you can list the package(s)
  6099. you want to update as such:
  6100. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  6101. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  6102. from a specific vendor:
  6103. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  6104. To select packages names interactively with auto-completion use <info>-i</info>.
  6105. EOT
  6106. )
  6107. ;
  6108. }
  6109. protected function execute(InputInterface $input, OutputInterface $output)
  6110. {
  6111. $io = $this->getIO();
  6112. if ($input->getOption('no-custom-installers')) {
  6113. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  6114. $input->setOption('no-plugins', true);
  6115. }
  6116. if ($input->getOption('dev')) {
  6117. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  6118. }
  6119. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  6120. $packages = $input->getArgument('packages');
  6121. if ($input->getOption('interactive')) {
  6122. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  6123. }
  6124. if ($input->getOption('root-reqs')) {
  6125. $require = array_keys($composer->getPackage()->getRequires());
  6126. if (!$input->getOption('no-dev')) {
  6127. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  6128. $require = array_merge($require, $requireDev);
  6129. }
  6130. if (!empty($packages)) {
  6131. $packages = array_intersect($packages, $require);
  6132. } else {
  6133. $packages = $require;
  6134. }
  6135. }
  6136. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  6137. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  6138. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6139. $install = Installer::create($io, $composer);
  6140. $config = $composer->getConfig();
  6141. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  6142. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6143. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6144. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6145. $install
  6146. ->setDryRun($input->getOption('dry-run'))
  6147. ->setVerbose($input->getOption('verbose'))
  6148. ->setPreferSource($preferSource)
  6149. ->setPreferDist($preferDist)
  6150. ->setDevMode(!$input->getOption('no-dev'))
  6151. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  6152. ->setRunScripts(!$input->getOption('no-scripts'))
  6153. ->setSkipSuggest($input->getOption('no-suggest'))
  6154. ->setOptimizeAutoloader($optimize)
  6155. ->setClassMapAuthoritative($authoritative)
  6156. ->setApcuAutoloader($apcu)
  6157. ->setUpdate(true)
  6158. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  6159. ->setWhitelistTransitiveDependencies($input->getOption('with-dependencies'))
  6160. ->setWhitelistAllDependencies($input->getOption('with-all-dependencies'))
  6161. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  6162. ->setPreferStable($input->getOption('prefer-stable'))
  6163. ->setPreferLowest($input->getOption('prefer-lowest'))
  6164. ;
  6165. if ($input->getOption('no-plugins')) {
  6166. $install->disablePlugins();
  6167. }
  6168. return $install->run();
  6169. }
  6170. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  6171. {
  6172. if (!$input->isInteractive()) {
  6173. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  6174. }
  6175. $requires = array_merge(
  6176. $composer->getPackage()->getRequires(),
  6177. $composer->getPackage()->getDevRequires()
  6178. );
  6179. $autocompleterValues = array();
  6180. foreach ($requires as $require) {
  6181. $target = $require->getTarget();
  6182. $autocompleterValues[strtolower($target)] = $target;
  6183. }
  6184. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  6185. foreach ($installedPackages as $package) {
  6186. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  6187. }
  6188. $helper = $this->getHelper('question');
  6189. $question = new Question('<comment>Enter package name: </comment>', null);
  6190. $io->writeError('<info>Press enter without value to end submission</info>');
  6191. do {
  6192. $autocompleterValues = array_diff($autocompleterValues, $packages);
  6193. $question->setAutocompleterValues($autocompleterValues);
  6194. $addedPackage = $helper->ask($input, $output, $question);
  6195. if (!is_string($addedPackage) || empty($addedPackage)) {
  6196. break;
  6197. }
  6198. $addedPackage = strtolower($addedPackage);
  6199. if (!in_array($addedPackage, $packages)) {
  6200. $packages[] = $addedPackage;
  6201. }
  6202. } while (true);
  6203. $packages = array_filter($packages);
  6204. if (!$packages) {
  6205. throw new \InvalidArgumentException('You must enter minimum one package.');
  6206. }
  6207. $table = new Table($output);
  6208. $table->setHeaders(array('Selected packages'));
  6209. foreach ($packages as $package) {
  6210. $table->addRow(array($package));
  6211. }
  6212. $table->render();
  6213. if ($io->askConfirmation(sprintf(
  6214. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  6215. 1 === count($packages) ? '' : 's'
  6216. ), true)) {
  6217. return $packages;
  6218. }
  6219. throw new \RuntimeException('Installation aborted.');
  6220. }
  6221. }
  6222. <?php
  6223. namespace Composer\Command;
  6224. use Composer\Factory;
  6225. use Composer\Package\Loader\ValidatingArrayLoader;
  6226. use Composer\Plugin\CommandEvent;
  6227. use Composer\Plugin\PluginEvents;
  6228. use Composer\Util\ConfigValidator;
  6229. use Symfony\Component\Console\Input\InputArgument;
  6230. use Symfony\Component\Console\Input\InputInterface;
  6231. use Symfony\Component\Console\Input\InputOption;
  6232. use Symfony\Component\Console\Output\OutputInterface;
  6233. class ValidateCommand extends BaseCommand
  6234. {
  6235. protected function configure()
  6236. {
  6237. $this
  6238. ->setName('validate')
  6239. ->setDescription('Validates a composer.json and composer.lock.')
  6240. ->setDefinition(array(
  6241. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not make a complete validation'),
  6242. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  6243. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  6244. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  6245. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  6246. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  6247. ))
  6248. ->setHelp(
  6249. <<<EOT
  6250. The validate command validates a given composer.json and composer.lock
  6251. Exit codes in case of errors are:
  6252. 1 validation warning(s), only when --strict is given
  6253. 2 validation error(s)
  6254. 3 file unreadable or missing
  6255. EOT
  6256. );
  6257. }
  6258. protected function execute(InputInterface $input, OutputInterface $output)
  6259. {
  6260. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  6261. $io = $this->getIO();
  6262. if (!file_exists($file)) {
  6263. $io->writeError('<error>' . $file . ' not found.</error>');
  6264. return 3;
  6265. }
  6266. if (!is_readable($file)) {
  6267. $io->writeError('<error>' . $file . ' is not readable.</error>');
  6268. return 3;
  6269. }
  6270. $validator = new ConfigValidator($io);
  6271. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  6272. $checkPublish = !$input->getOption('no-check-publish');
  6273. $checkLock = !$input->getOption('no-check-lock');
  6274. $isStrict = $input->getOption('strict');
  6275. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6276. $lockErrors = array();
  6277. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  6278. $locker = $composer->getLocker();
  6279. if ($locker->isLocked() && !$locker->isFresh()) {
  6280. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  6281. }
  6282. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  6283. $exitCode = $errors || ($publishErrors && $checkPublish) || ($lockErrors && $checkLock) ? 2 : ($isStrict && $warnings ? 1 : 0);
  6284. if ($input->getOption('with-dependencies')) {
  6285. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6286. foreach ($localRepo->getPackages() as $package) {
  6287. $path = $composer->getInstallationManager()->getInstallPath($package);
  6288. $file = $path . '/composer.json';
  6289. if (is_dir($path) && file_exists($file)) {
  6290. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6291. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  6292. $depCode = $errors || ($publishErrors && $checkPublish) ? 2 : ($isStrict && $warnings ? 1 : 0);
  6293. $exitCode = max($depCode, $exitCode);
  6294. }
  6295. }
  6296. }
  6297. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  6298. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6299. $exitCode = max($eventCode, $exitCode);
  6300. return $exitCode;
  6301. }
  6302. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  6303. {
  6304. if (!$errors && !$publishErrors && !$warnings) {
  6305. $io->write('<info>' . $name . ' is valid</info>');
  6306. } elseif (!$errors && !$publishErrors) {
  6307. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  6308. if ($printSchemaUrl) {
  6309. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6310. }
  6311. } elseif (!$errors) {
  6312. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  6313. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  6314. if ($printSchemaUrl) {
  6315. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6316. }
  6317. } else {
  6318. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  6319. }
  6320. if ($checkPublish) {
  6321. $errors = array_merge($errors, $publishErrors);
  6322. } else {
  6323. $warnings = array_merge($warnings, $publishErrors);
  6324. }
  6325. if ($checkLock) {
  6326. $errors = array_merge($errors, $lockErrors);
  6327. } else {
  6328. $warnings = array_merge($warnings, $lockErrors);
  6329. }
  6330. $messages = array(
  6331. 'error' => $errors,
  6332. 'warning' => $warnings,
  6333. );
  6334. foreach ($messages as $style => $msgs) {
  6335. foreach ($msgs as $msg) {
  6336. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  6337. }
  6338. }
  6339. }
  6340. }
  6341. <?php
  6342. namespace Composer;
  6343. use Composer\Package\RootPackageInterface;
  6344. use Composer\Package\Locker;
  6345. use Composer\Repository\RepositoryManager;
  6346. use Composer\Installer\InstallationManager;
  6347. use Composer\Plugin\PluginManager;
  6348. use Composer\Downloader\DownloadManager;
  6349. use Composer\EventDispatcher\EventDispatcher;
  6350. use Composer\Autoload\AutoloadGenerator;
  6351. use Composer\Package\Archiver\ArchiveManager;
  6352. class Composer
  6353. {
  6354. const VERSION = '1.7.2';
  6355. const BRANCH_ALIAS_VERSION = '';
  6356. const RELEASE_DATE = '2018-08-16 16:57:12';
  6357. private $package;
  6358. private $locker;
  6359. private $repositoryManager;
  6360. private $downloadManager;
  6361. private $installationManager;
  6362. private $pluginManager;
  6363. private $config;
  6364. private $eventDispatcher;
  6365. private $autoloadGenerator;
  6366. private $archiveManager;
  6367. public function setPackage(RootPackageInterface $package)
  6368. {
  6369. $this->package = $package;
  6370. }
  6371. public function getPackage()
  6372. {
  6373. return $this->package;
  6374. }
  6375. public function setConfig(Config $config)
  6376. {
  6377. $this->config = $config;
  6378. }
  6379. public function getConfig()
  6380. {
  6381. return $this->config;
  6382. }
  6383. public function setLocker(Locker $locker)
  6384. {
  6385. $this->locker = $locker;
  6386. }
  6387. public function getLocker()
  6388. {
  6389. return $this->locker;
  6390. }
  6391. public function setRepositoryManager(RepositoryManager $manager)
  6392. {
  6393. $this->repositoryManager = $manager;
  6394. }
  6395. public function getRepositoryManager()
  6396. {
  6397. return $this->repositoryManager;
  6398. }
  6399. public function setDownloadManager(DownloadManager $manager)
  6400. {
  6401. $this->downloadManager = $manager;
  6402. }
  6403. public function getDownloadManager()
  6404. {
  6405. return $this->downloadManager;
  6406. }
  6407. public function setArchiveManager(ArchiveManager $manager)
  6408. {
  6409. $this->archiveManager = $manager;
  6410. }
  6411. public function getArchiveManager()
  6412. {
  6413. return $this->archiveManager;
  6414. }
  6415. public function setInstallationManager(InstallationManager $manager)
  6416. {
  6417. $this->installationManager = $manager;
  6418. }
  6419. public function getInstallationManager()
  6420. {
  6421. return $this->installationManager;
  6422. }
  6423. public function setPluginManager(PluginManager $manager)
  6424. {
  6425. $this->pluginManager = $manager;
  6426. }
  6427. public function getPluginManager()
  6428. {
  6429. return $this->pluginManager;
  6430. }
  6431. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  6432. {
  6433. $this->eventDispatcher = $eventDispatcher;
  6434. }
  6435. public function getEventDispatcher()
  6436. {
  6437. return $this->eventDispatcher;
  6438. }
  6439. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  6440. {
  6441. $this->autoloadGenerator = $autoloadGenerator;
  6442. }
  6443. public function getAutoloadGenerator()
  6444. {
  6445. return $this->autoloadGenerator;
  6446. }
  6447. }
  6448. <?php
  6449. namespace Composer;
  6450. use Composer\Config\ConfigSourceInterface;
  6451. use Composer\Downloader\TransportException;
  6452. use Composer\IO\IOInterface;
  6453. use Composer\Util\Platform;
  6454. class Config
  6455. {
  6456. const RELATIVE_PATHS = 1;
  6457. public static $defaultConfig = array(
  6458. 'process-timeout' => 300,
  6459. 'use-include-path' => false,
  6460. 'preferred-install' => 'auto',
  6461. 'notify-on-install' => true,
  6462. 'github-protocols' => array('https', 'ssh', 'git'),
  6463. 'vendor-dir' => 'vendor',
  6464. 'bin-dir' => '{$vendor-dir}/bin',
  6465. 'cache-dir' => '{$home}/cache',
  6466. 'data-dir' => '{$home}',
  6467. 'cache-files-dir' => '{$cache-dir}/files',
  6468. 'cache-repo-dir' => '{$cache-dir}/repo',
  6469. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  6470. 'cache-ttl' => 15552000,
  6471. 'cache-files-ttl' => null,
  6472. 'cache-files-maxsize' => '300MiB',
  6473. 'bin-compat' => 'auto',
  6474. 'discard-changes' => false,
  6475. 'autoloader-suffix' => null,
  6476. 'sort-packages' => false,
  6477. 'optimize-autoloader' => false,
  6478. 'classmap-authoritative' => false,
  6479. 'apcu-autoloader' => false,
  6480. 'prepend-autoloader' => true,
  6481. 'github-domains' => array('github.com'),
  6482. 'bitbucket-expose-hostname' => true,
  6483. 'disable-tls' => false,
  6484. 'secure-http' => true,
  6485. 'cafile' => null,
  6486. 'capath' => null,
  6487. 'github-expose-hostname' => true,
  6488. 'gitlab-domains' => array('gitlab.com'),
  6489. 'store-auths' => 'prompt',
  6490. 'platform' => array(),
  6491. 'archive-format' => 'tar',
  6492. 'archive-dir' => '.',
  6493. 'htaccess-protect' => true,
  6494. );
  6495. public static $defaultRepositories = array(
  6496. 'packagist.org' => array(
  6497. 'type' => 'composer',
  6498. 'url' => 'https?://repo.packagist.org',
  6499. 'allow_ssl_downgrade' => true,
  6500. ),
  6501. );
  6502. private $config;
  6503. private $baseDir;
  6504. private $repositories;
  6505. private $configSource;
  6506. private $authConfigSource;
  6507. private $useEnvironment;
  6508. private $warnedHosts = array();
  6509. public function __construct($useEnvironment = true, $baseDir = null)
  6510. {
  6511. $this->config = static::$defaultConfig;
  6512. $this->repositories = static::$defaultRepositories;
  6513. $this->useEnvironment = (bool) $useEnvironment;
  6514. $this->baseDir = $baseDir;
  6515. }
  6516. public function setConfigSource(ConfigSourceInterface $source)
  6517. {
  6518. $this->configSource = $source;
  6519. }
  6520. public function getConfigSource()
  6521. {
  6522. return $this->configSource;
  6523. }
  6524. public function setAuthConfigSource(ConfigSourceInterface $source)
  6525. {
  6526. $this->authConfigSource = $source;
  6527. }
  6528. public function getAuthConfigSource()
  6529. {
  6530. return $this->authConfigSource;
  6531. }
  6532. public function merge($config)
  6533. {
  6534. if (!empty($config['config']) && is_array($config['config'])) {
  6535. foreach ($config['config'] as $key => $val) {
  6536. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic')) && isset($this->config[$key])) {
  6537. $this->config[$key] = array_merge($this->config[$key], $val);
  6538. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  6539. if (is_array($val) || is_array($this->config[$key])) {
  6540. if (is_string($val)) {
  6541. $val = array('*' => $val);
  6542. }
  6543. if (is_string($this->config[$key])) {
  6544. $this->config[$key] = array('*' => $this->config[$key]);
  6545. }
  6546. $this->config[$key] = array_merge($this->config[$key], $val);
  6547. if (isset($this->config[$key]['*'])) {
  6548. $wildcard = $this->config[$key]['*'];
  6549. unset($this->config[$key]['*']);
  6550. $this->config[$key]['*'] = $wildcard;
  6551. }
  6552. } else {
  6553. $this->config[$key] = $val;
  6554. }
  6555. } else {
  6556. $this->config[$key] = $val;
  6557. }
  6558. }
  6559. }
  6560. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  6561. $this->repositories = array_reverse($this->repositories, true);
  6562. $newRepos = array_reverse($config['repositories'], true);
  6563. foreach ($newRepos as $name => $repository) {
  6564. if (false === $repository) {
  6565. $this->disableRepoByName($name);
  6566. continue;
  6567. }
  6568. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  6569. $this->disableRepoByName(key($repository));
  6570. continue;
  6571. }
  6572. if (is_int($name)) {
  6573. $this->repositories[] = $repository;
  6574. } else {
  6575. if ($name === 'packagist') {
  6576. $this->repositories[$name . '.org'] = $repository;
  6577. } else {
  6578. $this->repositories[$name] = $repository;
  6579. }
  6580. }
  6581. }
  6582. $this->repositories = array_reverse($this->repositories, true);
  6583. }
  6584. }
  6585. public function getRepositories()
  6586. {
  6587. return $this->repositories;
  6588. }
  6589. public function get($key, $flags = 0)
  6590. {
  6591. switch ($key) {
  6592. case 'vendor-dir':
  6593. case 'bin-dir':
  6594. case 'process-timeout':
  6595. case 'data-dir':
  6596. case 'cache-dir':
  6597. case 'cache-files-dir':
  6598. case 'cache-repo-dir':
  6599. case 'cache-vcs-dir':
  6600. case 'cafile':
  6601. case 'capath':
  6602. case 'htaccess-protect':
  6603. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  6604. $val = $this->getComposerEnv($env);
  6605. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  6606. $val = Platform::expandPath($val);
  6607. if (substr($key, -4) !== '-dir') {
  6608. return $val;
  6609. }
  6610. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  6611. case 'cache-ttl':
  6612. return (int) $this->config[$key];
  6613. case 'cache-files-maxsize':
  6614. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  6615. throw new \RuntimeException(
  6616. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  6617. );
  6618. }
  6619. $size = $matches[1];
  6620. if (isset($matches[2])) {
  6621. switch (strtolower($matches[2])) {
  6622. case 'g':
  6623. $size *= 1024;
  6624. case 'm':
  6625. $size *= 1024;
  6626. case 'k':
  6627. $size *= 1024;
  6628. break;
  6629. }
  6630. }
  6631. return $size;
  6632. case 'cache-files-ttl':
  6633. if (isset($this->config[$key])) {
  6634. return (int) $this->config[$key];
  6635. }
  6636. return (int) $this->config['cache-ttl'];
  6637. case 'home':
  6638. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  6639. return rtrim($this->process($val, $flags), '/\\');
  6640. case 'bin-compat':
  6641. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  6642. if (!in_array($value, array('auto', 'full'))) {
  6643. throw new \RuntimeException(
  6644. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  6645. );
  6646. }
  6647. return $value;
  6648. case 'discard-changes':
  6649. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  6650. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  6651. throw new \RuntimeException(
  6652. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  6653. );
  6654. }
  6655. if ('stash' === $env) {
  6656. return 'stash';
  6657. }
  6658. return $env !== 'false' && (bool) $env;
  6659. }
  6660. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  6661. throw new \RuntimeException(
  6662. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  6663. );
  6664. }
  6665. return $this->config[$key];
  6666. case 'github-protocols':
  6667. $protos = $this->config['github-protocols'];
  6668. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  6669. unset($protos[$index]);
  6670. }
  6671. if (reset($protos) === 'http') {
  6672. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  6673. }
  6674. return $protos;
  6675. case 'disable-tls':
  6676. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6677. case 'secure-http':
  6678. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6679. default:
  6680. if (!isset($this->config[$key])) {
  6681. return null;
  6682. }
  6683. return $this->process($this->config[$key], $flags);
  6684. }
  6685. }
  6686. public function all($flags = 0)
  6687. {
  6688. $all = array(
  6689. 'repositories' => $this->getRepositories(),
  6690. );
  6691. foreach (array_keys($this->config) as $key) {
  6692. $all['config'][$key] = $this->get($key, $flags);
  6693. }
  6694. return $all;
  6695. }
  6696. public function raw()
  6697. {
  6698. return array(
  6699. 'repositories' => $this->getRepositories(),
  6700. 'config' => $this->config,
  6701. );
  6702. }
  6703. public function has($key)
  6704. {
  6705. return array_key_exists($key, $this->config);
  6706. }
  6707. private function process($value, $flags)
  6708. {
  6709. $config = $this;
  6710. if (!is_string($value)) {
  6711. return $value;
  6712. }
  6713. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  6714. return $config->get($match[1], $flags);
  6715. }, $value);
  6716. }
  6717. private function realpath($path)
  6718. {
  6719. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  6720. return $path;
  6721. }
  6722. return $this->baseDir . '/' . $path;
  6723. }
  6724. private function getComposerEnv($var)
  6725. {
  6726. if ($this->useEnvironment) {
  6727. return getenv($var);
  6728. }
  6729. return false;
  6730. }
  6731. private function disableRepoByName($name)
  6732. {
  6733. if (isset($this->repositories[$name])) {
  6734. unset($this->repositories[$name]);
  6735. } elseif ($name === 'packagist') {
  6736. unset($this->repositories['packagist.org']);
  6737. }
  6738. }
  6739. public function prohibitUrlByConfig($url, IOInterface $io = null)
  6740. {
  6741. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  6742. return;
  6743. }
  6744. $scheme = parse_url($url, PHP_URL_SCHEME);
  6745. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  6746. if ($this->get('secure-http')) {
  6747. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  6748. } elseif ($io) {
  6749. $host = parse_url($url, PHP_URL_HOST);
  6750. if (!isset($this->warnedHosts[$host])) {
  6751. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  6752. }
  6753. $this->warnedHosts[$host] = true;
  6754. }
  6755. }
  6756. }
  6757. }
  6758. <?php
  6759. namespace Composer\Config;
  6760. interface ConfigSourceInterface
  6761. {
  6762. public function addRepository($name, $config);
  6763. public function removeRepository($name);
  6764. public function addConfigSetting($name, $value);
  6765. public function removeConfigSetting($name);
  6766. public function addProperty($name, $value);
  6767. public function removeProperty($name);
  6768. public function addLink($type, $name, $value);
  6769. public function removeLink($type, $name);
  6770. public function getName();
  6771. }
  6772. <?php
  6773. namespace Composer\Config;
  6774. use Composer\Json\JsonFile;
  6775. use Composer\Json\JsonManipulator;
  6776. use Composer\Util\Silencer;
  6777. class JsonConfigSource implements ConfigSourceInterface
  6778. {
  6779. private $file;
  6780. private $authConfig;
  6781. public function __construct(JsonFile $file, $authConfig = false)
  6782. {
  6783. $this->file = $file;
  6784. $this->authConfig = $authConfig;
  6785. }
  6786. public function getName()
  6787. {
  6788. return $this->file->getPath();
  6789. }
  6790. public function addRepository($name, $config)
  6791. {
  6792. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  6793. if (isset($config['repositories'])) {
  6794. foreach ($config['repositories'] as $index => $val) {
  6795. if ($index === $repo) {
  6796. continue;
  6797. }
  6798. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  6799. unset($config['repositories'][$index]);
  6800. $config['repositories']['packagist.org'] = false;
  6801. break;
  6802. }
  6803. }
  6804. }
  6805. $config['repositories'][$repo] = $repoConfig;
  6806. });
  6807. }
  6808. public function removeRepository($name)
  6809. {
  6810. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  6811. unset($config['repositories'][$repo]);
  6812. });
  6813. }
  6814. public function addConfigSetting($name, $value)
  6815. {
  6816. $authConfig = $this->authConfig;
  6817. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  6818. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6819. list($key, $host) = explode('.', $key, 2);
  6820. if ($authConfig) {
  6821. $config[$key][$host] = $val;
  6822. } else {
  6823. $config['config'][$key][$host] = $val;
  6824. }
  6825. } else {
  6826. $config['config'][$key] = $val;
  6827. }
  6828. });
  6829. }
  6830. public function removeConfigSetting($name)
  6831. {
  6832. $authConfig = $this->authConfig;
  6833. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  6834. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6835. list($key, $host) = explode('.', $key, 2);
  6836. if ($authConfig) {
  6837. unset($config[$key][$host]);
  6838. } else {
  6839. unset($config['config'][$key][$host]);
  6840. }
  6841. } else {
  6842. unset($config['config'][$key]);
  6843. }
  6844. });
  6845. }
  6846. public function addProperty($name, $value)
  6847. {
  6848. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  6849. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  6850. $bits = explode('.', $key);
  6851. $last = array_pop($bits);
  6852. $arr = &$config[reset($bits)];
  6853. foreach ($bits as $bit) {
  6854. if (!isset($arr[$bit])) {
  6855. $arr[$bit] = array();
  6856. }
  6857. $arr = &$arr[$bit];
  6858. }
  6859. $arr[$last] = $val;
  6860. } else {
  6861. $config[$key] = $val;
  6862. }
  6863. });
  6864. }
  6865. public function removeProperty($name)
  6866. {
  6867. $authConfig = $this->authConfig;
  6868. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  6869. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  6870. $bits = explode('.', $key);
  6871. $last = array_pop($bits);
  6872. $arr = &$config[reset($bits)];
  6873. foreach ($bits as $bit) {
  6874. if (!isset($arr[$bit])) {
  6875. return;
  6876. }
  6877. $arr = &$arr[$bit];
  6878. }
  6879. unset($arr[$last]);
  6880. } else {
  6881. unset($config[$key]);
  6882. }
  6883. });
  6884. }
  6885. public function addLink($type, $name, $value)
  6886. {
  6887. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  6888. $config[$type][$name] = $value;
  6889. });
  6890. }
  6891. public function removeLink($type, $name)
  6892. {
  6893. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  6894. unset($config[$type][$name]);
  6895. });
  6896. }
  6897. protected function manipulateJson($method, $args, $fallback)
  6898. {
  6899. $args = func_get_args();
  6900. array_shift($args);
  6901. $fallback = array_pop($args);
  6902. if ($this->file->exists()) {
  6903. if (!is_writable($this->file->getPath())) {
  6904. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  6905. }
  6906. if (!is_readable($this->file->getPath())) {
  6907. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  6908. }
  6909. $contents = file_get_contents($this->file->getPath());
  6910. } elseif ($this->authConfig) {
  6911. $contents = "{\n}\n";
  6912. } else {
  6913. $contents = "{\n \"config\": {\n }\n}\n";
  6914. }
  6915. $manipulator = new JsonManipulator($contents);
  6916. $newFile = !$this->file->exists();
  6917. if ($this->authConfig && $method === 'addConfigSetting') {
  6918. $method = 'addSubNode';
  6919. list($mainNode, $name) = explode('.', $args[0], 2);
  6920. $args = array($mainNode, $name, $args[1]);
  6921. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  6922. $method = 'removeSubNode';
  6923. list($mainNode, $name) = explode('.', $args[0], 2);
  6924. $args = array($mainNode, $name);
  6925. }
  6926. if (call_user_func_array(array($manipulator, $method), $args)) {
  6927. file_put_contents($this->file->getPath(), $manipulator->getContents());
  6928. } else {
  6929. $config = $this->file->read();
  6930. $this->arrayUnshiftRef($args, $config);
  6931. call_user_func_array($fallback, $args);
  6932. $this->file->write($config);
  6933. }
  6934. if ($newFile) {
  6935. Silencer::call('chmod', $this->file->getPath(), 0600);
  6936. }
  6937. }
  6938. private function arrayUnshiftRef(&$array, &$value)
  6939. {
  6940. $return = array_unshift($array, '');
  6941. $array[0] = &$value;
  6942. return $return;
  6943. }
  6944. }
  6945. <?php
  6946. namespace Composer\Console;
  6947. use Composer\IO\NullIO;
  6948. use Composer\Util\Platform;
  6949. use Composer\Util\Silencer;
  6950. use Symfony\Component\Console\Application as BaseApplication;
  6951. use Symfony\Component\Console\Input\InputInterface;
  6952. use Symfony\Component\Console\Input\InputOption;
  6953. use Symfony\Component\Console\Output\OutputInterface;
  6954. use Composer\Command;
  6955. use Composer\Composer;
  6956. use Composer\Factory;
  6957. use Composer\IO\IOInterface;
  6958. use Composer\IO\ConsoleIO;
  6959. use Composer\Json\JsonValidationException;
  6960. use Composer\Util\ErrorHandler;
  6961. use Composer\EventDispatcher\ScriptExecutionException;
  6962. use Composer\Exception\NoSslException;
  6963. class Application extends BaseApplication
  6964. {
  6965. protected $composer;
  6966. protected $io;
  6967. private static $logo = ' ______
  6968. / ____/___ ____ ___ ____ ____ ________ _____
  6969. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  6970. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  6971. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  6972. /_/
  6973. ';
  6974. private $hasPluginCommands = false;
  6975. private $disablePluginsByDefault = false;
  6976. public function __construct()
  6977. {
  6978. static $shutdownRegistered = false;
  6979. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  6980. ini_set('xdebug.show_exception_trace', false);
  6981. ini_set('xdebug.scream', false);
  6982. }
  6983. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  6984. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  6985. }
  6986. if (!$shutdownRegistered) {
  6987. $shutdownRegistered = true;
  6988. register_shutdown_function(function () {
  6989. $lastError = error_get_last();
  6990. if ($lastError && $lastError['message'] &&
  6991. (strpos($lastError['message'], 'Allowed memory') !== false ||
  6992. strpos($lastError['message'], 'exceeded memory') !== false )) {
  6993. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  6994. }
  6995. });
  6996. }
  6997. $this->io = new NullIO();
  6998. parent::__construct('Composer', Composer::VERSION);
  6999. }
  7000. public function run(InputInterface $input = null, OutputInterface $output = null)
  7001. {
  7002. if (null === $output) {
  7003. $output = Factory::createOutput();
  7004. }
  7005. return parent::run($input, $output);
  7006. }
  7007. public function doRun(InputInterface $input, OutputInterface $output)
  7008. {
  7009. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  7010. $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
  7011. ErrorHandler::register($io);
  7012. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  7013. $oldWorkingDir = getcwd();
  7014. chdir($newWorkDir);
  7015. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  7016. }
  7017. $commandName = '';
  7018. if ($name = $this->getCommandName($input)) {
  7019. try {
  7020. $commandName = $this->find($name)->getName();
  7021. } catch (\InvalidArgumentException $e) {
  7022. }
  7023. }
  7024. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) {
  7025. $dir = dirname(getcwd());
  7026. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  7027. while (dirname($dir) !== $dir && $dir !== $home) {
  7028. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  7029. 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)) {
  7030. $oldWorkingDir = getcwd();
  7031. chdir($dir);
  7032. }
  7033. break;
  7034. }
  7035. $dir = dirname($dir);
  7036. }
  7037. }
  7038. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  7039. try {
  7040. foreach ($this->getPluginCommands() as $command) {
  7041. if ($this->has($command->getName())) {
  7042. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  7043. } else {
  7044. $this->add($command);
  7045. }
  7046. }
  7047. } catch (NoSslException $e) {
  7048. }
  7049. $this->hasPluginCommands = true;
  7050. }
  7051. $isProxyCommand = false;
  7052. if ($name = $this->getCommandName($input)) {
  7053. try {
  7054. $command = $this->find($name);
  7055. $commandName = $command->getName();
  7056. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  7057. } catch (\InvalidArgumentException $e) {
  7058. }
  7059. }
  7060. if (!$isProxyCommand) {
  7061. $io->writeError(sprintf(
  7062. 'Running %s (%s) with %s on %s',
  7063. Composer::VERSION,
  7064. Composer::RELEASE_DATE,
  7065. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  7066. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  7067. ), true, IOInterface::DEBUG);
  7068. if (PHP_VERSION_ID < 50302) {
  7069. $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>');
  7070. }
  7071. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  7072. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  7073. }
  7074. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  7075. $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']));
  7076. }
  7077. if (getenv('COMPOSER_NO_INTERACTION')) {
  7078. $input->setInteractive(false);
  7079. }
  7080. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
  7081. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  7082. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  7083. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  7084. }
  7085. if ($uid = (int) getenv('SUDO_UID')) {
  7086. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  7087. }
  7088. }
  7089. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  7090. }
  7091. Silencer::call(function () use ($io) {
  7092. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  7093. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  7094. $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()));
  7095. }
  7096. });
  7097. $file = Factory::getComposerFile();
  7098. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  7099. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  7100. foreach ($composer['scripts'] as $script => $dummy) {
  7101. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7102. if ($this->has($script)) {
  7103. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  7104. } else {
  7105. $description = null;
  7106. if (isset($composer['scripts-descriptions'][$script])) {
  7107. $description = $composer['scripts-descriptions'][$script];
  7108. }
  7109. $this->add(new Command\ScriptAliasCommand($script, $description));
  7110. }
  7111. }
  7112. }
  7113. }
  7114. }
  7115. }
  7116. try {
  7117. if ($input->hasParameterOption('--profile')) {
  7118. $startTime = microtime(true);
  7119. $this->io->enableDebugging($startTime);
  7120. }
  7121. $result = parent::doRun($input, $output);
  7122. if (isset($oldWorkingDir)) {
  7123. chdir($oldWorkingDir);
  7124. }
  7125. if (isset($startTime)) {
  7126. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MB), time: '.round(microtime(true) - $startTime, 2).'s');
  7127. }
  7128. restore_error_handler();
  7129. return $result;
  7130. } catch (ScriptExecutionException $e) {
  7131. return $e->getCode();
  7132. } catch (\Exception $e) {
  7133. $this->hintCommonErrors($e);
  7134. restore_error_handler();
  7135. throw $e;
  7136. }
  7137. }
  7138. private function getNewWorkingDir(InputInterface $input)
  7139. {
  7140. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  7141. if (false !== $workingDir && !is_dir($workingDir)) {
  7142. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  7143. }
  7144. return $workingDir;
  7145. }
  7146. private function hintCommonErrors($exception)
  7147. {
  7148. $io = $this->getIO();
  7149. Silencer::suppress();
  7150. try {
  7151. $composer = $this->getComposer(false, true);
  7152. if ($composer) {
  7153. $config = $composer->getConfig();
  7154. $minSpaceFree = 1024 * 1024;
  7155. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  7156. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  7157. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  7158. ) {
  7159. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  7160. }
  7161. }
  7162. } catch (\Exception $e) {
  7163. }
  7164. Silencer::restore();
  7165. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  7166. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  7167. $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);
  7168. }
  7169. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  7170. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  7171. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  7172. }
  7173. }
  7174. public function getComposer($required = true, $disablePlugins = null)
  7175. {
  7176. if (null === $disablePlugins) {
  7177. $disablePlugins = $this->disablePluginsByDefault;
  7178. }
  7179. if (null === $this->composer) {
  7180. try {
  7181. $this->composer = Factory::create($this->io, null, $disablePlugins);
  7182. } catch (\InvalidArgumentException $e) {
  7183. if ($required) {
  7184. $this->io->writeError($e->getMessage());
  7185. exit(1);
  7186. }
  7187. } catch (JsonValidationException $e) {
  7188. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  7189. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  7190. throw new JsonValidationException($message);
  7191. }
  7192. }
  7193. return $this->composer;
  7194. }
  7195. public function resetComposer()
  7196. {
  7197. $this->composer = null;
  7198. }
  7199. public function getIO()
  7200. {
  7201. return $this->io;
  7202. }
  7203. public function getHelp()
  7204. {
  7205. return self::$logo . parent::getHelp();
  7206. }
  7207. protected function getDefaultCommands()
  7208. {
  7209. $commands = array_merge(parent::getDefaultCommands(), array(
  7210. new Command\AboutCommand(),
  7211. new Command\ConfigCommand(),
  7212. new Command\DependsCommand(),
  7213. new Command\ProhibitsCommand(),
  7214. new Command\InitCommand(),
  7215. new Command\InstallCommand(),
  7216. new Command\CreateProjectCommand(),
  7217. new Command\UpdateCommand(),
  7218. new Command\SearchCommand(),
  7219. new Command\ValidateCommand(),
  7220. new Command\ShowCommand(),
  7221. new Command\SuggestsCommand(),
  7222. new Command\RequireCommand(),
  7223. new Command\DumpAutoloadCommand(),
  7224. new Command\StatusCommand(),
  7225. new Command\ArchiveCommand(),
  7226. new Command\DiagnoseCommand(),
  7227. new Command\RunScriptCommand(),
  7228. new Command\LicensesCommand(),
  7229. new Command\GlobalCommand(),
  7230. new Command\ClearCacheCommand(),
  7231. new Command\RemoveCommand(),
  7232. new Command\HomeCommand(),
  7233. new Command\ExecCommand(),
  7234. new Command\OutdatedCommand(),
  7235. new Command\CheckPlatformReqsCommand(),
  7236. ));
  7237. if ('phar:' === substr(__FILE__, 0, 5)) {
  7238. $commands[] = new Command\SelfUpdateCommand();
  7239. }
  7240. return $commands;
  7241. }
  7242. public function getLongVersion()
  7243. {
  7244. if (Composer::BRANCH_ALIAS_VERSION) {
  7245. return sprintf(
  7246. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  7247. $this->getName(),
  7248. Composer::BRANCH_ALIAS_VERSION,
  7249. $this->getVersion(),
  7250. Composer::RELEASE_DATE
  7251. );
  7252. }
  7253. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  7254. }
  7255. protected function getDefaultInputDefinition()
  7256. {
  7257. $definition = parent::getDefaultInputDefinition();
  7258. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  7259. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  7260. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  7261. return $definition;
  7262. }
  7263. private function getPluginCommands()
  7264. {
  7265. $commands = array();
  7266. $composer = $this->getComposer(false, false);
  7267. if (null === $composer) {
  7268. $composer = Factory::createGlobal($this->io, false);
  7269. }
  7270. if (null !== $composer) {
  7271. $pm = $composer->getPluginManager();
  7272. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  7273. $newCommands = $capability->getCommands();
  7274. if (!is_array($newCommands)) {
  7275. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  7276. }
  7277. foreach ($newCommands as $command) {
  7278. if (!$command instanceof Command\BaseCommand) {
  7279. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  7280. }
  7281. }
  7282. $commands = array_merge($commands, $newCommands);
  7283. }
  7284. }
  7285. return $commands;
  7286. }
  7287. }
  7288. <?php
  7289. namespace Composer\Console;
  7290. use Symfony\Component\Console\Formatter\OutputFormatter;
  7291. class HtmlOutputFormatter extends OutputFormatter
  7292. {
  7293. private static $availableForegroundColors = array(
  7294. 30 => 'black',
  7295. 31 => 'red',
  7296. 32 => 'green',
  7297. 33 => 'yellow',
  7298. 34 => 'blue',
  7299. 35 => 'magenta',
  7300. 36 => 'cyan',
  7301. 37 => 'white',
  7302. );
  7303. private static $availableBackgroundColors = array(
  7304. 40 => 'black',
  7305. 41 => 'red',
  7306. 42 => 'green',
  7307. 43 => 'yellow',
  7308. 44 => 'blue',
  7309. 45 => 'magenta',
  7310. 46 => 'cyan',
  7311. 47 => 'white',
  7312. );
  7313. private static $availableOptions = array(
  7314. 1 => 'bold',
  7315. 4 => 'underscore',
  7316. );
  7317. public function __construct(array $styles = array())
  7318. {
  7319. parent::__construct(true, $styles);
  7320. }
  7321. public function format($message)
  7322. {
  7323. $formatted = parent::format($message);
  7324. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  7325. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  7326. }
  7327. private function formatHtml($matches)
  7328. {
  7329. $out = '<span style="';
  7330. foreach (explode(';', $matches[1]) as $code) {
  7331. if (isset(self::$availableForegroundColors[$code])) {
  7332. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  7333. } elseif (isset(self::$availableBackgroundColors[$code])) {
  7334. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  7335. } elseif (isset(self::$availableOptions[$code])) {
  7336. switch (self::$availableOptions[$code]) {
  7337. case 'bold':
  7338. $out .= 'font-weight:bold;';
  7339. break;
  7340. case 'underscore':
  7341. $out .= 'text-decoration:underline;';
  7342. break;
  7343. }
  7344. }
  7345. }
  7346. return $out.'">'.$matches[2].'</span>';
  7347. }
  7348. }
  7349. <?php
  7350. namespace Composer\DependencyResolver;
  7351. class Decisions implements \Iterator, \Countable
  7352. {
  7353. const DECISION_LITERAL = 0;
  7354. const DECISION_REASON = 1;
  7355. protected $pool;
  7356. protected $decisionMap;
  7357. protected $decisionQueue = array();
  7358. public function __construct($pool)
  7359. {
  7360. $this->pool = $pool;
  7361. $this->decisionMap = array();
  7362. }
  7363. public function decide($literal, $level, $why)
  7364. {
  7365. $this->addDecision($literal, $level);
  7366. $this->decisionQueue[] = array(
  7367. self::DECISION_LITERAL => $literal,
  7368. self::DECISION_REASON => $why,
  7369. );
  7370. }
  7371. public function satisfy($literal)
  7372. {
  7373. $packageId = abs($literal);
  7374. return (
  7375. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  7376. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  7377. );
  7378. }
  7379. public function conflict($literal)
  7380. {
  7381. $packageId = abs($literal);
  7382. return (
  7383. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  7384. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  7385. );
  7386. }
  7387. public function decided($literalOrPackageId)
  7388. {
  7389. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  7390. }
  7391. public function undecided($literalOrPackageId)
  7392. {
  7393. return empty($this->decisionMap[abs($literalOrPackageId)]);
  7394. }
  7395. public function decidedInstall($literalOrPackageId)
  7396. {
  7397. $packageId = abs($literalOrPackageId);
  7398. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  7399. }
  7400. public function decisionLevel($literalOrPackageId)
  7401. {
  7402. $packageId = abs($literalOrPackageId);
  7403. if (isset($this->decisionMap[$packageId])) {
  7404. return abs($this->decisionMap[$packageId]);
  7405. }
  7406. return 0;
  7407. }
  7408. public function decisionRule($literalOrPackageId)
  7409. {
  7410. $packageId = abs($literalOrPackageId);
  7411. foreach ($this->decisionQueue as $i => $decision) {
  7412. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  7413. return $decision[self::DECISION_REASON];
  7414. }
  7415. }
  7416. return null;
  7417. }
  7418. public function atOffset($queueOffset)
  7419. {
  7420. return $this->decisionQueue[$queueOffset];
  7421. }
  7422. public function validOffset($queueOffset)
  7423. {
  7424. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  7425. }
  7426. public function lastReason()
  7427. {
  7428. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  7429. }
  7430. public function lastLiteral()
  7431. {
  7432. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  7433. }
  7434. public function reset()
  7435. {
  7436. while ($decision = array_pop($this->decisionQueue)) {
  7437. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7438. }
  7439. }
  7440. public function resetToOffset($offset)
  7441. {
  7442. while (count($this->decisionQueue) > $offset + 1) {
  7443. $decision = array_pop($this->decisionQueue);
  7444. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7445. }
  7446. }
  7447. public function revertLast()
  7448. {
  7449. $this->decisionMap[abs($this->lastLiteral())] = 0;
  7450. array_pop($this->decisionQueue);
  7451. }
  7452. public function count()
  7453. {
  7454. return count($this->decisionQueue);
  7455. }
  7456. public function rewind()
  7457. {
  7458. end($this->decisionQueue);
  7459. }
  7460. public function current()
  7461. {
  7462. return current($this->decisionQueue);
  7463. }
  7464. public function key()
  7465. {
  7466. return key($this->decisionQueue);
  7467. }
  7468. public function next()
  7469. {
  7470. return prev($this->decisionQueue);
  7471. }
  7472. public function valid()
  7473. {
  7474. return false !== current($this->decisionQueue);
  7475. }
  7476. public function isEmpty()
  7477. {
  7478. return count($this->decisionQueue) === 0;
  7479. }
  7480. protected function addDecision($literal, $level)
  7481. {
  7482. $packageId = abs($literal);
  7483. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  7484. if ($previousDecision != 0) {
  7485. $literalString = $this->pool->literalToString($literal);
  7486. $package = $this->pool->literalToPackage($literal);
  7487. throw new SolverBugException(
  7488. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  7489. );
  7490. }
  7491. if ($literal > 0) {
  7492. $this->decisionMap[$packageId] = $level;
  7493. } else {
  7494. $this->decisionMap[$packageId] = -$level;
  7495. }
  7496. }
  7497. }
  7498. <?php
  7499. namespace Composer\DependencyResolver;
  7500. use Composer\Package\PackageInterface;
  7501. use Composer\Package\AliasPackage;
  7502. use Composer\Package\BasePackage;
  7503. use Composer\Semver\Constraint\Constraint;
  7504. class DefaultPolicy implements PolicyInterface
  7505. {
  7506. private $preferStable;
  7507. private $preferLowest;
  7508. public function __construct($preferStable = false, $preferLowest = false)
  7509. {
  7510. $this->preferStable = $preferStable;
  7511. $this->preferLowest = $preferLowest;
  7512. }
  7513. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  7514. {
  7515. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  7516. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  7517. }
  7518. $constraint = new Constraint($operator, $b->getVersion());
  7519. $version = new Constraint('==', $a->getVersion());
  7520. return $constraint->matchSpecific($version, true);
  7521. }
  7522. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  7523. {
  7524. $packages = array();
  7525. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  7526. if ($candidate !== $package) {
  7527. $packages[] = $candidate;
  7528. }
  7529. }
  7530. return $packages;
  7531. }
  7532. public function getPriority(Pool $pool, PackageInterface $package)
  7533. {
  7534. return $pool->getPriority($package->getRepository());
  7535. }
  7536. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  7537. {
  7538. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  7539. foreach ($packages as &$literals) {
  7540. $policy = $this;
  7541. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7542. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  7543. });
  7544. }
  7545. foreach ($packages as &$literals) {
  7546. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  7547. $literals = $this->pruneToBestVersion($pool, $literals);
  7548. $literals = $this->pruneRemoteAliases($pool, $literals);
  7549. }
  7550. $selected = call_user_func_array('array_merge', $packages);
  7551. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7552. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  7553. });
  7554. return $selected;
  7555. }
  7556. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  7557. {
  7558. $packages = array();
  7559. foreach ($literals as $literal) {
  7560. $packageName = $pool->literalToPackage($literal)->getName();
  7561. if (!isset($packages[$packageName])) {
  7562. $packages[$packageName] = array();
  7563. }
  7564. if (isset($installedMap[abs($literal)])) {
  7565. array_unshift($packages[$packageName], $literal);
  7566. } else {
  7567. $packages[$packageName][] = $literal;
  7568. }
  7569. }
  7570. return $packages;
  7571. }
  7572. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  7573. {
  7574. if ($a->getRepository() === $b->getRepository()) {
  7575. if ($a->getName() === $b->getName()) {
  7576. $aAliased = $a instanceof AliasPackage;
  7577. $bAliased = $b instanceof AliasPackage;
  7578. if ($aAliased && !$bAliased) {
  7579. return -1;
  7580. }
  7581. if (!$aAliased && $bAliased) {
  7582. return 1;
  7583. }
  7584. }
  7585. if (!$ignoreReplace) {
  7586. if ($this->replaces($a, $b)) {
  7587. return 1;
  7588. }
  7589. if ($this->replaces($b, $a)) {
  7590. return -1;
  7591. }
  7592. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  7593. $requiredVendor = substr($requiredPackage, 0, $pos);
  7594. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  7595. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  7596. if ($bIsSameVendor !== $aIsSameVendor) {
  7597. return $aIsSameVendor ? -1 : 1;
  7598. }
  7599. }
  7600. }
  7601. if ($a->id === $b->id) {
  7602. return 0;
  7603. }
  7604. return ($a->id < $b->id) ? -1 : 1;
  7605. }
  7606. if (isset($installedMap[$a->id])) {
  7607. return -1;
  7608. }
  7609. if (isset($installedMap[$b->id])) {
  7610. return 1;
  7611. }
  7612. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  7613. }
  7614. protected function replaces(PackageInterface $source, PackageInterface $target)
  7615. {
  7616. foreach ($source->getReplaces() as $link) {
  7617. if ($link->getTarget() === $target->getName()
  7618. ) {
  7619. return true;
  7620. }
  7621. }
  7622. return false;
  7623. }
  7624. protected function pruneToBestVersion(Pool $pool, $literals)
  7625. {
  7626. $operator = $this->preferLowest ? '<' : '>';
  7627. $bestLiterals = array($literals[0]);
  7628. $bestPackage = $pool->literalToPackage($literals[0]);
  7629. foreach ($literals as $i => $literal) {
  7630. if (0 === $i) {
  7631. continue;
  7632. }
  7633. $package = $pool->literalToPackage($literal);
  7634. if ($this->versionCompare($package, $bestPackage, $operator)) {
  7635. $bestPackage = $package;
  7636. $bestLiterals = array($literal);
  7637. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  7638. $bestLiterals[] = $literal;
  7639. }
  7640. }
  7641. return $bestLiterals;
  7642. }
  7643. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  7644. {
  7645. $selected = array();
  7646. $priority = null;
  7647. foreach ($literals as $literal) {
  7648. $package = $pool->literalToPackage($literal);
  7649. if (isset($installedMap[$package->id])) {
  7650. $selected[] = $literal;
  7651. continue;
  7652. }
  7653. if (null === $priority) {
  7654. $priority = $this->getPriority($pool, $package);
  7655. }
  7656. if ($this->getPriority($pool, $package) != $priority) {
  7657. break;
  7658. }
  7659. $selected[] = $literal;
  7660. }
  7661. return $selected;
  7662. }
  7663. protected function pruneRemoteAliases(Pool $pool, array $literals)
  7664. {
  7665. $hasLocalAlias = false;
  7666. foreach ($literals as $literal) {
  7667. $package = $pool->literalToPackage($literal);
  7668. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7669. $hasLocalAlias = true;
  7670. break;
  7671. }
  7672. }
  7673. if (!$hasLocalAlias) {
  7674. return $literals;
  7675. }
  7676. $selected = array();
  7677. foreach ($literals as $literal) {
  7678. $package = $pool->literalToPackage($literal);
  7679. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7680. $selected[] = $literal;
  7681. }
  7682. }
  7683. return $selected;
  7684. }
  7685. }
  7686. <?php
  7687. namespace Composer\DependencyResolver;
  7688. use Composer\Package\PackageInterface;
  7689. use Composer\Package\Link;
  7690. class GenericRule extends Rule
  7691. {
  7692. protected $literals;
  7693. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7694. {
  7695. parent::__construct($reason, $reasonData, $job);
  7696. sort($literals);
  7697. $this->literals = $literals;
  7698. }
  7699. public function getLiterals()
  7700. {
  7701. return $this->literals;
  7702. }
  7703. public function getHash()
  7704. {
  7705. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7706. return $data['hash'];
  7707. }
  7708. public function equals(Rule $rule)
  7709. {
  7710. return $this->literals === $rule->getLiterals();
  7711. }
  7712. public function isAssertion()
  7713. {
  7714. return 1 === count($this->literals);
  7715. }
  7716. public function __toString()
  7717. {
  7718. $result = $this->isDisabled() ? 'disabled(' : '(';
  7719. foreach ($this->literals as $i => $literal) {
  7720. if ($i != 0) {
  7721. $result .= '|';
  7722. }
  7723. $result .= $literal;
  7724. }
  7725. $result .= ')';
  7726. return $result;
  7727. }
  7728. }
  7729. <?php
  7730. namespace Composer\DependencyResolver\Operation;
  7731. use Composer\Package\PackageInterface;
  7732. class InstallOperation extends SolverOperation
  7733. {
  7734. protected $package;
  7735. public function __construct(PackageInterface $package, $reason = null)
  7736. {
  7737. parent::__construct($reason);
  7738. $this->package = $package;
  7739. }
  7740. public function getPackage()
  7741. {
  7742. return $this->package;
  7743. }
  7744. public function getJobType()
  7745. {
  7746. return 'install';
  7747. }
  7748. public function __toString()
  7749. {
  7750. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7751. }
  7752. }
  7753. <?php
  7754. namespace Composer\DependencyResolver\Operation;
  7755. use Composer\Package\AliasPackage;
  7756. use Composer\Package\PackageInterface;
  7757. class MarkAliasInstalledOperation extends SolverOperation
  7758. {
  7759. protected $package;
  7760. public function __construct(AliasPackage $package, $reason = null)
  7761. {
  7762. parent::__construct($reason);
  7763. $this->package = $package;
  7764. }
  7765. public function getPackage()
  7766. {
  7767. return $this->package;
  7768. }
  7769. public function getJobType()
  7770. {
  7771. return 'markAliasInstalled';
  7772. }
  7773. public function __toString()
  7774. {
  7775. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7776. }
  7777. }
  7778. <?php
  7779. namespace Composer\DependencyResolver\Operation;
  7780. use Composer\Package\AliasPackage;
  7781. use Composer\Package\PackageInterface;
  7782. class MarkAliasUninstalledOperation extends SolverOperation
  7783. {
  7784. protected $package;
  7785. public function __construct(AliasPackage $package, $reason = null)
  7786. {
  7787. parent::__construct($reason);
  7788. $this->package = $package;
  7789. }
  7790. public function getPackage()
  7791. {
  7792. return $this->package;
  7793. }
  7794. public function getJobType()
  7795. {
  7796. return 'markAliasUninstalled';
  7797. }
  7798. public function __toString()
  7799. {
  7800. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7801. }
  7802. }
  7803. <?php
  7804. namespace Composer\DependencyResolver\Operation;
  7805. interface OperationInterface
  7806. {
  7807. public function getJobType();
  7808. public function getReason();
  7809. public function __toString();
  7810. }
  7811. <?php
  7812. namespace Composer\DependencyResolver\Operation;
  7813. use Composer\Package\PackageInterface;
  7814. abstract class SolverOperation implements OperationInterface
  7815. {
  7816. protected $reason;
  7817. public function __construct($reason = null)
  7818. {
  7819. $this->reason = $reason;
  7820. }
  7821. public function getReason()
  7822. {
  7823. return $this->reason;
  7824. }
  7825. protected function formatVersion(PackageInterface $package)
  7826. {
  7827. return $package->getFullPrettyVersion();
  7828. }
  7829. }
  7830. <?php
  7831. namespace Composer\DependencyResolver\Operation;
  7832. use Composer\Package\PackageInterface;
  7833. class UninstallOperation extends SolverOperation
  7834. {
  7835. protected $package;
  7836. public function __construct(PackageInterface $package, $reason = null)
  7837. {
  7838. parent::__construct($reason);
  7839. $this->package = $package;
  7840. }
  7841. public function getPackage()
  7842. {
  7843. return $this->package;
  7844. }
  7845. public function getJobType()
  7846. {
  7847. return 'uninstall';
  7848. }
  7849. public function __toString()
  7850. {
  7851. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7852. }
  7853. }
  7854. <?php
  7855. namespace Composer\DependencyResolver\Operation;
  7856. use Composer\Package\PackageInterface;
  7857. class UpdateOperation extends SolverOperation
  7858. {
  7859. protected $initialPackage;
  7860. protected $targetPackage;
  7861. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  7862. {
  7863. parent::__construct($reason);
  7864. $this->initialPackage = $initial;
  7865. $this->targetPackage = $target;
  7866. }
  7867. public function getInitialPackage()
  7868. {
  7869. return $this->initialPackage;
  7870. }
  7871. public function getTargetPackage()
  7872. {
  7873. return $this->targetPackage;
  7874. }
  7875. public function getJobType()
  7876. {
  7877. return 'update';
  7878. }
  7879. public function __toString()
  7880. {
  7881. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  7882. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  7883. }
  7884. }
  7885. <?php
  7886. namespace Composer\DependencyResolver;
  7887. use Composer\Package\PackageInterface;
  7888. interface PolicyInterface
  7889. {
  7890. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  7891. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  7892. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  7893. }
  7894. <?php
  7895. namespace Composer\DependencyResolver;
  7896. use Composer\Package\BasePackage;
  7897. use Composer\Package\AliasPackage;
  7898. use Composer\Package\Version\VersionParser;
  7899. use Composer\Semver\Constraint\ConstraintInterface;
  7900. use Composer\Semver\Constraint\Constraint;
  7901. use Composer\Semver\Constraint\EmptyConstraint;
  7902. use Composer\Repository\RepositoryInterface;
  7903. use Composer\Repository\CompositeRepository;
  7904. use Composer\Repository\ComposerRepository;
  7905. use Composer\Repository\InstalledRepositoryInterface;
  7906. use Composer\Repository\PlatformRepository;
  7907. use Composer\Package\PackageInterface;
  7908. class Pool implements \Countable
  7909. {
  7910. const MATCH_NAME = -1;
  7911. const MATCH_NONE = 0;
  7912. const MATCH = 1;
  7913. const MATCH_PROVIDE = 2;
  7914. const MATCH_REPLACE = 3;
  7915. const MATCH_FILTERED = 4;
  7916. protected $repositories = array();
  7917. protected $providerRepos = array();
  7918. protected $packages = array();
  7919. protected $packageByName = array();
  7920. protected $packageByExactName = array();
  7921. protected $acceptableStabilities;
  7922. protected $stabilityFlags;
  7923. protected $versionParser;
  7924. protected $providerCache = array();
  7925. protected $filterRequires;
  7926. protected $whitelist = null;
  7927. protected $id = 1;
  7928. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  7929. {
  7930. $this->versionParser = new VersionParser;
  7931. $this->acceptableStabilities = array();
  7932. foreach (BasePackage::$stabilities as $stability => $value) {
  7933. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  7934. $this->acceptableStabilities[$stability] = $value;
  7935. }
  7936. }
  7937. $this->stabilityFlags = $stabilityFlags;
  7938. $this->filterRequires = $filterRequires;
  7939. foreach ($filterRequires as $name => $constraint) {
  7940. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  7941. unset($this->filterRequires[$name]);
  7942. }
  7943. }
  7944. }
  7945. public function setWhitelist($whitelist)
  7946. {
  7947. $this->whitelist = $whitelist;
  7948. $this->providerCache = array();
  7949. }
  7950. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  7951. {
  7952. if ($repo instanceof CompositeRepository) {
  7953. $repos = $repo->getRepositories();
  7954. } else {
  7955. $repos = array($repo);
  7956. }
  7957. foreach ($repos as $repo) {
  7958. $this->repositories[] = $repo;
  7959. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  7960. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  7961. $this->providerRepos[] = $repo;
  7962. $repo->setRootAliases($rootAliases);
  7963. $repo->resetPackageIds();
  7964. } else {
  7965. foreach ($repo->getPackages() as $package) {
  7966. $names = $package->getNames();
  7967. $stability = $package->getStability();
  7968. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  7969. $package->setId($this->id++);
  7970. $this->packages[] = $package;
  7971. $this->packageByExactName[$package->getName()][$package->id] = $package;
  7972. foreach ($names as $provided) {
  7973. $this->packageByName[$provided][] = $package;
  7974. }
  7975. $name = $package->getName();
  7976. if (isset($rootAliases[$name][$package->getVersion()])) {
  7977. $alias = $rootAliases[$name][$package->getVersion()];
  7978. if ($package instanceof AliasPackage) {
  7979. $package = $package->getAliasOf();
  7980. }
  7981. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  7982. $aliasPackage->setRootPackageAlias(true);
  7983. $aliasPackage->setId($this->id++);
  7984. $package->getRepository()->addPackage($aliasPackage);
  7985. $this->packages[] = $aliasPackage;
  7986. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  7987. foreach ($aliasPackage->getNames() as $name) {
  7988. $this->packageByName[$name][] = $aliasPackage;
  7989. }
  7990. }
  7991. }
  7992. }
  7993. }
  7994. }
  7995. }
  7996. public function getPriority(RepositoryInterface $repo)
  7997. {
  7998. $priority = array_search($repo, $this->repositories, true);
  7999. if (false === $priority) {
  8000. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  8001. }
  8002. return -$priority;
  8003. }
  8004. public function packageById($id)
  8005. {
  8006. return $this->packages[$id - 1];
  8007. }
  8008. public function count()
  8009. {
  8010. return count($this->packages);
  8011. }
  8012. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  8013. {
  8014. if ($bypassFilters) {
  8015. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  8016. }
  8017. $key = ((int) $mustMatchName).$constraint;
  8018. if (isset($this->providerCache[$name][$key])) {
  8019. return $this->providerCache[$name][$key];
  8020. }
  8021. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  8022. }
  8023. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  8024. {
  8025. $candidates = array();
  8026. foreach ($this->providerRepos as $repo) {
  8027. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  8028. $candidates[] = $candidate;
  8029. if ($candidate->id < 1) {
  8030. $candidate->setId($this->id++);
  8031. $this->packages[$this->id - 2] = $candidate;
  8032. }
  8033. }
  8034. }
  8035. if ($mustMatchName) {
  8036. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  8037. return $candidate->getName() == $name;
  8038. });
  8039. if (isset($this->packageByExactName[$name])) {
  8040. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  8041. }
  8042. } elseif (isset($this->packageByName[$name])) {
  8043. $candidates = array_merge($candidates, $this->packageByName[$name]);
  8044. }
  8045. $matches = $provideMatches = array();
  8046. $nameMatch = false;
  8047. foreach ($candidates as $candidate) {
  8048. $aliasOfCandidate = null;
  8049. if ($candidate instanceof AliasPackage) {
  8050. $aliasOfCandidate = $candidate->getAliasOf();
  8051. }
  8052. if ($this->whitelist !== null && !$bypassFilters && (
  8053. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  8054. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  8055. )) {
  8056. continue;
  8057. }
  8058. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  8059. case self::MATCH_NONE:
  8060. break;
  8061. case self::MATCH_NAME:
  8062. $nameMatch = true;
  8063. break;
  8064. case self::MATCH:
  8065. $nameMatch = true;
  8066. $matches[] = $candidate;
  8067. break;
  8068. case self::MATCH_PROVIDE:
  8069. $provideMatches[] = $candidate;
  8070. break;
  8071. case self::MATCH_REPLACE:
  8072. $matches[] = $candidate;
  8073. break;
  8074. case self::MATCH_FILTERED:
  8075. break;
  8076. default:
  8077. throw new \UnexpectedValueException('Unexpected match type');
  8078. }
  8079. }
  8080. if ($nameMatch) {
  8081. return $matches;
  8082. }
  8083. return array_merge($matches, $provideMatches);
  8084. }
  8085. public function literalToPackage($literal)
  8086. {
  8087. $packageId = abs($literal);
  8088. return $this->packageById($packageId);
  8089. }
  8090. public function literalToPrettyString($literal, $installedMap)
  8091. {
  8092. $package = $this->literalToPackage($literal);
  8093. if (isset($installedMap[$package->id])) {
  8094. $prefix = ($literal > 0 ? 'keep' : 'remove');
  8095. } else {
  8096. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  8097. }
  8098. return $prefix.' '.$package->getPrettyString();
  8099. }
  8100. public function isPackageAcceptable($name, $stability)
  8101. {
  8102. foreach ((array) $name as $n) {
  8103. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  8104. return true;
  8105. }
  8106. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  8107. return true;
  8108. }
  8109. }
  8110. return false;
  8111. }
  8112. private function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  8113. {
  8114. $candidateName = $candidate->getName();
  8115. $candidateVersion = $candidate->getVersion();
  8116. $isDev = $candidate->getStability() === 'dev';
  8117. $isAlias = $candidate instanceof AliasPackage;
  8118. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  8119. $requireFilter = $this->filterRequires[$name];
  8120. } else {
  8121. $requireFilter = new EmptyConstraint;
  8122. }
  8123. if ($candidateName === $name) {
  8124. $pkgConstraint = new Constraint('==', $candidateVersion);
  8125. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  8126. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  8127. }
  8128. return self::MATCH_NAME;
  8129. }
  8130. $provides = $candidate->getProvides();
  8131. $replaces = $candidate->getReplaces();
  8132. if (isset($replaces[0]) || isset($provides[0])) {
  8133. foreach ($provides as $link) {
  8134. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8135. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8136. }
  8137. }
  8138. foreach ($replaces as $link) {
  8139. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8140. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8141. }
  8142. }
  8143. return self::MATCH_NONE;
  8144. }
  8145. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  8146. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8147. }
  8148. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  8149. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8150. }
  8151. return self::MATCH_NONE;
  8152. }
  8153. }
  8154. <?php
  8155. namespace Composer\DependencyResolver;
  8156. use Composer\Package\CompletePackageInterface;
  8157. class Problem
  8158. {
  8159. protected $reasonSeen;
  8160. protected $reasons = array();
  8161. protected $section = 0;
  8162. protected $pool;
  8163. public function __construct(Pool $pool)
  8164. {
  8165. $this->pool = $pool;
  8166. }
  8167. public function addRule(Rule $rule)
  8168. {
  8169. $this->addReason(spl_object_hash($rule), array(
  8170. 'rule' => $rule,
  8171. 'job' => $rule->getJob(),
  8172. ));
  8173. }
  8174. public function getReasons()
  8175. {
  8176. return $this->reasons;
  8177. }
  8178. public function getPrettyString(array $installedMap = array())
  8179. {
  8180. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  8181. if (count($reasons) === 1) {
  8182. reset($reasons);
  8183. $reason = current($reasons);
  8184. $rule = $reason['rule'];
  8185. $job = $reason['job'];
  8186. if (isset($job['constraint'])) {
  8187. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8188. } else {
  8189. $packages = array();
  8190. }
  8191. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  8192. if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
  8193. $version = phpversion();
  8194. $available = $this->pool->whatProvides($job['packageName']);
  8195. if (count($available)) {
  8196. $firstAvailable = reset($available);
  8197. $version = $firstAvailable->getPrettyVersion();
  8198. $extra = $firstAvailable->getExtra();
  8199. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  8200. $version .= '; ' . $firstAvailable->getDescription();
  8201. }
  8202. }
  8203. $msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
  8204. if (defined('HHVM_VERSION')) {
  8205. return $msg . 'your HHVM version does not satisfy that requirement.';
  8206. }
  8207. if ($job['packageName'] === 'hhvm') {
  8208. return $msg . 'you are running this with PHP and not HHVM.';
  8209. }
  8210. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  8211. }
  8212. if (0 === stripos($job['packageName'], 'ext-')) {
  8213. if (false !== strpos($job['packageName'], ' ')) {
  8214. return "\n - The requested PHP extension ".$job['packageName'].' should be required as '.str_replace(' ', '-', $job['packageName']).'.';
  8215. }
  8216. $ext = substr($job['packageName'], 4);
  8217. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8218. return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  8219. }
  8220. if (0 === stripos($job['packageName'], 'lib-')) {
  8221. if (strtolower($job['packageName']) === 'lib-icu') {
  8222. $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.';
  8223. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error;
  8224. }
  8225. 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.';
  8226. }
  8227. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $job['packageName'])) {
  8228. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $job['packageName']);
  8229. 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.';
  8230. }
  8231. if ($providers = $this->pool->whatProvides($job['packageName'], $job['constraint'], true, true)) {
  8232. 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.';
  8233. }
  8234. if ($providers = $this->pool->whatProvides($job['packageName'], null, true, true)) {
  8235. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  8236. }
  8237. return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';
  8238. }
  8239. }
  8240. $messages = array();
  8241. foreach ($reasons as $reason) {
  8242. $rule = $reason['rule'];
  8243. $job = $reason['job'];
  8244. if ($job) {
  8245. $messages[] = $this->jobToText($job);
  8246. } elseif ($rule) {
  8247. if ($rule instanceof Rule) {
  8248. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  8249. }
  8250. }
  8251. }
  8252. return "\n - ".implode("\n - ", $messages);
  8253. }
  8254. protected function addReason($id, $reason)
  8255. {
  8256. if (!isset($this->reasonSeen[$id])) {
  8257. $this->reasonSeen[$id] = true;
  8258. $this->reasons[$this->section][] = $reason;
  8259. }
  8260. }
  8261. public function nextSection()
  8262. {
  8263. $this->section++;
  8264. }
  8265. protected function jobToText($job)
  8266. {
  8267. switch ($job['cmd']) {
  8268. case 'install':
  8269. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8270. if (!$packages) {
  8271. return 'No package found to satisfy install request for '.$job['packageName'].$this->constraintToText($job['constraint']);
  8272. }
  8273. return 'Installation request for '.$job['packageName'].$this->constraintToText($job['constraint']).' -> satisfiable by '.$this->getPackageList($packages).'.';
  8274. case 'update':
  8275. return 'Update request for '.$job['packageName'].$this->constraintToText($job['constraint']).'.';
  8276. case 'remove':
  8277. return 'Removal request for '.$job['packageName'].$this->constraintToText($job['constraint']).'';
  8278. }
  8279. if (isset($job['constraint'])) {
  8280. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8281. } else {
  8282. $packages = array();
  8283. }
  8284. return 'Job(cmd='.$job['cmd'].', target='.$job['packageName'].', packages=['.$this->getPackageList($packages).'])';
  8285. }
  8286. protected function getPackageList($packages)
  8287. {
  8288. $prepared = array();
  8289. foreach ($packages as $package) {
  8290. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8291. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8292. }
  8293. foreach ($prepared as $name => $package) {
  8294. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8295. }
  8296. return implode(', ', $prepared);
  8297. }
  8298. protected function constraintToText($constraint)
  8299. {
  8300. return $constraint ? ' '.$constraint->getPrettyString() : '';
  8301. }
  8302. }
  8303. <?php
  8304. namespace Composer\DependencyResolver;
  8305. use Composer\Semver\Constraint\ConstraintInterface;
  8306. class Request
  8307. {
  8308. protected $jobs;
  8309. public function __construct()
  8310. {
  8311. $this->jobs = array();
  8312. }
  8313. public function install($packageName, ConstraintInterface $constraint = null)
  8314. {
  8315. $this->addJob($packageName, 'install', $constraint);
  8316. }
  8317. public function update($packageName, ConstraintInterface $constraint = null)
  8318. {
  8319. $this->addJob($packageName, 'update', $constraint);
  8320. }
  8321. public function remove($packageName, ConstraintInterface $constraint = null)
  8322. {
  8323. $this->addJob($packageName, 'remove', $constraint);
  8324. }
  8325. public function fix($packageName, ConstraintInterface $constraint = null)
  8326. {
  8327. $this->addJob($packageName, 'install', $constraint, true);
  8328. }
  8329. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  8330. {
  8331. $packageName = strtolower($packageName);
  8332. $this->jobs[] = array(
  8333. 'cmd' => $cmd,
  8334. 'packageName' => $packageName,
  8335. 'constraint' => $constraint,
  8336. 'fixed' => $fixed,
  8337. );
  8338. }
  8339. public function updateAll()
  8340. {
  8341. $this->jobs[] = array('cmd' => 'update-all');
  8342. }
  8343. public function getJobs()
  8344. {
  8345. return $this->jobs;
  8346. }
  8347. }
  8348. <?php
  8349. namespace Composer\DependencyResolver;
  8350. use Composer\Package\CompletePackage;
  8351. use Composer\Package\Link;
  8352. use Composer\Package\PackageInterface;
  8353. abstract class Rule
  8354. {
  8355. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  8356. const RULE_JOB_INSTALL = 2;
  8357. const RULE_JOB_REMOVE = 3;
  8358. const RULE_PACKAGE_CONFLICT = 6;
  8359. const RULE_PACKAGE_REQUIRES = 7;
  8360. const RULE_PACKAGE_OBSOLETES = 8;
  8361. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  8362. const RULE_PACKAGE_SAME_NAME = 10;
  8363. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  8364. const RULE_LEARNED = 12;
  8365. const RULE_PACKAGE_ALIAS = 13;
  8366. const BITFIELD_TYPE = 0;
  8367. const BITFIELD_REASON = 8;
  8368. const BITFIELD_DISABLED = 16;
  8369. protected $bitfield;
  8370. protected $job;
  8371. protected $reasonData;
  8372. public function __construct($reason, $reasonData, $job = null)
  8373. {
  8374. $this->reasonData = $reasonData;
  8375. if ($job) {
  8376. $this->job = $job;
  8377. }
  8378. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  8379. ($reason << self::BITFIELD_REASON) |
  8380. (255 << self::BITFIELD_TYPE);
  8381. }
  8382. abstract public function getLiterals();
  8383. abstract public function getHash();
  8384. public function getJob()
  8385. {
  8386. return $this->job;
  8387. }
  8388. abstract public function equals(Rule $rule);
  8389. public function getReason()
  8390. {
  8391. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  8392. }
  8393. public function getReasonData()
  8394. {
  8395. return $this->reasonData;
  8396. }
  8397. public function getRequiredPackage()
  8398. {
  8399. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  8400. return $this->reasonData;
  8401. }
  8402. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  8403. return $this->reasonData->getTarget();
  8404. }
  8405. }
  8406. public function setType($type)
  8407. {
  8408. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  8409. }
  8410. public function getType()
  8411. {
  8412. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  8413. }
  8414. public function disable()
  8415. {
  8416. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  8417. }
  8418. public function enable()
  8419. {
  8420. $this->bitfield = $this->bitfield & ~(255 << self::BITFIELD_DISABLED);
  8421. }
  8422. public function isDisabled()
  8423. {
  8424. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8425. }
  8426. public function isEnabled()
  8427. {
  8428. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8429. }
  8430. abstract public function isAssertion();
  8431. public function getPrettyString(Pool $pool, array $installedMap = array())
  8432. {
  8433. $literals = $this->getLiterals();
  8434. $ruleText = '';
  8435. foreach ($literals as $i => $literal) {
  8436. if ($i != 0) {
  8437. $ruleText .= '|';
  8438. }
  8439. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  8440. }
  8441. switch ($this->getReason()) {
  8442. case self::RULE_INTERNAL_ALLOW_UPDATE:
  8443. return $ruleText;
  8444. case self::RULE_JOB_INSTALL:
  8445. return "Install command rule ($ruleText)";
  8446. case self::RULE_JOB_REMOVE:
  8447. return "Remove command rule ($ruleText)";
  8448. case self::RULE_PACKAGE_CONFLICT:
  8449. $package1 = $pool->literalToPackage($literals[0]);
  8450. $package2 = $pool->literalToPackage($literals[1]);
  8451. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  8452. case self::RULE_PACKAGE_REQUIRES:
  8453. $sourceLiteral = array_shift($literals);
  8454. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  8455. $requires = array();
  8456. foreach ($literals as $literal) {
  8457. $requires[] = $pool->literalToPackage($literal);
  8458. }
  8459. $text = $this->reasonData->getPrettyString($sourcePackage);
  8460. if ($requires) {
  8461. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  8462. } else {
  8463. $targetName = $this->reasonData->getTarget();
  8464. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  8465. if (defined('HHVM_VERSION')) {
  8466. return $text . ' -> your HHVM version does not satisfy that requirement.';
  8467. }
  8468. if ($targetName === 'hhvm') {
  8469. return $text . ' -> you are running this with PHP and not HHVM.';
  8470. }
  8471. $packages = $pool->whatProvides($targetName);
  8472. $package = count($packages) ? current($packages) : phpversion();
  8473. if (!($package instanceof CompletePackage)) {
  8474. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  8475. }
  8476. $extra = $package->getExtra();
  8477. if (!empty($extra['config.platform'])) {
  8478. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8479. } else {
  8480. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8481. }
  8482. return $text;
  8483. }
  8484. if (0 === strpos($targetName, 'ext-')) {
  8485. $ext = substr($targetName, 4);
  8486. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8487. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  8488. }
  8489. if (0 === strpos($targetName, 'lib-')) {
  8490. $lib = substr($targetName, 4);
  8491. 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.';
  8492. }
  8493. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  8494. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  8495. }
  8496. return $text . ' -> no matching package found.';
  8497. }
  8498. return $text;
  8499. case self::RULE_PACKAGE_OBSOLETES:
  8500. return $ruleText;
  8501. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  8502. return $ruleText;
  8503. case self::RULE_PACKAGE_SAME_NAME:
  8504. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  8505. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  8506. return $ruleText;
  8507. case self::RULE_LEARNED:
  8508. return 'Conclusion: '.$ruleText;
  8509. case self::RULE_PACKAGE_ALIAS:
  8510. return $ruleText;
  8511. default:
  8512. return '('.$ruleText.')';
  8513. }
  8514. }
  8515. protected function formatPackagesUnique($pool, array $packages)
  8516. {
  8517. $prepared = array();
  8518. foreach ($packages as $package) {
  8519. if (!is_object($package)) {
  8520. $package = $pool->literalToPackage($package);
  8521. }
  8522. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8523. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8524. }
  8525. foreach ($prepared as $name => $package) {
  8526. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8527. }
  8528. return implode(', ', $prepared);
  8529. }
  8530. }
  8531. <?php
  8532. namespace Composer\DependencyResolver;
  8533. use Composer\Package\PackageInterface;
  8534. use Composer\Package\Link;
  8535. class Rule2Literals extends Rule
  8536. {
  8537. protected $literal1;
  8538. protected $literal2;
  8539. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  8540. {
  8541. parent::__construct($reason, $reasonData, $job);
  8542. if ($literal1 < $literal2) {
  8543. $this->literal1 = $literal1;
  8544. $this->literal2 = $literal2;
  8545. } else {
  8546. $this->literal1 = $literal2;
  8547. $this->literal2 = $literal1;
  8548. }
  8549. }
  8550. public function getLiterals()
  8551. {
  8552. return array($this->literal1, $this->literal2);
  8553. }
  8554. public function getHash()
  8555. {
  8556. return $this->literal1.','.$this->literal2;
  8557. }
  8558. public function equals(Rule $rule)
  8559. {
  8560. if ($rule instanceof self) {
  8561. if ($this->literal1 !== $rule->literal1) {
  8562. return false;
  8563. }
  8564. if ($this->literal2 !== $rule->literal2) {
  8565. return false;
  8566. }
  8567. return true;
  8568. }
  8569. $literals = $rule->getLiterals();
  8570. if (2 != count($literals)) {
  8571. return false;
  8572. }
  8573. if ($this->literal1 !== $literals[0]) {
  8574. return false;
  8575. }
  8576. if ($this->literal2 !== $literals[1]) {
  8577. return false;
  8578. }
  8579. return true;
  8580. }
  8581. public function isAssertion()
  8582. {
  8583. return false;
  8584. }
  8585. public function __toString()
  8586. {
  8587. $result = $this->isDisabled() ? 'disabled(' : '(';
  8588. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  8589. return $result;
  8590. }
  8591. }
  8592. <?php
  8593. namespace Composer\DependencyResolver;
  8594. class RuleSet implements \IteratorAggregate, \Countable
  8595. {
  8596. const TYPE_PACKAGE = 0;
  8597. const TYPE_JOB = 1;
  8598. const TYPE_LEARNED = 4;
  8599. public $ruleById;
  8600. protected static $types = array(
  8601. 255 => 'UNKNOWN',
  8602. self::TYPE_PACKAGE => 'PACKAGE',
  8603. self::TYPE_JOB => 'JOB',
  8604. self::TYPE_LEARNED => 'LEARNED',
  8605. );
  8606. protected $rules;
  8607. protected $nextRuleId;
  8608. protected $rulesByHash;
  8609. public function __construct()
  8610. {
  8611. $this->nextRuleId = 0;
  8612. foreach ($this->getTypes() as $type) {
  8613. $this->rules[$type] = array();
  8614. }
  8615. $this->rulesByHash = array();
  8616. }
  8617. public function add(Rule $rule, $type)
  8618. {
  8619. if (!isset(self::$types[$type])) {
  8620. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  8621. }
  8622. $hash = $rule->getHash();
  8623. if (isset($this->rulesByHash[$hash])) {
  8624. $potentialDuplicates = $this->rulesByHash[$hash];
  8625. if (is_array($potentialDuplicates)) {
  8626. foreach ($potentialDuplicates as $potentialDuplicate) {
  8627. if ($rule->equals($potentialDuplicate)) {
  8628. return;
  8629. }
  8630. }
  8631. } else {
  8632. if ($rule->equals($potentialDuplicates)) {
  8633. return;
  8634. }
  8635. }
  8636. }
  8637. if (!isset($this->rules[$type])) {
  8638. $this->rules[$type] = array();
  8639. }
  8640. $this->rules[$type][] = $rule;
  8641. $this->ruleById[$this->nextRuleId] = $rule;
  8642. $rule->setType($type);
  8643. $this->nextRuleId++;
  8644. if (!isset($this->rulesByHash[$hash])) {
  8645. $this->rulesByHash[$hash] = $rule;
  8646. } elseif (is_array($this->rulesByHash[$hash])) {
  8647. $this->rulesByHash[$hash][] = $rule;
  8648. } else {
  8649. $originalRule = $this->rulesByHash[$hash];
  8650. $this->rulesByHash[$hash] = array($originalRule, $rule);
  8651. }
  8652. }
  8653. public function count()
  8654. {
  8655. return $this->nextRuleId;
  8656. }
  8657. public function ruleById($id)
  8658. {
  8659. return $this->ruleById[$id];
  8660. }
  8661. public function getRules()
  8662. {
  8663. return $this->rules;
  8664. }
  8665. public function getIterator()
  8666. {
  8667. return new RuleSetIterator($this->getRules());
  8668. }
  8669. public function getIteratorFor($types)
  8670. {
  8671. if (!is_array($types)) {
  8672. $types = array($types);
  8673. }
  8674. $allRules = $this->getRules();
  8675. $rules = array();
  8676. foreach ($types as $type) {
  8677. $rules[$type] = $allRules[$type];
  8678. }
  8679. return new RuleSetIterator($rules);
  8680. }
  8681. public function getIteratorWithout($types)
  8682. {
  8683. if (!is_array($types)) {
  8684. $types = array($types);
  8685. }
  8686. $rules = $this->getRules();
  8687. foreach ($types as $type) {
  8688. unset($rules[$type]);
  8689. }
  8690. return new RuleSetIterator($rules);
  8691. }
  8692. public function getTypes()
  8693. {
  8694. $types = self::$types;
  8695. unset($types[255]);
  8696. return array_keys($types);
  8697. }
  8698. public function getPrettyString(Pool $pool = null)
  8699. {
  8700. $string = "\n";
  8701. foreach ($this->rules as $type => $rules) {
  8702. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  8703. foreach ($rules as $rule) {
  8704. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  8705. }
  8706. $string .= "\n\n";
  8707. }
  8708. return $string;
  8709. }
  8710. public function __toString()
  8711. {
  8712. return $this->getPrettyString(null);
  8713. }
  8714. }
  8715. <?php
  8716. namespace Composer\DependencyResolver;
  8717. use Composer\Package\PackageInterface;
  8718. use Composer\Package\AliasPackage;
  8719. use Composer\Repository\PlatformRepository;
  8720. class RuleSetGenerator
  8721. {
  8722. protected $policy;
  8723. protected $pool;
  8724. protected $rules;
  8725. protected $jobs;
  8726. protected $installedMap;
  8727. protected $whitelistedMap;
  8728. protected $addedMap;
  8729. public function __construct(PolicyInterface $policy, Pool $pool)
  8730. {
  8731. $this->policy = $policy;
  8732. $this->pool = $pool;
  8733. }
  8734. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  8735. {
  8736. $literals = array(-$package->id);
  8737. foreach ($providers as $provider) {
  8738. if ($provider === $package) {
  8739. return null;
  8740. }
  8741. $literals[] = $provider->id;
  8742. }
  8743. return new GenericRule($literals, $reason, $reasonData);
  8744. }
  8745. protected function createInstallOneOfRule(array $packages, $reason, $job)
  8746. {
  8747. $literals = array();
  8748. foreach ($packages as $package) {
  8749. $literals[] = $package->id;
  8750. }
  8751. return new GenericRule($literals, $reason, $job['packageName'], $job);
  8752. }
  8753. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  8754. {
  8755. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  8756. }
  8757. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  8758. {
  8759. if ($issuer === $provider) {
  8760. return null;
  8761. }
  8762. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  8763. }
  8764. private function addRule($type, Rule $newRule = null)
  8765. {
  8766. if (!$newRule) {
  8767. return;
  8768. }
  8769. $this->rules->add($newRule, $type);
  8770. }
  8771. protected function whitelistFromPackage(PackageInterface $package)
  8772. {
  8773. $workQueue = new \SplQueue;
  8774. $workQueue->enqueue($package);
  8775. while (!$workQueue->isEmpty()) {
  8776. $package = $workQueue->dequeue();
  8777. if (isset($this->whitelistedMap[$package->id])) {
  8778. continue;
  8779. }
  8780. $this->whitelistedMap[$package->id] = true;
  8781. foreach ($package->getRequires() as $link) {
  8782. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  8783. foreach ($possibleRequires as $require) {
  8784. $workQueue->enqueue($require);
  8785. }
  8786. }
  8787. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  8788. foreach ($obsoleteProviders as $provider) {
  8789. if ($provider === $package) {
  8790. continue;
  8791. }
  8792. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8793. $workQueue->enqueue($provider);
  8794. }
  8795. }
  8796. }
  8797. }
  8798. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  8799. {
  8800. $workQueue = new \SplQueue;
  8801. $workQueue->enqueue($package);
  8802. while (!$workQueue->isEmpty()) {
  8803. $package = $workQueue->dequeue();
  8804. if (isset($this->addedMap[$package->id])) {
  8805. continue;
  8806. }
  8807. $this->addedMap[$package->id] = true;
  8808. foreach ($package->getRequires() as $link) {
  8809. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  8810. continue;
  8811. }
  8812. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8813. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  8814. foreach ($possibleRequires as $require) {
  8815. $workQueue->enqueue($require);
  8816. }
  8817. }
  8818. foreach ($package->getConflicts() as $link) {
  8819. $possibleConflicts = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8820. foreach ($possibleConflicts as $conflict) {
  8821. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  8822. }
  8823. }
  8824. $isInstalled = isset($this->installedMap[$package->id]);
  8825. foreach ($package->getReplaces() as $link) {
  8826. $obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8827. foreach ($obsoleteProviders as $provider) {
  8828. if ($provider === $package) {
  8829. continue;
  8830. }
  8831. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8832. $reason = $isInstalled ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  8833. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  8834. }
  8835. }
  8836. }
  8837. $packageName = $package->getName();
  8838. $obsoleteProviders = $this->pool->whatProvides($packageName, null);
  8839. foreach ($obsoleteProviders as $provider) {
  8840. if ($provider === $package) {
  8841. continue;
  8842. }
  8843. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8844. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  8845. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8846. $reason = ($packageName == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  8847. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $package));
  8848. }
  8849. }
  8850. }
  8851. }
  8852. protected function obsoleteImpossibleForAlias($package, $provider)
  8853. {
  8854. $packageIsAlias = $package instanceof AliasPackage;
  8855. $providerIsAlias = $provider instanceof AliasPackage;
  8856. $impossible = (
  8857. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  8858. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  8859. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  8860. );
  8861. return $impossible;
  8862. }
  8863. protected function whitelistFromJobs()
  8864. {
  8865. foreach ($this->jobs as $job) {
  8866. switch ($job['cmd']) {
  8867. case 'install':
  8868. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  8869. foreach ($packages as $package) {
  8870. $this->whitelistFromPackage($package);
  8871. }
  8872. break;
  8873. }
  8874. }
  8875. }
  8876. protected function addRulesForJobs($ignorePlatformReqs)
  8877. {
  8878. foreach ($this->jobs as $job) {
  8879. switch ($job['cmd']) {
  8880. case 'install':
  8881. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8882. break;
  8883. }
  8884. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8885. if ($packages) {
  8886. foreach ($packages as $package) {
  8887. if (!isset($this->installedMap[$package->id])) {
  8888. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8889. }
  8890. }
  8891. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  8892. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8893. }
  8894. break;
  8895. case 'remove':
  8896. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8897. foreach ($packages as $package) {
  8898. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  8899. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8900. }
  8901. break;
  8902. }
  8903. }
  8904. }
  8905. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  8906. {
  8907. $this->jobs = $jobs;
  8908. $this->rules = new RuleSet;
  8909. $this->installedMap = $installedMap;
  8910. $this->whitelistedMap = array();
  8911. foreach ($this->installedMap as $package) {
  8912. $this->whitelistFromPackage($package);
  8913. }
  8914. $this->whitelistFromJobs();
  8915. $this->pool->setWhitelist($this->whitelistedMap);
  8916. $this->addedMap = array();
  8917. foreach ($this->installedMap as $package) {
  8918. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8919. }
  8920. $this->addRulesForJobs($ignorePlatformReqs);
  8921. return $this->rules;
  8922. }
  8923. }
  8924. <?php
  8925. namespace Composer\DependencyResolver;
  8926. class RuleSetIterator implements \Iterator
  8927. {
  8928. protected $rules;
  8929. protected $types;
  8930. protected $currentOffset;
  8931. protected $currentType;
  8932. protected $currentTypeOffset;
  8933. public function __construct(array $rules)
  8934. {
  8935. $this->rules = $rules;
  8936. $this->types = array_keys($rules);
  8937. sort($this->types);
  8938. $this->rewind();
  8939. }
  8940. public function current()
  8941. {
  8942. return $this->rules[$this->currentType][$this->currentOffset];
  8943. }
  8944. public function key()
  8945. {
  8946. return $this->currentType;
  8947. }
  8948. public function next()
  8949. {
  8950. $this->currentOffset++;
  8951. if (!isset($this->rules[$this->currentType])) {
  8952. return;
  8953. }
  8954. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  8955. $this->currentOffset = 0;
  8956. do {
  8957. $this->currentTypeOffset++;
  8958. if (!isset($this->types[$this->currentTypeOffset])) {
  8959. $this->currentType = -1;
  8960. break;
  8961. }
  8962. $this->currentType = $this->types[$this->currentTypeOffset];
  8963. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  8964. }
  8965. }
  8966. public function rewind()
  8967. {
  8968. $this->currentOffset = 0;
  8969. $this->currentTypeOffset = -1;
  8970. $this->currentType = -1;
  8971. do {
  8972. $this->currentTypeOffset++;
  8973. if (!isset($this->types[$this->currentTypeOffset])) {
  8974. $this->currentType = -1;
  8975. break;
  8976. }
  8977. $this->currentType = $this->types[$this->currentTypeOffset];
  8978. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  8979. }
  8980. public function valid()
  8981. {
  8982. return isset($this->rules[$this->currentType])
  8983. && isset($this->rules[$this->currentType][$this->currentOffset]);
  8984. }
  8985. }
  8986. <?php
  8987. namespace Composer\DependencyResolver;
  8988. class RuleWatchChain extends \SplDoublyLinkedList
  8989. {
  8990. protected $offset = 0;
  8991. public function seek($offset)
  8992. {
  8993. $this->rewind();
  8994. for ($i = 0; $i < $offset; $i++, $this->next());
  8995. }
  8996. public function remove()
  8997. {
  8998. $offset = $this->key();
  8999. $this->offsetUnset($offset);
  9000. $this->seek($offset);
  9001. }
  9002. }
  9003. <?php
  9004. namespace Composer\DependencyResolver;
  9005. class RuleWatchGraph
  9006. {
  9007. protected $watchChains = array();
  9008. public function insert(RuleWatchNode $node)
  9009. {
  9010. if ($node->getRule()->isAssertion()) {
  9011. return;
  9012. }
  9013. foreach (array($node->watch1, $node->watch2) as $literal) {
  9014. if (!isset($this->watchChains[$literal])) {
  9015. $this->watchChains[$literal] = new RuleWatchChain;
  9016. }
  9017. $this->watchChains[$literal]->unshift($node);
  9018. }
  9019. }
  9020. public function propagateLiteral($decidedLiteral, $level, $decisions)
  9021. {
  9022. $literal = -$decidedLiteral;
  9023. if (!isset($this->watchChains[$literal])) {
  9024. return null;
  9025. }
  9026. $chain = $this->watchChains[$literal];
  9027. $chain->rewind();
  9028. while ($chain->valid()) {
  9029. $node = $chain->current();
  9030. $otherWatch = $node->getOtherWatch($literal);
  9031. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  9032. $ruleLiterals = $node->getRule()->getLiterals();
  9033. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  9034. return $literal !== $ruleLiteral &&
  9035. $otherWatch !== $ruleLiteral &&
  9036. !$decisions->conflict($ruleLiteral);
  9037. });
  9038. if ($alternativeLiterals) {
  9039. reset($alternativeLiterals);
  9040. $this->moveWatch($literal, current($alternativeLiterals), $node);
  9041. continue;
  9042. }
  9043. if ($decisions->conflict($otherWatch)) {
  9044. return $node->getRule();
  9045. }
  9046. $decisions->decide($otherWatch, $level, $node->getRule());
  9047. }
  9048. $chain->next();
  9049. }
  9050. return null;
  9051. }
  9052. protected function moveWatch($fromLiteral, $toLiteral, $node)
  9053. {
  9054. if (!isset($this->watchChains[$toLiteral])) {
  9055. $this->watchChains[$toLiteral] = new RuleWatchChain;
  9056. }
  9057. $node->moveWatch($fromLiteral, $toLiteral);
  9058. $this->watchChains[$fromLiteral]->remove();
  9059. $this->watchChains[$toLiteral]->unshift($node);
  9060. }
  9061. }
  9062. <?php
  9063. namespace Composer\DependencyResolver;
  9064. class RuleWatchNode
  9065. {
  9066. public $watch1;
  9067. public $watch2;
  9068. protected $rule;
  9069. public function __construct($rule)
  9070. {
  9071. $this->rule = $rule;
  9072. $literals = $rule->getLiterals();
  9073. $literalCount = count($literals);
  9074. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  9075. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  9076. }
  9077. public function watch2OnHighest(Decisions $decisions)
  9078. {
  9079. $literals = $this->rule->getLiterals();
  9080. if (count($literals) < 3) {
  9081. return;
  9082. }
  9083. $watchLevel = 0;
  9084. foreach ($literals as $literal) {
  9085. $level = $decisions->decisionLevel($literal);
  9086. if ($level > $watchLevel) {
  9087. $this->watch2 = $literal;
  9088. $watchLevel = $level;
  9089. }
  9090. }
  9091. }
  9092. public function getRule()
  9093. {
  9094. return $this->rule;
  9095. }
  9096. public function getOtherWatch($literal)
  9097. {
  9098. if ($this->watch1 == $literal) {
  9099. return $this->watch2;
  9100. }
  9101. return $this->watch1;
  9102. }
  9103. public function moveWatch($from, $to)
  9104. {
  9105. if ($this->watch1 == $from) {
  9106. $this->watch1 = $to;
  9107. } else {
  9108. $this->watch2 = $to;
  9109. }
  9110. }
  9111. }
  9112. <?php
  9113. namespace Composer\DependencyResolver;
  9114. use Composer\IO\IOInterface;
  9115. use Composer\Repository\RepositoryInterface;
  9116. use Composer\Repository\PlatformRepository;
  9117. class Solver
  9118. {
  9119. const BRANCH_LITERALS = 0;
  9120. const BRANCH_LEVEL = 1;
  9121. protected $policy;
  9122. protected $pool;
  9123. protected $installed;
  9124. protected $rules;
  9125. protected $ruleSetGenerator;
  9126. protected $jobs;
  9127. protected $updateMap = array();
  9128. protected $watchGraph;
  9129. protected $decisions;
  9130. protected $installedMap;
  9131. protected $propagateIndex;
  9132. protected $branches = array();
  9133. protected $problems = array();
  9134. protected $learnedPool = array();
  9135. protected $learnedWhy = array();
  9136. protected $io;
  9137. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  9138. {
  9139. $this->io = $io;
  9140. $this->policy = $policy;
  9141. $this->pool = $pool;
  9142. $this->installed = $installed;
  9143. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  9144. }
  9145. public function getRuleSetSize()
  9146. {
  9147. return count($this->rules);
  9148. }
  9149. private function makeAssertionRuleDecisions()
  9150. {
  9151. $decisionStart = count($this->decisions) - 1;
  9152. $rulesCount = count($this->rules);
  9153. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  9154. $rule = $this->rules->ruleById[$ruleIndex];
  9155. if (!$rule->isAssertion() || $rule->isDisabled()) {
  9156. continue;
  9157. }
  9158. $literals = $rule->getLiterals();
  9159. $literal = $literals[0];
  9160. if (!$this->decisions->decided($literal)) {
  9161. $this->decisions->decide($literal, 1, $rule);
  9162. continue;
  9163. }
  9164. if ($this->decisions->satisfy($literal)) {
  9165. continue;
  9166. }
  9167. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  9168. $rule->disable();
  9169. continue;
  9170. }
  9171. $conflict = $this->decisions->decisionRule($literal);
  9172. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  9173. $problem = new Problem($this->pool);
  9174. $problem->addRule($rule);
  9175. $problem->addRule($conflict);
  9176. $this->disableProblem($rule);
  9177. $this->problems[] = $problem;
  9178. continue;
  9179. }
  9180. $problem = new Problem($this->pool);
  9181. $problem->addRule($rule);
  9182. $problem->addRule($conflict);
  9183. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  9184. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  9185. continue;
  9186. }
  9187. $assertRuleLiterals = $assertRule->getLiterals();
  9188. $assertRuleLiteral = $assertRuleLiterals[0];
  9189. if (abs($literal) !== abs($assertRuleLiteral)) {
  9190. continue;
  9191. }
  9192. $problem->addRule($assertRule);
  9193. $this->disableProblem($assertRule);
  9194. }
  9195. $this->problems[] = $problem;
  9196. $this->decisions->resetToOffset($decisionStart);
  9197. $ruleIndex = -1;
  9198. }
  9199. }
  9200. protected function setupInstalledMap()
  9201. {
  9202. $this->installedMap = array();
  9203. foreach ($this->installed->getPackages() as $package) {
  9204. $this->installedMap[$package->id] = $package;
  9205. }
  9206. }
  9207. protected function checkForRootRequireProblems($ignorePlatformReqs)
  9208. {
  9209. foreach ($this->jobs as $job) {
  9210. switch ($job['cmd']) {
  9211. case 'update':
  9212. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9213. foreach ($packages as $package) {
  9214. if (isset($this->installedMap[$package->id])) {
  9215. $this->updateMap[$package->id] = true;
  9216. }
  9217. }
  9218. break;
  9219. case 'update-all':
  9220. foreach ($this->installedMap as $package) {
  9221. $this->updateMap[$package->id] = true;
  9222. }
  9223. break;
  9224. case 'install':
  9225. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9226. break;
  9227. }
  9228. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  9229. $problem = new Problem($this->pool);
  9230. $problem->addRule(new GenericRule(array(), null, null, $job));
  9231. $this->problems[] = $problem;
  9232. }
  9233. break;
  9234. }
  9235. }
  9236. }
  9237. public function solve(Request $request, $ignorePlatformReqs = false)
  9238. {
  9239. $this->jobs = $request->getJobs();
  9240. $this->setupInstalledMap();
  9241. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  9242. $this->checkForRootRequireProblems($ignorePlatformReqs);
  9243. $this->decisions = new Decisions($this->pool);
  9244. $this->watchGraph = new RuleWatchGraph;
  9245. foreach ($this->rules as $rule) {
  9246. $this->watchGraph->insert(new RuleWatchNode($rule));
  9247. }
  9248. $this->makeAssertionRuleDecisions();
  9249. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  9250. $before = microtime(true);
  9251. $this->runSat(true);
  9252. $this->io->writeError('', true, IOInterface::DEBUG);
  9253. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  9254. foreach ($this->installedMap as $packageId => $void) {
  9255. if ($this->decisions->undecided($packageId)) {
  9256. $this->decisions->decide(-$packageId, 1, null);
  9257. }
  9258. }
  9259. if ($this->problems) {
  9260. throw new SolverProblemsException($this->problems, $this->installedMap);
  9261. }
  9262. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  9263. return $transaction->getOperations();
  9264. }
  9265. protected function propagate($level)
  9266. {
  9267. while ($this->decisions->validOffset($this->propagateIndex)) {
  9268. $decision = $this->decisions->atOffset($this->propagateIndex);
  9269. $conflict = $this->watchGraph->propagateLiteral(
  9270. $decision[Decisions::DECISION_LITERAL],
  9271. $level,
  9272. $this->decisions
  9273. );
  9274. $this->propagateIndex++;
  9275. if ($conflict) {
  9276. return $conflict;
  9277. }
  9278. }
  9279. return null;
  9280. }
  9281. private function revert($level)
  9282. {
  9283. while (!$this->decisions->isEmpty()) {
  9284. $literal = $this->decisions->lastLiteral();
  9285. if ($this->decisions->undecided($literal)) {
  9286. break;
  9287. }
  9288. $decisionLevel = $this->decisions->decisionLevel($literal);
  9289. if ($decisionLevel <= $level) {
  9290. break;
  9291. }
  9292. $this->decisions->revertLast();
  9293. $this->propagateIndex = count($this->decisions);
  9294. }
  9295. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  9296. array_pop($this->branches);
  9297. }
  9298. }
  9299. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  9300. {
  9301. $level++;
  9302. $this->decisions->decide($literal, $level, $rule);
  9303. while (true) {
  9304. $rule = $this->propagate($level);
  9305. if (!$rule) {
  9306. break;
  9307. }
  9308. if ($level == 1) {
  9309. return $this->analyzeUnsolvable($rule, $disableRules);
  9310. }
  9311. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  9312. if ($newLevel <= 0 || $newLevel >= $level) {
  9313. throw new SolverBugException(
  9314. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  9315. );
  9316. } elseif (!$newRule) {
  9317. throw new SolverBugException(
  9318. "No rule was learned from analyzing $rule at level $level."
  9319. );
  9320. }
  9321. $level = $newLevel;
  9322. $this->revert($level);
  9323. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  9324. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  9325. $ruleNode = new RuleWatchNode($newRule);
  9326. $ruleNode->watch2OnHighest($this->decisions);
  9327. $this->watchGraph->insert($ruleNode);
  9328. $this->decisions->decide($learnLiteral, $level, $newRule);
  9329. }
  9330. return $level;
  9331. }
  9332. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  9333. {
  9334. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  9335. $selectedLiteral = array_shift($literals);
  9336. if (count($literals)) {
  9337. $this->branches[] = array($literals, $level);
  9338. }
  9339. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  9340. }
  9341. protected function analyze($level, Rule $rule)
  9342. {
  9343. $analyzedRule = $rule;
  9344. $ruleLevel = 1;
  9345. $num = 0;
  9346. $l1num = 0;
  9347. $seen = array();
  9348. $learnedLiterals = array(null);
  9349. $decisionId = count($this->decisions);
  9350. $this->learnedPool[] = array();
  9351. while (true) {
  9352. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  9353. foreach ($rule->getLiterals() as $literal) {
  9354. if ($this->decisions->satisfy($literal)) {
  9355. continue;
  9356. }
  9357. if (isset($seen[abs($literal)])) {
  9358. continue;
  9359. }
  9360. $seen[abs($literal)] = true;
  9361. $l = $this->decisions->decisionLevel($literal);
  9362. if (1 === $l) {
  9363. $l1num++;
  9364. } elseif ($level === $l) {
  9365. $num++;
  9366. } else {
  9367. $learnedLiterals[] = $literal;
  9368. if ($l > $ruleLevel) {
  9369. $ruleLevel = $l;
  9370. }
  9371. }
  9372. }
  9373. $l1retry = true;
  9374. while ($l1retry) {
  9375. $l1retry = false;
  9376. if (!$num && !--$l1num) {
  9377. break 2;
  9378. }
  9379. while (true) {
  9380. if ($decisionId <= 0) {
  9381. throw new SolverBugException(
  9382. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  9383. );
  9384. }
  9385. $decisionId--;
  9386. $decision = $this->decisions->atOffset($decisionId);
  9387. $literal = $decision[Decisions::DECISION_LITERAL];
  9388. if (isset($seen[abs($literal)])) {
  9389. break;
  9390. }
  9391. }
  9392. unset($seen[abs($literal)]);
  9393. if ($num && 0 === --$num) {
  9394. $learnedLiterals[0] = -abs($literal);
  9395. if (!$l1num) {
  9396. break 2;
  9397. }
  9398. foreach ($learnedLiterals as $i => $learnedLiteral) {
  9399. if ($i !== 0) {
  9400. unset($seen[abs($learnedLiteral)]);
  9401. }
  9402. }
  9403. $l1num++;
  9404. $l1retry = true;
  9405. }
  9406. }
  9407. $decision = $this->decisions->atOffset($decisionId);
  9408. $rule = $decision[Decisions::DECISION_REASON];
  9409. }
  9410. $why = count($this->learnedPool) - 1;
  9411. if (!$learnedLiterals[0]) {
  9412. throw new SolverBugException(
  9413. "Did not find a learnable literal in analyzed rule $analyzedRule."
  9414. );
  9415. }
  9416. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  9417. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  9418. }
  9419. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  9420. {
  9421. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  9422. $why = spl_object_hash($conflictRule);
  9423. $learnedWhy = $this->learnedWhy[$why];
  9424. $problemRules = $this->learnedPool[$learnedWhy];
  9425. foreach ($problemRules as $problemRule) {
  9426. $this->analyzeUnsolvableRule($problem, $problemRule);
  9427. }
  9428. return;
  9429. }
  9430. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  9431. return;
  9432. }
  9433. $problem->nextSection();
  9434. $problem->addRule($conflictRule);
  9435. }
  9436. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  9437. {
  9438. $problem = new Problem($this->pool);
  9439. $problem->addRule($conflictRule);
  9440. $this->analyzeUnsolvableRule($problem, $conflictRule);
  9441. $this->problems[] = $problem;
  9442. $seen = array();
  9443. $literals = $conflictRule->getLiterals();
  9444. foreach ($literals as $literal) {
  9445. if ($this->decisions->satisfy($literal)) {
  9446. continue;
  9447. }
  9448. $seen[abs($literal)] = true;
  9449. }
  9450. foreach ($this->decisions as $decision) {
  9451. $literal = $decision[Decisions::DECISION_LITERAL];
  9452. if (!isset($seen[abs($literal)])) {
  9453. continue;
  9454. }
  9455. $why = $decision[Decisions::DECISION_REASON];
  9456. $problem->addRule($why);
  9457. $this->analyzeUnsolvableRule($problem, $why);
  9458. $literals = $why->getLiterals();
  9459. foreach ($literals as $literal) {
  9460. if ($this->decisions->satisfy($literal)) {
  9461. continue;
  9462. }
  9463. $seen[abs($literal)] = true;
  9464. }
  9465. }
  9466. if ($disableRules) {
  9467. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  9468. $this->disableProblem($reason['rule']);
  9469. }
  9470. $this->resetSolver();
  9471. return 1;
  9472. }
  9473. return 0;
  9474. }
  9475. private function disableProblem(Rule $why)
  9476. {
  9477. $job = $why->getJob();
  9478. if (!$job) {
  9479. $why->disable();
  9480. return;
  9481. }
  9482. foreach ($this->rules as $rule) {
  9483. if ($job === $rule->getJob()) {
  9484. $rule->disable();
  9485. }
  9486. }
  9487. }
  9488. private function resetSolver()
  9489. {
  9490. $this->decisions->reset();
  9491. $this->propagateIndex = 0;
  9492. $this->branches = array();
  9493. $this->enableDisableLearnedRules();
  9494. $this->makeAssertionRuleDecisions();
  9495. }
  9496. private function enableDisableLearnedRules()
  9497. {
  9498. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  9499. $why = $this->learnedWhy[spl_object_hash($rule)];
  9500. $problemRules = $this->learnedPool[$why];
  9501. $foundDisabled = false;
  9502. foreach ($problemRules as $problemRule) {
  9503. if ($problemRule->isDisabled()) {
  9504. $foundDisabled = true;
  9505. break;
  9506. }
  9507. }
  9508. if ($foundDisabled && $rule->isEnabled()) {
  9509. $rule->disable();
  9510. } elseif (!$foundDisabled && $rule->isDisabled()) {
  9511. $rule->enable();
  9512. }
  9513. }
  9514. }
  9515. private function runSat($disableRules = true)
  9516. {
  9517. $this->propagateIndex = 0;
  9518. $decisionQueue = array();
  9519. $decisionSupplementQueue = array();
  9520. $disableRules = array();
  9521. $level = 1;
  9522. $systemLevel = $level + 1;
  9523. $installedPos = 0;
  9524. while (true) {
  9525. if (1 === $level) {
  9526. $conflictRule = $this->propagate($level);
  9527. if (null !== $conflictRule) {
  9528. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  9529. continue;
  9530. }
  9531. return;
  9532. }
  9533. }
  9534. if ($level < $systemLevel) {
  9535. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  9536. foreach ($iterator as $rule) {
  9537. if ($rule->isEnabled()) {
  9538. $decisionQueue = array();
  9539. $noneSatisfied = true;
  9540. foreach ($rule->getLiterals() as $literal) {
  9541. if ($this->decisions->satisfy($literal)) {
  9542. $noneSatisfied = false;
  9543. break;
  9544. }
  9545. if ($literal > 0 && $this->decisions->undecided($literal)) {
  9546. $decisionQueue[] = $literal;
  9547. }
  9548. }
  9549. if ($noneSatisfied && count($decisionQueue)) {
  9550. if (count($this->installed) != count($this->updateMap)) {
  9551. $prunedQueue = array();
  9552. foreach ($decisionQueue as $literal) {
  9553. if (isset($this->installedMap[abs($literal)])) {
  9554. $prunedQueue[] = $literal;
  9555. if (isset($this->updateMap[abs($literal)])) {
  9556. $prunedQueue = $decisionQueue;
  9557. break;
  9558. }
  9559. }
  9560. }
  9561. $decisionQueue = $prunedQueue;
  9562. }
  9563. }
  9564. if ($noneSatisfied && count($decisionQueue)) {
  9565. $oLevel = $level;
  9566. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9567. if (0 === $level) {
  9568. return;
  9569. }
  9570. if ($level <= $oLevel) {
  9571. break;
  9572. }
  9573. }
  9574. }
  9575. }
  9576. $systemLevel = $level + 1;
  9577. $iterator->next();
  9578. if ($iterator->valid()) {
  9579. continue;
  9580. }
  9581. }
  9582. if ($level < $systemLevel) {
  9583. $systemLevel = $level;
  9584. }
  9585. $rulesCount = count($this->rules);
  9586. $pass = 1;
  9587. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  9588. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  9589. if ($i == $rulesCount) {
  9590. if (1 === $pass) {
  9591. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  9592. } else {
  9593. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  9594. }
  9595. $i = 0;
  9596. $pass++;
  9597. }
  9598. $rule = $this->rules->ruleById[$i];
  9599. $literals = $rule->getLiterals();
  9600. if ($rule->isDisabled()) {
  9601. continue;
  9602. }
  9603. $decisionQueue = array();
  9604. foreach ($literals as $literal) {
  9605. if ($literal <= 0) {
  9606. if (!$this->decisions->decidedInstall($literal)) {
  9607. continue 2;
  9608. }
  9609. } else {
  9610. if ($this->decisions->decidedInstall($literal)) {
  9611. continue 2;
  9612. }
  9613. if ($this->decisions->undecided($literal)) {
  9614. $decisionQueue[] = $literal;
  9615. }
  9616. }
  9617. }
  9618. if (count($decisionQueue) < 2) {
  9619. continue;
  9620. }
  9621. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9622. if (0 === $level) {
  9623. return;
  9624. }
  9625. $rulesCount = count($this->rules);
  9626. $n = -1;
  9627. }
  9628. if ($level < $systemLevel) {
  9629. continue;
  9630. }
  9631. if (count($this->branches)) {
  9632. $lastLiteral = null;
  9633. $lastLevel = null;
  9634. $lastBranchIndex = 0;
  9635. $lastBranchOffset = 0;
  9636. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  9637. list($literals, $l) = $this->branches[$i];
  9638. foreach ($literals as $offset => $literal) {
  9639. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  9640. $lastLiteral = $literal;
  9641. $lastBranchIndex = $i;
  9642. $lastBranchOffset = $offset;
  9643. $lastLevel = $l;
  9644. }
  9645. }
  9646. }
  9647. if ($lastLiteral) {
  9648. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  9649. $level = $lastLevel;
  9650. $this->revert($level);
  9651. $why = $this->decisions->lastReason();
  9652. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  9653. if ($level == 0) {
  9654. return;
  9655. }
  9656. continue;
  9657. }
  9658. }
  9659. break;
  9660. }
  9661. }
  9662. }
  9663. <?php
  9664. namespace Composer\DependencyResolver;
  9665. class SolverBugException extends \RuntimeException
  9666. {
  9667. public function __construct($message)
  9668. {
  9669. parent::__construct(
  9670. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  9671. "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"
  9672. );
  9673. }
  9674. }
  9675. <?php
  9676. namespace Composer\DependencyResolver;
  9677. use Composer\Util\IniHelper;
  9678. class SolverProblemsException extends \RuntimeException
  9679. {
  9680. protected $problems;
  9681. protected $installedMap;
  9682. public function __construct(array $problems, array $installedMap)
  9683. {
  9684. $this->problems = $problems;
  9685. $this->installedMap = $installedMap;
  9686. parent::__construct($this->createMessage(), 2);
  9687. }
  9688. protected function createMessage()
  9689. {
  9690. $text = "\n";
  9691. $hasExtensionProblems = false;
  9692. foreach ($this->problems as $i => $problem) {
  9693. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  9694. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  9695. $hasExtensionProblems = true;
  9696. }
  9697. }
  9698. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  9699. $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.";
  9700. }
  9701. if ($hasExtensionProblems) {
  9702. $text .= $this->createExtensionHint();
  9703. }
  9704. return $text;
  9705. }
  9706. public function getProblems()
  9707. {
  9708. return $this->problems;
  9709. }
  9710. private function createExtensionHint()
  9711. {
  9712. $paths = IniHelper::getAll();
  9713. if (count($paths) === 1 && empty($paths[0])) {
  9714. return '';
  9715. }
  9716. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  9717. $text .= implode("\n - ", $paths);
  9718. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  9719. return $text;
  9720. }
  9721. private function hasExtensionProblems(array $reasonSets)
  9722. {
  9723. foreach ($reasonSets as $reasonSet) {
  9724. foreach ($reasonSet as $reason) {
  9725. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  9726. return true;
  9727. }
  9728. }
  9729. }
  9730. return false;
  9731. }
  9732. }
  9733. <?php
  9734. namespace Composer\DependencyResolver;
  9735. use Composer\Package\AliasPackage;
  9736. class Transaction
  9737. {
  9738. protected $policy;
  9739. protected $pool;
  9740. protected $installedMap;
  9741. protected $decisions;
  9742. protected $transaction;
  9743. public function __construct($policy, $pool, $installedMap, $decisions)
  9744. {
  9745. $this->policy = $policy;
  9746. $this->pool = $pool;
  9747. $this->installedMap = $installedMap;
  9748. $this->decisions = $decisions;
  9749. $this->transaction = array();
  9750. }
  9751. public function getOperations()
  9752. {
  9753. $installMeansUpdateMap = $this->findUpdates();
  9754. $updateMap = array();
  9755. $installMap = array();
  9756. $uninstallMap = array();
  9757. foreach ($this->decisions as $i => $decision) {
  9758. $literal = $decision[Decisions::DECISION_LITERAL];
  9759. $reason = $decision[Decisions::DECISION_REASON];
  9760. $package = $this->pool->literalToPackage($literal);
  9761. if (($literal > 0) == isset($this->installedMap[$package->id])) {
  9762. continue;
  9763. }
  9764. if ($literal > 0) {
  9765. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  9766. $source = $installMeansUpdateMap[abs($literal)];
  9767. $updateMap[$package->id] = array(
  9768. 'package' => $package,
  9769. 'source' => $source,
  9770. 'reason' => $reason,
  9771. );
  9772. unset($installMeansUpdateMap[abs($literal)]);
  9773. $ignoreRemove[$source->id] = true;
  9774. } else {
  9775. $installMap[$package->id] = array(
  9776. 'package' => $package,
  9777. 'reason' => $reason,
  9778. );
  9779. }
  9780. }
  9781. }
  9782. foreach ($this->decisions as $i => $decision) {
  9783. $literal = $decision[Decisions::DECISION_LITERAL];
  9784. $reason = $decision[Decisions::DECISION_REASON];
  9785. $package = $this->pool->literalToPackage($literal);
  9786. if ($literal <= 0 &&
  9787. isset($this->installedMap[$package->id]) &&
  9788. !isset($ignoreRemove[$package->id])) {
  9789. $uninstallMap[$package->id] = array(
  9790. 'package' => $package,
  9791. 'reason' => $reason,
  9792. );
  9793. }
  9794. }
  9795. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  9796. return $this->transaction;
  9797. }
  9798. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  9799. {
  9800. $queue = array_map(
  9801. function ($operation) {
  9802. return $operation['package'];
  9803. },
  9804. $this->findRootPackages($installMap, $updateMap)
  9805. );
  9806. $visited = array();
  9807. while (!empty($queue)) {
  9808. $package = array_pop($queue);
  9809. $packageId = $package->id;
  9810. if (!isset($visited[$packageId])) {
  9811. $queue[] = $package;
  9812. if ($package instanceof AliasPackage) {
  9813. $queue[] = $package->getAliasOf();
  9814. } else {
  9815. foreach ($package->getRequires() as $link) {
  9816. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9817. foreach ($possibleRequires as $require) {
  9818. $queue[] = $require;
  9819. }
  9820. }
  9821. }
  9822. $visited[$package->id] = true;
  9823. } else {
  9824. if (isset($installMap[$packageId])) {
  9825. $this->install(
  9826. $installMap[$packageId]['package'],
  9827. $installMap[$packageId]['reason']
  9828. );
  9829. unset($installMap[$packageId]);
  9830. }
  9831. if (isset($updateMap[$packageId])) {
  9832. $this->update(
  9833. $updateMap[$packageId]['source'],
  9834. $updateMap[$packageId]['package'],
  9835. $updateMap[$packageId]['reason']
  9836. );
  9837. unset($updateMap[$packageId]);
  9838. }
  9839. }
  9840. }
  9841. foreach ($uninstallMap as $uninstall) {
  9842. $this->uninstall($uninstall['package'], $uninstall['reason']);
  9843. }
  9844. }
  9845. protected function findRootPackages($installMap, $updateMap)
  9846. {
  9847. $packages = $installMap + $updateMap;
  9848. $roots = $packages;
  9849. foreach ($packages as $packageId => $operation) {
  9850. $package = $operation['package'];
  9851. if (!isset($roots[$packageId])) {
  9852. continue;
  9853. }
  9854. foreach ($package->getRequires() as $link) {
  9855. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9856. foreach ($possibleRequires as $require) {
  9857. if ($require !== $package) {
  9858. unset($roots[$require->id]);
  9859. }
  9860. }
  9861. }
  9862. }
  9863. return $roots;
  9864. }
  9865. protected function findUpdates()
  9866. {
  9867. $installMeansUpdateMap = array();
  9868. foreach ($this->decisions as $i => $decision) {
  9869. $literal = $decision[Decisions::DECISION_LITERAL];
  9870. $package = $this->pool->literalToPackage($literal);
  9871. if ($package instanceof AliasPackage) {
  9872. continue;
  9873. }
  9874. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  9875. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  9876. $literals = array($package->id);
  9877. foreach ($updates as $update) {
  9878. $literals[] = $update->id;
  9879. }
  9880. foreach ($literals as $updateLiteral) {
  9881. if ($updateLiteral !== $literal) {
  9882. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  9883. }
  9884. }
  9885. }
  9886. }
  9887. return $installMeansUpdateMap;
  9888. }
  9889. protected function install($package, $reason)
  9890. {
  9891. if ($package instanceof AliasPackage) {
  9892. return $this->markAliasInstalled($package, $reason);
  9893. }
  9894. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  9895. }
  9896. protected function update($from, $to, $reason)
  9897. {
  9898. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  9899. }
  9900. protected function uninstall($package, $reason)
  9901. {
  9902. if ($package instanceof AliasPackage) {
  9903. return $this->markAliasUninstalled($package, $reason);
  9904. }
  9905. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  9906. }
  9907. protected function markAliasInstalled($package, $reason)
  9908. {
  9909. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  9910. }
  9911. protected function markAliasUninstalled($package, $reason)
  9912. {
  9913. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  9914. }
  9915. }
  9916. <?php
  9917. namespace Composer\Downloader;
  9918. use Composer\Package\PackageInterface;
  9919. use Symfony\Component\Finder\Finder;
  9920. use Composer\IO\IOInterface;
  9921. abstract class ArchiveDownloader extends FileDownloader
  9922. {
  9923. public function download(PackageInterface $package, $path, $output = true)
  9924. {
  9925. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  9926. $retries = 3;
  9927. while ($retries--) {
  9928. $fileName = parent::download($package, $path, $output);
  9929. if ($output) {
  9930. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  9931. }
  9932. try {
  9933. $this->filesystem->ensureDirectoryExists($temporaryDir);
  9934. try {
  9935. $this->extract($fileName, $temporaryDir);
  9936. } catch (\Exception $e) {
  9937. parent::clearLastCacheWrite($package);
  9938. throw $e;
  9939. }
  9940. $this->filesystem->unlink($fileName);
  9941. $contentDir = $this->getFolderContent($temporaryDir);
  9942. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  9943. $contentDir = $this->getFolderContent((string) reset($contentDir));
  9944. }
  9945. foreach ($contentDir as $file) {
  9946. $file = (string) $file;
  9947. $this->filesystem->rename($file, $path . '/' . basename($file));
  9948. }
  9949. $this->filesystem->removeDirectory($temporaryDir);
  9950. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  9951. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  9952. }
  9953. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  9954. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  9955. }
  9956. } catch (\Exception $e) {
  9957. $this->filesystem->removeDirectory($path);
  9958. $this->filesystem->removeDirectory($temporaryDir);
  9959. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  9960. $this->io->writeError('');
  9961. if ($this->io->isDebug()) {
  9962. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  9963. } else {
  9964. $this->io->writeError(' Invalid zip file, retrying...');
  9965. }
  9966. usleep(500000);
  9967. continue;
  9968. }
  9969. throw $e;
  9970. }
  9971. break;
  9972. }
  9973. }
  9974. protected function getFileName(PackageInterface $package, $path)
  9975. {
  9976. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  9977. }
  9978. abstract protected function extract($file, $path);
  9979. private function getFolderContent($dir)
  9980. {
  9981. $finder = Finder::create()
  9982. ->ignoreVCS(false)
  9983. ->ignoreDotFiles(false)
  9984. ->notName('.DS_Store')
  9985. ->depth(0)
  9986. ->in($dir);
  9987. return iterator_to_array($finder);
  9988. }
  9989. }
  9990. <?php
  9991. namespace Composer\Downloader;
  9992. use Composer\Package\PackageInterface;
  9993. interface ChangeReportInterface
  9994. {
  9995. public function getLocalChanges(PackageInterface $package, $path);
  9996. }
  9997. <?php
  9998. namespace Composer\Downloader;
  9999. use Composer\Package\PackageInterface;
  10000. use Composer\IO\IOInterface;
  10001. use Composer\Util\Filesystem;
  10002. class DownloadManager
  10003. {
  10004. private $io;
  10005. private $preferDist = false;
  10006. private $preferSource = false;
  10007. private $packagePreferences = array();
  10008. private $filesystem;
  10009. private $downloaders = array();
  10010. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  10011. {
  10012. $this->io = $io;
  10013. $this->preferSource = $preferSource;
  10014. $this->filesystem = $filesystem ?: new Filesystem();
  10015. }
  10016. public function setPreferSource($preferSource)
  10017. {
  10018. $this->preferSource = $preferSource;
  10019. return $this;
  10020. }
  10021. public function setPreferDist($preferDist)
  10022. {
  10023. $this->preferDist = $preferDist;
  10024. return $this;
  10025. }
  10026. public function setPreferences(array $preferences)
  10027. {
  10028. $this->packagePreferences = $preferences;
  10029. return $this;
  10030. }
  10031. public function setOutputProgress($outputProgress)
  10032. {
  10033. foreach ($this->downloaders as $downloader) {
  10034. $downloader->setOutputProgress($outputProgress);
  10035. }
  10036. return $this;
  10037. }
  10038. public function setDownloader($type, DownloaderInterface $downloader)
  10039. {
  10040. $type = strtolower($type);
  10041. $this->downloaders[$type] = $downloader;
  10042. return $this;
  10043. }
  10044. public function getDownloader($type)
  10045. {
  10046. $type = strtolower($type);
  10047. if (!isset($this->downloaders[$type])) {
  10048. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  10049. }
  10050. return $this->downloaders[$type];
  10051. }
  10052. public function getDownloaderForInstalledPackage(PackageInterface $package)
  10053. {
  10054. $installationSource = $package->getInstallationSource();
  10055. if ('metapackage' === $package->getType()) {
  10056. return;
  10057. }
  10058. if ('dist' === $installationSource) {
  10059. $downloader = $this->getDownloader($package->getDistType());
  10060. } elseif ('source' === $installationSource) {
  10061. $downloader = $this->getDownloader($package->getSourceType());
  10062. } else {
  10063. throw new \InvalidArgumentException(
  10064. 'Package '.$package.' seems not been installed properly'
  10065. );
  10066. }
  10067. if ($installationSource !== $downloader->getInstallationSource()) {
  10068. throw new \LogicException(sprintf(
  10069. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  10070. get_class($downloader),
  10071. $downloader->getInstallationSource(),
  10072. $installationSource,
  10073. $package
  10074. ));
  10075. }
  10076. return $downloader;
  10077. }
  10078. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  10079. {
  10080. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  10081. $sourceType = $package->getSourceType();
  10082. $distType = $package->getDistType();
  10083. $sources = array();
  10084. if ($sourceType) {
  10085. $sources[] = 'source';
  10086. }
  10087. if ($distType) {
  10088. $sources[] = 'dist';
  10089. }
  10090. if (empty($sources)) {
  10091. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  10092. }
  10093. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  10094. $sources = array_reverse($sources);
  10095. }
  10096. $this->filesystem->ensureDirectoryExists($targetDir);
  10097. foreach ($sources as $i => $source) {
  10098. if (isset($e)) {
  10099. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  10100. }
  10101. $package->setInstallationSource($source);
  10102. try {
  10103. $downloader = $this->getDownloaderForInstalledPackage($package);
  10104. if ($downloader) {
  10105. $downloader->download($package, $targetDir);
  10106. }
  10107. break;
  10108. } catch (\RuntimeException $e) {
  10109. if ($i === count($sources) - 1) {
  10110. throw $e;
  10111. }
  10112. $this->io->writeError(
  10113. ' <warning>Failed to download '.
  10114. $package->getPrettyName().
  10115. ' from ' . $source . ': '.
  10116. $e->getMessage().'</warning>'
  10117. );
  10118. }
  10119. }
  10120. }
  10121. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  10122. {
  10123. $downloader = $this->getDownloaderForInstalledPackage($initial);
  10124. if (!$downloader) {
  10125. return;
  10126. }
  10127. $installationSource = $initial->getInstallationSource();
  10128. if ('dist' === $installationSource) {
  10129. $initialType = $initial->getDistType();
  10130. $targetType = $target->getDistType();
  10131. } else {
  10132. $initialType = $initial->getSourceType();
  10133. $targetType = $target->getSourceType();
  10134. }
  10135. if ($target->isDev() && 'dist' === $installationSource) {
  10136. $downloader->remove($initial, $targetDir);
  10137. $this->download($target, $targetDir);
  10138. return;
  10139. }
  10140. if ($initialType === $targetType) {
  10141. $target->setInstallationSource($installationSource);
  10142. try {
  10143. $downloader->update($initial, $target, $targetDir);
  10144. return;
  10145. } catch (\RuntimeException $e) {
  10146. if (!$this->io->isInteractive()) {
  10147. throw $e;
  10148. }
  10149. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  10150. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  10151. throw $e;
  10152. }
  10153. }
  10154. }
  10155. $downloader->remove($initial, $targetDir);
  10156. $this->download($target, $targetDir, 'source' === $installationSource);
  10157. }
  10158. public function remove(PackageInterface $package, $targetDir)
  10159. {
  10160. $downloader = $this->getDownloaderForInstalledPackage($package);
  10161. if ($downloader) {
  10162. $downloader->remove($package, $targetDir);
  10163. }
  10164. }
  10165. protected function resolvePackageInstallPreference(PackageInterface $package)
  10166. {
  10167. foreach ($this->packagePreferences as $pattern => $preference) {
  10168. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  10169. if (preg_match($pattern, $package->getName())) {
  10170. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  10171. return 'dist';
  10172. }
  10173. return 'source';
  10174. }
  10175. }
  10176. return $package->isDev() ? 'source' : 'dist';
  10177. }
  10178. }
  10179. <?php
  10180. namespace Composer\Downloader;
  10181. use Composer\Package\PackageInterface;
  10182. interface DownloaderInterface
  10183. {
  10184. public function getInstallationSource();
  10185. public function download(PackageInterface $package, $path);
  10186. public function update(PackageInterface $initial, PackageInterface $target, $path);
  10187. public function remove(PackageInterface $package, $path);
  10188. public function setOutputProgress($outputProgress);
  10189. }
  10190. <?php
  10191. namespace Composer\Downloader;
  10192. use Composer\Package\PackageInterface;
  10193. interface DvcsDownloaderInterface
  10194. {
  10195. public function getUnpushedChanges(PackageInterface $package, $path);
  10196. }
  10197. <?php
  10198. namespace Composer\Downloader;
  10199. use Composer\Config;
  10200. use Composer\Cache;
  10201. use Composer\Factory;
  10202. use Composer\IO\IOInterface;
  10203. use Composer\IO\NullIO;
  10204. use Composer\Package\Comparer\Comparer;
  10205. use Composer\Package\PackageInterface;
  10206. use Composer\Package\Version\VersionParser;
  10207. use Composer\Plugin\PluginEvents;
  10208. use Composer\Plugin\PreFileDownloadEvent;
  10209. use Composer\EventDispatcher\EventDispatcher;
  10210. use Composer\Util\Filesystem;
  10211. use Composer\Util\RemoteFilesystem;
  10212. use Composer\Util\Url as UrlUtil;
  10213. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  10214. {
  10215. protected $io;
  10216. protected $config;
  10217. protected $rfs;
  10218. protected $filesystem;
  10219. protected $cache;
  10220. protected $outputProgress = true;
  10221. private $lastCacheWrites = array();
  10222. private $eventDispatcher;
  10223. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  10224. {
  10225. $this->io = $io;
  10226. $this->config = $config;
  10227. $this->eventDispatcher = $eventDispatcher;
  10228. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  10229. $this->filesystem = $filesystem ?: new Filesystem();
  10230. $this->cache = $cache;
  10231. if ($this->cache && $this->cache->gcIsNecessary()) {
  10232. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  10233. }
  10234. }
  10235. public function getInstallationSource()
  10236. {
  10237. return 'dist';
  10238. }
  10239. public function download(PackageInterface $package, $path, $output = true)
  10240. {
  10241. if (!$package->getDistUrl()) {
  10242. throw new \InvalidArgumentException('The given package is missing url information');
  10243. }
  10244. if ($output) {
  10245. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  10246. }
  10247. $urls = $package->getDistUrls();
  10248. while ($url = array_shift($urls)) {
  10249. try {
  10250. $fileName = $this->doDownload($package, $path, $url);
  10251. break;
  10252. } catch (\Exception $e) {
  10253. if ($this->io->isDebug()) {
  10254. $this->io->writeError('');
  10255. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  10256. } elseif (count($urls)) {
  10257. $this->io->writeError('');
  10258. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  10259. }
  10260. if (!count($urls)) {
  10261. throw $e;
  10262. }
  10263. }
  10264. }
  10265. if ($output) {
  10266. $this->io->writeError('');
  10267. }
  10268. return $fileName;
  10269. }
  10270. protected function doDownload(PackageInterface $package, $path, $url)
  10271. {
  10272. $this->filesystem->emptyDirectory($path);
  10273. $fileName = $this->getFileName($package, $path);
  10274. $processedUrl = $this->processUrl($package, $url);
  10275. $hostname = parse_url($processedUrl, PHP_URL_HOST);
  10276. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  10277. if ($this->eventDispatcher) {
  10278. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  10279. }
  10280. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  10281. try {
  10282. $checksum = $package->getDistSha1Checksum();
  10283. $cacheKey = $this->getCacheKey($package, $processedUrl);
  10284. if ($this->cache && (!$checksum || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
  10285. $this->io->writeError('Loading from cache', false);
  10286. } else {
  10287. if (!$this->outputProgress) {
  10288. $this->io->writeError('Downloading', false);
  10289. }
  10290. $retries = 3;
  10291. while ($retries--) {
  10292. try {
  10293. $rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  10294. break;
  10295. } catch (TransportException $e) {
  10296. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  10297. throw $e;
  10298. }
  10299. $this->io->writeError('');
  10300. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  10301. usleep(500000);
  10302. }
  10303. }
  10304. if (!$this->outputProgress) {
  10305. $this->io->writeError(' (<comment>100%</comment>)', false);
  10306. }
  10307. if ($this->cache) {
  10308. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  10309. $this->cache->copyFrom($cacheKey, $fileName);
  10310. }
  10311. }
  10312. if (!file_exists($fileName)) {
  10313. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  10314. .' directory is writable and you have internet connectivity');
  10315. }
  10316. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  10317. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  10318. }
  10319. } catch (\Exception $e) {
  10320. $this->filesystem->removeDirectory($path);
  10321. $this->clearLastCacheWrite($package);
  10322. throw $e;
  10323. }
  10324. return $fileName;
  10325. }
  10326. public function setOutputProgress($outputProgress)
  10327. {
  10328. $this->outputProgress = $outputProgress;
  10329. return $this;
  10330. }
  10331. protected function clearLastCacheWrite(PackageInterface $package)
  10332. {
  10333. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  10334. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  10335. unset($this->lastCacheWrites[$package->getName()]);
  10336. }
  10337. }
  10338. public function update(PackageInterface $initial, PackageInterface $target, $path)
  10339. {
  10340. $name = $target->getName();
  10341. $from = $initial->getPrettyVersion();
  10342. $to = $target->getPrettyVersion();
  10343. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  10344. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  10345. $this->remove($initial, $path, false);
  10346. $this->download($target, $path, false);
  10347. $this->io->writeError('');
  10348. }
  10349. public function remove(PackageInterface $package, $path, $output = true)
  10350. {
  10351. if ($output) {
  10352. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10353. }
  10354. if (!$this->filesystem->removeDirectory($path)) {
  10355. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10356. }
  10357. }
  10358. protected function getFileName(PackageInterface $package, $path)
  10359. {
  10360. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10361. }
  10362. protected function processUrl(PackageInterface $package, $url)
  10363. {
  10364. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  10365. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  10366. }
  10367. if ($package->getDistReference()) {
  10368. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  10369. }
  10370. return $url;
  10371. }
  10372. private function getCacheKey(PackageInterface $package, $processedUrl)
  10373. {
  10374. $cacheKey = sha1($processedUrl);
  10375. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  10376. }
  10377. public function getLocalChanges(PackageInterface $package, $targetDir)
  10378. {
  10379. $prevIO = $this->io;
  10380. $prevProgress = $this->outputProgress;
  10381. $this->io = new NullIO;
  10382. $this->io->loadConfiguration($this->config);
  10383. $this->outputProgress = false;
  10384. $e = null;
  10385. try {
  10386. $this->download($package, $targetDir.'_compare', false);
  10387. $comparer = new Comparer();
  10388. $comparer->setSource($targetDir.'_compare');
  10389. $comparer->setUpdate($targetDir);
  10390. $comparer->doCompare();
  10391. $output = $comparer->getChanged(true, true);
  10392. $this->filesystem->removeDirectory($targetDir.'_compare');
  10393. } catch (\Exception $e) {
  10394. }
  10395. $this->io = $prevIO;
  10396. $this->outputProgress = $prevProgress;
  10397. if ($e) {
  10398. throw $e;
  10399. }
  10400. return trim($output);
  10401. }
  10402. }
  10403. <?php
  10404. namespace Composer\Downloader;
  10405. class FilesystemException extends \Exception
  10406. {
  10407. public function __construct($message = '', $code = 0, \Exception $previous = null)
  10408. {
  10409. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  10410. }
  10411. }
  10412. <?php
  10413. namespace Composer\Downloader;
  10414. use Composer\Package\PackageInterface;
  10415. use Composer\Util\ProcessExecutor;
  10416. class FossilDownloader extends VcsDownloader
  10417. {
  10418. public function doDownload(PackageInterface $package, $path, $url)
  10419. {
  10420. $this->config->prohibitUrlByConfig($url, $this->io);
  10421. $url = ProcessExecutor::escape($url);
  10422. $ref = ProcessExecutor::escape($package->getSourceReference());
  10423. $repoFile = $path . '.fossil';
  10424. $this->io->writeError("Cloning ".$package->getSourceReference());
  10425. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  10426. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10427. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10428. }
  10429. $command = sprintf('fossil open %s --nested', ProcessExecutor::escape($repoFile));
  10430. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10431. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10432. }
  10433. $command = sprintf('fossil update %s', $ref);
  10434. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10435. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10436. }
  10437. }
  10438. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10439. {
  10440. $this->config->prohibitUrlByConfig($url, $this->io);
  10441. $url = ProcessExecutor::escape($url);
  10442. $ref = ProcessExecutor::escape($target->getSourceReference());
  10443. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10444. if (!$this->hasMetadataRepository($path)) {
  10445. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10446. }
  10447. $command = sprintf('fossil pull && fossil up %s', $ref);
  10448. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10449. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10450. }
  10451. }
  10452. public function getLocalChanges(PackageInterface $package, $path)
  10453. {
  10454. if (!$this->hasMetadataRepository($path)) {
  10455. return null;
  10456. }
  10457. $this->process->execute('fossil changes', $output, realpath($path));
  10458. return trim($output) ?: null;
  10459. }
  10460. protected function getCommitLogs($fromReference, $toReference, $path)
  10461. {
  10462. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  10463. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10464. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10465. }
  10466. $log = '';
  10467. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  10468. foreach ($this->process->splitLines($output) as $line) {
  10469. if (preg_match($match, $line)) {
  10470. break;
  10471. }
  10472. $log .= $line;
  10473. }
  10474. return $log;
  10475. }
  10476. protected function hasMetadataRepository($path)
  10477. {
  10478. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  10479. }
  10480. }
  10481. <?php
  10482. namespace Composer\Downloader;
  10483. use Composer\Config;
  10484. use Composer\IO\IOInterface;
  10485. use Composer\Package\PackageInterface;
  10486. use Composer\Util\Filesystem;
  10487. use Composer\Util\Git as GitUtil;
  10488. use Composer\Util\Platform;
  10489. use Composer\Util\ProcessExecutor;
  10490. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  10491. {
  10492. private $hasStashedChanges = false;
  10493. private $hasDiscardedChanges = false;
  10494. private $gitUtil;
  10495. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10496. {
  10497. parent::__construct($io, $config, $process, $fs);
  10498. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  10499. }
  10500. public function doDownload(PackageInterface $package, $path, $url)
  10501. {
  10502. GitUtil::cleanEnv();
  10503. $path = $this->normalizePath($path);
  10504. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  10505. $ref = $package->getSourceReference();
  10506. $flag = Platform::isWindows() ? '/D ' : '';
  10507. $gitVersion = $this->gitUtil->getVersion();
  10508. $msg = "Cloning ".$this->getShortHash($ref);
  10509. $command = 'git clone --no-checkout %url% %path% && cd '.$flag.'%path% && git remote add composer %url% && git fetch composer';
  10510. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=')) {
  10511. $this->io->writeError('', true, IOInterface::DEBUG);
  10512. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  10513. try {
  10514. $this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref);
  10515. if (is_dir($cachePath)) {
  10516. $command =
  10517. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  10518. . '&& cd '.$flag.'%path% '
  10519. . '&& git remote set-url origin %url% && git remote add composer %url%';
  10520. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  10521. }
  10522. } catch (\RuntimeException $e) {
  10523. }
  10524. }
  10525. $this->io->writeError($msg);
  10526. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  10527. return str_replace(
  10528. array('%url%', '%path%', '%cachePath%'),
  10529. array(
  10530. ProcessExecutor::escape($url),
  10531. ProcessExecutor::escape($path),
  10532. ProcessExecutor::escape($cachePath),
  10533. ),
  10534. $command
  10535. );
  10536. };
  10537. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  10538. if ($url !== $package->getSourceUrl()) {
  10539. $this->updateOriginUrl($path, $package->getSourceUrl());
  10540. } else {
  10541. $this->setPushUrl($path, $url);
  10542. }
  10543. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  10544. if ($package->getDistReference() === $package->getSourceReference()) {
  10545. $package->setDistReference($newRef);
  10546. }
  10547. $package->setSourceReference($newRef);
  10548. }
  10549. }
  10550. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10551. {
  10552. GitUtil::cleanEnv();
  10553. if (!$this->hasMetadataRepository($path)) {
  10554. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10555. }
  10556. $updateOriginUrl = false;
  10557. if (
  10558. 0 === $this->process->execute('git remote -v', $output, $path)
  10559. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  10560. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  10561. ) {
  10562. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  10563. $updateOriginUrl = true;
  10564. }
  10565. }
  10566. $ref = $target->getSourceReference();
  10567. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  10568. $command = 'git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)';
  10569. $commandCallable = function ($url) use ($command, $ref) {
  10570. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($ref.'^{commit}'));
  10571. };
  10572. $this->gitUtil->runCommand($commandCallable, $url, $path);
  10573. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  10574. if ($target->getDistReference() === $target->getSourceReference()) {
  10575. $target->setDistReference($newRef);
  10576. }
  10577. $target->setSourceReference($newRef);
  10578. }
  10579. if ($updateOriginUrl) {
  10580. $this->updateOriginUrl($path, $target->getSourceUrl());
  10581. }
  10582. }
  10583. public function getLocalChanges(PackageInterface $package, $path)
  10584. {
  10585. GitUtil::cleanEnv();
  10586. if (!$this->hasMetadataRepository($path)) {
  10587. return;
  10588. }
  10589. $command = 'git status --porcelain --untracked-files=no';
  10590. if (0 !== $this->process->execute($command, $output, $path)) {
  10591. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10592. }
  10593. return trim($output) ?: null;
  10594. }
  10595. public function getUnpushedChanges(PackageInterface $package, $path)
  10596. {
  10597. GitUtil::cleanEnv();
  10598. $path = $this->normalizePath($path);
  10599. if (!$this->hasMetadataRepository($path)) {
  10600. return;
  10601. }
  10602. $command = 'git show-ref --head -d';
  10603. if (0 !== $this->process->execute($command, $output, $path)) {
  10604. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10605. }
  10606. $refs = trim($output);
  10607. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  10608. return;
  10609. }
  10610. $headRef = $match[1];
  10611. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  10612. return;
  10613. }
  10614. $branch = $matches[1][0];
  10615. $unpushedChanges = null;
  10616. for ($i = 0; $i <= 1; $i++) {
  10617. foreach ($matches[1] as $candidate) {
  10618. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  10619. $branch = $candidate;
  10620. $remoteBranch = $match[1];
  10621. break;
  10622. }
  10623. }
  10624. if (!isset($remoteBranch)) {
  10625. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  10626. } else {
  10627. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  10628. if (0 !== $this->process->execute($command, $output, $path)) {
  10629. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10630. }
  10631. $unpushedChanges = trim($output) ?: null;
  10632. }
  10633. if ($unpushedChanges && $i === 0) {
  10634. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  10635. }
  10636. if (!$unpushedChanges) {
  10637. break;
  10638. }
  10639. }
  10640. return $unpushedChanges;
  10641. }
  10642. protected function cleanChanges(PackageInterface $package, $path, $update)
  10643. {
  10644. GitUtil::cleanEnv();
  10645. $path = $this->normalizePath($path);
  10646. $unpushed = $this->getUnpushedChanges($package, $path);
  10647. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  10648. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  10649. }
  10650. if (!$changes = $this->getLocalChanges($package, $path)) {
  10651. return;
  10652. }
  10653. if (!$this->io->isInteractive()) {
  10654. $discardChanges = $this->config->get('discard-changes');
  10655. if (true === $discardChanges) {
  10656. return $this->discardChanges($path);
  10657. }
  10658. if ('stash' === $discardChanges) {
  10659. if (!$update) {
  10660. return parent::cleanChanges($package, $path, $update);
  10661. }
  10662. return $this->stashChanges($path);
  10663. }
  10664. return parent::cleanChanges($package, $path, $update);
  10665. }
  10666. $changes = array_map(function ($elem) {
  10667. return ' '.$elem;
  10668. }, preg_split('{\s*\r?\n\s*}', $changes));
  10669. $this->io->writeError(' <error>The package has modified files:</error>');
  10670. $this->io->writeError(array_slice($changes, 0, 10));
  10671. if (count($changes) > 10) {
  10672. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  10673. }
  10674. while (true) {
  10675. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  10676. case 'y':
  10677. $this->discardChanges($path);
  10678. break 2;
  10679. case 's':
  10680. if (!$update) {
  10681. goto help;
  10682. }
  10683. $this->stashChanges($path);
  10684. break 2;
  10685. case 'n':
  10686. throw new \RuntimeException('Update aborted');
  10687. case 'v':
  10688. $this->io->writeError($changes);
  10689. break;
  10690. case 'd':
  10691. $this->viewDiff($path);
  10692. break;
  10693. case '?':
  10694. default:
  10695. help:
  10696. $this->io->writeError(array(
  10697. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  10698. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  10699. ' v - view modified files',
  10700. ' d - view local modifications (diff)',
  10701. ));
  10702. if ($update) {
  10703. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  10704. }
  10705. $this->io->writeError(' ? - print help');
  10706. break;
  10707. }
  10708. }
  10709. }
  10710. protected function reapplyChanges($path)
  10711. {
  10712. $path = $this->normalizePath($path);
  10713. if ($this->hasStashedChanges) {
  10714. $this->hasStashedChanges = false;
  10715. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  10716. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  10717. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  10718. }
  10719. }
  10720. $this->hasDiscardedChanges = false;
  10721. }
  10722. protected function updateToCommit($path, $reference, $branch, $date)
  10723. {
  10724. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  10725. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  10726. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  10727. $branches = null;
  10728. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  10729. $branches = $output;
  10730. }
  10731. $gitRef = $reference;
  10732. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  10733. && $branches
  10734. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  10735. ) {
  10736. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  10737. if (0 === $this->process->execute($command, $output, $path)) {
  10738. return;
  10739. }
  10740. }
  10741. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  10742. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  10743. $branch = 'v' . $branch;
  10744. }
  10745. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  10746. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  10747. if (0 === $this->process->execute($command, $output, $path)
  10748. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  10749. ) {
  10750. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  10751. if (0 === $this->process->execute($command, $output, $path)) {
  10752. return;
  10753. }
  10754. }
  10755. }
  10756. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  10757. if (0 === $this->process->execute($command, $output, $path)) {
  10758. return;
  10759. }
  10760. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  10761. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  10762. }
  10763. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  10764. }
  10765. protected function updateOriginUrl($path, $url)
  10766. {
  10767. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  10768. $this->setPushUrl($path, $url);
  10769. }
  10770. protected function setPushUrl($path, $url)
  10771. {
  10772. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  10773. $protocols = $this->config->get('github-protocols');
  10774. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  10775. if (!in_array('ssh', $protocols, true)) {
  10776. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  10777. }
  10778. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  10779. $this->process->execute($cmd, $ignoredOutput, $path);
  10780. }
  10781. }
  10782. protected function getCommitLogs($fromReference, $toReference, $path)
  10783. {
  10784. $path = $this->normalizePath($path);
  10785. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  10786. if (0 !== $this->process->execute($command, $output, $path)) {
  10787. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10788. }
  10789. return $output;
  10790. }
  10791. protected function discardChanges($path)
  10792. {
  10793. $path = $this->normalizePath($path);
  10794. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  10795. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  10796. }
  10797. $this->hasDiscardedChanges = true;
  10798. }
  10799. protected function stashChanges($path)
  10800. {
  10801. $path = $this->normalizePath($path);
  10802. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  10803. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  10804. }
  10805. $this->hasStashedChanges = true;
  10806. }
  10807. protected function viewDiff($path)
  10808. {
  10809. $path = $this->normalizePath($path);
  10810. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  10811. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  10812. }
  10813. $this->io->writeError($output);
  10814. }
  10815. protected function normalizePath($path)
  10816. {
  10817. if (Platform::isWindows() && strlen($path) > 0) {
  10818. $basePath = $path;
  10819. $removed = array();
  10820. while (!is_dir($basePath) && $basePath !== '\\') {
  10821. array_unshift($removed, basename($basePath));
  10822. $basePath = dirname($basePath);
  10823. }
  10824. if ($basePath === '\\') {
  10825. return $path;
  10826. }
  10827. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  10828. }
  10829. return $path;
  10830. }
  10831. protected function hasMetadataRepository($path)
  10832. {
  10833. $path = $this->normalizePath($path);
  10834. return is_dir($path.'/.git');
  10835. }
  10836. protected function getShortHash($reference)
  10837. {
  10838. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  10839. return substr($reference, 0, 10);
  10840. }
  10841. return $reference;
  10842. }
  10843. }
  10844. <?php
  10845. namespace Composer\Downloader;
  10846. use Composer\Config;
  10847. use Composer\Cache;
  10848. use Composer\EventDispatcher\EventDispatcher;
  10849. use Composer\Package\PackageInterface;
  10850. use Composer\Util\Platform;
  10851. use Composer\Util\ProcessExecutor;
  10852. use Composer\Util\RemoteFilesystem;
  10853. use Composer\IO\IOInterface;
  10854. class GzipDownloader extends ArchiveDownloader
  10855. {
  10856. protected $process;
  10857. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10858. {
  10859. $this->process = $process ?: new ProcessExecutor($io);
  10860. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10861. }
  10862. protected function extract($file, $path)
  10863. {
  10864. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  10865. if (!Platform::isWindows()) {
  10866. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  10867. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10868. return;
  10869. }
  10870. if (extension_loaded('zlib')) {
  10871. $this->extractUsingExt($file, $targetFilepath);
  10872. return;
  10873. }
  10874. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10875. throw new \RuntimeException($processError);
  10876. }
  10877. $this->extractUsingExt($file, $targetFilepath);
  10878. }
  10879. protected function getFileName(PackageInterface $package, $path)
  10880. {
  10881. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10882. }
  10883. private function extractUsingExt($file, $targetFilepath)
  10884. {
  10885. $archiveFile = gzopen($file, 'rb');
  10886. $targetFile = fopen($targetFilepath, 'wb');
  10887. while ($string = gzread($archiveFile, 4096)) {
  10888. fwrite($targetFile, $string, Platform::strlen($string));
  10889. }
  10890. gzclose($archiveFile);
  10891. fclose($targetFile);
  10892. }
  10893. }
  10894. <?php
  10895. namespace Composer\Downloader;
  10896. use Composer\Package\PackageInterface;
  10897. use Composer\Util\ProcessExecutor;
  10898. use Composer\Util\Hg as HgUtils;
  10899. class HgDownloader extends VcsDownloader
  10900. {
  10901. public function doDownload(PackageInterface $package, $path, $url)
  10902. {
  10903. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  10904. $cloneCommand = function ($url) use ($path) {
  10905. return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  10906. };
  10907. $hgUtils->runCommand($cloneCommand, $url, $path);
  10908. $ref = ProcessExecutor::escape($package->getSourceReference());
  10909. $command = sprintf('hg up %s', $ref);
  10910. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10911. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10912. }
  10913. }
  10914. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10915. {
  10916. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  10917. $ref = $target->getSourceReference();
  10918. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10919. if (!$this->hasMetadataRepository($path)) {
  10920. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10921. }
  10922. $command = function ($url) use ($ref) {
  10923. return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  10924. };
  10925. $hgUtils->runCommand($command, $url, $path);
  10926. }
  10927. public function getLocalChanges(PackageInterface $package, $path)
  10928. {
  10929. if (!is_dir($path.'/.hg')) {
  10930. return null;
  10931. }
  10932. $this->process->execute('hg st', $output, realpath($path));
  10933. return trim($output) ?: null;
  10934. }
  10935. protected function getCommitLogs($fromReference, $toReference, $path)
  10936. {
  10937. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  10938. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10939. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10940. }
  10941. return $output;
  10942. }
  10943. protected function hasMetadataRepository($path)
  10944. {
  10945. return is_dir($path . '/.hg');
  10946. }
  10947. }
  10948. <?php
  10949. namespace Composer\Downloader;
  10950. use Composer\Package\Archiver\ArchivableFilesFinder;
  10951. use Composer\Package\Dumper\ArrayDumper;
  10952. use Composer\Package\PackageInterface;
  10953. use Composer\Package\Version\VersionGuesser;
  10954. use Composer\Package\Version\VersionParser;
  10955. use Composer\Util\Platform;
  10956. use Composer\Util\ProcessExecutor;
  10957. use Composer\Util\Filesystem as ComposerFilesystem;
  10958. use Symfony\Component\Filesystem\Exception\IOException;
  10959. use Symfony\Component\Filesystem\Filesystem;
  10960. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  10961. {
  10962. const STRATEGY_SYMLINK = 10;
  10963. const STRATEGY_MIRROR = 20;
  10964. public function download(PackageInterface $package, $path, $output = true)
  10965. {
  10966. $url = $package->getDistUrl();
  10967. $realUrl = realpath($url);
  10968. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  10969. throw new \RuntimeException(sprintf(
  10970. 'Source path "%s" is not found for package %s',
  10971. $url,
  10972. $package->getName()
  10973. ));
  10974. }
  10975. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  10976. throw new \RuntimeException(sprintf(
  10977. 'Package %s cannot install to "%s" inside its source at "%s"',
  10978. $package->getName(),
  10979. realpath($path),
  10980. $realUrl
  10981. ));
  10982. }
  10983. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  10984. $currentStrategy = self::STRATEGY_SYMLINK;
  10985. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  10986. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  10987. if ($mirrorPathRepos) {
  10988. $currentStrategy = self::STRATEGY_MIRROR;
  10989. }
  10990. if (true === $transportOptions['symlink']) {
  10991. $currentStrategy = self::STRATEGY_SYMLINK;
  10992. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  10993. } elseif (false === $transportOptions['symlink']) {
  10994. $currentStrategy = self::STRATEGY_MIRROR;
  10995. $allowedStrategies = array(self::STRATEGY_MIRROR);
  10996. }
  10997. $fileSystem = new Filesystem();
  10998. $this->filesystem->removeDirectory($path);
  10999. if ($output) {
  11000. $this->io->writeError(sprintf(
  11001. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  11002. $package->getName(),
  11003. $package->getFullPrettyVersion()
  11004. ), false);
  11005. }
  11006. $isFallback = false;
  11007. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  11008. try {
  11009. if (Platform::isWindows()) {
  11010. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  11011. $this->filesystem->junction($realUrl, $path);
  11012. } else {
  11013. $absolutePath = $path;
  11014. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  11015. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  11016. }
  11017. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  11018. $path = rtrim($path, "/");
  11019. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  11020. $fileSystem->symlink($shortestPath, $path);
  11021. }
  11022. } catch (IOException $e) {
  11023. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  11024. $this->io->writeError('');
  11025. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  11026. $currentStrategy = self::STRATEGY_MIRROR;
  11027. $isFallback = true;
  11028. } else {
  11029. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  11030. }
  11031. }
  11032. }
  11033. if (self::STRATEGY_MIRROR == $currentStrategy) {
  11034. $fs = new ComposerFilesystem();
  11035. $realUrl = $fs->normalizePath($realUrl);
  11036. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  11037. $iterator = new ArchivableFilesFinder($realUrl, array());
  11038. $fileSystem->mirror($realUrl, $path, $iterator);
  11039. }
  11040. $this->io->writeError('');
  11041. }
  11042. public function remove(PackageInterface $package, $path, $output = true)
  11043. {
  11044. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  11045. if ($output) {
  11046. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11047. }
  11048. if (!$this->filesystem->removeJunction($path)) {
  11049. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  11050. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  11051. }
  11052. } else {
  11053. parent::remove($package, $path, $output);
  11054. }
  11055. }
  11056. public function getVcsReference(PackageInterface $package, $path)
  11057. {
  11058. $parser = new VersionParser;
  11059. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  11060. $dumper = new ArrayDumper;
  11061. $packageConfig = $dumper->dump($package);
  11062. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11063. return $packageVersion['commit'];
  11064. }
  11065. }
  11066. }
  11067. <?php
  11068. namespace Composer\Downloader;
  11069. use Composer\Util\Filesystem;
  11070. class PearPackageExtractor
  11071. {
  11072. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  11073. private $filesystem;
  11074. private $file;
  11075. public function __construct($file)
  11076. {
  11077. if (!is_file($file)) {
  11078. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  11079. }
  11080. $this->filesystem = new Filesystem();
  11081. $this->file = $file;
  11082. }
  11083. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  11084. {
  11085. $extractionPath = $target.'/tarball';
  11086. try {
  11087. $archive = new \PharData($this->file);
  11088. $archive->extractTo($extractionPath, null, true);
  11089. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  11090. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  11091. }
  11092. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  11093. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  11094. $this->filesystem->removeDirectory($extractionPath);
  11095. } catch (\Exception $exception) {
  11096. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  11097. }
  11098. }
  11099. private function copyFiles($files, $source, $target, $roles, $vars)
  11100. {
  11101. foreach ($files as $file) {
  11102. $from = $this->combine($source, $file['from']);
  11103. $to = $this->combine($target, $roles[$file['role']]);
  11104. $to = $this->combine($to, $file['to']);
  11105. $tasks = $file['tasks'];
  11106. $this->copyFile($from, $to, $tasks, $vars);
  11107. }
  11108. }
  11109. private function copyFile($from, $to, $tasks, $vars)
  11110. {
  11111. if (!is_file($from)) {
  11112. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  11113. }
  11114. $this->filesystem->ensureDirectoryExists(dirname($to));
  11115. if (0 == count($tasks)) {
  11116. $copied = copy($from, $to);
  11117. } else {
  11118. $content = file_get_contents($from);
  11119. $replacements = array();
  11120. foreach ($tasks as $task) {
  11121. $pattern = $task['from'];
  11122. $varName = $task['to'];
  11123. if (isset($vars[$varName])) {
  11124. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  11125. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  11126. } else {
  11127. $replacements[$pattern] = $vars[$varName];
  11128. }
  11129. }
  11130. }
  11131. $content = strtr($content, $replacements);
  11132. $copied = file_put_contents($to, $content);
  11133. }
  11134. if (false === $copied) {
  11135. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  11136. }
  11137. }
  11138. private function buildCopyActions($source, array $roles, $vars)
  11139. {
  11140. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  11141. if (false === $package) {
  11142. throw new \RuntimeException('Package definition file is not valid.');
  11143. }
  11144. $packageSchemaVersion = $package['version'];
  11145. if ('1.0' == $packageSchemaVersion) {
  11146. $children = $package->release->filelist->children();
  11147. $packageName = (string) $package->name;
  11148. $packageVersion = (string) $package->release->version;
  11149. $sourceDir = $packageName . '-' . $packageVersion;
  11150. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  11151. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  11152. $children = $package->contents->children();
  11153. $packageName = (string) $package->name;
  11154. $packageVersion = (string) $package->version->release;
  11155. $sourceDir = $packageName . '-' . $packageVersion;
  11156. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  11157. $namespaces = $package->getNamespaces();
  11158. $package->registerXPathNamespace('ns', $namespaces['']);
  11159. $releaseNodes = $package->xpath('ns:phprelease');
  11160. $this->applyRelease($result, $releaseNodes, $vars);
  11161. } else {
  11162. throw new \RuntimeException('Unsupported schema version of package definition file.');
  11163. }
  11164. return $result;
  11165. }
  11166. private function applyRelease(&$actions, $releaseNodes, $vars)
  11167. {
  11168. foreach ($releaseNodes as $releaseNode) {
  11169. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  11170. if ($requiredOs && $vars['os'] != $requiredOs) {
  11171. continue;
  11172. }
  11173. if ($releaseNode->filelist) {
  11174. foreach ($releaseNode->filelist->children() as $action) {
  11175. if ('install' == $action->getName()) {
  11176. $name = (string) $action['name'];
  11177. $as = (string) $action['as'];
  11178. if (isset($actions[$name])) {
  11179. $actions[$name]['to'] = $as;
  11180. }
  11181. } elseif ('ignore' == $action->getName()) {
  11182. $name = (string) $action['name'];
  11183. unset($actions[$name]);
  11184. } else {
  11185. }
  11186. }
  11187. }
  11188. break;
  11189. }
  11190. }
  11191. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  11192. {
  11193. $result = array();
  11194. foreach ($children as $child) {
  11195. if ($child->getName() == 'dir') {
  11196. $dirSource = $this->combine($source, (string) $child['name']);
  11197. $dirTarget = $child['baseinstalldir'] ?: $target;
  11198. $dirRole = $child['role'] ?: $role;
  11199. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11200. $result = array_merge($result, $dirFiles);
  11201. } elseif ($child->getName() == 'file') {
  11202. $fileRole = (string) $child['role'] ?: $role;
  11203. if (isset($targetRoles[$fileRole])) {
  11204. $fileName = (string) ($child['name'] ?: $child[0]);
  11205. $fileSource = $this->combine($source, $fileName);
  11206. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  11207. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11208. $fileTarget = $packageName . '/' . $fileTarget;
  11209. }
  11210. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  11211. }
  11212. }
  11213. }
  11214. return $result;
  11215. }
  11216. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  11217. {
  11218. $result = array();
  11219. foreach ($children as $child) {
  11220. if ('dir' == $child->getName()) {
  11221. $dirSource = $this->combine($source, $child['name']);
  11222. $dirTarget = $child['baseinstalldir'] ?: $target;
  11223. $dirRole = $child['role'] ?: $role;
  11224. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11225. $result = array_merge($result, $dirFiles);
  11226. } elseif ('file' == $child->getName()) {
  11227. $fileRole = (string) $child['role'] ?: $role;
  11228. if (isset($targetRoles[$fileRole])) {
  11229. $fileSource = $this->combine($source, (string) $child['name']);
  11230. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  11231. $fileTasks = array();
  11232. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  11233. if ('replace' == $taskNode->getName()) {
  11234. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  11235. }
  11236. }
  11237. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11238. $fileTarget = $packageName . '/' . $fileTarget;
  11239. }
  11240. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  11241. }
  11242. }
  11243. }
  11244. return $result;
  11245. }
  11246. private function combine($left, $right)
  11247. {
  11248. return rtrim($left, '/') . '/' . ltrim($right, '/');
  11249. }
  11250. }
  11251. <?php
  11252. namespace Composer\Downloader;
  11253. use Composer\Package\PackageInterface;
  11254. use Composer\Repository\VcsRepository;
  11255. use Composer\Util\Perforce;
  11256. class PerforceDownloader extends VcsDownloader
  11257. {
  11258. protected $perforce;
  11259. public function doDownload(PackageInterface $package, $path, $url)
  11260. {
  11261. $ref = $package->getSourceReference();
  11262. $label = $this->getLabelFromSourceReference($ref);
  11263. $this->io->writeError('Cloning ' . $ref);
  11264. $this->initPerforce($package, $path, $url);
  11265. $this->perforce->setStream($ref);
  11266. $this->perforce->p4Login();
  11267. $this->perforce->writeP4ClientSpec();
  11268. $this->perforce->connectClient();
  11269. $this->perforce->syncCodeBase($label);
  11270. $this->perforce->cleanupClientSpec();
  11271. }
  11272. private function getLabelFromSourceReference($ref)
  11273. {
  11274. $pos = strpos($ref, '@');
  11275. if (false !== $pos) {
  11276. return substr($ref, $pos + 1);
  11277. }
  11278. return null;
  11279. }
  11280. public function initPerforce(PackageInterface $package, $path, $url)
  11281. {
  11282. if (!empty($this->perforce)) {
  11283. $this->perforce->initializePath($path);
  11284. return;
  11285. }
  11286. $repository = $package->getRepository();
  11287. $repoConfig = null;
  11288. if ($repository instanceof VcsRepository) {
  11289. $repoConfig = $this->getRepoConfig($repository);
  11290. }
  11291. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  11292. }
  11293. private function getRepoConfig(VcsRepository $repository)
  11294. {
  11295. return $repository->getRepoConfig();
  11296. }
  11297. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11298. {
  11299. $this->doDownload($target, $path, $url);
  11300. }
  11301. public function getLocalChanges(PackageInterface $package, $path)
  11302. {
  11303. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  11304. return;
  11305. }
  11306. protected function getCommitLogs($fromReference, $toReference, $path)
  11307. {
  11308. return $this->perforce->getCommitLogs($fromReference, $toReference);
  11309. }
  11310. public function setPerforce($perforce)
  11311. {
  11312. $this->perforce = $perforce;
  11313. }
  11314. protected function hasMetadataRepository($path)
  11315. {
  11316. return true;
  11317. }
  11318. }
  11319. <?php
  11320. namespace Composer\Downloader;
  11321. class PharDownloader extends ArchiveDownloader
  11322. {
  11323. protected function extract($file, $path)
  11324. {
  11325. $archive = new \Phar($file);
  11326. $archive->extractTo($path, null, true);
  11327. }
  11328. }
  11329. <?php
  11330. namespace Composer\Downloader;
  11331. use Composer\Config;
  11332. use Composer\Cache;
  11333. use Composer\EventDispatcher\EventDispatcher;
  11334. use Composer\Util\IniHelper;
  11335. use Composer\Util\Platform;
  11336. use Composer\Util\ProcessExecutor;
  11337. use Composer\Util\RemoteFilesystem;
  11338. use Composer\IO\IOInterface;
  11339. use RarArchive;
  11340. class RarDownloader extends ArchiveDownloader
  11341. {
  11342. protected $process;
  11343. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11344. {
  11345. $this->process = $process ?: new ProcessExecutor($io);
  11346. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11347. }
  11348. protected function extract($file, $path)
  11349. {
  11350. $processError = null;
  11351. if (!Platform::isWindows()) {
  11352. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  11353. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11354. return;
  11355. }
  11356. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11357. }
  11358. if (!class_exists('RarArchive')) {
  11359. $iniMessage = IniHelper::getMessage();
  11360. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  11361. . $iniMessage . "\n" . $processError;
  11362. if (!Platform::isWindows()) {
  11363. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  11364. }
  11365. throw new \RuntimeException($error);
  11366. }
  11367. $rarArchive = RarArchive::open($file);
  11368. if (false === $rarArchive) {
  11369. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  11370. }
  11371. $entries = $rarArchive->getEntries();
  11372. if (false === $entries) {
  11373. throw new \RuntimeException('Could not retrieve RAR archive entries');
  11374. }
  11375. foreach ($entries as $entry) {
  11376. if (false === $entry->extract($path)) {
  11377. throw new \RuntimeException('Could not extract entry');
  11378. }
  11379. }
  11380. $rarArchive->close();
  11381. }
  11382. }
  11383. <?php
  11384. namespace Composer\Downloader;
  11385. use Composer\Package\PackageInterface;
  11386. use Composer\Util\Svn as SvnUtil;
  11387. use Composer\Repository\VcsRepository;
  11388. use Composer\Util\ProcessExecutor;
  11389. class SvnDownloader extends VcsDownloader
  11390. {
  11391. protected $cacheCredentials = true;
  11392. public function doDownload(PackageInterface $package, $path, $url)
  11393. {
  11394. SvnUtil::cleanEnv();
  11395. $ref = $package->getSourceReference();
  11396. $repo = $package->getRepository();
  11397. if ($repo instanceof VcsRepository) {
  11398. $repoConfig = $repo->getRepoConfig();
  11399. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  11400. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  11401. }
  11402. }
  11403. $this->io->writeError(" Checking out ".$package->getSourceReference());
  11404. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  11405. }
  11406. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11407. {
  11408. SvnUtil::cleanEnv();
  11409. $ref = $target->getSourceReference();
  11410. if (!$this->hasMetadataRepository($path)) {
  11411. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11412. }
  11413. $util = new SvnUtil($url, $this->io, $this->config);
  11414. $flags = "";
  11415. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  11416. $flags .= ' --ignore-ancestry';
  11417. }
  11418. $this->io->writeError(" Checking out " . $ref);
  11419. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  11420. }
  11421. public function getLocalChanges(PackageInterface $package, $path)
  11422. {
  11423. if (!$this->hasMetadataRepository($path)) {
  11424. return null;
  11425. }
  11426. $this->process->execute('svn status --ignore-externals', $output, $path);
  11427. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  11428. }
  11429. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  11430. {
  11431. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11432. $util->setCacheCredentials($this->cacheCredentials);
  11433. try {
  11434. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  11435. } catch (\RuntimeException $e) {
  11436. throw new \RuntimeException(
  11437. 'Package could not be downloaded, '.$e->getMessage()
  11438. );
  11439. }
  11440. }
  11441. protected function cleanChanges(PackageInterface $package, $path, $update)
  11442. {
  11443. if (!$changes = $this->getLocalChanges($package, $path)) {
  11444. return;
  11445. }
  11446. if (!$this->io->isInteractive()) {
  11447. if (true === $this->config->get('discard-changes')) {
  11448. return $this->discardChanges($path);
  11449. }
  11450. return parent::cleanChanges($package, $path, $update);
  11451. }
  11452. $changes = array_map(function ($elem) {
  11453. return ' '.$elem;
  11454. }, preg_split('{\s*\r?\n\s*}', $changes));
  11455. $countChanges = count($changes);
  11456. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  11457. $this->io->writeError(array_slice($changes, 0, 10));
  11458. if ($countChanges > 10) {
  11459. $remaingChanges = $countChanges - 10;
  11460. $this->io->writeError(
  11461. sprintf(
  11462. ' <info>'.$remaingChanges.' more file%s modified, choose "v" to view the full list</info>',
  11463. $remaingChanges === 1 ? '' : 's'
  11464. )
  11465. );
  11466. }
  11467. while (true) {
  11468. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  11469. case 'y':
  11470. $this->discardChanges($path);
  11471. break 2;
  11472. case 'n':
  11473. throw new \RuntimeException('Update aborted');
  11474. case 'v':
  11475. $this->io->writeError($changes);
  11476. break;
  11477. case '?':
  11478. default:
  11479. $this->io->writeError(array(
  11480. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11481. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11482. ' v - view modified files',
  11483. ' ? - print help',
  11484. ));
  11485. break;
  11486. }
  11487. }
  11488. }
  11489. protected function getCommitLogs($fromReference, $toReference, $path)
  11490. {
  11491. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  11492. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  11493. if (0 !== $this->process->execute($command, $output, $path)) {
  11494. throw new \RuntimeException(
  11495. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  11496. );
  11497. }
  11498. $urlPattern = '#<url>(.*)</url>#';
  11499. if (preg_match($urlPattern, $output, $matches)) {
  11500. $baseUrl = $matches[1];
  11501. } else {
  11502. throw new \RuntimeException(
  11503. 'Unable to determine svn url for path '. $path
  11504. );
  11505. }
  11506. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  11507. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  11508. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  11509. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11510. $util->setCacheCredentials($this->cacheCredentials);
  11511. try {
  11512. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  11513. } catch (\RuntimeException $e) {
  11514. throw new \RuntimeException(
  11515. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  11516. );
  11517. }
  11518. }
  11519. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  11520. }
  11521. protected function discardChanges($path)
  11522. {
  11523. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  11524. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11525. }
  11526. }
  11527. protected function hasMetadataRepository($path)
  11528. {
  11529. return is_dir($path.'/.svn');
  11530. }
  11531. }
  11532. <?php
  11533. namespace Composer\Downloader;
  11534. class TarDownloader extends ArchiveDownloader
  11535. {
  11536. protected function extract($file, $path)
  11537. {
  11538. $archive = new \PharData($file);
  11539. $archive->extractTo($path, null, true);
  11540. }
  11541. }
  11542. <?php
  11543. namespace Composer\Downloader;
  11544. class TransportException extends \RuntimeException
  11545. {
  11546. protected $headers;
  11547. protected $response;
  11548. protected $statusCode;
  11549. public function setHeaders($headers)
  11550. {
  11551. $this->headers = $headers;
  11552. }
  11553. public function getHeaders()
  11554. {
  11555. return $this->headers;
  11556. }
  11557. public function setResponse($response)
  11558. {
  11559. $this->response = $response;
  11560. }
  11561. public function getResponse()
  11562. {
  11563. return $this->response;
  11564. }
  11565. public function setStatusCode($statusCode)
  11566. {
  11567. $this->statusCode = $statusCode;
  11568. }
  11569. public function getStatusCode()
  11570. {
  11571. return $this->statusCode;
  11572. }
  11573. }
  11574. <?php
  11575. namespace Composer\Downloader;
  11576. use Composer\Package\PackageInterface;
  11577. interface VcsCapableDownloaderInterface
  11578. {
  11579. public function getVcsReference(PackageInterface $package, $path);
  11580. }
  11581. <?php
  11582. namespace Composer\Downloader;
  11583. use Composer\Config;
  11584. use Composer\Package\Dumper\ArrayDumper;
  11585. use Composer\Package\PackageInterface;
  11586. use Composer\Package\Version\VersionGuesser;
  11587. use Composer\Package\Version\VersionParser;
  11588. use Composer\Util\ProcessExecutor;
  11589. use Composer\IO\IOInterface;
  11590. use Composer\Util\Filesystem;
  11591. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  11592. {
  11593. protected $io;
  11594. protected $config;
  11595. protected $process;
  11596. protected $filesystem;
  11597. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11598. {
  11599. $this->io = $io;
  11600. $this->config = $config;
  11601. $this->process = $process ?: new ProcessExecutor($io);
  11602. $this->filesystem = $fs ?: new Filesystem($this->process);
  11603. }
  11604. public function getInstallationSource()
  11605. {
  11606. return 'source';
  11607. }
  11608. public function download(PackageInterface $package, $path)
  11609. {
  11610. if (!$package->getSourceReference()) {
  11611. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  11612. }
  11613. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11614. $this->filesystem->emptyDirectory($path);
  11615. $urls = $package->getSourceUrls();
  11616. while ($url = array_shift($urls)) {
  11617. try {
  11618. if (Filesystem::isLocalPath($url)) {
  11619. $needle = 'file://';
  11620. $isFileProtocol = false;
  11621. if (0 === strpos($url, $needle)) {
  11622. $url = substr($url, strlen($needle));
  11623. $isFileProtocol = true;
  11624. }
  11625. if (false !== strpos($url, '%')) {
  11626. $url = rawurldecode($url);
  11627. }
  11628. $url = realpath($url);
  11629. if ($isFileProtocol) {
  11630. $url = $needle . $url;
  11631. }
  11632. }
  11633. $this->doDownload($package, $path, $url);
  11634. break;
  11635. } catch (\Exception $e) {
  11636. if ($e instanceof \PHPUnit_Framework_Exception) {
  11637. throw $e;
  11638. }
  11639. if ($this->io->isDebug()) {
  11640. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  11641. } elseif (count($urls)) {
  11642. $this->io->writeError(' Failed, trying the next URL');
  11643. }
  11644. if (!count($urls)) {
  11645. throw $e;
  11646. }
  11647. }
  11648. }
  11649. }
  11650. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11651. {
  11652. if (!$target->getSourceReference()) {
  11653. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  11654. }
  11655. $name = $target->getName();
  11656. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  11657. if ($target->getSourceType() === 'svn') {
  11658. $from = $initial->getSourceReference();
  11659. $to = $target->getSourceReference();
  11660. } else {
  11661. $from = substr($initial->getSourceReference(), 0, 7);
  11662. $to = substr($target->getSourceReference(), 0, 7);
  11663. }
  11664. $name .= ' '.$initial->getPrettyVersion();
  11665. } else {
  11666. $from = $initial->getFullPrettyVersion();
  11667. $to = $target->getFullPrettyVersion();
  11668. }
  11669. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  11670. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11671. $this->cleanChanges($initial, $path, true);
  11672. $urls = $target->getSourceUrls();
  11673. $exception = null;
  11674. while ($url = array_shift($urls)) {
  11675. try {
  11676. if (Filesystem::isLocalPath($url)) {
  11677. $url = realpath($url);
  11678. }
  11679. $this->doUpdate($initial, $target, $path, $url);
  11680. $exception = null;
  11681. break;
  11682. } catch (\Exception $exception) {
  11683. if ($exception instanceof \PHPUnit_Framework_Exception) {
  11684. throw $exception;
  11685. }
  11686. if ($this->io->isDebug()) {
  11687. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  11688. } elseif (count($urls)) {
  11689. $this->io->writeError(' Failed, trying the next URL');
  11690. }
  11691. }
  11692. }
  11693. $this->reapplyChanges($path);
  11694. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  11695. $message = 'Pulling in changes:';
  11696. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  11697. if (!trim($logs)) {
  11698. $message = 'Rolling back changes:';
  11699. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  11700. }
  11701. if (trim($logs)) {
  11702. $logs = implode("\n", array_map(function ($line) {
  11703. return ' ' . $line;
  11704. }, explode("\n", $logs)));
  11705. $logs = str_replace('<', '\<', $logs);
  11706. $this->io->writeError(' '.$message);
  11707. $this->io->writeError($logs);
  11708. }
  11709. }
  11710. if (!$urls && $exception) {
  11711. throw $exception;
  11712. }
  11713. }
  11714. public function remove(PackageInterface $package, $path)
  11715. {
  11716. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  11717. $this->cleanChanges($package, $path, false);
  11718. if (!$this->filesystem->removeDirectory($path)) {
  11719. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  11720. }
  11721. }
  11722. public function setOutputProgress($outputProgress)
  11723. {
  11724. return $this;
  11725. }
  11726. public function getVcsReference(PackageInterface $package, $path)
  11727. {
  11728. $parser = new VersionParser;
  11729. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  11730. $dumper = new ArrayDumper;
  11731. $packageConfig = $dumper->dump($package);
  11732. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11733. return $packageVersion['commit'];
  11734. }
  11735. }
  11736. protected function cleanChanges(PackageInterface $package, $path, $update)
  11737. {
  11738. if (null !== $this->getLocalChanges($package, $path)) {
  11739. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  11740. }
  11741. }
  11742. protected function reapplyChanges($path)
  11743. {
  11744. }
  11745. abstract protected function doDownload(PackageInterface $package, $path, $url);
  11746. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  11747. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  11748. abstract protected function hasMetadataRepository($path);
  11749. }
  11750. <?php
  11751. namespace Composer\Downloader;
  11752. use Composer\Config;
  11753. use Composer\Cache;
  11754. use Composer\EventDispatcher\EventDispatcher;
  11755. use Composer\Package\PackageInterface;
  11756. use Composer\Util\ProcessExecutor;
  11757. use Composer\Util\RemoteFilesystem;
  11758. use Composer\IO\IOInterface;
  11759. class XzDownloader extends ArchiveDownloader
  11760. {
  11761. protected $process;
  11762. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11763. {
  11764. $this->process = $process ?: new ProcessExecutor($io);
  11765. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11766. }
  11767. protected function extract($file, $path)
  11768. {
  11769. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  11770. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11771. return;
  11772. }
  11773. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11774. throw new \RuntimeException($processError);
  11775. }
  11776. protected function getFileName(PackageInterface $package, $path)
  11777. {
  11778. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11779. }
  11780. }
  11781. <?php
  11782. namespace Composer\Downloader;
  11783. use Composer\Config;
  11784. use Composer\Cache;
  11785. use Composer\EventDispatcher\EventDispatcher;
  11786. use Composer\Package\PackageInterface;
  11787. use Composer\Util\IniHelper;
  11788. use Composer\Util\Platform;
  11789. use Composer\Util\ProcessExecutor;
  11790. use Composer\Util\RemoteFilesystem;
  11791. use Composer\IO\IOInterface;
  11792. use Symfony\Component\Process\ExecutableFinder;
  11793. use ZipArchive;
  11794. class ZipDownloader extends ArchiveDownloader
  11795. {
  11796. protected static $hasSystemUnzip;
  11797. private static $hasZipArchive;
  11798. private static $isWindows;
  11799. protected $process;
  11800. private $zipArchiveObject;
  11801. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11802. {
  11803. $this->process = $process ?: new ProcessExecutor($io);
  11804. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11805. }
  11806. public function download(PackageInterface $package, $path, $output = true)
  11807. {
  11808. if (null === self::$hasSystemUnzip) {
  11809. $finder = new ExecutableFinder;
  11810. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  11811. }
  11812. if (null === self::$hasZipArchive) {
  11813. self::$hasZipArchive = class_exists('ZipArchive');
  11814. }
  11815. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  11816. $iniMessage = IniHelper::getMessage();
  11817. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  11818. throw new \RuntimeException($error);
  11819. }
  11820. if (null === self::$isWindows) {
  11821. self::$isWindows = Platform::isWindows();
  11822. if (!self::$isWindows && !self::$hasSystemUnzip) {
  11823. $this->io->writeError("<warning>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  11824. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Installing 'unzip' may remediate them.</warning>");
  11825. }
  11826. }
  11827. return parent::download($package, $path, $output);
  11828. }
  11829. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  11830. {
  11831. if (!self::$hasZipArchive) {
  11832. $isLastChance = true;
  11833. }
  11834. if (!self::$hasSystemUnzip && !$isLastChance) {
  11835. return $this->extractWithZipArchive($file, $path, true);
  11836. }
  11837. $processError = null;
  11838. $overwrite = $isLastChance ? '-o' : '';
  11839. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  11840. try {
  11841. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11842. return true;
  11843. }
  11844. $processError = new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11845. } catch (\Exception $e) {
  11846. $processError = $e;
  11847. }
  11848. if ($isLastChance) {
  11849. throw $processError;
  11850. }
  11851. $this->io->writeError(' '.$processError->getMessage());
  11852. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  11853. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  11854. return $this->extractWithZipArchive($file, $path, true);
  11855. }
  11856. protected function extractWithZipArchive($file, $path, $isLastChance)
  11857. {
  11858. if (!self::$hasSystemUnzip) {
  11859. $isLastChance = true;
  11860. }
  11861. if (!self::$hasZipArchive && !$isLastChance) {
  11862. return $this->extractWithSystemUnzip($file, $path, true);
  11863. }
  11864. $processError = null;
  11865. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  11866. try {
  11867. if (true === ($retval = $zipArchive->open($file))) {
  11868. $extractResult = $zipArchive->extractTo($path);
  11869. if (true === $extractResult) {
  11870. $zipArchive->close();
  11871. return true;
  11872. }
  11873. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  11874. } else {
  11875. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  11876. }
  11877. } catch (\ErrorException $e) {
  11878. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  11879. } catch (\Exception $e) {
  11880. $processError = $e;
  11881. }
  11882. if ($isLastChance) {
  11883. throw $processError;
  11884. }
  11885. $this->io->writeError(' '.$processError->getMessage());
  11886. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  11887. return $this->extractWithSystemUnzip($file, $path, true);
  11888. }
  11889. public function extract($file, $path)
  11890. {
  11891. if (self::$isWindows) {
  11892. $this->extractWithZipArchive($file, $path, false);
  11893. } else {
  11894. $this->extractWithSystemUnzip($file, $path, false);
  11895. }
  11896. }
  11897. protected function getErrorMessage($retval, $file)
  11898. {
  11899. switch ($retval) {
  11900. case ZipArchive::ER_EXISTS:
  11901. return sprintf("File '%s' already exists.", $file);
  11902. case ZipArchive::ER_INCONS:
  11903. return sprintf("Zip archive '%s' is inconsistent.", $file);
  11904. case ZipArchive::ER_INVAL:
  11905. return sprintf("Invalid argument (%s)", $file);
  11906. case ZipArchive::ER_MEMORY:
  11907. return sprintf("Malloc failure (%s)", $file);
  11908. case ZipArchive::ER_NOENT:
  11909. return sprintf("No such zip file: '%s'", $file);
  11910. case ZipArchive::ER_NOZIP:
  11911. return sprintf("'%s' is not a zip archive.", $file);
  11912. case ZipArchive::ER_OPEN:
  11913. return sprintf("Can't open zip file: %s", $file);
  11914. case ZipArchive::ER_READ:
  11915. return sprintf("Zip read error (%s)", $file);
  11916. case ZipArchive::ER_SEEK:
  11917. return sprintf("Zip seek error (%s)", $file);
  11918. default:
  11919. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  11920. }
  11921. }
  11922. }
  11923. <?php
  11924. namespace Composer\EventDispatcher;
  11925. class Event
  11926. {
  11927. protected $name;
  11928. protected $args;
  11929. protected $flags;
  11930. private $propagationStopped = false;
  11931. public function __construct($name, array $args = array(), array $flags = array())
  11932. {
  11933. $this->name = $name;
  11934. $this->args = $args;
  11935. $this->flags = $flags;
  11936. }
  11937. public function getName()
  11938. {
  11939. return $this->name;
  11940. }
  11941. public function getArguments()
  11942. {
  11943. return $this->args;
  11944. }
  11945. public function getFlags()
  11946. {
  11947. return $this->flags;
  11948. }
  11949. public function isPropagationStopped()
  11950. {
  11951. return $this->propagationStopped;
  11952. }
  11953. public function stopPropagation()
  11954. {
  11955. $this->propagationStopped = true;
  11956. }
  11957. }
  11958. <?php
  11959. namespace Composer\EventDispatcher;
  11960. use Composer\DependencyResolver\PolicyInterface;
  11961. use Composer\DependencyResolver\Pool;
  11962. use Composer\DependencyResolver\Request;
  11963. use Composer\Installer\InstallerEvent;
  11964. use Composer\IO\IOInterface;
  11965. use Composer\Composer;
  11966. use Composer\DependencyResolver\Operation\OperationInterface;
  11967. use Composer\Repository\CompositeRepository;
  11968. use Composer\Script;
  11969. use Composer\Installer\PackageEvent;
  11970. use Composer\Installer\BinaryInstaller;
  11971. use Composer\Util\ProcessExecutor;
  11972. use Composer\Script\Event as ScriptEvent;
  11973. use Symfony\Component\Process\PhpExecutableFinder;
  11974. class EventDispatcher
  11975. {
  11976. protected $composer;
  11977. protected $io;
  11978. protected $loader;
  11979. protected $process;
  11980. protected $listeners;
  11981. private $eventStack;
  11982. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  11983. {
  11984. $this->composer = $composer;
  11985. $this->io = $io;
  11986. $this->process = $process ?: new ProcessExecutor($io);
  11987. $this->eventStack = array();
  11988. }
  11989. public function dispatch($eventName, Event $event = null)
  11990. {
  11991. if (null === $event) {
  11992. $event = new Event($eventName);
  11993. }
  11994. return $this->doDispatch($event);
  11995. }
  11996. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  11997. {
  11998. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  11999. }
  12000. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  12001. {
  12002. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  12003. }
  12004. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  12005. {
  12006. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  12007. }
  12008. protected function doDispatch(Event $event)
  12009. {
  12010. $pathStr = 'PATH';
  12011. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  12012. $pathStr = 'Path';
  12013. }
  12014. $binDir = $this->composer->getConfig()->get('bin-dir');
  12015. if (is_dir($binDir)) {
  12016. $binDir = realpath($binDir);
  12017. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  12018. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  12019. putenv($pathStr.'='.$_SERVER[$pathStr]);
  12020. }
  12021. }
  12022. $listeners = $this->getListeners($event);
  12023. $this->pushEvent($event);
  12024. $return = 0;
  12025. foreach ($listeners as $callable) {
  12026. if (!is_string($callable)) {
  12027. if (!is_callable($callable)) {
  12028. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  12029. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  12030. }
  12031. $event = $this->checkListenerExpectedEvent($callable, $event);
  12032. $return = false === call_user_func($callable, $event) ? 1 : 0;
  12033. } elseif ($this->isComposerScript($callable)) {
  12034. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  12035. $scriptName = substr($callable, 1);
  12036. $args = $event->getArguments();
  12037. $flags = $event->getFlags();
  12038. if (substr($callable, 0, 10) === '@composer ') {
  12039. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  12040. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12041. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12042. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12043. }
  12044. } else {
  12045. if (!$this->getListeners(new Event($scriptName))) {
  12046. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  12047. }
  12048. try {
  12049. $return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
  12050. } catch (ScriptExecutionException $e) {
  12051. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12052. throw $e;
  12053. }
  12054. }
  12055. } elseif ($this->isPhpScript($callable)) {
  12056. $className = substr($callable, 0, strpos($callable, '::'));
  12057. $methodName = substr($callable, strpos($callable, '::') + 2);
  12058. if (!class_exists($className)) {
  12059. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12060. continue;
  12061. }
  12062. if (!is_callable($callable)) {
  12063. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12064. continue;
  12065. }
  12066. try {
  12067. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  12068. } catch (\Exception $e) {
  12069. $message = "Script %s handling the %s event terminated with an exception";
  12070. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  12071. throw $e;
  12072. }
  12073. } else {
  12074. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  12075. $exec = $callable . ($args === '' ? '' : ' '.$args);
  12076. if ($this->io->isVerbose()) {
  12077. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  12078. } else {
  12079. $this->io->writeError(sprintf('> %s', $exec));
  12080. }
  12081. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  12082. if ($possibleLocalBinaries) {
  12083. foreach ($possibleLocalBinaries as $localExec) {
  12084. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  12085. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  12086. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  12087. break;
  12088. }
  12089. }
  12090. }
  12091. if (substr($exec, 0, 5) === '@php ') {
  12092. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  12093. }
  12094. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12095. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12096. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12097. }
  12098. }
  12099. if ($event->isPropagationStopped()) {
  12100. break;
  12101. }
  12102. }
  12103. $this->popEvent();
  12104. return $return;
  12105. }
  12106. protected function getPhpExecCommand()
  12107. {
  12108. $finder = new PhpExecutableFinder();
  12109. $phpPath = $finder->find();
  12110. if (!$phpPath) {
  12111. throw new \RuntimeException('Failed to locate PHP binary to execute '.$scriptName);
  12112. }
  12113. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  12114. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  12115. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  12116. return ProcessExecutor::escape($phpPath) . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  12117. }
  12118. protected function executeEventPhpScript($className, $methodName, Event $event)
  12119. {
  12120. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  12121. if ($this->io->isVerbose()) {
  12122. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  12123. } else {
  12124. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  12125. }
  12126. return $className::$methodName($event);
  12127. }
  12128. protected function checkListenerExpectedEvent($target, Event $event)
  12129. {
  12130. if (in_array($event->getName(), array(
  12131. 'init',
  12132. 'command',
  12133. 'pre-file-download',
  12134. ), true)) {
  12135. return $event;
  12136. }
  12137. try {
  12138. $reflected = new \ReflectionParameter($target, 0);
  12139. } catch (\Exception $e) {
  12140. return $event;
  12141. }
  12142. $typehint = $reflected->getClass();
  12143. if (!$typehint instanceof \ReflectionClass) {
  12144. return $event;
  12145. }
  12146. $expected = $typehint->getName();
  12147. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  12148. 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);
  12149. $event = new \Composer\Script\CommandEvent(
  12150. $event->getName(),
  12151. $event->getComposer(),
  12152. $event->getIO(),
  12153. $event->isDevMode(),
  12154. $event->getArguments()
  12155. );
  12156. }
  12157. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  12158. 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);
  12159. $event = new \Composer\Script\PackageEvent(
  12160. $event->getName(),
  12161. $event->getComposer(),
  12162. $event->getIO(),
  12163. $event->isDevMode(),
  12164. $event->getPolicy(),
  12165. $event->getPool(),
  12166. $event->getInstalledRepo(),
  12167. $event->getRequest(),
  12168. $event->getOperations(),
  12169. $event->getOperation()
  12170. );
  12171. }
  12172. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  12173. 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);
  12174. $event = new \Composer\Script\Event(
  12175. $event->getName(),
  12176. $event->getComposer(),
  12177. $event->getIO(),
  12178. $event->isDevMode(),
  12179. $event->getArguments(),
  12180. $event->getFlags()
  12181. );
  12182. }
  12183. return $event;
  12184. }
  12185. private function serializeCallback($cb)
  12186. {
  12187. if (is_array($cb) && count($cb) === 2) {
  12188. if (is_object($cb[0])) {
  12189. $cb[0] = get_class($cb[0]);
  12190. }
  12191. if (is_string($cb[0]) && is_string($cb[1])) {
  12192. $cb = implode('::', $cb);
  12193. }
  12194. }
  12195. if (is_string($cb)) {
  12196. return $cb;
  12197. }
  12198. return var_export($cb, true);
  12199. }
  12200. public function addListener($eventName, $listener, $priority = 0)
  12201. {
  12202. $this->listeners[$eventName][$priority][] = $listener;
  12203. }
  12204. public function addSubscriber(EventSubscriberInterface $subscriber)
  12205. {
  12206. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  12207. if (is_string($params)) {
  12208. $this->addListener($eventName, array($subscriber, $params));
  12209. } elseif (is_string($params[0])) {
  12210. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  12211. } else {
  12212. foreach ($params as $listener) {
  12213. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  12214. }
  12215. }
  12216. }
  12217. }
  12218. protected function getListeners(Event $event)
  12219. {
  12220. $scriptListeners = $this->getScriptListeners($event);
  12221. if (!isset($this->listeners[$event->getName()][0])) {
  12222. $this->listeners[$event->getName()][0] = array();
  12223. }
  12224. krsort($this->listeners[$event->getName()]);
  12225. $listeners = $this->listeners;
  12226. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  12227. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  12228. }
  12229. public function hasEventListeners(Event $event)
  12230. {
  12231. $listeners = $this->getListeners($event);
  12232. return count($listeners) > 0;
  12233. }
  12234. protected function getScriptListeners(Event $event)
  12235. {
  12236. $package = $this->composer->getPackage();
  12237. $scripts = $package->getScripts();
  12238. if (empty($scripts[$event->getName()])) {
  12239. return array();
  12240. }
  12241. if ($this->loader) {
  12242. $this->loader->unregister();
  12243. }
  12244. $generator = $this->composer->getAutoloadGenerator();
  12245. if ($event instanceof ScriptEvent) {
  12246. $generator->setDevMode($event->isDevMode());
  12247. }
  12248. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  12249. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  12250. $map = $generator->parseAutoloads($packageMap, $package);
  12251. $this->loader = $generator->createLoader($map);
  12252. $this->loader->register();
  12253. return $scripts[$event->getName()];
  12254. }
  12255. protected function isPhpScript($callable)
  12256. {
  12257. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  12258. }
  12259. protected function isComposerScript($callable)
  12260. {
  12261. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5);
  12262. }
  12263. protected function pushEvent(Event $event)
  12264. {
  12265. $eventName = $event->getName();
  12266. if (in_array($eventName, $this->eventStack)) {
  12267. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  12268. }
  12269. return array_push($this->eventStack, $eventName);
  12270. }
  12271. protected function popEvent()
  12272. {
  12273. return array_pop($this->eventStack);
  12274. }
  12275. }
  12276. <?php
  12277. namespace Composer\EventDispatcher;
  12278. interface EventSubscriberInterface
  12279. {
  12280. public static function getSubscribedEvents();
  12281. }
  12282. <?php
  12283. namespace Composer\EventDispatcher;
  12284. class ScriptExecutionException extends \RuntimeException
  12285. {
  12286. }
  12287. <?php
  12288. namespace Composer\Exception;
  12289. class NoSslException extends \RuntimeException
  12290. {
  12291. }
  12292. <?php
  12293. namespace Composer;
  12294. use Composer\Config\JsonConfigSource;
  12295. use Composer\Json\JsonFile;
  12296. use Composer\IO\IOInterface;
  12297. use Composer\Package\Archiver;
  12298. use Composer\Package\Version\VersionGuesser;
  12299. use Composer\Repository\RepositoryManager;
  12300. use Composer\Repository\RepositoryFactory;
  12301. use Composer\Repository\WritableRepositoryInterface;
  12302. use Composer\Util\Filesystem;
  12303. use Composer\Util\Platform;
  12304. use Composer\Util\ProcessExecutor;
  12305. use Composer\Util\RemoteFilesystem;
  12306. use Composer\Util\Silencer;
  12307. use Composer\Plugin\PluginEvents;
  12308. use Composer\EventDispatcher\Event;
  12309. use Seld\JsonLint\DuplicateKeyException;
  12310. use Symfony\Component\Console\Formatter\OutputFormatter;
  12311. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  12312. use Symfony\Component\Console\Output\ConsoleOutput;
  12313. use Composer\EventDispatcher\EventDispatcher;
  12314. use Composer\Autoload\AutoloadGenerator;
  12315. use Composer\Package\Version\VersionParser;
  12316. use Composer\Downloader\TransportException;
  12317. use Seld\JsonLint\JsonParser;
  12318. class Factory
  12319. {
  12320. protected static function getHomeDir()
  12321. {
  12322. $home = getenv('COMPOSER_HOME');
  12323. if ($home) {
  12324. return $home;
  12325. }
  12326. if (Platform::isWindows()) {
  12327. if (!getenv('APPDATA')) {
  12328. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12329. }
  12330. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  12331. }
  12332. $userDir = self::getUserDir();
  12333. if (is_dir($userDir . '/.composer')) {
  12334. return $userDir . '/.composer';
  12335. }
  12336. if (self::useXdg()) {
  12337. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  12338. return $xdgConfig . '/composer';
  12339. }
  12340. return $userDir . '/.composer';
  12341. }
  12342. protected static function getCacheDir($home)
  12343. {
  12344. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  12345. if ($cacheDir) {
  12346. return $cacheDir;
  12347. }
  12348. $homeEnv = getenv('COMPOSER_HOME');
  12349. if ($homeEnv) {
  12350. return $homeEnv . '/cache';
  12351. }
  12352. if (Platform::isWindows()) {
  12353. if ($cacheDir = getenv('LOCALAPPDATA')) {
  12354. $cacheDir .= '/Composer';
  12355. } else {
  12356. $cacheDir = $home . '/cache';
  12357. }
  12358. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  12359. }
  12360. $userDir = self::getUserDir();
  12361. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  12362. return $home . '/cache';
  12363. }
  12364. if (self::useXdg()) {
  12365. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  12366. return $xdgCache . '/composer';
  12367. }
  12368. return $home . '/cache';
  12369. }
  12370. protected static function getDataDir($home)
  12371. {
  12372. $homeEnv = getenv('COMPOSER_HOME');
  12373. if ($homeEnv) {
  12374. return $homeEnv;
  12375. }
  12376. if (Platform::isWindows()) {
  12377. return strtr($home, '\\', '/');
  12378. }
  12379. $userDir = self::getUserDir();
  12380. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  12381. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  12382. return $xdgData . '/composer';
  12383. }
  12384. return $home;
  12385. }
  12386. public static function createConfig(IOInterface $io = null, $cwd = null)
  12387. {
  12388. $cwd = $cwd ?: getcwd();
  12389. $config = new Config(true, $cwd);
  12390. $home = self::getHomeDir();
  12391. $config->merge(array('config' => array(
  12392. 'home' => $home,
  12393. 'cache-dir' => self::getCacheDir($home),
  12394. 'data-dir' => self::getDataDir($home),
  12395. )));
  12396. $htaccessProtect = (bool) $config->get('htaccess-protect');
  12397. if ($htaccessProtect) {
  12398. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  12399. foreach ($dirs as $dir) {
  12400. if (!file_exists($dir . '/.htaccess')) {
  12401. if (!is_dir($dir)) {
  12402. Silencer::call('mkdir', $dir, 0777, true);
  12403. }
  12404. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  12405. }
  12406. }
  12407. }
  12408. $file = new JsonFile($config->get('home').'/config.json');
  12409. if ($file->exists()) {
  12410. if ($io && $io->isDebug()) {
  12411. $io->writeError('Loading config file ' . $file->getPath());
  12412. }
  12413. $config->merge($file->read());
  12414. }
  12415. $config->setConfigSource(new JsonConfigSource($file));
  12416. $file = new JsonFile($config->get('home').'/auth.json');
  12417. if ($file->exists()) {
  12418. if ($io && $io->isDebug()) {
  12419. $io->writeError('Loading config file ' . $file->getPath());
  12420. }
  12421. $config->merge(array('config' => $file->read()));
  12422. }
  12423. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  12424. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  12425. $authData = json_decode($composerAuthEnv, true);
  12426. if (null === $authData) {
  12427. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  12428. }
  12429. if ($io && $io->isDebug()) {
  12430. $io->writeError('Loading auth config from COMPOSER_AUTH');
  12431. }
  12432. $config->merge(array('config' => $authData));
  12433. }
  12434. return $config;
  12435. }
  12436. public static function getComposerFile()
  12437. {
  12438. return trim(getenv('COMPOSER')) ?: './composer.json';
  12439. }
  12440. public static function createAdditionalStyles()
  12441. {
  12442. return array(
  12443. 'highlight' => new OutputFormatterStyle('red'),
  12444. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  12445. );
  12446. }
  12447. public static function createOutput()
  12448. {
  12449. $styles = self::createAdditionalStyles();
  12450. $formatter = new OutputFormatter(false, $styles);
  12451. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  12452. }
  12453. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  12454. {
  12455. return RepositoryFactory::defaultRepos($io, $config, $rm);
  12456. }
  12457. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  12458. {
  12459. $cwd = $cwd ?: getcwd();
  12460. if (null === $localConfig) {
  12461. $localConfig = static::getComposerFile();
  12462. }
  12463. if (is_string($localConfig)) {
  12464. $composerFile = $localConfig;
  12465. $file = new JsonFile($localConfig, null, $io);
  12466. if (!$file->exists()) {
  12467. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  12468. $message = 'Composer could not find a composer.json file in '.$cwd;
  12469. } else {
  12470. $message = 'Composer could not find the config file: '.$localConfig;
  12471. }
  12472. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  12473. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  12474. }
  12475. $file->validateSchema(JsonFile::LAX_SCHEMA);
  12476. $jsonParser = new JsonParser;
  12477. try {
  12478. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  12479. } catch (DuplicateKeyException $e) {
  12480. $details = $e->getDetails();
  12481. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  12482. }
  12483. $localConfig = $file->read();
  12484. }
  12485. $config = static::createConfig($io, $cwd);
  12486. $config->merge($localConfig);
  12487. if (isset($composerFile)) {
  12488. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  12489. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  12490. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  12491. if ($localAuthFile->exists()) {
  12492. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  12493. $config->merge(array('config' => $localAuthFile->read()));
  12494. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  12495. }
  12496. }
  12497. $vendorDir = $config->get('vendor-dir');
  12498. $composer = new Composer();
  12499. $composer->setConfig($config);
  12500. if ($fullLoad) {
  12501. $io->loadConfiguration($config);
  12502. }
  12503. $rfs = self::createRemoteFilesystem($io, $config);
  12504. $dispatcher = new EventDispatcher($composer, $io);
  12505. $composer->setEventDispatcher($dispatcher);
  12506. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  12507. $composer->setRepositoryManager($rm);
  12508. $this->addLocalRepository($io, $rm, $vendorDir);
  12509. if (!$fullLoad && !isset($localConfig['version'])) {
  12510. $localConfig['version'] = '1.0.0';
  12511. }
  12512. $parser = new VersionParser;
  12513. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  12514. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser);
  12515. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  12516. $composer->setPackage($package);
  12517. $im = $this->createInstallationManager();
  12518. $composer->setInstallationManager($im);
  12519. if ($fullLoad) {
  12520. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  12521. $composer->setDownloadManager($dm);
  12522. $generator = new AutoloadGenerator($dispatcher, $io);
  12523. $composer->setAutoloadGenerator($generator);
  12524. $am = $this->createArchiveManager($config, $dm);
  12525. $composer->setArchiveManager($am);
  12526. }
  12527. $this->createDefaultInstallers($im, $composer, $io);
  12528. if ($fullLoad) {
  12529. $globalComposer = null;
  12530. if (realpath($config->get('home')) !== $cwd) {
  12531. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  12532. }
  12533. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  12534. $composer->setPluginManager($pm);
  12535. $pm->loadInstalledPlugins();
  12536. }
  12537. if ($fullLoad && isset($composerFile)) {
  12538. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  12539. ? substr($composerFile, 0, -4).'lock'
  12540. : $composerFile . '.lock';
  12541. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  12542. $composer->setLocker($locker);
  12543. }
  12544. if ($fullLoad) {
  12545. $initEvent = new Event(PluginEvents::INIT);
  12546. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  12547. if ($rm->getLocalRepository()) {
  12548. $this->purgePackages($rm->getLocalRepository(), $im);
  12549. }
  12550. }
  12551. return $composer;
  12552. }
  12553. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  12554. {
  12555. $factory = new static();
  12556. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  12557. }
  12558. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  12559. {
  12560. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  12561. }
  12562. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  12563. {
  12564. $composer = null;
  12565. try {
  12566. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  12567. } catch (\Exception $e) {
  12568. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  12569. }
  12570. return $composer;
  12571. }
  12572. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  12573. {
  12574. $cache = null;
  12575. if ($config->get('cache-files-ttl') > 0) {
  12576. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  12577. }
  12578. $dm = new Downloader\DownloadManager($io);
  12579. switch ($preferred = $config->get('preferred-install')) {
  12580. case 'dist':
  12581. $dm->setPreferDist(true);
  12582. break;
  12583. case 'source':
  12584. $dm->setPreferSource(true);
  12585. break;
  12586. case 'auto':
  12587. default:
  12588. break;
  12589. }
  12590. if (is_array($preferred)) {
  12591. $dm->setPreferences($preferred);
  12592. }
  12593. $executor = new ProcessExecutor($io);
  12594. $fs = new Filesystem($executor);
  12595. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  12596. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  12597. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  12598. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  12599. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  12600. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12601. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12602. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12603. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12604. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12605. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12606. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12607. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12608. return $dm;
  12609. }
  12610. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  12611. {
  12612. if (null === $dm) {
  12613. $io = new IO\NullIO();
  12614. $io->loadConfiguration($config);
  12615. $dm = $this->createDownloadManager($io, $config);
  12616. }
  12617. $am = new Archiver\ArchiveManager($dm);
  12618. $am->addArchiver(new Archiver\ZipArchiver);
  12619. $am->addArchiver(new Archiver\PharArchiver);
  12620. return $am;
  12621. }
  12622. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  12623. {
  12624. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  12625. }
  12626. protected function createInstallationManager()
  12627. {
  12628. return new Installer\InstallationManager();
  12629. }
  12630. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  12631. {
  12632. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  12633. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  12634. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  12635. $im->addInstaller(new Installer\MetapackageInstaller());
  12636. }
  12637. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  12638. {
  12639. foreach ($repo->getPackages() as $package) {
  12640. if (!$im->isPackageInstalled($repo, $package)) {
  12641. $repo->removePackage($package);
  12642. }
  12643. }
  12644. }
  12645. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  12646. {
  12647. $factory = new static();
  12648. return $factory->createComposer($io, $config, $disablePlugins);
  12649. }
  12650. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  12651. {
  12652. static $warned = false;
  12653. $disableTls = false;
  12654. if ($config && $config->get('disable-tls') === true) {
  12655. if (!$warned) {
  12656. $io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  12657. }
  12658. $warned = true;
  12659. $disableTls = true;
  12660. } elseif (!extension_loaded('openssl')) {
  12661. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  12662. . '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.');
  12663. }
  12664. $remoteFilesystemOptions = array();
  12665. if ($disableTls === false) {
  12666. if ($config && $config->get('cafile')) {
  12667. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  12668. }
  12669. if ($config && $config->get('capath')) {
  12670. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  12671. }
  12672. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  12673. }
  12674. try {
  12675. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  12676. } catch (TransportException $e) {
  12677. if (false !== strpos($e->getMessage(), 'cafile')) {
  12678. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  12679. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  12680. if (PHP_VERSION_ID < 50600) {
  12681. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  12682. }
  12683. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  12684. }
  12685. throw $e;
  12686. }
  12687. return $remoteFilesystem;
  12688. }
  12689. private static function useXdg()
  12690. {
  12691. foreach (array_keys($_SERVER) as $key) {
  12692. if (substr($key, 0, 4) === 'XDG_') {
  12693. return true;
  12694. }
  12695. }
  12696. return false;
  12697. }
  12698. private static function getUserDir()
  12699. {
  12700. $home = getenv('HOME');
  12701. if (!$home) {
  12702. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12703. }
  12704. return rtrim(strtr($home, '\\', '/'), '/');
  12705. }
  12706. }
  12707. <?php
  12708. namespace Composer\IO;
  12709. use Composer\Config;
  12710. use Composer\Util\ProcessExecutor;
  12711. use Psr\Log\LoggerInterface;
  12712. use Psr\Log\LogLevel;
  12713. abstract class BaseIO implements IOInterface, LoggerInterface
  12714. {
  12715. protected $authentications = array();
  12716. public function getAuthentications()
  12717. {
  12718. return $this->authentications;
  12719. }
  12720. public function hasAuthentication($repositoryName)
  12721. {
  12722. return isset($this->authentications[$repositoryName]);
  12723. }
  12724. public function getAuthentication($repositoryName)
  12725. {
  12726. if (isset($this->authentications[$repositoryName])) {
  12727. return $this->authentications[$repositoryName];
  12728. }
  12729. return array('username' => null, 'password' => null);
  12730. }
  12731. public function setAuthentication($repositoryName, $username, $password = null)
  12732. {
  12733. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  12734. }
  12735. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  12736. {
  12737. if ($this->hasAuthentication($repositoryName)) {
  12738. $auth = $this->getAuthentication($repositoryName);
  12739. if ($auth['username'] === $username && $auth['password'] === $password) {
  12740. return;
  12741. }
  12742. $this->writeError(
  12743. sprintf(
  12744. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  12745. $repositoryName
  12746. )
  12747. );
  12748. }
  12749. $this->setAuthentication($repositoryName, $username, $password);
  12750. }
  12751. public function loadConfiguration(Config $config)
  12752. {
  12753. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  12754. $githubOauth = $config->get('github-oauth') ?: array();
  12755. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  12756. $gitlabToken = $config->get('gitlab-token') ?: array();
  12757. $httpBasic = $config->get('http-basic') ?: array();
  12758. foreach ($bitbucketOauth as $domain => $cred) {
  12759. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  12760. }
  12761. foreach ($githubOauth as $domain => $token) {
  12762. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  12763. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  12764. }
  12765. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  12766. }
  12767. foreach ($gitlabOauth as $domain => $token) {
  12768. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  12769. }
  12770. foreach ($gitlabToken as $domain => $token) {
  12771. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  12772. }
  12773. foreach ($httpBasic as $domain => $cred) {
  12774. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  12775. }
  12776. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  12777. }
  12778. public function emergency($message, array $context = array())
  12779. {
  12780. return $this->log(LogLevel::EMERGENCY, $message, $context);
  12781. }
  12782. public function alert($message, array $context = array())
  12783. {
  12784. return $this->log(LogLevel::ALERT, $message, $context);
  12785. }
  12786. public function critical($message, array $context = array())
  12787. {
  12788. return $this->log(LogLevel::CRITICAL, $message, $context);
  12789. }
  12790. public function error($message, array $context = array())
  12791. {
  12792. return $this->log(LogLevel::ERROR, $message, $context);
  12793. }
  12794. public function warning($message, array $context = array())
  12795. {
  12796. return $this->log(LogLevel::WARNING, $message, $context);
  12797. }
  12798. public function notice($message, array $context = array())
  12799. {
  12800. return $this->log(LogLevel::NOTICE, $message, $context);
  12801. }
  12802. public function info($message, array $context = array())
  12803. {
  12804. return $this->log(LogLevel::INFO, $message, $context);
  12805. }
  12806. public function debug($message, array $context = array())
  12807. {
  12808. return $this->log(LogLevel::DEBUG, $message, $context);
  12809. }
  12810. public function log($level, $message, array $context = array())
  12811. {
  12812. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  12813. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  12814. } elseif ($level === LogLevel::WARNING) {
  12815. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  12816. } elseif ($level === LogLevel::NOTICE) {
  12817. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  12818. } elseif ($level === LogLevel::INFO) {
  12819. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  12820. } else {
  12821. $this->writeError($message, true, self::DEBUG);
  12822. }
  12823. }
  12824. }
  12825. <?php
  12826. namespace Composer\IO;
  12827. use Symfony\Component\Console\Output\StreamOutput;
  12828. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  12829. use Symfony\Component\Console\Input\StringInput;
  12830. use Symfony\Component\Console\Helper\HelperSet;
  12831. class BufferIO extends ConsoleIO
  12832. {
  12833. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  12834. {
  12835. $input = new StringInput($input);
  12836. $input->setInteractive(false);
  12837. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  12838. parent::__construct($input, $output, new HelperSet(array()));
  12839. }
  12840. public function getOutput()
  12841. {
  12842. fseek($this->output->getStream(), 0);
  12843. $output = stream_get_contents($this->output->getStream());
  12844. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  12845. $pre = strip_tags($matches[1]);
  12846. if (strlen($pre) === strlen($matches[2])) {
  12847. return '';
  12848. }
  12849. return rtrim($matches[1])."\n";
  12850. }, $output);
  12851. return $output;
  12852. }
  12853. }
  12854. <?php
  12855. namespace Composer\IO;
  12856. use Composer\Question\StrictConfirmationQuestion;
  12857. use Symfony\Component\Console\Helper\HelperSet;
  12858. use Symfony\Component\Console\Input\InputInterface;
  12859. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  12860. use Symfony\Component\Console\Output\OutputInterface;
  12861. use Symfony\Component\Console\Question\ChoiceQuestion;
  12862. use Symfony\Component\Console\Question\Question;
  12863. class ConsoleIO extends BaseIO
  12864. {
  12865. protected $input;
  12866. protected $output;
  12867. protected $helperSet;
  12868. protected $lastMessage;
  12869. protected $lastMessageErr;
  12870. private $startTime;
  12871. private $verbosityMap;
  12872. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  12873. {
  12874. $this->input = $input;
  12875. $this->output = $output;
  12876. $this->helperSet = $helperSet;
  12877. $this->verbosityMap = array(
  12878. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  12879. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  12880. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  12881. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  12882. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  12883. );
  12884. }
  12885. public function enableDebugging($startTime)
  12886. {
  12887. $this->startTime = $startTime;
  12888. }
  12889. public function isInteractive()
  12890. {
  12891. return $this->input->isInteractive();
  12892. }
  12893. public function isDecorated()
  12894. {
  12895. return $this->output->isDecorated();
  12896. }
  12897. public function isVerbose()
  12898. {
  12899. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  12900. }
  12901. public function isVeryVerbose()
  12902. {
  12903. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  12904. }
  12905. public function isDebug()
  12906. {
  12907. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  12908. }
  12909. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  12910. {
  12911. $this->doWrite($messages, $newline, false, $verbosity);
  12912. }
  12913. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  12914. {
  12915. $this->doWrite($messages, $newline, true, $verbosity);
  12916. }
  12917. private function doWrite($messages, $newline, $stderr, $verbosity)
  12918. {
  12919. $sfVerbosity = $this->verbosityMap[$verbosity];
  12920. if ($sfVerbosity > $this->output->getVerbosity()) {
  12921. return;
  12922. }
  12923. if (OutputInterface::VERBOSITY_QUIET === 0) {
  12924. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  12925. }
  12926. if (null !== $this->startTime) {
  12927. $memoryUsage = memory_get_usage() / 1024 / 1024;
  12928. $timeSpent = microtime(true) - $this->startTime;
  12929. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  12930. return sprintf('[%.1fMB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  12931. }, (array) $messages);
  12932. }
  12933. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  12934. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  12935. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  12936. return;
  12937. }
  12938. $this->output->write($messages, $newline, $sfVerbosity);
  12939. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  12940. }
  12941. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  12942. {
  12943. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  12944. }
  12945. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  12946. {
  12947. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  12948. }
  12949. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  12950. {
  12951. $messages = implode($newline ? "\n" : '', (array) $messages);
  12952. if (!isset($size)) {
  12953. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  12954. }
  12955. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  12956. $this->doWrite($messages, false, $stderr, $verbosity);
  12957. $fill = $size - strlen(strip_tags($messages));
  12958. if ($fill > 0) {
  12959. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  12960. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  12961. }
  12962. if ($newline) {
  12963. $this->doWrite('', true, $stderr, $verbosity);
  12964. }
  12965. if ($stderr) {
  12966. $this->lastMessageErr = $messages;
  12967. } else {
  12968. $this->lastMessage = $messages;
  12969. }
  12970. }
  12971. public function ask($question, $default = null)
  12972. {
  12973. $helper = $this->helperSet->get('question');
  12974. $question = new Question($question, $default);
  12975. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12976. }
  12977. public function askConfirmation($question, $default = true)
  12978. {
  12979. $helper = $this->helperSet->get('question');
  12980. $question = new StrictConfirmationQuestion($question, $default);
  12981. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12982. }
  12983. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  12984. {
  12985. $helper = $this->helperSet->get('question');
  12986. $question = new Question($question, $default);
  12987. $question->setValidator($validator);
  12988. $question->setMaxAttempts($attempts);
  12989. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12990. }
  12991. public function askAndHideAnswer($question)
  12992. {
  12993. $helper = $this->helperSet->get('question');
  12994. $question = new Question($question);
  12995. $question->setHidden(true);
  12996. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12997. }
  12998. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  12999. {
  13000. $helper = $this->helperSet->get('question');
  13001. $question = new ChoiceQuestion($question, $choices, $default);
  13002. $question->setMaxAttempts($attempts ?: null);
  13003. $question->setErrorMessage($errorMessage);
  13004. $question->setMultiselect($multiselect);
  13005. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  13006. if (!is_array($result)) {
  13007. return (string) array_search($result, $choices, true);
  13008. }
  13009. $results = array();
  13010. foreach ($choices as $index => $choice) {
  13011. if (in_array($choice, $result, true)) {
  13012. $results[] = (string) $index;
  13013. }
  13014. }
  13015. return $results;
  13016. }
  13017. private function getErrorOutput()
  13018. {
  13019. if ($this->output instanceof ConsoleOutputInterface) {
  13020. return $this->output->getErrorOutput();
  13021. }
  13022. return $this->output;
  13023. }
  13024. }
  13025. <?php
  13026. namespace Composer\IO;
  13027. use Composer\Config;
  13028. interface IOInterface
  13029. {
  13030. const QUIET = 1;
  13031. const NORMAL = 2;
  13032. const VERBOSE = 4;
  13033. const VERY_VERBOSE = 8;
  13034. const DEBUG = 16;
  13035. public function isInteractive();
  13036. public function isVerbose();
  13037. public function isVeryVerbose();
  13038. public function isDebug();
  13039. public function isDecorated();
  13040. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  13041. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  13042. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13043. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13044. public function ask($question, $default = null);
  13045. public function askConfirmation($question, $default = true);
  13046. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  13047. public function askAndHideAnswer($question);
  13048. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  13049. public function getAuthentications();
  13050. public function hasAuthentication($repositoryName);
  13051. public function getAuthentication($repositoryName);
  13052. public function setAuthentication($repositoryName, $username, $password = null);
  13053. public function loadConfiguration(Config $config);
  13054. }
  13055. <?php
  13056. namespace Composer\IO;
  13057. class NullIO extends BaseIO
  13058. {
  13059. public function isInteractive()
  13060. {
  13061. return false;
  13062. }
  13063. public function isVerbose()
  13064. {
  13065. return false;
  13066. }
  13067. public function isVeryVerbose()
  13068. {
  13069. return false;
  13070. }
  13071. public function isDebug()
  13072. {
  13073. return false;
  13074. }
  13075. public function isDecorated()
  13076. {
  13077. return false;
  13078. }
  13079. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13080. {
  13081. }
  13082. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13083. {
  13084. }
  13085. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13086. {
  13087. }
  13088. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13089. {
  13090. }
  13091. public function ask($question, $default = null)
  13092. {
  13093. return $default;
  13094. }
  13095. public function askConfirmation($question, $default = true)
  13096. {
  13097. return $default;
  13098. }
  13099. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  13100. {
  13101. return $default;
  13102. }
  13103. public function askAndHideAnswer($question)
  13104. {
  13105. return null;
  13106. }
  13107. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13108. {
  13109. return $default;
  13110. }
  13111. }
  13112. <?php
  13113. namespace Composer;
  13114. use Composer\Autoload\AutoloadGenerator;
  13115. use Composer\DependencyResolver\DefaultPolicy;
  13116. use Composer\DependencyResolver\Operation\UpdateOperation;
  13117. use Composer\DependencyResolver\Operation\InstallOperation;
  13118. use Composer\DependencyResolver\Operation\UninstallOperation;
  13119. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  13120. use Composer\DependencyResolver\Operation\OperationInterface;
  13121. use Composer\DependencyResolver\PolicyInterface;
  13122. use Composer\DependencyResolver\Pool;
  13123. use Composer\DependencyResolver\Request;
  13124. use Composer\DependencyResolver\Rule;
  13125. use Composer\DependencyResolver\Solver;
  13126. use Composer\DependencyResolver\SolverProblemsException;
  13127. use Composer\Downloader\DownloadManager;
  13128. use Composer\EventDispatcher\EventDispatcher;
  13129. use Composer\Installer\InstallationManager;
  13130. use Composer\Installer\InstallerEvents;
  13131. use Composer\Installer\NoopInstaller;
  13132. use Composer\Installer\SuggestedPackagesReporter;
  13133. use Composer\IO\IOInterface;
  13134. use Composer\Package\AliasPackage;
  13135. use Composer\Package\CompletePackage;
  13136. use Composer\Package\Link;
  13137. use Composer\Package\Loader\ArrayLoader;
  13138. use Composer\Package\Dumper\ArrayDumper;
  13139. use Composer\Semver\Constraint\Constraint;
  13140. use Composer\Package\Locker;
  13141. use Composer\Package\PackageInterface;
  13142. use Composer\Package\RootPackageInterface;
  13143. use Composer\Repository\CompositeRepository;
  13144. use Composer\Repository\InstalledArrayRepository;
  13145. use Composer\Repository\PlatformRepository;
  13146. use Composer\Repository\RepositoryInterface;
  13147. use Composer\Repository\RepositoryManager;
  13148. use Composer\Repository\WritableRepositoryInterface;
  13149. use Composer\Script\ScriptEvents;
  13150. class Installer
  13151. {
  13152. protected $io;
  13153. protected $config;
  13154. protected $package;
  13155. protected $downloadManager;
  13156. protected $repositoryManager;
  13157. protected $locker;
  13158. protected $installationManager;
  13159. protected $eventDispatcher;
  13160. protected $autoloadGenerator;
  13161. protected $preferSource = false;
  13162. protected $preferDist = false;
  13163. protected $optimizeAutoloader = false;
  13164. protected $classMapAuthoritative = false;
  13165. protected $apcuAutoloader = false;
  13166. protected $devMode = false;
  13167. protected $dryRun = false;
  13168. protected $verbose = false;
  13169. protected $update = false;
  13170. protected $dumpAutoloader = true;
  13171. protected $runScripts = true;
  13172. protected $ignorePlatformReqs = false;
  13173. protected $preferStable = false;
  13174. protected $preferLowest = false;
  13175. protected $skipSuggest = false;
  13176. protected $writeLock = true;
  13177. protected $executeOperations = true;
  13178. protected $updateWhitelist = null;
  13179. protected $whitelistDependencies = false;
  13180. protected $whitelistAllDependencies = false;
  13181. protected $suggestedPackagesReporter;
  13182. protected $additionalInstalledRepository;
  13183. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  13184. {
  13185. $this->io = $io;
  13186. $this->config = $config;
  13187. $this->package = $package;
  13188. $this->downloadManager = $downloadManager;
  13189. $this->repositoryManager = $repositoryManager;
  13190. $this->locker = $locker;
  13191. $this->installationManager = $installationManager;
  13192. $this->eventDispatcher = $eventDispatcher;
  13193. $this->autoloadGenerator = $autoloadGenerator;
  13194. }
  13195. public function run()
  13196. {
  13197. gc_collect_cycles();
  13198. gc_disable();
  13199. if (!$this->update && !$this->locker->isLocked()) {
  13200. $this->update = true;
  13201. }
  13202. if ($this->dryRun) {
  13203. $this->verbose = true;
  13204. $this->runScripts = false;
  13205. $this->executeOperations = false;
  13206. $this->writeLock = false;
  13207. $this->dumpAutoloader = false;
  13208. $this->installationManager->addInstaller(new NoopInstaller);
  13209. $this->mockLocalRepositories($this->repositoryManager);
  13210. }
  13211. if ($this->runScripts) {
  13212. $devMode = (int) $this->devMode;
  13213. putenv("COMPOSER_DEV_MODE=$devMode");
  13214. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  13215. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13216. }
  13217. $this->downloadManager->setPreferSource($this->preferSource);
  13218. $this->downloadManager->setPreferDist($this->preferDist);
  13219. $localRepo = $this->repositoryManager->getLocalRepository();
  13220. if ($this->update) {
  13221. $platformOverrides = $this->config->get('platform') ?: array();
  13222. } else {
  13223. $platformOverrides = $this->locker->getPlatformOverrides();
  13224. }
  13225. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  13226. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13227. $aliases = $this->getRootAliases();
  13228. $this->aliasPlatformPackages($platformRepo, $aliases);
  13229. if (!$this->suggestedPackagesReporter) {
  13230. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  13231. }
  13232. try {
  13233. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  13234. if ($res !== 0) {
  13235. return $res;
  13236. }
  13237. } catch (\Exception $e) {
  13238. if ($this->executeOperations) {
  13239. $this->installationManager->notifyInstalls($this->io);
  13240. }
  13241. throw $e;
  13242. }
  13243. if ($this->executeOperations) {
  13244. $this->installationManager->notifyInstalls($this->io);
  13245. }
  13246. if ($this->devMode && !$this->skipSuggest) {
  13247. $this->suggestedPackagesReporter->output($installedRepo);
  13248. }
  13249. foreach ($localRepo->getPackages() as $package) {
  13250. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  13251. continue;
  13252. }
  13253. $replacement = is_string($package->getReplacementPackage())
  13254. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  13255. : 'No replacement was suggested';
  13256. $this->io->writeError(
  13257. sprintf(
  13258. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  13259. $package->getPrettyName(),
  13260. $replacement
  13261. )
  13262. );
  13263. }
  13264. if ($this->update && $this->writeLock) {
  13265. $localRepo->reload();
  13266. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  13267. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  13268. $updatedLock = $this->locker->setLockData(
  13269. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  13270. $devPackages,
  13271. $platformReqs,
  13272. $platformDevReqs,
  13273. $aliases,
  13274. $this->package->getMinimumStability(),
  13275. $this->package->getStabilityFlags(),
  13276. $this->preferStable || $this->package->getPreferStable(),
  13277. $this->preferLowest,
  13278. $this->config->get('platform') ?: array()
  13279. );
  13280. if ($updatedLock) {
  13281. $this->io->writeError('<info>Writing lock file</info>');
  13282. }
  13283. }
  13284. if ($this->dumpAutoloader) {
  13285. if ($this->optimizeAutoloader) {
  13286. $this->io->writeError('<info>Generating optimized autoload files</info>');
  13287. } else {
  13288. $this->io->writeError('<info>Generating autoload files</info>');
  13289. }
  13290. $this->autoloadGenerator->setDevMode($this->devMode);
  13291. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  13292. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  13293. $this->autoloadGenerator->setRunScripts($this->runScripts);
  13294. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  13295. }
  13296. if ($this->executeOperations) {
  13297. foreach ($localRepo->getPackages() as $package) {
  13298. $this->installationManager->ensureBinariesPresence($package);
  13299. }
  13300. $vendorDir = $this->config->get('vendor-dir');
  13301. if (is_dir($vendorDir)) {
  13302. @touch($vendorDir);
  13303. }
  13304. }
  13305. if ($this->runScripts) {
  13306. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  13307. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13308. }
  13309. if (!defined('HHVM_VERSION')) {
  13310. gc_enable();
  13311. }
  13312. return 0;
  13313. }
  13314. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  13315. {
  13316. $lockedRepository = null;
  13317. $repositories = null;
  13318. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  13319. try {
  13320. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  13321. } catch (\RuntimeException $e) {
  13322. if ($this->package->getDevRequires()) {
  13323. throw $e;
  13324. }
  13325. $lockedRepository = $this->locker->getLockedRepository();
  13326. }
  13327. }
  13328. $this->whitelistUpdateDependencies(
  13329. $lockedRepository ?: $localRepo,
  13330. $this->package->getRequires(),
  13331. $this->package->getDevRequires()
  13332. );
  13333. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  13334. $policy = $this->createPolicy();
  13335. $pool = $this->createPool($this->update ? null : $lockedRepository);
  13336. $pool->addRepository($installedRepo, $aliases);
  13337. if ($this->update) {
  13338. $repositories = $this->repositoryManager->getRepositories();
  13339. foreach ($repositories as $repository) {
  13340. $pool->addRepository($repository, $aliases);
  13341. }
  13342. }
  13343. if ($lockedRepository) {
  13344. $pool->addRepository($lockedRepository, $aliases);
  13345. }
  13346. $request = $this->createRequest($this->package, $platformRepo);
  13347. if ($this->update) {
  13348. $removedUnstablePackages = array();
  13349. foreach ($localRepo->getPackages() as $package) {
  13350. if (
  13351. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  13352. && $this->installationManager->isPackageInstalled($localRepo, $package)
  13353. ) {
  13354. $removedUnstablePackages[$package->getName()] = true;
  13355. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  13356. }
  13357. }
  13358. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  13359. $request->updateAll();
  13360. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13361. foreach ($links as $link) {
  13362. $request->install($link->getTarget(), $link->getConstraint());
  13363. }
  13364. if ($this->updateWhitelist) {
  13365. $currentPackages = $this->getCurrentPackages($installedRepo);
  13366. $candidates = array();
  13367. foreach ($links as $link) {
  13368. $candidates[$link->getTarget()] = true;
  13369. $rootRequires[$link->getTarget()] = $link;
  13370. }
  13371. foreach ($currentPackages as $package) {
  13372. $candidates[$package->getName()] = true;
  13373. }
  13374. foreach ($candidates as $candidate => $dummy) {
  13375. foreach ($currentPackages as $curPackage) {
  13376. if ($curPackage->getName() === $candidate) {
  13377. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  13378. $constraint = new Constraint('=', $curPackage->getVersion());
  13379. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  13380. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  13381. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  13382. $request->install($curPackage->getName(), $constraint);
  13383. }
  13384. break;
  13385. }
  13386. }
  13387. }
  13388. }
  13389. } else {
  13390. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  13391. if (!$this->locker->isFresh()) {
  13392. $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);
  13393. }
  13394. foreach ($lockedRepository->getPackages() as $package) {
  13395. $version = $package->getVersion();
  13396. if (isset($aliases[$package->getName()][$version])) {
  13397. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  13398. }
  13399. $constraint = new Constraint('=', $version);
  13400. $constraint->setPrettyString($package->getPrettyVersion());
  13401. $request->install($package->getName(), $constraint);
  13402. }
  13403. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  13404. $request->install($link->getTarget(), $link->getConstraint());
  13405. }
  13406. }
  13407. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  13408. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  13409. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13410. try {
  13411. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  13412. } catch (SolverProblemsException $e) {
  13413. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  13414. $this->io->writeError($e->getMessage());
  13415. if ($this->update && !$this->devMode) {
  13416. $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);
  13417. }
  13418. return array(max(1, $e->getCode()), array());
  13419. }
  13420. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  13421. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  13422. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  13423. $this->io->writeError("Analyzed ".$solver->getRuleSetSize()." rules to resolve dependencies", true, IOInterface::VERBOSE);
  13424. if (!$operations) {
  13425. $this->io->writeError('Nothing to install or update');
  13426. }
  13427. $operations = $this->movePluginsToFront($operations);
  13428. $operations = $this->moveUninstallsToFront($operations);
  13429. if ($this->update) {
  13430. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  13431. if (!$this->devMode) {
  13432. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  13433. }
  13434. } else {
  13435. $devPackages = null;
  13436. }
  13437. if ($operations) {
  13438. $installs = $updates = $uninstalls = array();
  13439. foreach ($operations as $operation) {
  13440. if ($operation instanceof InstallOperation) {
  13441. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  13442. } elseif ($operation instanceof UpdateOperation) {
  13443. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  13444. } elseif ($operation instanceof UninstallOperation) {
  13445. $uninstalls[] = $operation->getPackage()->getPrettyName();
  13446. }
  13447. }
  13448. $this->io->writeError(sprintf(
  13449. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  13450. count($installs),
  13451. 1 === count($installs) ? '' : 's',
  13452. count($updates),
  13453. 1 === count($updates) ? '' : 's',
  13454. count($uninstalls),
  13455. 1 === count($uninstalls) ? '' : 's'
  13456. ));
  13457. if ($installs) {
  13458. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  13459. }
  13460. if ($updates) {
  13461. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  13462. }
  13463. if ($uninstalls) {
  13464. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  13465. }
  13466. }
  13467. foreach ($operations as $operation) {
  13468. $jobType = $operation->getJobType();
  13469. if ('install' === $jobType) {
  13470. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  13471. }
  13472. if ($this->update) {
  13473. $package = null;
  13474. if ('update' === $jobType) {
  13475. $package = $operation->getTargetPackage();
  13476. } elseif ('install' === $jobType) {
  13477. $package = $operation->getPackage();
  13478. }
  13479. if ($package && $package->isDev()) {
  13480. $references = $this->package->getReferences();
  13481. if (isset($references[$package->getName()])) {
  13482. $this->updateInstallReferences($package, $references[$package->getName()]);
  13483. }
  13484. }
  13485. if ('update' === $jobType) {
  13486. $targetPackage = $operation->getTargetPackage();
  13487. if ($targetPackage->isDev()) {
  13488. $initialPackage = $operation->getInitialPackage();
  13489. if ($targetPackage->getVersion() === $initialPackage->getVersion()
  13490. && (!$targetPackage->getSourceReference() || $targetPackage->getSourceReference() === $initialPackage->getSourceReference())
  13491. && (!$targetPackage->getDistReference() || $targetPackage->getDistReference() === $initialPackage->getDistReference())
  13492. ) {
  13493. $this->io->writeError(' - Skipping update of ' . $targetPackage->getPrettyName() . ' to the same reference-locked version', true, IOInterface::DEBUG);
  13494. $this->io->writeError('', true, IOInterface::DEBUG);
  13495. continue;
  13496. }
  13497. }
  13498. }
  13499. }
  13500. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($jobType);
  13501. if (defined($event) && $this->runScripts) {
  13502. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13503. }
  13504. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  13505. $this->io->writeError(' - ' . $operation);
  13506. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  13507. $this->io->writeError(' - ' . $operation);
  13508. }
  13509. $this->installationManager->execute($localRepo, $operation);
  13510. if ($this->verbose && $this->io->isVeryVerbose() && in_array($jobType, array('install', 'update'))) {
  13511. $reason = $operation->getReason();
  13512. if ($reason instanceof Rule) {
  13513. switch ($reason->getReason()) {
  13514. case Rule::RULE_JOB_INSTALL:
  13515. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  13516. $this->io->writeError('');
  13517. break;
  13518. case Rule::RULE_PACKAGE_REQUIRES:
  13519. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  13520. $this->io->writeError('');
  13521. break;
  13522. }
  13523. }
  13524. }
  13525. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($jobType);
  13526. if (defined($event) && $this->runScripts) {
  13527. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13528. }
  13529. if ($this->executeOperations || $this->writeLock) {
  13530. $localRepo->write();
  13531. }
  13532. }
  13533. if ($this->executeOperations) {
  13534. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  13535. $localRepo->write();
  13536. }
  13537. return array(0, $devPackages);
  13538. }
  13539. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  13540. {
  13541. if (!$this->package->getDevRequires()) {
  13542. return array();
  13543. }
  13544. $tempLocalRepo = clone $localRepo;
  13545. foreach ($operations as $operation) {
  13546. switch ($operation->getJobType()) {
  13547. case 'install':
  13548. case 'markAliasInstalled':
  13549. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  13550. $tempLocalRepo->addPackage(clone $operation->getPackage());
  13551. }
  13552. break;
  13553. case 'uninstall':
  13554. case 'markAliasUninstalled':
  13555. $tempLocalRepo->removePackage($operation->getPackage());
  13556. break;
  13557. case 'update':
  13558. $tempLocalRepo->removePackage($operation->getInitialPackage());
  13559. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  13560. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  13561. }
  13562. break;
  13563. default:
  13564. throw new \LogicException('Unknown type: '.$operation->getJobType());
  13565. }
  13566. }
  13567. $localRepo = new InstalledArrayRepository(array());
  13568. $loader = new ArrayLoader(null, true);
  13569. $dumper = new ArrayDumper();
  13570. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  13571. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  13572. }
  13573. unset($tempLocalRepo, $loader, $dumper);
  13574. $policy = $this->createPolicy();
  13575. $pool = $this->createPool();
  13576. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13577. $pool->addRepository($installedRepo, $aliases);
  13578. $request = $this->createRequest($this->package, $platformRepo);
  13579. $request->updateAll();
  13580. foreach ($this->package->getRequires() as $link) {
  13581. $request->install($link->getTarget(), $link->getConstraint());
  13582. }
  13583. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  13584. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13585. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  13586. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  13587. $devPackages = array();
  13588. foreach ($ops as $op) {
  13589. if ($op->getJobType() === 'uninstall') {
  13590. $devPackages[] = $op->getPackage();
  13591. }
  13592. }
  13593. return $devPackages;
  13594. }
  13595. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  13596. {
  13597. $finalOps = array();
  13598. $packagesToSkip = array();
  13599. foreach ($devPackages as $pkg) {
  13600. $packagesToSkip[$pkg->getName()] = true;
  13601. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  13602. if ($installedDevPkg instanceof AliasPackage) {
  13603. $finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
  13604. $installedDevPkg = $installedDevPkg->getAliasOf();
  13605. }
  13606. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  13607. }
  13608. }
  13609. foreach ($operations as $op) {
  13610. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  13611. if (isset($packagesToSkip[$package->getName()])) {
  13612. continue;
  13613. }
  13614. $finalOps[] = $op;
  13615. }
  13616. return $finalOps;
  13617. }
  13618. private function movePluginsToFront(array $operations)
  13619. {
  13620. $pluginsNoDeps = array();
  13621. $pluginsWithDeps = array();
  13622. $pluginRequires = array();
  13623. foreach (array_reverse($operations, true) as $idx => $op) {
  13624. if ($op instanceof InstallOperation) {
  13625. $package = $op->getPackage();
  13626. } elseif ($op instanceof UpdateOperation) {
  13627. $package = $op->getTargetPackage();
  13628. } else {
  13629. continue;
  13630. }
  13631. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  13632. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  13633. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  13634. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  13635. });
  13636. if ($isPlugin && !count($requires)) {
  13637. array_unshift($pluginsNoDeps, $op);
  13638. } else {
  13639. $pluginRequires = array_merge($pluginRequires, $requires);
  13640. array_unshift($pluginsWithDeps, $op);
  13641. }
  13642. unset($operations[$idx]);
  13643. }
  13644. }
  13645. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  13646. }
  13647. private function moveUninstallsToFront(array $operations)
  13648. {
  13649. $uninstOps = array();
  13650. foreach ($operations as $idx => $op) {
  13651. if ($op instanceof UninstallOperation) {
  13652. $uninstOps[] = $op;
  13653. unset($operations[$idx]);
  13654. }
  13655. }
  13656. return array_merge($uninstOps, $operations);
  13657. }
  13658. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  13659. {
  13660. $installedRootPackage = clone $this->package;
  13661. $installedRootPackage->setRequires(array());
  13662. $installedRootPackage->setDevRequires(array());
  13663. $repos = array(
  13664. $localRepo,
  13665. new InstalledArrayRepository(array($installedRootPackage)),
  13666. $platformRepo,
  13667. );
  13668. $installedRepo = new CompositeRepository($repos);
  13669. if ($this->additionalInstalledRepository) {
  13670. $installedRepo->addRepository($this->additionalInstalledRepository);
  13671. }
  13672. return $installedRepo;
  13673. }
  13674. private function createPool(RepositoryInterface $lockedRepository = null)
  13675. {
  13676. if ($this->update) {
  13677. $minimumStability = $this->package->getMinimumStability();
  13678. $stabilityFlags = $this->package->getStabilityFlags();
  13679. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13680. } else {
  13681. $minimumStability = $this->locker->getMinimumStability();
  13682. $stabilityFlags = $this->locker->getStabilityFlags();
  13683. $requires = array();
  13684. foreach ($lockedRepository->getPackages() as $package) {
  13685. $constraint = new Constraint('=', $package->getVersion());
  13686. $constraint->setPrettyString($package->getPrettyVersion());
  13687. $requires[$package->getName()] = $constraint;
  13688. }
  13689. }
  13690. $rootConstraints = array();
  13691. foreach ($requires as $req => $constraint) {
  13692. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  13693. continue;
  13694. }
  13695. if ($constraint instanceof Link) {
  13696. $rootConstraints[$req] = $constraint->getConstraint();
  13697. } else {
  13698. $rootConstraints[$req] = $constraint;
  13699. }
  13700. }
  13701. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  13702. }
  13703. private function createPolicy()
  13704. {
  13705. $preferStable = null;
  13706. $preferLowest = null;
  13707. if (!$this->update) {
  13708. $preferStable = $this->locker->getPreferStable();
  13709. $preferLowest = $this->locker->getPreferLowest();
  13710. }
  13711. if (null === $preferStable) {
  13712. $preferStable = $this->preferStable || $this->package->getPreferStable();
  13713. }
  13714. if (null === $preferLowest) {
  13715. $preferLowest = $this->preferLowest;
  13716. }
  13717. return new DefaultPolicy($preferStable, $preferLowest);
  13718. }
  13719. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  13720. {
  13721. $request = new Request();
  13722. $constraint = new Constraint('=', $rootPackage->getVersion());
  13723. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  13724. $request->install($rootPackage->getName(), $constraint);
  13725. $fixedPackages = $platformRepo->getPackages();
  13726. if ($this->additionalInstalledRepository) {
  13727. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  13728. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  13729. }
  13730. $provided = $rootPackage->getProvides();
  13731. foreach ($fixedPackages as $package) {
  13732. $constraint = new Constraint('=', $package->getVersion());
  13733. $constraint->setPrettyString($package->getPrettyVersion());
  13734. if ($package->getRepository() !== $platformRepo
  13735. || !isset($provided[$package->getName()])
  13736. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  13737. ) {
  13738. $request->fix($package->getName(), $constraint);
  13739. }
  13740. }
  13741. return $request;
  13742. }
  13743. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  13744. {
  13745. if ($task === 'force-updates' && null === $operations) {
  13746. throw new \InvalidArgumentException('Missing operations argument');
  13747. }
  13748. if ($task === 'force-links') {
  13749. $operations = array();
  13750. }
  13751. if ($this->update && $this->updateWhitelist) {
  13752. $currentPackages = $this->getCurrentPackages($installedRepo);
  13753. }
  13754. foreach ($localRepo->getCanonicalPackages() as $package) {
  13755. if (!$package->isDev()) {
  13756. continue;
  13757. }
  13758. foreach ($operations as $operation) {
  13759. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  13760. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  13761. ) {
  13762. continue 2;
  13763. }
  13764. }
  13765. if ($this->update) {
  13766. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13767. foreach ($currentPackages as $curPackage) {
  13768. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  13769. if ($task === 'force-links') {
  13770. $package->setRequires($curPackage->getRequires());
  13771. $package->setConflicts($curPackage->getConflicts());
  13772. $package->setProvides($curPackage->getProvides());
  13773. $package->setReplaces($curPackage->getReplaces());
  13774. } elseif ($task === 'force-updates') {
  13775. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  13776. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  13777. ) {
  13778. $operations[] = new UpdateOperation($package, $curPackage);
  13779. }
  13780. }
  13781. break;
  13782. }
  13783. }
  13784. continue;
  13785. }
  13786. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13787. foreach ($matches as $index => $match) {
  13788. if (!in_array($match->getRepository(), $repositories, true)) {
  13789. unset($matches[$index]);
  13790. continue;
  13791. }
  13792. if ($match->getName() !== $package->getName()) {
  13793. unset($matches[$index]);
  13794. continue;
  13795. }
  13796. $matches[$index] = $match->getId();
  13797. }
  13798. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13799. $newPackage = $pool->literalToPackage($matches[0]);
  13800. if ($task === 'force-links' && $newPackage) {
  13801. $package->setRequires($newPackage->getRequires());
  13802. $package->setConflicts($newPackage->getConflicts());
  13803. $package->setProvides($newPackage->getProvides());
  13804. $package->setReplaces($newPackage->getReplaces());
  13805. }
  13806. if (
  13807. $task === 'force-updates'
  13808. && $newPackage
  13809. && (
  13810. ($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  13811. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  13812. )
  13813. ) {
  13814. $operations[] = new UpdateOperation($package, $newPackage);
  13815. continue;
  13816. }
  13817. }
  13818. if ($task === 'force-updates') {
  13819. $references = $this->package->getReferences();
  13820. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  13821. $operations[] = new UpdateOperation($package, clone $package);
  13822. }
  13823. }
  13824. } else {
  13825. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  13826. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  13827. if ($task === 'force-links') {
  13828. $package->setRequires($lockedPackage->getRequires());
  13829. $package->setConflicts($lockedPackage->getConflicts());
  13830. $package->setProvides($lockedPackage->getProvides());
  13831. $package->setReplaces($lockedPackage->getReplaces());
  13832. } elseif ($task === 'force-updates') {
  13833. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  13834. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  13835. ) {
  13836. $operations[] = new UpdateOperation($package, $lockedPackage);
  13837. }
  13838. }
  13839. break;
  13840. }
  13841. }
  13842. }
  13843. }
  13844. return $operations;
  13845. }
  13846. private function getCurrentPackages($installedRepo)
  13847. {
  13848. if ($this->locker->isLocked()) {
  13849. try {
  13850. return $this->locker->getLockedRepository(true)->getPackages();
  13851. } catch (\RuntimeException $e) {
  13852. return $this->locker->getLockedRepository()->getPackages();
  13853. }
  13854. }
  13855. return $installedRepo->getPackages();
  13856. }
  13857. private function getRootAliases()
  13858. {
  13859. if ($this->update) {
  13860. $aliases = $this->package->getAliases();
  13861. } else {
  13862. $aliases = $this->locker->getAliases();
  13863. }
  13864. $normalizedAliases = array();
  13865. foreach ($aliases as $alias) {
  13866. $normalizedAliases[$alias['package']][$alias['version']] = array(
  13867. 'alias' => $alias['alias'],
  13868. 'alias_normalized' => $alias['alias_normalized'],
  13869. );
  13870. }
  13871. return $normalizedAliases;
  13872. }
  13873. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  13874. {
  13875. if (!$this->update) {
  13876. return;
  13877. }
  13878. $rootRefs = $this->package->getReferences();
  13879. foreach ($localRepo->getCanonicalPackages() as $package) {
  13880. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13881. foreach ($matches as $index => $match) {
  13882. if (!in_array($match->getRepository(), $repositories, true)) {
  13883. unset($matches[$index]);
  13884. continue;
  13885. }
  13886. if ($match->getName() !== $package->getName()) {
  13887. unset($matches[$index]);
  13888. continue;
  13889. }
  13890. $matches[$index] = $match->getId();
  13891. }
  13892. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13893. $newPackage = $pool->literalToPackage($matches[0]);
  13894. $sourceUrl = $package->getSourceUrl();
  13895. $newSourceUrl = $newPackage->getSourceUrl();
  13896. $newReference = $newPackage->getSourceReference();
  13897. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  13898. $newReference = $rootRefs[$package->getName()];
  13899. }
  13900. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl());
  13901. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  13902. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  13903. }
  13904. $package->setDistMirrors($newPackage->getDistMirrors());
  13905. $package->setSourceMirrors($newPackage->getSourceMirrors());
  13906. }
  13907. }
  13908. }
  13909. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl)
  13910. {
  13911. $oldSourceRef = $package->getSourceReference();
  13912. if ($package->getSourceUrl() !== $sourceUrl) {
  13913. $package->setSourceType($sourceType);
  13914. $package->setSourceUrl($sourceUrl);
  13915. $package->setSourceReference($sourceReference);
  13916. }
  13917. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
  13918. $package->setDistUrl($distUrl);
  13919. $this->updateInstallReferences($package, $sourceReference);
  13920. }
  13921. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13922. $this->updateInstallReferences($package, $oldSourceRef);
  13923. }
  13924. }
  13925. private function updateInstallReferences(PackageInterface $package, $reference)
  13926. {
  13927. if (!$reference) {
  13928. return;
  13929. }
  13930. $package->setSourceReference($reference);
  13931. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  13932. $package->setDistReference($reference);
  13933. $package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  13934. } elseif ($package->getDistReference()) {
  13935. $package->setDistReference($reference);
  13936. }
  13937. }
  13938. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  13939. {
  13940. foreach ($aliases as $package => $versions) {
  13941. foreach ($versions as $version => $alias) {
  13942. $packages = $platformRepo->findPackages($package, $version);
  13943. foreach ($packages as $package) {
  13944. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  13945. $aliasPackage->setRootPackageAlias(true);
  13946. $platformRepo->addPackage($aliasPackage);
  13947. }
  13948. }
  13949. }
  13950. }
  13951. private function isUpdateable(PackageInterface $package)
  13952. {
  13953. if (!$this->updateWhitelist) {
  13954. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  13955. }
  13956. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  13957. $patternRegexp = $this->packageNameToRegexp($whiteListedPattern);
  13958. if (preg_match($patternRegexp, $package->getName())) {
  13959. return true;
  13960. }
  13961. }
  13962. return false;
  13963. }
  13964. private function packageNameToRegexp($whiteListedPattern)
  13965. {
  13966. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  13967. return "{^" . $cleanedWhiteListedPattern . "$}i";
  13968. }
  13969. private function extractPlatformRequirements($links)
  13970. {
  13971. $platformReqs = array();
  13972. foreach ($links as $link) {
  13973. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  13974. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  13975. }
  13976. }
  13977. return $platformReqs;
  13978. }
  13979. private function whitelistUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  13980. {
  13981. if (!$this->updateWhitelist) {
  13982. return;
  13983. }
  13984. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  13985. $requiredPackageNames = array();
  13986. foreach ($rootRequires as $require) {
  13987. $requiredPackageNames[] = $require->getTarget();
  13988. }
  13989. $skipPackages = array();
  13990. if (!$this->whitelistAllDependencies) {
  13991. foreach ($rootRequires as $require) {
  13992. $skipPackages[$require->getTarget()] = true;
  13993. }
  13994. }
  13995. $pool = new Pool('dev');
  13996. $pool->addRepository($localOrLockRepo);
  13997. $seen = array();
  13998. $rootRequiredPackageNames = array_keys($rootRequires);
  13999. foreach ($this->updateWhitelist as $packageName => $void) {
  14000. $packageQueue = new \SplQueue;
  14001. $depPackages = $pool->whatProvides($packageName);
  14002. $nameMatchesRequiredPackage = in_array($packageName, $requiredPackageNames, true);
  14003. if (!$nameMatchesRequiredPackage) {
  14004. $whitelistPatternRegexp = $this->packageNameToRegexp($packageName);
  14005. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  14006. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  14007. $nameMatchesRequiredPackage = true;
  14008. break;
  14009. }
  14010. }
  14011. }
  14012. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  14013. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  14014. }
  14015. foreach ($depPackages as $depPackage) {
  14016. $packageQueue->enqueue($depPackage);
  14017. }
  14018. while (!$packageQueue->isEmpty()) {
  14019. $package = $packageQueue->dequeue();
  14020. if (isset($seen[$package->getId()])) {
  14021. continue;
  14022. }
  14023. $seen[$package->getId()] = true;
  14024. $this->updateWhitelist[$package->getName()] = true;
  14025. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  14026. continue;
  14027. }
  14028. $requires = $package->getRequires();
  14029. foreach ($requires as $require) {
  14030. $requirePackages = $pool->whatProvides($require->getTarget());
  14031. foreach ($requirePackages as $requirePackage) {
  14032. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  14033. continue;
  14034. }
  14035. if (isset($skipPackages[$requirePackage->getName()])) {
  14036. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  14037. continue;
  14038. }
  14039. $packageQueue->enqueue($requirePackage);
  14040. }
  14041. }
  14042. }
  14043. }
  14044. }
  14045. private function mockLocalRepositories(RepositoryManager $rm)
  14046. {
  14047. $packages = array();
  14048. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  14049. $packages[(string) $package] = clone $package;
  14050. }
  14051. foreach ($packages as $key => $package) {
  14052. if ($package instanceof AliasPackage) {
  14053. $alias = (string) $package->getAliasOf();
  14054. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  14055. }
  14056. }
  14057. $rm->setLocalRepository(
  14058. new InstalledArrayRepository($packages)
  14059. );
  14060. }
  14061. public static function create(IOInterface $io, Composer $composer)
  14062. {
  14063. return new static(
  14064. $io,
  14065. $composer->getConfig(),
  14066. $composer->getPackage(),
  14067. $composer->getDownloadManager(),
  14068. $composer->getRepositoryManager(),
  14069. $composer->getLocker(),
  14070. $composer->getInstallationManager(),
  14071. $composer->getEventDispatcher(),
  14072. $composer->getAutoloadGenerator()
  14073. );
  14074. }
  14075. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  14076. {
  14077. $this->additionalInstalledRepository = $additionalInstalledRepository;
  14078. return $this;
  14079. }
  14080. public function setDryRun($dryRun = true)
  14081. {
  14082. $this->dryRun = (bool) $dryRun;
  14083. return $this;
  14084. }
  14085. public function isDryRun()
  14086. {
  14087. return $this->dryRun;
  14088. }
  14089. public function setPreferSource($preferSource = true)
  14090. {
  14091. $this->preferSource = (bool) $preferSource;
  14092. return $this;
  14093. }
  14094. public function setPreferDist($preferDist = true)
  14095. {
  14096. $this->preferDist = (bool) $preferDist;
  14097. return $this;
  14098. }
  14099. public function setOptimizeAutoloader($optimizeAutoloader = false)
  14100. {
  14101. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  14102. if (!$this->optimizeAutoloader) {
  14103. $this->setClassMapAuthoritative(false);
  14104. }
  14105. return $this;
  14106. }
  14107. public function setClassMapAuthoritative($classMapAuthoritative = false)
  14108. {
  14109. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  14110. if ($this->classMapAuthoritative) {
  14111. $this->setOptimizeAutoloader(true);
  14112. }
  14113. return $this;
  14114. }
  14115. public function setApcuAutoloader($apcuAutoloader = false)
  14116. {
  14117. $this->apcuAutoloader = (bool) $apcuAutoloader;
  14118. return $this;
  14119. }
  14120. public function setUpdate($update = true)
  14121. {
  14122. $this->update = (bool) $update;
  14123. return $this;
  14124. }
  14125. public function setDevMode($devMode = true)
  14126. {
  14127. $this->devMode = (bool) $devMode;
  14128. return $this;
  14129. }
  14130. public function setDumpAutoloader($dumpAutoloader = true)
  14131. {
  14132. $this->dumpAutoloader = (bool) $dumpAutoloader;
  14133. return $this;
  14134. }
  14135. public function setRunScripts($runScripts = true)
  14136. {
  14137. $this->runScripts = (bool) $runScripts;
  14138. return $this;
  14139. }
  14140. public function setConfig(Config $config)
  14141. {
  14142. $this->config = $config;
  14143. return $this;
  14144. }
  14145. public function setVerbose($verbose = true)
  14146. {
  14147. $this->verbose = (bool) $verbose;
  14148. return $this;
  14149. }
  14150. public function isVerbose()
  14151. {
  14152. return $this->verbose;
  14153. }
  14154. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  14155. {
  14156. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  14157. return $this;
  14158. }
  14159. public function setUpdateWhitelist(array $packages)
  14160. {
  14161. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  14162. return $this;
  14163. }
  14164. public function setWhitelistDependencies($updateDependencies = true)
  14165. {
  14166. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  14167. }
  14168. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  14169. {
  14170. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  14171. return $this;
  14172. }
  14173. public function setWhitelistAllDependencies($updateAllDependencies = true)
  14174. {
  14175. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  14176. return $this;
  14177. }
  14178. public function setPreferStable($preferStable = true)
  14179. {
  14180. $this->preferStable = (bool) $preferStable;
  14181. return $this;
  14182. }
  14183. public function setPreferLowest($preferLowest = true)
  14184. {
  14185. $this->preferLowest = (bool) $preferLowest;
  14186. return $this;
  14187. }
  14188. public function setWriteLock($writeLock = true)
  14189. {
  14190. $this->writeLock = (bool) $writeLock;
  14191. return $this;
  14192. }
  14193. public function setExecuteOperations($executeOperations = true)
  14194. {
  14195. $this->executeOperations = (bool) $executeOperations;
  14196. return $this;
  14197. }
  14198. public function setSkipSuggest($skipSuggest = true)
  14199. {
  14200. $this->skipSuggest = (bool) $skipSuggest;
  14201. return $this;
  14202. }
  14203. public function disablePlugins()
  14204. {
  14205. $this->installationManager->disablePlugins();
  14206. return $this;
  14207. }
  14208. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  14209. {
  14210. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  14211. return $this;
  14212. }
  14213. }
  14214. <?php
  14215. namespace Composer\Installer;
  14216. use Composer\IO\IOInterface;
  14217. use Composer\Package\PackageInterface;
  14218. use Composer\Util\Filesystem;
  14219. use Composer\Util\Platform;
  14220. use Composer\Util\ProcessExecutor;
  14221. use Composer\Util\Silencer;
  14222. class BinaryInstaller
  14223. {
  14224. protected $binDir;
  14225. protected $binCompat;
  14226. protected $io;
  14227. protected $filesystem;
  14228. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  14229. {
  14230. $this->binDir = $binDir;
  14231. $this->binCompat = $binCompat;
  14232. $this->io = $io;
  14233. $this->filesystem = $filesystem ?: new Filesystem();
  14234. }
  14235. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  14236. {
  14237. $binaries = $this->getBinaries($package);
  14238. if (!$binaries) {
  14239. return;
  14240. }
  14241. foreach ($binaries as $bin) {
  14242. $binPath = $installPath.'/'.$bin;
  14243. if (!file_exists($binPath)) {
  14244. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  14245. continue;
  14246. }
  14247. $binPath = realpath($binPath);
  14248. $this->initializeBinDir();
  14249. $link = $this->binDir.'/'.basename($bin);
  14250. if (file_exists($link)) {
  14251. if (is_link($link)) {
  14252. Silencer::call('chmod', $link, 0777 & ~umask());
  14253. }
  14254. if ($warnOnOverwrite) {
  14255. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  14256. }
  14257. continue;
  14258. }
  14259. if ($this->binCompat === "auto") {
  14260. if (Platform::isWindows()) {
  14261. $this->installFullBinaries($binPath, $link, $bin, $package);
  14262. } else {
  14263. $this->installSymlinkBinaries($binPath, $link);
  14264. }
  14265. } elseif ($this->binCompat === "full") {
  14266. $this->installFullBinaries($binPath, $link, $bin, $package);
  14267. }
  14268. Silencer::call('chmod', $link, 0777 & ~umask());
  14269. }
  14270. }
  14271. public function removeBinaries(PackageInterface $package)
  14272. {
  14273. $this->initializeBinDir();
  14274. $binaries = $this->getBinaries($package);
  14275. if (!$binaries) {
  14276. return;
  14277. }
  14278. foreach ($binaries as $bin) {
  14279. $link = $this->binDir.'/'.basename($bin);
  14280. if (is_link($link) || file_exists($link)) {
  14281. $this->filesystem->unlink($link);
  14282. }
  14283. if (file_exists($link.'.bat')) {
  14284. $this->filesystem->unlink($link.'.bat');
  14285. }
  14286. }
  14287. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  14288. Silencer::call('rmdir', $this->binDir);
  14289. }
  14290. }
  14291. public static function determineBinaryCaller($bin)
  14292. {
  14293. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  14294. return 'call';
  14295. }
  14296. $handle = fopen($bin, 'r');
  14297. $line = fgets($handle);
  14298. fclose($handle);
  14299. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14300. return trim($match[1]);
  14301. }
  14302. return 'php';
  14303. }
  14304. protected function getBinaries(PackageInterface $package)
  14305. {
  14306. return $package->getBinaries();
  14307. }
  14308. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  14309. {
  14310. if ('.bat' !== substr($binPath, -4)) {
  14311. $this->installUnixyProxyBinaries($binPath, $link);
  14312. @chmod($link, 0777 & ~umask());
  14313. $link .= '.bat';
  14314. if (file_exists($link)) {
  14315. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  14316. }
  14317. }
  14318. if (!file_exists($link)) {
  14319. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  14320. }
  14321. }
  14322. protected function installSymlinkBinaries($binPath, $link)
  14323. {
  14324. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  14325. $this->installUnixyProxyBinaries($binPath, $link);
  14326. }
  14327. }
  14328. protected function installUnixyProxyBinaries($binPath, $link)
  14329. {
  14330. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  14331. }
  14332. protected function initializeBinDir()
  14333. {
  14334. $this->filesystem->ensureDirectoryExists($this->binDir);
  14335. $this->binDir = realpath($this->binDir);
  14336. }
  14337. protected function generateWindowsProxyCode($bin, $link)
  14338. {
  14339. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14340. $caller = self::determineBinaryCaller($bin);
  14341. return "@ECHO OFF\r\n".
  14342. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  14343. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  14344. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  14345. }
  14346. protected function generateUnixyProxyCode($bin, $link)
  14347. {
  14348. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14349. $binDir = ProcessExecutor::escape(dirname($binPath));
  14350. $binFile = basename($binPath);
  14351. $proxyCode = <<<PROXY
  14352. #!/usr/bin/env sh
  14353. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  14354. if [ -d /proc/cygdrive ] && [[ \$(which php) == \$(readlink -n /proc/cygdrive)/* ]]; then
  14355. # We are in Cgywin using Windows php, so the path must be translated
  14356. dir=\$(cygpath -m "\$dir");
  14357. fi
  14358. "\${dir}/$binFile" "\$@"
  14359. PROXY;
  14360. return $proxyCode;
  14361. }
  14362. }
  14363. <?php
  14364. namespace Composer\Installer;
  14365. use Composer\Package\PackageInterface;
  14366. interface BinaryPresenceInterface
  14367. {
  14368. public function ensureBinariesPresence(PackageInterface $package);
  14369. }
  14370. <?php
  14371. namespace Composer\Installer;
  14372. use Composer\IO\IOInterface;
  14373. use Composer\Package\PackageInterface;
  14374. use Composer\Package\AliasPackage;
  14375. use Composer\Repository\RepositoryInterface;
  14376. use Composer\Repository\InstalledRepositoryInterface;
  14377. use Composer\DependencyResolver\Operation\OperationInterface;
  14378. use Composer\DependencyResolver\Operation\InstallOperation;
  14379. use Composer\DependencyResolver\Operation\UpdateOperation;
  14380. use Composer\DependencyResolver\Operation\UninstallOperation;
  14381. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  14382. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14383. use Composer\Util\StreamContextFactory;
  14384. class InstallationManager
  14385. {
  14386. private $installers = array();
  14387. private $cache = array();
  14388. private $notifiablePackages = array();
  14389. public function reset()
  14390. {
  14391. $this->notifiablePackages = array();
  14392. }
  14393. public function addInstaller(InstallerInterface $installer)
  14394. {
  14395. array_unshift($this->installers, $installer);
  14396. $this->cache = array();
  14397. }
  14398. public function removeInstaller(InstallerInterface $installer)
  14399. {
  14400. if (false !== ($key = array_search($installer, $this->installers, true))) {
  14401. array_splice($this->installers, $key, 1);
  14402. $this->cache = array();
  14403. }
  14404. }
  14405. public function disablePlugins()
  14406. {
  14407. foreach ($this->installers as $i => $installer) {
  14408. if (!$installer instanceof PluginInstaller) {
  14409. continue;
  14410. }
  14411. unset($this->installers[$i]);
  14412. }
  14413. }
  14414. public function getInstaller($type)
  14415. {
  14416. $type = strtolower($type);
  14417. if (isset($this->cache[$type])) {
  14418. return $this->cache[$type];
  14419. }
  14420. foreach ($this->installers as $installer) {
  14421. if ($installer->supports($type)) {
  14422. return $this->cache[$type] = $installer;
  14423. }
  14424. }
  14425. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  14426. }
  14427. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14428. {
  14429. if ($package instanceof AliasPackage) {
  14430. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  14431. }
  14432. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  14433. }
  14434. public function ensureBinariesPresence(PackageInterface $package)
  14435. {
  14436. try {
  14437. $installer = $this->getInstaller($package->getType());
  14438. } catch (\InvalidArgumentException $e) {
  14439. return;
  14440. }
  14441. if ($installer instanceof BinaryPresenceInterface) {
  14442. $installer->ensureBinariesPresence($package);
  14443. }
  14444. }
  14445. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  14446. {
  14447. $method = $operation->getJobType();
  14448. $this->$method($repo, $operation);
  14449. }
  14450. public function install(RepositoryInterface $repo, InstallOperation $operation)
  14451. {
  14452. $package = $operation->getPackage();
  14453. $installer = $this->getInstaller($package->getType());
  14454. $installer->install($repo, $package);
  14455. $this->markForNotification($package);
  14456. }
  14457. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  14458. {
  14459. $initial = $operation->getInitialPackage();
  14460. $target = $operation->getTargetPackage();
  14461. $initialType = $initial->getType();
  14462. $targetType = $target->getType();
  14463. if ($initialType === $targetType) {
  14464. $installer = $this->getInstaller($initialType);
  14465. $installer->update($repo, $initial, $target);
  14466. $this->markForNotification($target);
  14467. } else {
  14468. $this->getInstaller($initialType)->uninstall($repo, $initial);
  14469. $this->getInstaller($targetType)->install($repo, $target);
  14470. }
  14471. }
  14472. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  14473. {
  14474. $package = $operation->getPackage();
  14475. $installer = $this->getInstaller($package->getType());
  14476. $installer->uninstall($repo, $package);
  14477. }
  14478. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  14479. {
  14480. $package = $operation->getPackage();
  14481. if (!$repo->hasPackage($package)) {
  14482. $repo->addPackage(clone $package);
  14483. }
  14484. }
  14485. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  14486. {
  14487. $package = $operation->getPackage();
  14488. $repo->removePackage($package);
  14489. }
  14490. public function getInstallPath(PackageInterface $package)
  14491. {
  14492. $installer = $this->getInstaller($package->getType());
  14493. return $installer->getInstallPath($package);
  14494. }
  14495. public function notifyInstalls(IOInterface $io)
  14496. {
  14497. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  14498. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  14499. if ($io->hasAuthentication($repositoryName)) {
  14500. $auth = $io->getAuthentication($repositoryName);
  14501. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  14502. $authHeader = 'Authorization: Basic '.$authStr;
  14503. }
  14504. if (strpos($repoUrl, '%package%')) {
  14505. foreach ($packages as $package) {
  14506. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  14507. $params = array(
  14508. 'version' => $package->getPrettyVersion(),
  14509. 'version_normalized' => $package->getVersion(),
  14510. );
  14511. $opts = array('http' =>
  14512. array(
  14513. 'method' => 'POST',
  14514. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  14515. 'content' => http_build_query($params, '', '&'),
  14516. 'timeout' => 3,
  14517. ),
  14518. );
  14519. if (isset($authHeader)) {
  14520. $opts['http']['header'][] = $authHeader;
  14521. }
  14522. $context = StreamContextFactory::getContext($url, $opts);
  14523. @file_get_contents($url, false, $context);
  14524. }
  14525. continue;
  14526. }
  14527. $postData = array('downloads' => array());
  14528. foreach ($packages as $package) {
  14529. $postData['downloads'][] = array(
  14530. 'name' => $package->getPrettyName(),
  14531. 'version' => $package->getVersion(),
  14532. );
  14533. }
  14534. $opts = array('http' =>
  14535. array(
  14536. 'method' => 'POST',
  14537. 'header' => array('Content-Type: application/json'),
  14538. 'content' => json_encode($postData),
  14539. 'timeout' => 6,
  14540. ),
  14541. );
  14542. if (isset($authHeader)) {
  14543. $opts['http']['header'][] = $authHeader;
  14544. }
  14545. $context = StreamContextFactory::getContext($repoUrl, $opts);
  14546. @file_get_contents($repoUrl, false, $context);
  14547. }
  14548. $this->reset();
  14549. }
  14550. private function markForNotification(PackageInterface $package)
  14551. {
  14552. if ($package->getNotificationUrl()) {
  14553. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  14554. }
  14555. }
  14556. }
  14557. <?php
  14558. namespace Composer\Installer;
  14559. use Composer\Composer;
  14560. use Composer\DependencyResolver\PolicyInterface;
  14561. use Composer\DependencyResolver\Operation\OperationInterface;
  14562. use Composer\DependencyResolver\Pool;
  14563. use Composer\DependencyResolver\Request;
  14564. use Composer\EventDispatcher\Event;
  14565. use Composer\IO\IOInterface;
  14566. use Composer\Repository\CompositeRepository;
  14567. class InstallerEvent extends Event
  14568. {
  14569. private $composer;
  14570. private $io;
  14571. private $devMode;
  14572. private $policy;
  14573. private $pool;
  14574. private $installedRepo;
  14575. private $request;
  14576. private $operations;
  14577. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  14578. {
  14579. parent::__construct($eventName);
  14580. $this->composer = $composer;
  14581. $this->io = $io;
  14582. $this->devMode = $devMode;
  14583. $this->policy = $policy;
  14584. $this->pool = $pool;
  14585. $this->installedRepo = $installedRepo;
  14586. $this->request = $request;
  14587. $this->operations = $operations;
  14588. }
  14589. public function getComposer()
  14590. {
  14591. return $this->composer;
  14592. }
  14593. public function getIO()
  14594. {
  14595. return $this->io;
  14596. }
  14597. public function isDevMode()
  14598. {
  14599. return $this->devMode;
  14600. }
  14601. public function getPolicy()
  14602. {
  14603. return $this->policy;
  14604. }
  14605. public function getPool()
  14606. {
  14607. return $this->pool;
  14608. }
  14609. public function getInstalledRepo()
  14610. {
  14611. return $this->installedRepo;
  14612. }
  14613. public function getRequest()
  14614. {
  14615. return $this->request;
  14616. }
  14617. public function getOperations()
  14618. {
  14619. return $this->operations;
  14620. }
  14621. }
  14622. <?php
  14623. namespace Composer\Installer;
  14624. class InstallerEvents
  14625. {
  14626. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  14627. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  14628. }
  14629. <?php
  14630. namespace Composer\Installer;
  14631. use Composer\Package\PackageInterface;
  14632. use Composer\Repository\InstalledRepositoryInterface;
  14633. use InvalidArgumentException;
  14634. interface InstallerInterface
  14635. {
  14636. public function supports($packageType);
  14637. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  14638. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  14639. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  14640. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  14641. public function getInstallPath(PackageInterface $package);
  14642. }
  14643. <?php
  14644. namespace Composer\Installer;
  14645. use Composer\Composer;
  14646. use Composer\IO\IOInterface;
  14647. use Composer\Repository\InstalledRepositoryInterface;
  14648. use Composer\Package\PackageInterface;
  14649. use Composer\Util\Filesystem;
  14650. use Composer\Util\Silencer;
  14651. use Composer\Util\Platform;
  14652. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  14653. {
  14654. protected $composer;
  14655. protected $vendorDir;
  14656. protected $binDir;
  14657. protected $downloadManager;
  14658. protected $io;
  14659. protected $type;
  14660. protected $filesystem;
  14661. protected $binCompat;
  14662. protected $binaryInstaller;
  14663. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  14664. {
  14665. $this->composer = $composer;
  14666. $this->downloadManager = $composer->getDownloadManager();
  14667. $this->io = $io;
  14668. $this->type = $type;
  14669. $this->filesystem = $filesystem ?: new Filesystem();
  14670. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  14671. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  14672. }
  14673. public function supports($packageType)
  14674. {
  14675. return $packageType === $this->type || null === $this->type;
  14676. }
  14677. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14678. {
  14679. if (!$repo->hasPackage($package)) {
  14680. return false;
  14681. }
  14682. $installPath = $this->getInstallPath($package);
  14683. if (is_readable($installPath)) {
  14684. return true;
  14685. }
  14686. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  14687. }
  14688. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14689. {
  14690. $this->initializeVendorDir();
  14691. $downloadPath = $this->getInstallPath($package);
  14692. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  14693. $this->binaryInstaller->removeBinaries($package);
  14694. }
  14695. $this->installCode($package);
  14696. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  14697. if (!$repo->hasPackage($package)) {
  14698. $repo->addPackage(clone $package);
  14699. }
  14700. }
  14701. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14702. {
  14703. if (!$repo->hasPackage($initial)) {
  14704. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14705. }
  14706. $this->initializeVendorDir();
  14707. $this->binaryInstaller->removeBinaries($initial);
  14708. $this->updateCode($initial, $target);
  14709. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  14710. $repo->removePackage($initial);
  14711. if (!$repo->hasPackage($target)) {
  14712. $repo->addPackage(clone $target);
  14713. }
  14714. }
  14715. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14716. {
  14717. if (!$repo->hasPackage($package)) {
  14718. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14719. }
  14720. $this->removeCode($package);
  14721. $this->binaryInstaller->removeBinaries($package);
  14722. $repo->removePackage($package);
  14723. $downloadPath = $this->getPackageBasePath($package);
  14724. if (strpos($package->getName(), '/')) {
  14725. $packageVendorDir = dirname($downloadPath);
  14726. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  14727. Silencer::call('rmdir', $packageVendorDir);
  14728. }
  14729. }
  14730. }
  14731. public function getInstallPath(PackageInterface $package)
  14732. {
  14733. $this->initializeVendorDir();
  14734. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  14735. $targetDir = $package->getTargetDir();
  14736. return $basePath . ($targetDir ? '/'.$targetDir : '');
  14737. }
  14738. public function ensureBinariesPresence(PackageInterface $package)
  14739. {
  14740. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  14741. }
  14742. protected function getPackageBasePath(PackageInterface $package)
  14743. {
  14744. $installPath = $this->getInstallPath($package);
  14745. $targetDir = $package->getTargetDir();
  14746. if ($targetDir) {
  14747. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  14748. }
  14749. return $installPath;
  14750. }
  14751. protected function installCode(PackageInterface $package)
  14752. {
  14753. $downloadPath = $this->getInstallPath($package);
  14754. $this->downloadManager->download($package, $downloadPath);
  14755. }
  14756. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  14757. {
  14758. $initialDownloadPath = $this->getInstallPath($initial);
  14759. $targetDownloadPath = $this->getInstallPath($target);
  14760. if ($targetDownloadPath !== $initialDownloadPath) {
  14761. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  14762. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  14763. ) {
  14764. $this->removeCode($initial);
  14765. $this->installCode($target);
  14766. return;
  14767. }
  14768. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  14769. }
  14770. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  14771. }
  14772. protected function removeCode(PackageInterface $package)
  14773. {
  14774. $downloadPath = $this->getPackageBasePath($package);
  14775. $this->downloadManager->remove($package, $downloadPath);
  14776. }
  14777. protected function initializeVendorDir()
  14778. {
  14779. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  14780. $this->vendorDir = realpath($this->vendorDir);
  14781. }
  14782. }
  14783. <?php
  14784. namespace Composer\Installer;
  14785. use Composer\Repository\InstalledRepositoryInterface;
  14786. use Composer\Package\PackageInterface;
  14787. class MetapackageInstaller implements InstallerInterface
  14788. {
  14789. public function supports($packageType)
  14790. {
  14791. return $packageType === 'metapackage';
  14792. }
  14793. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14794. {
  14795. return $repo->hasPackage($package);
  14796. }
  14797. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14798. {
  14799. $repo->addPackage(clone $package);
  14800. }
  14801. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14802. {
  14803. if (!$repo->hasPackage($initial)) {
  14804. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14805. }
  14806. $repo->removePackage($initial);
  14807. $repo->addPackage(clone $target);
  14808. }
  14809. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14810. {
  14811. if (!$repo->hasPackage($package)) {
  14812. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14813. }
  14814. $repo->removePackage($package);
  14815. }
  14816. public function getInstallPath(PackageInterface $package)
  14817. {
  14818. return '';
  14819. }
  14820. }
  14821. <?php
  14822. namespace Composer\Installer;
  14823. use Composer\Repository\InstalledRepositoryInterface;
  14824. use Composer\Package\PackageInterface;
  14825. class NoopInstaller implements InstallerInterface
  14826. {
  14827. public function supports($packageType)
  14828. {
  14829. return true;
  14830. }
  14831. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14832. {
  14833. return $repo->hasPackage($package);
  14834. }
  14835. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14836. {
  14837. if (!$repo->hasPackage($package)) {
  14838. $repo->addPackage(clone $package);
  14839. }
  14840. }
  14841. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14842. {
  14843. if (!$repo->hasPackage($initial)) {
  14844. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14845. }
  14846. $repo->removePackage($initial);
  14847. if (!$repo->hasPackage($target)) {
  14848. $repo->addPackage(clone $target);
  14849. }
  14850. }
  14851. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14852. {
  14853. if (!$repo->hasPackage($package)) {
  14854. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14855. }
  14856. $repo->removePackage($package);
  14857. }
  14858. public function getInstallPath(PackageInterface $package)
  14859. {
  14860. $targetDir = $package->getTargetDir();
  14861. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  14862. }
  14863. }
  14864. <?php
  14865. namespace Composer\Installer;
  14866. use Composer\Composer;
  14867. use Composer\IO\IOInterface;
  14868. use Composer\DependencyResolver\Operation\OperationInterface;
  14869. use Composer\DependencyResolver\PolicyInterface;
  14870. use Composer\DependencyResolver\Pool;
  14871. use Composer\DependencyResolver\Request;
  14872. use Composer\Repository\CompositeRepository;
  14873. class PackageEvent extends InstallerEvent
  14874. {
  14875. private $operation;
  14876. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  14877. {
  14878. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  14879. $this->operation = $operation;
  14880. }
  14881. public function getOperation()
  14882. {
  14883. return $this->operation;
  14884. }
  14885. }
  14886. <?php
  14887. namespace Composer\Installer;
  14888. class PackageEvents
  14889. {
  14890. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  14891. const POST_PACKAGE_INSTALL = 'post-package-install';
  14892. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  14893. const POST_PACKAGE_UPDATE = 'post-package-update';
  14894. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  14895. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  14896. }
  14897. <?php
  14898. namespace Composer\Installer;
  14899. use Composer\IO\IOInterface;
  14900. use Composer\Package\PackageInterface;
  14901. use Composer\Util\Filesystem;
  14902. use Composer\Util\ProcessExecutor;
  14903. class PearBinaryInstaller extends BinaryInstaller
  14904. {
  14905. private $installer;
  14906. private $vendorDir;
  14907. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  14908. {
  14909. parent::__construct($io, $binDir, $binCompat, $filesystem);
  14910. $this->installer = $installer;
  14911. $this->vendorDir = $vendorDir;
  14912. }
  14913. protected function getBinaries(PackageInterface $package)
  14914. {
  14915. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  14916. $binaries = array();
  14917. if (file_exists($binariesPath)) {
  14918. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  14919. if (!$value->isDir()) {
  14920. $binaries[] = 'bin/'.$fileName;
  14921. }
  14922. }
  14923. }
  14924. return $binaries;
  14925. }
  14926. protected function initializeBinDir()
  14927. {
  14928. parent::initializeBinDir();
  14929. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  14930. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  14931. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  14932. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  14933. }
  14934. protected function generateWindowsProxyCode($bin, $link)
  14935. {
  14936. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14937. if ('.bat' === substr($bin, -4)) {
  14938. $caller = 'call';
  14939. } else {
  14940. $handle = fopen($bin, 'r');
  14941. $line = fgets($handle);
  14942. fclose($handle);
  14943. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14944. $caller = trim($match[1]);
  14945. } else {
  14946. $caller = 'php';
  14947. }
  14948. if ($caller === 'php') {
  14949. return "@echo off\r\n".
  14950. "pushd .\r\n".
  14951. "cd %~dp0\r\n".
  14952. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  14953. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  14954. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  14955. "popd\r\n".
  14956. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  14957. }
  14958. }
  14959. return "@echo off\r\n".
  14960. "pushd .\r\n".
  14961. "cd %~dp0\r\n".
  14962. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  14963. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  14964. "popd\r\n".
  14965. $caller." \"%BIN_TARGET%\" %*\r\n";
  14966. }
  14967. private function generateWindowsPhpProxyCode()
  14968. {
  14969. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  14970. return
  14971. "@echo off\r\n" .
  14972. "setlocal enabledelayedexpansion\r\n" .
  14973. "set BIN_DIR=%~dp0\r\n" .
  14974. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  14975. "set DIRS=.\r\n" .
  14976. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  14977. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  14978. " set DIRS=!DIRS!;%%~fP\r\n" .
  14979. " )\r\n" .
  14980. ")\r\n" .
  14981. "php.exe -d include_path=!DIRS! %*\r\n";
  14982. }
  14983. private function generateUnixyPhpProxyCode()
  14984. {
  14985. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  14986. return
  14987. "#!/usr/bin/env sh\n".
  14988. "SRC_DIR=`pwd`\n".
  14989. "BIN_DIR=`dirname $0`\n".
  14990. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  14991. "DIRS=\"\"\n".
  14992. "for vendor in \$VENDOR_DIR/*; do\n".
  14993. " if [ -d \"\$vendor\" ]; then\n".
  14994. " for package in \$vendor/*; do\n".
  14995. " if [ -d \"\$package\" ]; then\n".
  14996. " DIRS=\"\${DIRS}:\${package}\"\n".
  14997. " fi\n".
  14998. " done\n".
  14999. " fi\n".
  15000. "done\n".
  15001. "php -d include_path=\".\$DIRS\" $@\n";
  15002. }
  15003. }
  15004. <?php
  15005. namespace Composer\Installer;
  15006. use Composer\IO\IOInterface;
  15007. use Composer\Composer;
  15008. use Composer\Downloader\PearPackageExtractor;
  15009. use Composer\Repository\InstalledRepositoryInterface;
  15010. use Composer\Package\PackageInterface;
  15011. use Composer\Util\Platform;
  15012. use Composer\Util\Filesystem;
  15013. class PearInstaller extends LibraryInstaller
  15014. {
  15015. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  15016. {
  15017. $filesystem = new Filesystem();
  15018. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  15019. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  15020. }
  15021. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15022. {
  15023. $this->uninstall($repo, $initial);
  15024. $this->install($repo, $target);
  15025. }
  15026. protected function installCode(PackageInterface $package)
  15027. {
  15028. parent::installCode($package);
  15029. $isWindows = Platform::isWindows();
  15030. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  15031. if (!$isWindows) {
  15032. $php_bin = '/usr/bin/env ' . $php_bin;
  15033. }
  15034. $installPath = $this->getInstallPath($package);
  15035. $vars = array(
  15036. 'os' => $isWindows ? 'windows' : 'linux',
  15037. 'php_bin' => $php_bin,
  15038. 'pear_php' => $installPath,
  15039. 'php_dir' => $installPath,
  15040. 'bin_dir' => $installPath . '/bin',
  15041. 'data_dir' => $installPath . '/data',
  15042. 'version' => $package->getPrettyVersion(),
  15043. );
  15044. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  15045. $pearExtractor = new PearPackageExtractor($packageArchive);
  15046. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  15047. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  15048. $this->filesystem->unlink($packageArchive);
  15049. }
  15050. }
  15051. <?php
  15052. namespace Composer\Installer;
  15053. use Composer\Composer;
  15054. use Composer\IO\IOInterface;
  15055. use Composer\Repository\InstalledRepositoryInterface;
  15056. use Composer\Package\PackageInterface;
  15057. class PluginInstaller extends LibraryInstaller
  15058. {
  15059. private $installationManager;
  15060. public function __construct(IOInterface $io, Composer $composer)
  15061. {
  15062. parent::__construct($io, $composer, 'composer-plugin');
  15063. $this->installationManager = $composer->getInstallationManager();
  15064. }
  15065. public function supports($packageType)
  15066. {
  15067. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  15068. }
  15069. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15070. {
  15071. $extra = $package->getExtra();
  15072. if (empty($extra['class'])) {
  15073. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15074. }
  15075. parent::install($repo, $package);
  15076. try {
  15077. $this->composer->getPluginManager()->registerPackage($package, true);
  15078. } catch (\Exception $e) {
  15079. $this->io->writeError('Plugin installation failed, rolling back');
  15080. parent::uninstall($repo, $package);
  15081. throw $e;
  15082. }
  15083. }
  15084. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15085. {
  15086. $extra = $target->getExtra();
  15087. if (empty($extra['class'])) {
  15088. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15089. }
  15090. parent::update($repo, $initial, $target);
  15091. $this->composer->getPluginManager()->registerPackage($target, true);
  15092. }
  15093. }
  15094. <?php
  15095. namespace Composer\Installer;
  15096. use Composer\Package\PackageInterface;
  15097. use Composer\Downloader\DownloadManager;
  15098. use Composer\Repository\InstalledRepositoryInterface;
  15099. use Composer\Util\Filesystem;
  15100. class ProjectInstaller implements InstallerInterface
  15101. {
  15102. private $installPath;
  15103. private $downloadManager;
  15104. private $filesystem;
  15105. public function __construct($installPath, DownloadManager $dm)
  15106. {
  15107. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  15108. $this->downloadManager = $dm;
  15109. $this->filesystem = new Filesystem;
  15110. }
  15111. public function supports($packageType)
  15112. {
  15113. return true;
  15114. }
  15115. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15116. {
  15117. return false;
  15118. }
  15119. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15120. {
  15121. $installPath = $this->installPath;
  15122. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  15123. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  15124. }
  15125. if (!is_dir($installPath)) {
  15126. mkdir($installPath, 0777, true);
  15127. }
  15128. $this->downloadManager->download($package, $installPath);
  15129. }
  15130. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15131. {
  15132. throw new \InvalidArgumentException("not supported");
  15133. }
  15134. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15135. {
  15136. throw new \InvalidArgumentException("not supported");
  15137. }
  15138. public function getInstallPath(PackageInterface $package)
  15139. {
  15140. return $this->installPath;
  15141. }
  15142. }
  15143. <?php
  15144. namespace Composer\Installer;
  15145. use Composer\IO\IOInterface;
  15146. use Composer\Package\PackageInterface;
  15147. use Composer\Repository\RepositoryInterface;
  15148. use Symfony\Component\Console\Formatter\OutputFormatter;
  15149. class SuggestedPackagesReporter
  15150. {
  15151. protected $suggestedPackages = array();
  15152. private $io;
  15153. public function __construct(IOInterface $io)
  15154. {
  15155. $this->io = $io;
  15156. }
  15157. public function getPackages()
  15158. {
  15159. return $this->suggestedPackages;
  15160. }
  15161. public function addPackage($source, $target, $reason)
  15162. {
  15163. $this->suggestedPackages[] = array(
  15164. 'source' => $source,
  15165. 'target' => $target,
  15166. 'reason' => $reason,
  15167. );
  15168. return $this;
  15169. }
  15170. public function addSuggestionsFromPackage(PackageInterface $package)
  15171. {
  15172. $source = $package->getPrettyName();
  15173. foreach ($package->getSuggests() as $target => $reason) {
  15174. $this->addPackage(
  15175. $source,
  15176. $target,
  15177. $reason
  15178. );
  15179. }
  15180. return $this;
  15181. }
  15182. public function output(RepositoryInterface $installedRepo = null)
  15183. {
  15184. $suggestedPackages = $this->getPackages();
  15185. $installedPackages = array();
  15186. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  15187. foreach ($installedRepo->getPackages() as $package) {
  15188. $installedPackages = array_merge(
  15189. $installedPackages,
  15190. $package->getNames()
  15191. );
  15192. }
  15193. }
  15194. foreach ($suggestedPackages as $suggestion) {
  15195. if (in_array($suggestion['target'], $installedPackages)) {
  15196. continue;
  15197. }
  15198. $this->io->writeError(sprintf(
  15199. '%s suggests installing %s%s',
  15200. $suggestion['source'],
  15201. $this->escapeOutput($suggestion['target']),
  15202. $this->escapeOutput('' !== $suggestion['reason'] ? ' ('.$suggestion['reason'].')' : '')
  15203. ));
  15204. }
  15205. return $this;
  15206. }
  15207. private function escapeOutput($string)
  15208. {
  15209. return OutputFormatter::escape(
  15210. $this->removeControlCharacters($string)
  15211. );
  15212. }
  15213. private function removeControlCharacters($string)
  15214. {
  15215. return preg_replace(
  15216. '/[[:cntrl:]]/',
  15217. '',
  15218. str_replace("\n", ' ', $string)
  15219. );
  15220. }
  15221. }
  15222. <?php
  15223. namespace Composer\Json;
  15224. use JsonSchema\Validator;
  15225. use Seld\JsonLint\JsonParser;
  15226. use Seld\JsonLint\ParsingException;
  15227. use Composer\Util\RemoteFilesystem;
  15228. use Composer\IO\IOInterface;
  15229. use Composer\Downloader\TransportException;
  15230. class JsonFile
  15231. {
  15232. const LAX_SCHEMA = 1;
  15233. const STRICT_SCHEMA = 2;
  15234. const JSON_UNESCAPED_SLASHES = 64;
  15235. const JSON_PRETTY_PRINT = 128;
  15236. const JSON_UNESCAPED_UNICODE = 256;
  15237. private $path;
  15238. private $rfs;
  15239. private $io;
  15240. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  15241. {
  15242. $this->path = $path;
  15243. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  15244. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  15245. }
  15246. $this->rfs = $rfs;
  15247. $this->io = $io;
  15248. }
  15249. public function getPath()
  15250. {
  15251. return $this->path;
  15252. }
  15253. public function exists()
  15254. {
  15255. return is_file($this->path);
  15256. }
  15257. public function read()
  15258. {
  15259. try {
  15260. if ($this->rfs) {
  15261. $json = $this->rfs->getContents($this->path, $this->path, false);
  15262. } else {
  15263. if ($this->io && $this->io->isDebug()) {
  15264. $this->io->writeError('Reading ' . $this->path);
  15265. }
  15266. $json = file_get_contents($this->path);
  15267. }
  15268. } catch (TransportException $e) {
  15269. throw new \RuntimeException($e->getMessage(), 0, $e);
  15270. } catch (\Exception $e) {
  15271. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  15272. }
  15273. return static::parseJson($json, $this->path);
  15274. }
  15275. public function write(array $hash, $options = 448)
  15276. {
  15277. $dir = dirname($this->path);
  15278. if (!is_dir($dir)) {
  15279. if (file_exists($dir)) {
  15280. throw new \UnexpectedValueException(
  15281. $dir.' exists and is not a directory.'
  15282. );
  15283. }
  15284. if (!@mkdir($dir, 0777, true)) {
  15285. throw new \UnexpectedValueException(
  15286. $dir.' does not exist and could not be created.'
  15287. );
  15288. }
  15289. }
  15290. $retries = 3;
  15291. while ($retries--) {
  15292. try {
  15293. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  15294. break;
  15295. } catch (\Exception $e) {
  15296. if ($retries) {
  15297. usleep(500000);
  15298. continue;
  15299. }
  15300. throw $e;
  15301. }
  15302. }
  15303. }
  15304. public function validateSchema($schema = self::STRICT_SCHEMA)
  15305. {
  15306. $content = file_get_contents($this->path);
  15307. $data = json_decode($content);
  15308. if (null === $data && 'null' !== $content) {
  15309. self::validateSyntax($content, $this->path);
  15310. }
  15311. $schemaFile = __DIR__ . '/../../../res/composer-schema.json';
  15312. if (false === strpos($schemaFile, '://')) {
  15313. $schemaFile = 'file://' . $schemaFile;
  15314. }
  15315. $schemaData = (object) array('$ref' => $schemaFile);
  15316. if ($schema === self::LAX_SCHEMA) {
  15317. $schemaData->additionalProperties = true;
  15318. $schemaData->required = array();
  15319. }
  15320. $validator = new Validator();
  15321. $validator->check($data, $schemaData);
  15322. if (!$validator->isValid()) {
  15323. $errors = array();
  15324. foreach ((array) $validator->getErrors() as $error) {
  15325. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  15326. }
  15327. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  15328. }
  15329. return true;
  15330. }
  15331. public static function encode($data, $options = 448)
  15332. {
  15333. if (PHP_VERSION_ID >= 50400) {
  15334. $json = json_encode($data, $options);
  15335. if (false === $json) {
  15336. self::throwEncodeError(json_last_error());
  15337. }
  15338. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  15339. $json = preg_replace('/\[\s+\]/', '[]', $json);
  15340. $json = preg_replace('/\{\s+\}/', '{}', $json);
  15341. }
  15342. return $json;
  15343. }
  15344. $json = json_encode($data);
  15345. if (false === $json) {
  15346. self::throwEncodeError(json_last_error());
  15347. }
  15348. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  15349. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  15350. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  15351. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  15352. return $json;
  15353. }
  15354. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  15355. }
  15356. private static function throwEncodeError($code)
  15357. {
  15358. switch ($code) {
  15359. case JSON_ERROR_DEPTH:
  15360. $msg = 'Maximum stack depth exceeded';
  15361. break;
  15362. case JSON_ERROR_STATE_MISMATCH:
  15363. $msg = 'Underflow or the modes mismatch';
  15364. break;
  15365. case JSON_ERROR_CTRL_CHAR:
  15366. $msg = 'Unexpected control character found';
  15367. break;
  15368. case JSON_ERROR_UTF8:
  15369. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  15370. break;
  15371. default:
  15372. $msg = 'Unknown error';
  15373. }
  15374. throw new \RuntimeException('JSON encoding failed: '.$msg);
  15375. }
  15376. public static function parseJson($json, $file = null)
  15377. {
  15378. if (null === $json) {
  15379. return;
  15380. }
  15381. $data = json_decode($json, true);
  15382. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  15383. self::validateSyntax($json, $file);
  15384. }
  15385. return $data;
  15386. }
  15387. protected static function validateSyntax($json, $file = null)
  15388. {
  15389. $parser = new JsonParser();
  15390. $result = $parser->lint($json);
  15391. if (null === $result) {
  15392. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  15393. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  15394. }
  15395. return true;
  15396. }
  15397. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  15398. }
  15399. }
  15400. <?php
  15401. namespace Composer\Json;
  15402. class JsonFormatter
  15403. {
  15404. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  15405. {
  15406. $result = '';
  15407. $pos = 0;
  15408. $strLen = strlen($json);
  15409. $indentStr = ' ';
  15410. $newLine = "\n";
  15411. $outOfQuotes = true;
  15412. $buffer = '';
  15413. $noescape = true;
  15414. for ($i = 0; $i < $strLen; $i++) {
  15415. $char = substr($json, $i, 1);
  15416. if ('"' === $char && $noescape) {
  15417. $outOfQuotes = !$outOfQuotes;
  15418. }
  15419. if (!$outOfQuotes) {
  15420. $buffer .= $char;
  15421. $noescape = '\\' === $char ? !$noescape : true;
  15422. continue;
  15423. } elseif ('' !== $buffer) {
  15424. if ($unescapeSlashes) {
  15425. $buffer = str_replace('\\/', '/', $buffer);
  15426. }
  15427. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  15428. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  15429. $l = strlen($match[1]);
  15430. if ($l % 2) {
  15431. $code = hexdec($match[2]);
  15432. if (0xD800 <= $code && 0xDFFF >= $code) {
  15433. return $match[0];
  15434. }
  15435. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  15436. pack('H*', $match[2]),
  15437. 'UTF-8',
  15438. 'UCS-2BE'
  15439. );
  15440. }
  15441. return $match[0];
  15442. }, $buffer);
  15443. }
  15444. $result .= $buffer.$char;
  15445. $buffer = '';
  15446. continue;
  15447. }
  15448. if (':' === $char) {
  15449. $char .= ' ';
  15450. } elseif ('}' === $char || ']' === $char) {
  15451. $pos--;
  15452. $prevChar = substr($json, $i - 1, 1);
  15453. if ('{' !== $prevChar && '[' !== $prevChar) {
  15454. $result .= $newLine;
  15455. for ($j = 0; $j < $pos; $j++) {
  15456. $result .= $indentStr;
  15457. }
  15458. } else {
  15459. $result = rtrim($result);
  15460. }
  15461. }
  15462. $result .= $char;
  15463. if (',' === $char || '{' === $char || '[' === $char) {
  15464. $result .= $newLine;
  15465. if ('{' === $char || '[' === $char) {
  15466. $pos++;
  15467. }
  15468. for ($j = 0; $j < $pos; $j++) {
  15469. $result .= $indentStr;
  15470. }
  15471. }
  15472. }
  15473. return $result;
  15474. }
  15475. }
  15476. <?php
  15477. namespace Composer\Json;
  15478. use Composer\Repository\PlatformRepository;
  15479. class JsonManipulator
  15480. {
  15481. private static $DEFINES = '(?(DEFINE)
  15482. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  15483. (?<boolean> true | false | null )
  15484. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " )
  15485. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  15486. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  15487. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  15488. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  15489. )';
  15490. private $contents;
  15491. private $newline;
  15492. private $indent;
  15493. public function __construct($contents)
  15494. {
  15495. $contents = trim($contents);
  15496. if ($contents === '') {
  15497. $contents = '{}';
  15498. }
  15499. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  15500. throw new \InvalidArgumentException('The json file must be an object ({})');
  15501. }
  15502. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  15503. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  15504. $this->detectIndenting();
  15505. }
  15506. public function getContents()
  15507. {
  15508. return $this->contents . $this->newline;
  15509. }
  15510. public function addLink($type, $package, $constraint, $sortPackages = false)
  15511. {
  15512. $decoded = JsonFile::parseJson($this->contents);
  15513. if (!isset($decoded[$type])) {
  15514. return $this->addMainKey($type, array($package => $constraint));
  15515. }
  15516. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15517. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  15518. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  15519. return false;
  15520. }
  15521. $links = $matches['value'];
  15522. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  15523. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  15524. if ($this->pregMatch($regex, $links, $packageMatches)) {
  15525. $existingPackage = $packageMatches['package'];
  15526. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  15527. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  15528. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  15529. }, $links);
  15530. } else {
  15531. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  15532. $links = preg_replace(
  15533. '{'.preg_quote($match[1]).'$}',
  15534. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  15535. $links
  15536. );
  15537. } else {
  15538. $links = '{' . $this->newline .
  15539. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  15540. $this->indent . '}';
  15541. }
  15542. }
  15543. if (true === $sortPackages) {
  15544. $requirements = json_decode($links, true);
  15545. $this->sortPackages($requirements);
  15546. $links = $this->format($requirements);
  15547. }
  15548. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  15549. return true;
  15550. }
  15551. private function sortPackages(array &$packages = array())
  15552. {
  15553. $prefix = function ($requirement) {
  15554. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  15555. return preg_replace(
  15556. array(
  15557. '/^php/',
  15558. '/^hhvm/',
  15559. '/^ext/',
  15560. '/^lib/',
  15561. '/^\D/',
  15562. ),
  15563. array(
  15564. '0-$0',
  15565. '1-$0',
  15566. '2-$0',
  15567. '3-$0',
  15568. '4-$0',
  15569. ),
  15570. $requirement
  15571. );
  15572. }
  15573. return '5-'.$requirement;
  15574. };
  15575. uksort($packages, function ($a, $b) use ($prefix) {
  15576. return strnatcmp($prefix($a), $prefix($b));
  15577. });
  15578. }
  15579. public function addRepository($name, $config)
  15580. {
  15581. return $this->addSubNode('repositories', $name, $config);
  15582. }
  15583. public function removeRepository($name)
  15584. {
  15585. return $this->removeSubNode('repositories', $name);
  15586. }
  15587. public function addConfigSetting($name, $value)
  15588. {
  15589. return $this->addSubNode('config', $name, $value);
  15590. }
  15591. public function removeConfigSetting($name)
  15592. {
  15593. return $this->removeSubNode('config', $name);
  15594. }
  15595. public function addProperty($name, $value)
  15596. {
  15597. if (substr($name, 0, 6) === 'extra.') {
  15598. return $this->addSubNode('extra', substr($name, 6), $value);
  15599. }
  15600. if (substr($name, 0, 8) === 'scripts.') {
  15601. return $this->addSubNode('scripts', substr($name, 8), $value);
  15602. }
  15603. return $this->addMainKey($name, $value);
  15604. }
  15605. public function removeProperty($name)
  15606. {
  15607. if (substr($name, 0, 6) === 'extra.') {
  15608. return $this->removeSubNode('extra', substr($name, 6));
  15609. }
  15610. if (substr($name, 0, 8) === 'scripts.') {
  15611. return $this->removeSubNode('scripts', substr($name, 8));
  15612. }
  15613. return $this->removeMainKey($name);
  15614. }
  15615. public function addSubNode($mainNode, $name, $value)
  15616. {
  15617. $decoded = JsonFile::parseJson($this->contents);
  15618. $subName = null;
  15619. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  15620. list($name, $subName) = explode('.', $name, 2);
  15621. }
  15622. if (!isset($decoded[$mainNode])) {
  15623. if ($subName !== null) {
  15624. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  15625. } else {
  15626. $this->addMainKey($mainNode, array($name => $value));
  15627. }
  15628. return true;
  15629. }
  15630. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15631. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15632. try {
  15633. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15634. return false;
  15635. }
  15636. } catch (\RuntimeException $e) {
  15637. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15638. return false;
  15639. }
  15640. throw $e;
  15641. }
  15642. $children = $match['content'];
  15643. if (!@json_decode($children)) {
  15644. return false;
  15645. }
  15646. $that = $this;
  15647. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  15648. if ($this->pregMatch($childRegex, $children, $matches)) {
  15649. $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
  15650. if ($subName !== null) {
  15651. $curVal = json_decode($matches['content'], true);
  15652. if (!is_array($curVal)) {
  15653. $curVal = array();
  15654. }
  15655. $curVal[$subName] = $value;
  15656. $value = $curVal;
  15657. }
  15658. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  15659. }, $children);
  15660. } else {
  15661. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  15662. $whitespace = '';
  15663. if (!empty($match['trailingspace'])) {
  15664. $whitespace = $match['trailingspace'];
  15665. }
  15666. if (!empty($match['content'])) {
  15667. if ($subName !== null) {
  15668. $value = array($subName => $value);
  15669. }
  15670. $children = preg_replace(
  15671. '#'.$whitespace.'}$#',
  15672. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  15673. $children
  15674. );
  15675. } else {
  15676. if ($subName !== null) {
  15677. $value = array($subName => $value);
  15678. }
  15679. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  15680. }
  15681. }
  15682. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  15683. return $m['start'] . $children . $m['end'];
  15684. }, $this->contents);
  15685. return true;
  15686. }
  15687. public function removeSubNode($mainNode, $name)
  15688. {
  15689. $decoded = JsonFile::parseJson($this->contents);
  15690. if (empty($decoded[$mainNode])) {
  15691. return true;
  15692. }
  15693. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15694. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15695. try {
  15696. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15697. return false;
  15698. }
  15699. } catch (\RuntimeException $e) {
  15700. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15701. return false;
  15702. }
  15703. throw $e;
  15704. }
  15705. $children = $match['content'];
  15706. if (!@json_decode($children, true)) {
  15707. return false;
  15708. }
  15709. $subName = null;
  15710. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  15711. list($name, $subName) = explode('.', $name, 2);
  15712. }
  15713. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  15714. return true;
  15715. }
  15716. if ($this->pregMatch('{"'.preg_quote($name).'"\s*:}i', $children)) {
  15717. if (preg_match_all('{'.self::$DEFINES.'"'.preg_quote($name).'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  15718. $bestMatch = '';
  15719. foreach ($matches[0] as $match) {
  15720. if (strlen($bestMatch) < strlen($match)) {
  15721. $bestMatch = $match;
  15722. }
  15723. }
  15724. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  15725. if (1 !== $count) {
  15726. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  15727. if (1 !== $count) {
  15728. return false;
  15729. }
  15730. }
  15731. }
  15732. } else {
  15733. $childrenClean = $children;
  15734. }
  15735. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  15736. if (empty($match['content'])) {
  15737. $newline = $this->newline;
  15738. $indent = $this->indent;
  15739. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  15740. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  15741. }, $this->contents);
  15742. if ($subName !== null) {
  15743. $curVal = json_decode($children, true);
  15744. unset($curVal[$name][$subName]);
  15745. $this->addSubNode($mainNode, $name, $curVal[$name]);
  15746. }
  15747. return true;
  15748. }
  15749. $that = $this;
  15750. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  15751. if ($subName !== null) {
  15752. $curVal = json_decode($matches['content'], true);
  15753. unset($curVal[$name][$subName]);
  15754. $childrenClean = $that->format($curVal, 0);
  15755. }
  15756. return $matches['start'] . $childrenClean . $matches['end'];
  15757. }, $this->contents);
  15758. return true;
  15759. }
  15760. public function addMainKey($key, $content)
  15761. {
  15762. $decoded = JsonFile::parseJson($this->contents);
  15763. $content = $this->format($content);
  15764. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15765. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  15766. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  15767. if (!@json_decode('{'.$matches['key'].'}')) {
  15768. return false;
  15769. }
  15770. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  15771. return true;
  15772. }
  15773. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  15774. $this->contents = preg_replace(
  15775. '#'.$match[1].'\}$#',
  15776. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  15777. $this->contents
  15778. );
  15779. return true;
  15780. }
  15781. $this->contents = preg_replace(
  15782. '#\}$#',
  15783. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  15784. $this->contents
  15785. );
  15786. return true;
  15787. }
  15788. public function removeMainKey($key)
  15789. {
  15790. $decoded = JsonFile::parseJson($this->contents);
  15791. if (!array_key_exists($key, $decoded)) {
  15792. return true;
  15793. }
  15794. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15795. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  15796. if ($this->pregMatch($regex, $this->contents, $matches)) {
  15797. if (!@json_decode('{'.$matches['removal'].'}')) {
  15798. return false;
  15799. }
  15800. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  15801. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  15802. }
  15803. $this->contents = $matches['start'] . $matches['end'];
  15804. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  15805. $this->contents = "{\n}";
  15806. }
  15807. return true;
  15808. }
  15809. return false;
  15810. }
  15811. public function format($data, $depth = 0)
  15812. {
  15813. if (is_array($data)) {
  15814. reset($data);
  15815. if (is_numeric(key($data))) {
  15816. foreach ($data as $key => $val) {
  15817. $data[$key] = $this->format($val, $depth + 1);
  15818. }
  15819. return '['.implode(', ', $data).']';
  15820. }
  15821. $out = '{' . $this->newline;
  15822. $elems = array();
  15823. foreach ($data as $key => $val) {
  15824. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  15825. }
  15826. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  15827. }
  15828. return JsonFile::encode($data);
  15829. }
  15830. protected function detectIndenting()
  15831. {
  15832. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  15833. $this->indent = $match[1];
  15834. } else {
  15835. $this->indent = ' ';
  15836. }
  15837. }
  15838. protected function pregMatch($re, $str, &$matches = array())
  15839. {
  15840. $count = preg_match($re, $str, $matches);
  15841. if ($count === false) {
  15842. switch (preg_last_error()) {
  15843. case PREG_NO_ERROR:
  15844. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  15845. case PREG_INTERNAL_ERROR:
  15846. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  15847. case PREG_BACKTRACK_LIMIT_ERROR:
  15848. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  15849. case PREG_RECURSION_LIMIT_ERROR:
  15850. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  15851. case PREG_BAD_UTF8_ERROR:
  15852. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  15853. case PREG_BAD_UTF8_OFFSET_ERROR:
  15854. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  15855. case 6:
  15856. if (PHP_VERSION_ID > 70000) {
  15857. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  15858. }
  15859. default:
  15860. throw new \RuntimeException('Failed to execute regex: Unknown error');
  15861. }
  15862. }
  15863. return $count;
  15864. }
  15865. }
  15866. <?php
  15867. namespace Composer\Json;
  15868. use Exception;
  15869. class JsonValidationException extends Exception
  15870. {
  15871. protected $errors;
  15872. public function __construct($message, $errors = array(), Exception $previous = null)
  15873. {
  15874. $this->errors = $errors;
  15875. parent::__construct($message, 0, $previous);
  15876. }
  15877. public function getErrors()
  15878. {
  15879. return $this->errors;
  15880. }
  15881. }
  15882. <?php
  15883. namespace Composer\Package;
  15884. use Composer\Semver\Constraint\Constraint;
  15885. use Composer\Package\Version\VersionParser;
  15886. class AliasPackage extends BasePackage implements CompletePackageInterface
  15887. {
  15888. protected $version;
  15889. protected $prettyVersion;
  15890. protected $dev;
  15891. protected $rootPackageAlias = false;
  15892. protected $stability;
  15893. protected $aliasOf;
  15894. protected $requires;
  15895. protected $devRequires;
  15896. protected $conflicts;
  15897. protected $provides;
  15898. protected $replaces;
  15899. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  15900. {
  15901. parent::__construct($aliasOf->getName());
  15902. $this->version = $version;
  15903. $this->prettyVersion = $prettyVersion;
  15904. $this->aliasOf = $aliasOf;
  15905. $this->stability = VersionParser::parseStability($version);
  15906. $this->dev = $this->stability === 'dev';
  15907. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  15908. $links = $aliasOf->{'get' . ucfirst($type)}();
  15909. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  15910. }
  15911. }
  15912. public function getAliasOf()
  15913. {
  15914. return $this->aliasOf;
  15915. }
  15916. public function getVersion()
  15917. {
  15918. return $this->version;
  15919. }
  15920. public function getStability()
  15921. {
  15922. return $this->stability;
  15923. }
  15924. public function getPrettyVersion()
  15925. {
  15926. return $this->prettyVersion;
  15927. }
  15928. public function isDev()
  15929. {
  15930. return $this->dev;
  15931. }
  15932. public function getRequires()
  15933. {
  15934. return $this->requires;
  15935. }
  15936. public function getConflicts()
  15937. {
  15938. return $this->conflicts;
  15939. }
  15940. public function getProvides()
  15941. {
  15942. return $this->provides;
  15943. }
  15944. public function getReplaces()
  15945. {
  15946. return $this->replaces;
  15947. }
  15948. public function getDevRequires()
  15949. {
  15950. return $this->devRequires;
  15951. }
  15952. public function setRootPackageAlias($value)
  15953. {
  15954. return $this->rootPackageAlias = $value;
  15955. }
  15956. public function isRootPackageAlias()
  15957. {
  15958. return $this->rootPackageAlias;
  15959. }
  15960. protected function replaceSelfVersionDependencies(array $links, $linkType)
  15961. {
  15962. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  15963. $newLinks = array();
  15964. foreach ($links as $link) {
  15965. if ('self.version' === $link->getPrettyConstraint()) {
  15966. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  15967. }
  15968. }
  15969. $links = array_merge($links, $newLinks);
  15970. } else {
  15971. foreach ($links as $index => $link) {
  15972. if ('self.version' === $link->getPrettyConstraint()) {
  15973. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  15974. }
  15975. }
  15976. }
  15977. return $links;
  15978. }
  15979. public function getType()
  15980. {
  15981. return $this->aliasOf->getType();
  15982. }
  15983. public function getTargetDir()
  15984. {
  15985. return $this->aliasOf->getTargetDir();
  15986. }
  15987. public function getExtra()
  15988. {
  15989. return $this->aliasOf->getExtra();
  15990. }
  15991. public function setInstallationSource($type)
  15992. {
  15993. $this->aliasOf->setInstallationSource($type);
  15994. }
  15995. public function getInstallationSource()
  15996. {
  15997. return $this->aliasOf->getInstallationSource();
  15998. }
  15999. public function getSourceType()
  16000. {
  16001. return $this->aliasOf->getSourceType();
  16002. }
  16003. public function getSourceUrl()
  16004. {
  16005. return $this->aliasOf->getSourceUrl();
  16006. }
  16007. public function getSourceUrls()
  16008. {
  16009. return $this->aliasOf->getSourceUrls();
  16010. }
  16011. public function getSourceReference()
  16012. {
  16013. return $this->aliasOf->getSourceReference();
  16014. }
  16015. public function setSourceReference($reference)
  16016. {
  16017. return $this->aliasOf->setSourceReference($reference);
  16018. }
  16019. public function setSourceMirrors($mirrors)
  16020. {
  16021. return $this->aliasOf->setSourceMirrors($mirrors);
  16022. }
  16023. public function getSourceMirrors()
  16024. {
  16025. return $this->aliasOf->getSourceMirrors();
  16026. }
  16027. public function getDistType()
  16028. {
  16029. return $this->aliasOf->getDistType();
  16030. }
  16031. public function getDistUrl()
  16032. {
  16033. return $this->aliasOf->getDistUrl();
  16034. }
  16035. public function getDistUrls()
  16036. {
  16037. return $this->aliasOf->getDistUrls();
  16038. }
  16039. public function getDistReference()
  16040. {
  16041. return $this->aliasOf->getDistReference();
  16042. }
  16043. public function setDistReference($reference)
  16044. {
  16045. return $this->aliasOf->setDistReference($reference);
  16046. }
  16047. public function getDistSha1Checksum()
  16048. {
  16049. return $this->aliasOf->getDistSha1Checksum();
  16050. }
  16051. public function setTransportOptions(array $options)
  16052. {
  16053. return $this->aliasOf->setTransportOptions($options);
  16054. }
  16055. public function getTransportOptions()
  16056. {
  16057. return $this->aliasOf->getTransportOptions();
  16058. }
  16059. public function setDistMirrors($mirrors)
  16060. {
  16061. return $this->aliasOf->setDistMirrors($mirrors);
  16062. }
  16063. public function getDistMirrors()
  16064. {
  16065. return $this->aliasOf->getDistMirrors();
  16066. }
  16067. public function getScripts()
  16068. {
  16069. return $this->aliasOf->getScripts();
  16070. }
  16071. public function getLicense()
  16072. {
  16073. return $this->aliasOf->getLicense();
  16074. }
  16075. public function getAutoload()
  16076. {
  16077. return $this->aliasOf->getAutoload();
  16078. }
  16079. public function getDevAutoload()
  16080. {
  16081. return $this->aliasOf->getDevAutoload();
  16082. }
  16083. public function getIncludePaths()
  16084. {
  16085. return $this->aliasOf->getIncludePaths();
  16086. }
  16087. public function getRepositories()
  16088. {
  16089. return $this->aliasOf->getRepositories();
  16090. }
  16091. public function getReleaseDate()
  16092. {
  16093. return $this->aliasOf->getReleaseDate();
  16094. }
  16095. public function getBinaries()
  16096. {
  16097. return $this->aliasOf->getBinaries();
  16098. }
  16099. public function getKeywords()
  16100. {
  16101. return $this->aliasOf->getKeywords();
  16102. }
  16103. public function getDescription()
  16104. {
  16105. return $this->aliasOf->getDescription();
  16106. }
  16107. public function getHomepage()
  16108. {
  16109. return $this->aliasOf->getHomepage();
  16110. }
  16111. public function getSuggests()
  16112. {
  16113. return $this->aliasOf->getSuggests();
  16114. }
  16115. public function getAuthors()
  16116. {
  16117. return $this->aliasOf->getAuthors();
  16118. }
  16119. public function getSupport()
  16120. {
  16121. return $this->aliasOf->getSupport();
  16122. }
  16123. public function getNotificationUrl()
  16124. {
  16125. return $this->aliasOf->getNotificationUrl();
  16126. }
  16127. public function getArchiveExcludes()
  16128. {
  16129. return $this->aliasOf->getArchiveExcludes();
  16130. }
  16131. public function isAbandoned()
  16132. {
  16133. return $this->aliasOf->isAbandoned();
  16134. }
  16135. public function getReplacementPackage()
  16136. {
  16137. return $this->aliasOf->getReplacementPackage();
  16138. }
  16139. public function __toString()
  16140. {
  16141. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  16142. }
  16143. }
  16144. <?php
  16145. namespace Composer\Package\Archiver;
  16146. use FilterIterator;
  16147. use PharData;
  16148. class ArchivableFilesFilter extends FilterIterator
  16149. {
  16150. private $dirs = array();
  16151. public function accept()
  16152. {
  16153. $file = $this->getInnerIterator()->current();
  16154. if ($file->isDir()) {
  16155. $this->dirs[] = (string) $file;
  16156. return false;
  16157. }
  16158. return true;
  16159. }
  16160. public function addEmptyDir(PharData $phar, $sources)
  16161. {
  16162. foreach ($this->dirs as $filepath) {
  16163. $localname = str_replace($sources . "/", '', $filepath);
  16164. $phar->addEmptyDir($localname);
  16165. }
  16166. }
  16167. }
  16168. <?php
  16169. namespace Composer\Package\Archiver;
  16170. use Composer\Util\Filesystem;
  16171. use FilesystemIterator;
  16172. use Symfony\Component\Finder\Finder;
  16173. use Symfony\Component\Finder\SplFileInfo;
  16174. class ArchivableFilesFinder extends \FilterIterator
  16175. {
  16176. protected $finder;
  16177. public function __construct($sources, array $excludes, $ignoreFilters = false)
  16178. {
  16179. $fs = new Filesystem();
  16180. $sources = $fs->normalizePath($sources);
  16181. if ($ignoreFilters) {
  16182. $filters = array();
  16183. } else {
  16184. $filters = array(
  16185. new HgExcludeFilter($sources),
  16186. new GitExcludeFilter($sources),
  16187. new ComposerExcludeFilter($sources, $excludes),
  16188. );
  16189. }
  16190. $this->finder = new Finder();
  16191. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  16192. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  16193. return false;
  16194. }
  16195. $relativePath = preg_replace(
  16196. '#^'.preg_quote($sources, '#').'#',
  16197. '',
  16198. $fs->normalizePath($file->getRealPath())
  16199. );
  16200. $exclude = false;
  16201. foreach ($filters as $filter) {
  16202. $exclude = $filter->filter($relativePath, $exclude);
  16203. }
  16204. return !$exclude;
  16205. };
  16206. if (method_exists($filter, 'bindTo')) {
  16207. $filter = $filter->bindTo(null);
  16208. }
  16209. $this->finder
  16210. ->in($sources)
  16211. ->filter($filter)
  16212. ->ignoreVCS(true)
  16213. ->ignoreDotFiles(false);
  16214. parent::__construct($this->finder->getIterator());
  16215. }
  16216. public function accept()
  16217. {
  16218. $current = $this->getInnerIterator()->current();
  16219. if (!$current->isDir()) {
  16220. return true;
  16221. }
  16222. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  16223. return !$iterator->valid();
  16224. }
  16225. }
  16226. <?php
  16227. namespace Composer\Package\Archiver;
  16228. use Composer\Downloader\DownloadManager;
  16229. use Composer\Package\PackageInterface;
  16230. use Composer\Package\RootPackageInterface;
  16231. use Composer\Util\Filesystem;
  16232. use Composer\Json\JsonFile;
  16233. class ArchiveManager
  16234. {
  16235. protected $downloadManager;
  16236. protected $archivers = array();
  16237. protected $overwriteFiles = true;
  16238. public function __construct(DownloadManager $downloadManager)
  16239. {
  16240. $this->downloadManager = $downloadManager;
  16241. }
  16242. public function addArchiver(ArchiverInterface $archiver)
  16243. {
  16244. $this->archivers[] = $archiver;
  16245. }
  16246. public function setOverwriteFiles($overwriteFiles)
  16247. {
  16248. $this->overwriteFiles = $overwriteFiles;
  16249. return $this;
  16250. }
  16251. public function getPackageFilename(PackageInterface $package)
  16252. {
  16253. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  16254. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  16255. array_push($nameParts, $package->getDistReference(), $package->getDistType());
  16256. } else {
  16257. array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
  16258. }
  16259. if ($package->getSourceReference()) {
  16260. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  16261. }
  16262. $name = implode('-', array_filter($nameParts, function ($p) {
  16263. return !empty($p);
  16264. }));
  16265. return str_replace('/', '-', $name);
  16266. }
  16267. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  16268. {
  16269. if (empty($format)) {
  16270. throw new \InvalidArgumentException('Format must be specified');
  16271. }
  16272. $usableArchiver = null;
  16273. foreach ($this->archivers as $archiver) {
  16274. if ($archiver->supports($format, $package->getSourceType())) {
  16275. $usableArchiver = $archiver;
  16276. break;
  16277. }
  16278. }
  16279. if (null === $usableArchiver) {
  16280. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  16281. }
  16282. $filesystem = new Filesystem();
  16283. if (null === $fileName) {
  16284. $packageName = $this->getPackageFilename($package);
  16285. } else {
  16286. $packageName = $fileName;
  16287. }
  16288. $filesystem->ensureDirectoryExists($targetDir);
  16289. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  16290. $filesystem->ensureDirectoryExists(dirname($target));
  16291. if (!$this->overwriteFiles && file_exists($target)) {
  16292. return $target;
  16293. }
  16294. if ($package instanceof RootPackageInterface) {
  16295. $sourcePath = realpath('.');
  16296. } else {
  16297. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  16298. $filesystem->ensureDirectoryExists($sourcePath);
  16299. $this->downloadManager->download($package, $sourcePath);
  16300. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  16301. $jsonFile = new JsonFile($composerJsonPath);
  16302. $jsonData = $jsonFile->read();
  16303. if (!empty($jsonData['archive']['exclude'])) {
  16304. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  16305. }
  16306. }
  16307. }
  16308. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  16309. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  16310. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  16311. $filesystem->rename($archivePath, $target);
  16312. if (!$package instanceof RootPackageInterface) {
  16313. $filesystem->removeDirectory($sourcePath);
  16314. }
  16315. $filesystem->remove($tempTarget);
  16316. return $target;
  16317. }
  16318. }
  16319. <?php
  16320. namespace Composer\Package\Archiver;
  16321. interface ArchiverInterface
  16322. {
  16323. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  16324. public function supports($format, $sourceType);
  16325. }
  16326. <?php
  16327. namespace Composer\Package\Archiver;
  16328. use Symfony\Component\Finder;
  16329. abstract class BaseExcludeFilter
  16330. {
  16331. protected $sourcePath;
  16332. protected $excludePatterns;
  16333. public function __construct($sourcePath)
  16334. {
  16335. $this->sourcePath = $sourcePath;
  16336. $this->excludePatterns = array();
  16337. }
  16338. public function filter($relativePath, $exclude)
  16339. {
  16340. foreach ($this->excludePatterns as $patternData) {
  16341. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  16342. if ($stripLeadingSlash) {
  16343. $path = substr($relativePath, 1);
  16344. } else {
  16345. $path = $relativePath;
  16346. }
  16347. if (preg_match($pattern, $path)) {
  16348. $exclude = !$negate;
  16349. }
  16350. }
  16351. return $exclude;
  16352. }
  16353. protected function parseLines(array $lines, $lineParser)
  16354. {
  16355. return array_filter(
  16356. array_map(
  16357. function ($line) use ($lineParser) {
  16358. $line = trim($line);
  16359. if (!$line || 0 === strpos($line, '#')) {
  16360. return null;
  16361. }
  16362. return call_user_func($lineParser, $line);
  16363. },
  16364. $lines
  16365. ),
  16366. function ($pattern) {
  16367. return $pattern !== null;
  16368. }
  16369. );
  16370. }
  16371. protected function generatePatterns($rules)
  16372. {
  16373. $patterns = array();
  16374. foreach ($rules as $rule) {
  16375. $patterns[] = $this->generatePattern($rule);
  16376. }
  16377. return $patterns;
  16378. }
  16379. protected function generatePattern($rule)
  16380. {
  16381. $negate = false;
  16382. $pattern = '{';
  16383. if (strlen($rule) && $rule[0] === '!') {
  16384. $negate = true;
  16385. $rule = substr($rule, 1);
  16386. }
  16387. if (strlen($rule) && $rule[0] === '/') {
  16388. $pattern .= '^/';
  16389. $rule = substr($rule, 1);
  16390. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  16391. $pattern .= '/';
  16392. $rule = substr($rule, 0, -1);
  16393. } elseif (false === strpos($rule, '/')) {
  16394. $pattern .= '/';
  16395. }
  16396. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  16397. return array($pattern . '}', $negate, false);
  16398. }
  16399. }
  16400. <?php
  16401. namespace Composer\Package\Archiver;
  16402. class ComposerExcludeFilter extends BaseExcludeFilter
  16403. {
  16404. public function __construct($sourcePath, array $excludeRules)
  16405. {
  16406. parent::__construct($sourcePath);
  16407. $this->excludePatterns = $this->generatePatterns($excludeRules);
  16408. }
  16409. }
  16410. <?php
  16411. namespace Composer\Package\Archiver;
  16412. class GitExcludeFilter extends BaseExcludeFilter
  16413. {
  16414. public function __construct($sourcePath)
  16415. {
  16416. parent::__construct($sourcePath);
  16417. if (file_exists($sourcePath.'/.gitignore')) {
  16418. $this->excludePatterns = $this->parseLines(
  16419. file($sourcePath.'/.gitignore'),
  16420. array($this, 'parseGitIgnoreLine')
  16421. );
  16422. }
  16423. if (file_exists($sourcePath.'/.gitattributes')) {
  16424. $this->excludePatterns = array_merge(
  16425. $this->excludePatterns,
  16426. $this->parseLines(
  16427. file($sourcePath.'/.gitattributes'),
  16428. array($this, 'parseGitAttributesLine')
  16429. )
  16430. );
  16431. }
  16432. }
  16433. public function parseGitIgnoreLine($line)
  16434. {
  16435. return $this->generatePattern($line);
  16436. }
  16437. public function parseGitAttributesLine($line)
  16438. {
  16439. $parts = preg_split('#\s+#', $line);
  16440. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  16441. return $this->generatePattern($parts[0]);
  16442. }
  16443. return null;
  16444. }
  16445. }
  16446. <?php
  16447. namespace Composer\Package\Archiver;
  16448. use Symfony\Component\Finder;
  16449. class HgExcludeFilter extends BaseExcludeFilter
  16450. {
  16451. const HG_IGNORE_REGEX = 1;
  16452. const HG_IGNORE_GLOB = 2;
  16453. protected $patternMode;
  16454. public function __construct($sourcePath)
  16455. {
  16456. parent::__construct($sourcePath);
  16457. $this->patternMode = self::HG_IGNORE_REGEX;
  16458. if (file_exists($sourcePath.'/.hgignore')) {
  16459. $this->excludePatterns = $this->parseLines(
  16460. file($sourcePath.'/.hgignore'),
  16461. array($this, 'parseHgIgnoreLine')
  16462. );
  16463. }
  16464. }
  16465. public function parseHgIgnoreLine($line)
  16466. {
  16467. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  16468. if ($matches[1] === 'glob') {
  16469. $this->patternMode = self::HG_IGNORE_GLOB;
  16470. } else {
  16471. $this->patternMode = self::HG_IGNORE_REGEX;
  16472. }
  16473. return null;
  16474. }
  16475. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  16476. return $this->patternFromGlob($line);
  16477. }
  16478. return $this->patternFromRegex($line);
  16479. }
  16480. protected function patternFromGlob($line)
  16481. {
  16482. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  16483. $pattern = str_replace('[^/]*', '.*', $pattern);
  16484. return array($pattern, false, true);
  16485. }
  16486. public function patternFromRegex($line)
  16487. {
  16488. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  16489. return array($pattern, false, true);
  16490. }
  16491. }
  16492. <?php
  16493. namespace Composer\Package\Archiver;
  16494. class PharArchiver implements ArchiverInterface
  16495. {
  16496. protected static $formats = array(
  16497. 'zip' => \Phar::ZIP,
  16498. 'tar' => \Phar::TAR,
  16499. 'tar.gz' => \Phar::TAR,
  16500. 'tar.bz2' => \Phar::TAR,
  16501. );
  16502. protected static $compressFormats = array(
  16503. 'tar.gz' => \Phar::GZ,
  16504. 'tar.bz2' => \Phar::BZ2,
  16505. );
  16506. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16507. {
  16508. $sources = realpath($sources);
  16509. if (file_exists($target)) {
  16510. unlink($target);
  16511. }
  16512. try {
  16513. $filename = substr($target, 0, strrpos($target, $format) - 1);
  16514. if (isset(static::$compressFormats[$format])) {
  16515. $target = $filename . '.tar';
  16516. }
  16517. $phar = new \PharData($target, null, null, static::$formats[$format]);
  16518. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16519. $filesOnly = new ArchivableFilesFilter($files);
  16520. $phar->buildFromIterator($filesOnly, $sources);
  16521. $filesOnly->addEmptyDir($phar, $sources);
  16522. if (isset(static::$compressFormats[$format])) {
  16523. if (!$phar->canCompress(static::$compressFormats[$format])) {
  16524. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  16525. }
  16526. unlink($target);
  16527. $phar->compress(static::$compressFormats[$format]);
  16528. $target = $filename . '.' . $format;
  16529. }
  16530. return $target;
  16531. } catch (\UnexpectedValueException $e) {
  16532. $message = sprintf(
  16533. "Could not create archive '%s' from '%s': %s",
  16534. $target,
  16535. $sources,
  16536. $e->getMessage()
  16537. );
  16538. throw new \RuntimeException($message, $e->getCode(), $e);
  16539. }
  16540. }
  16541. public function supports($format, $sourceType)
  16542. {
  16543. return isset(static::$formats[$format]);
  16544. }
  16545. }
  16546. <?php
  16547. namespace Composer\Package\Archiver;
  16548. use ZipArchive;
  16549. use Composer\Util\Filesystem;
  16550. class ZipArchiver implements ArchiverInterface
  16551. {
  16552. protected static $formats = array(
  16553. 'zip' => 1,
  16554. );
  16555. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16556. {
  16557. $fs = new Filesystem();
  16558. $sources = $fs->normalizePath($sources);
  16559. $zip = new ZipArchive();
  16560. $res = $zip->open($target, ZipArchive::CREATE);
  16561. if ($res === true) {
  16562. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16563. foreach ($files as $file) {
  16564. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  16565. $localname = str_replace($sources.'/', '', $filepath);
  16566. if ($file->isDir()) {
  16567. $zip->addEmptyDir($localname);
  16568. } else {
  16569. $zip->addFile($filepath, $localname);
  16570. }
  16571. }
  16572. if ($zip->close()) {
  16573. return $target;
  16574. }
  16575. }
  16576. $message = sprintf(
  16577. "Could not create archive '%s' from '%s': %s",
  16578. $target,
  16579. $sources,
  16580. $zip->getStatusString()
  16581. );
  16582. throw new \RuntimeException($message);
  16583. }
  16584. public function supports($format, $sourceType)
  16585. {
  16586. return isset(static::$formats[$format]) && $this->compressionAvailable();
  16587. }
  16588. private function compressionAvailable()
  16589. {
  16590. return class_exists('ZipArchive');
  16591. }
  16592. }
  16593. <?php
  16594. namespace Composer\Package;
  16595. use Composer\Repository\RepositoryInterface;
  16596. use Composer\Repository\PlatformRepository;
  16597. abstract class BasePackage implements PackageInterface
  16598. {
  16599. public static $supportedLinkTypes = array(
  16600. 'require' => array('description' => 'requires', 'method' => 'requires'),
  16601. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  16602. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  16603. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  16604. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  16605. );
  16606. const STABILITY_STABLE = 0;
  16607. const STABILITY_RC = 5;
  16608. const STABILITY_BETA = 10;
  16609. const STABILITY_ALPHA = 15;
  16610. const STABILITY_DEV = 20;
  16611. public static $stabilities = array(
  16612. 'stable' => self::STABILITY_STABLE,
  16613. 'RC' => self::STABILITY_RC,
  16614. 'beta' => self::STABILITY_BETA,
  16615. 'alpha' => self::STABILITY_ALPHA,
  16616. 'dev' => self::STABILITY_DEV,
  16617. );
  16618. public $id;
  16619. protected $name;
  16620. protected $prettyName;
  16621. protected $repository;
  16622. protected $transportOptions = array();
  16623. public function __construct($name)
  16624. {
  16625. $this->prettyName = $name;
  16626. $this->name = strtolower($name);
  16627. $this->id = -1;
  16628. }
  16629. public function getName()
  16630. {
  16631. return $this->name;
  16632. }
  16633. public function getPrettyName()
  16634. {
  16635. return $this->prettyName;
  16636. }
  16637. public function getNames()
  16638. {
  16639. $names = array(
  16640. $this->getName() => true,
  16641. );
  16642. foreach ($this->getProvides() as $link) {
  16643. $names[$link->getTarget()] = true;
  16644. }
  16645. foreach ($this->getReplaces() as $link) {
  16646. $names[$link->getTarget()] = true;
  16647. }
  16648. return array_keys($names);
  16649. }
  16650. public function setId($id)
  16651. {
  16652. $this->id = $id;
  16653. }
  16654. public function getId()
  16655. {
  16656. return $this->id;
  16657. }
  16658. public function setRepository(RepositoryInterface $repository)
  16659. {
  16660. if ($this->repository && $repository !== $this->repository) {
  16661. throw new \LogicException('A package can only be added to one repository');
  16662. }
  16663. $this->repository = $repository;
  16664. }
  16665. public function getRepository()
  16666. {
  16667. return $this->repository;
  16668. }
  16669. public function getTransportOptions()
  16670. {
  16671. return $this->transportOptions;
  16672. }
  16673. public function setTransportOptions(array $options)
  16674. {
  16675. $this->transportOptions = $options;
  16676. }
  16677. public function isPlatform()
  16678. {
  16679. return $this->getRepository() instanceof PlatformRepository;
  16680. }
  16681. public function getUniqueName()
  16682. {
  16683. return $this->getName().'-'.$this->getVersion();
  16684. }
  16685. public function equals(PackageInterface $package)
  16686. {
  16687. $self = $this;
  16688. if ($this instanceof AliasPackage) {
  16689. $self = $this->getAliasOf();
  16690. }
  16691. if ($package instanceof AliasPackage) {
  16692. $package = $package->getAliasOf();
  16693. }
  16694. return $package === $self;
  16695. }
  16696. public function __toString()
  16697. {
  16698. return $this->getUniqueName();
  16699. }
  16700. public function getPrettyString()
  16701. {
  16702. return $this->getPrettyName().' '.$this->getPrettyVersion();
  16703. }
  16704. public function getFullPrettyVersion($truncate = true)
  16705. {
  16706. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  16707. return $this->getPrettyVersion();
  16708. }
  16709. if ($truncate && strlen($this->getSourceReference()) === 40) {
  16710. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  16711. }
  16712. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  16713. }
  16714. public function getStabilityPriority()
  16715. {
  16716. return self::$stabilities[$this->getStability()];
  16717. }
  16718. public function __clone()
  16719. {
  16720. $this->repository = null;
  16721. $this->id = -1;
  16722. }
  16723. }
  16724. <?php
  16725. namespace Composer\Package\Comparer;
  16726. class Comparer
  16727. {
  16728. private $source;
  16729. private $update;
  16730. private $changed;
  16731. public function setSource($source)
  16732. {
  16733. $this->source = $source;
  16734. }
  16735. public function setUpdate($update)
  16736. {
  16737. $this->update = $update;
  16738. }
  16739. public function getChanged($toString = false, $explicated = false)
  16740. {
  16741. $changed = $this->changed;
  16742. if (!count($changed)) {
  16743. return false;
  16744. }
  16745. if ($explicated) {
  16746. foreach ($changed as $sectionKey => $itemSection) {
  16747. foreach ($itemSection as $itemKey => $item) {
  16748. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  16749. }
  16750. }
  16751. }
  16752. if ($toString) {
  16753. foreach ($changed as $sectionKey => $itemSection) {
  16754. foreach ($itemSection as $itemKey => $item) {
  16755. $changed['string'][] = $item."\r\n";
  16756. }
  16757. }
  16758. $changed = implode("\r\n", $changed['string']);
  16759. }
  16760. return $changed;
  16761. }
  16762. public function doCompare()
  16763. {
  16764. $source = array();
  16765. $destination = array();
  16766. $this->changed = array();
  16767. $currentDirectory = getcwd();
  16768. chdir($this->source);
  16769. $source = $this->doTree('.', $source);
  16770. if (!is_array($source)) {
  16771. return;
  16772. }
  16773. chdir($this->update);
  16774. $destination = $this->doTree('.', $destination);
  16775. if (!is_array($destination)) {
  16776. exit;
  16777. }
  16778. chdir($currentDirectory);
  16779. foreach ($source as $dir => $value) {
  16780. foreach ($value as $file => $hash) {
  16781. if (isset($destination[$dir][$file])) {
  16782. if ($hash !== $destination[$dir][$file]) {
  16783. $this->changed['changed'][] = $dir.'/'.$file;
  16784. }
  16785. } else {
  16786. $this->changed['removed'][] = $dir.'/'.$file;
  16787. }
  16788. }
  16789. }
  16790. foreach ($destination as $dir => $value) {
  16791. foreach ($value as $file => $hash) {
  16792. if (!isset($source[$dir][$file])) {
  16793. $this->changed['added'][] = $dir.'/'.$file;
  16794. }
  16795. }
  16796. }
  16797. }
  16798. private function doTree($dir, &$array)
  16799. {
  16800. if ($dh = opendir($dir)) {
  16801. while ($file = readdir($dh)) {
  16802. if ($file !== '.' && $file !== '..') {
  16803. if (is_dir($dir.'/'.$file)) {
  16804. if (!count($array)) {
  16805. $array[0] = 'Temp';
  16806. }
  16807. if (!$this->doTree($dir.'/'.$file, $array)) {
  16808. return false;
  16809. }
  16810. } else {
  16811. if (filesize($dir.'/'.$file)) {
  16812. set_time_limit(30);
  16813. $array[$dir][$file] = md5_file($dir.'/'.$file);
  16814. }
  16815. }
  16816. }
  16817. }
  16818. if (count($array) > 1 && isset($array['0'])) {
  16819. unset($array['0']);
  16820. }
  16821. return $array;
  16822. }
  16823. return false;
  16824. }
  16825. }
  16826. <?php
  16827. namespace Composer\Package;
  16828. class CompletePackage extends Package implements CompletePackageInterface
  16829. {
  16830. protected $repositories;
  16831. protected $license = array();
  16832. protected $keywords;
  16833. protected $authors;
  16834. protected $description;
  16835. protected $homepage;
  16836. protected $scripts = array();
  16837. protected $support = array();
  16838. protected $abandoned = false;
  16839. public function setScripts(array $scripts)
  16840. {
  16841. $this->scripts = $scripts;
  16842. }
  16843. public function getScripts()
  16844. {
  16845. return $this->scripts;
  16846. }
  16847. public function setRepositories($repositories)
  16848. {
  16849. $this->repositories = $repositories;
  16850. }
  16851. public function getRepositories()
  16852. {
  16853. return $this->repositories;
  16854. }
  16855. public function setLicense(array $license)
  16856. {
  16857. $this->license = $license;
  16858. }
  16859. public function getLicense()
  16860. {
  16861. return $this->license;
  16862. }
  16863. public function setKeywords(array $keywords)
  16864. {
  16865. $this->keywords = $keywords;
  16866. }
  16867. public function getKeywords()
  16868. {
  16869. return $this->keywords;
  16870. }
  16871. public function setAuthors(array $authors)
  16872. {
  16873. $this->authors = $authors;
  16874. }
  16875. public function getAuthors()
  16876. {
  16877. return $this->authors;
  16878. }
  16879. public function setDescription($description)
  16880. {
  16881. $this->description = $description;
  16882. }
  16883. public function getDescription()
  16884. {
  16885. return $this->description;
  16886. }
  16887. public function setHomepage($homepage)
  16888. {
  16889. $this->homepage = $homepage;
  16890. }
  16891. public function getHomepage()
  16892. {
  16893. return $this->homepage;
  16894. }
  16895. public function setSupport(array $support)
  16896. {
  16897. $this->support = $support;
  16898. }
  16899. public function getSupport()
  16900. {
  16901. return $this->support;
  16902. }
  16903. public function isAbandoned()
  16904. {
  16905. return (bool) $this->abandoned;
  16906. }
  16907. public function setAbandoned($abandoned)
  16908. {
  16909. $this->abandoned = $abandoned;
  16910. }
  16911. public function getReplacementPackage()
  16912. {
  16913. return is_string($this->abandoned) ? $this->abandoned : null;
  16914. }
  16915. }
  16916. <?php
  16917. namespace Composer\Package;
  16918. interface CompletePackageInterface extends PackageInterface
  16919. {
  16920. public function getScripts();
  16921. public function getRepositories();
  16922. public function getLicense();
  16923. public function getKeywords();
  16924. public function getDescription();
  16925. public function getHomepage();
  16926. public function getAuthors();
  16927. public function getSupport();
  16928. public function isAbandoned();
  16929. public function getReplacementPackage();
  16930. }
  16931. <?php
  16932. namespace Composer\Package\Dumper;
  16933. use Composer\Package\BasePackage;
  16934. use Composer\Package\PackageInterface;
  16935. use Composer\Package\CompletePackageInterface;
  16936. use Composer\Package\RootPackageInterface;
  16937. class ArrayDumper
  16938. {
  16939. public function dump(PackageInterface $package)
  16940. {
  16941. $keys = array(
  16942. 'binaries' => 'bin',
  16943. 'type',
  16944. 'extra',
  16945. 'installationSource' => 'installation-source',
  16946. 'autoload',
  16947. 'devAutoload' => 'autoload-dev',
  16948. 'notificationUrl' => 'notification-url',
  16949. 'includePaths' => 'include-path',
  16950. );
  16951. $data = array();
  16952. $data['name'] = $package->getPrettyName();
  16953. $data['version'] = $package->getPrettyVersion();
  16954. $data['version_normalized'] = $package->getVersion();
  16955. if ($package->getTargetDir()) {
  16956. $data['target-dir'] = $package->getTargetDir();
  16957. }
  16958. if ($package->getSourceType() && $package->getType() !== 'metapackage') {
  16959. $data['source']['type'] = $package->getSourceType();
  16960. $data['source']['url'] = $package->getSourceUrl();
  16961. $data['source']['reference'] = $package->getSourceReference();
  16962. if ($mirrors = $package->getSourceMirrors()) {
  16963. $data['source']['mirrors'] = $mirrors;
  16964. }
  16965. }
  16966. if ($package->getDistType() && $package->getType() !== 'metapackage') {
  16967. $data['dist']['type'] = $package->getDistType();
  16968. $data['dist']['url'] = $package->getDistUrl();
  16969. $data['dist']['reference'] = $package->getDistReference();
  16970. $data['dist']['shasum'] = $package->getDistSha1Checksum();
  16971. if ($mirrors = $package->getDistMirrors()) {
  16972. $data['dist']['mirrors'] = $mirrors;
  16973. }
  16974. }
  16975. if ($package->getArchiveExcludes()) {
  16976. $data['archive']['exclude'] = $package->getArchiveExcludes();
  16977. }
  16978. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  16979. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  16980. foreach ($links as $link) {
  16981. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  16982. }
  16983. ksort($data[$type]);
  16984. }
  16985. }
  16986. if ($packages = $package->getSuggests()) {
  16987. ksort($packages);
  16988. $data['suggest'] = $packages;
  16989. }
  16990. if ($package->getReleaseDate()) {
  16991. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  16992. }
  16993. $data = $this->dumpValues($package, $keys, $data);
  16994. if ($package instanceof CompletePackageInterface) {
  16995. $keys = array(
  16996. 'scripts',
  16997. 'license',
  16998. 'authors',
  16999. 'description',
  17000. 'homepage',
  17001. 'keywords',
  17002. 'repositories',
  17003. 'support',
  17004. );
  17005. $data = $this->dumpValues($package, $keys, $data);
  17006. if (isset($data['keywords']) && is_array($data['keywords'])) {
  17007. sort($data['keywords']);
  17008. }
  17009. if ($package->isAbandoned()) {
  17010. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  17011. }
  17012. }
  17013. if ($package instanceof RootPackageInterface) {
  17014. $minimumStability = $package->getMinimumStability();
  17015. if ($minimumStability) {
  17016. $data['minimum-stability'] = $minimumStability;
  17017. }
  17018. }
  17019. if (count($package->getTransportOptions()) > 0) {
  17020. $data['transport-options'] = $package->getTransportOptions();
  17021. }
  17022. return $data;
  17023. }
  17024. private function dumpValues(PackageInterface $package, array $keys, array $data)
  17025. {
  17026. foreach ($keys as $method => $key) {
  17027. if (is_numeric($method)) {
  17028. $method = $key;
  17029. }
  17030. $getter = 'get'.ucfirst($method);
  17031. $value = $package->$getter();
  17032. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  17033. $data[$key] = $value;
  17034. }
  17035. }
  17036. return $data;
  17037. }
  17038. }
  17039. <?php
  17040. namespace Composer\Package;
  17041. use Composer\Semver\Constraint\ConstraintInterface;
  17042. class Link
  17043. {
  17044. protected $source;
  17045. protected $target;
  17046. protected $constraint;
  17047. protected $description;
  17048. protected $prettyConstraint;
  17049. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  17050. {
  17051. $this->source = strtolower($source);
  17052. $this->target = strtolower($target);
  17053. $this->constraint = $constraint;
  17054. $this->description = $description;
  17055. $this->prettyConstraint = $prettyConstraint;
  17056. }
  17057. public function getDescription()
  17058. {
  17059. return $this->description;
  17060. }
  17061. public function getSource()
  17062. {
  17063. return $this->source;
  17064. }
  17065. public function getTarget()
  17066. {
  17067. return $this->target;
  17068. }
  17069. public function getConstraint()
  17070. {
  17071. return $this->constraint;
  17072. }
  17073. public function getPrettyConstraint()
  17074. {
  17075. if (null === $this->prettyConstraint) {
  17076. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  17077. }
  17078. return $this->prettyConstraint;
  17079. }
  17080. public function __toString()
  17081. {
  17082. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  17083. }
  17084. public function getPrettyString(PackageInterface $sourcePackage)
  17085. {
  17086. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  17087. }
  17088. }
  17089. <?php
  17090. namespace Composer\Package\LinkConstraint;
  17091. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  17092. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  17093. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  17094. {
  17095. }
  17096. <?php
  17097. namespace Composer\Package\LinkConstraint;
  17098. use Composer\Semver\Constraint\ConstraintInterface;
  17099. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  17100. interface LinkConstraintInterface extends ConstraintInterface
  17101. {
  17102. }
  17103. <?php
  17104. namespace Composer\Package\LinkConstraint;
  17105. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  17106. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  17107. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  17108. {
  17109. }
  17110. <?php
  17111. namespace Composer\Package\LinkConstraint;
  17112. use Composer\Semver\Constraint\AbstractConstraint;
  17113. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  17114. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  17115. {
  17116. }
  17117. <?php
  17118. namespace Composer\Package\LinkConstraint;
  17119. use Composer\Semver\Constraint\Constraint;
  17120. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  17121. class VersionConstraint extends Constraint implements LinkConstraintInterface
  17122. {
  17123. }
  17124. <?php
  17125. namespace Composer\Package\Loader;
  17126. use Composer\Package;
  17127. use Composer\Package\AliasPackage;
  17128. use Composer\Package\Link;
  17129. use Composer\Package\RootAliasPackage;
  17130. use Composer\Package\RootPackageInterface;
  17131. use Composer\Package\Version\VersionParser;
  17132. use Composer\Semver\VersionParser as SemverVersionParser;
  17133. class ArrayLoader implements LoaderInterface
  17134. {
  17135. protected $versionParser;
  17136. protected $loadOptions;
  17137. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  17138. {
  17139. if (!$parser) {
  17140. $parser = new VersionParser;
  17141. }
  17142. $this->versionParser = $parser;
  17143. $this->loadOptions = $loadOptions;
  17144. }
  17145. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17146. {
  17147. if (!isset($config['name'])) {
  17148. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  17149. }
  17150. if (!isset($config['version'])) {
  17151. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  17152. }
  17153. if (isset($config['version_normalized'])) {
  17154. $version = $config['version_normalized'];
  17155. } else {
  17156. $version = $this->versionParser->normalize($config['version']);
  17157. }
  17158. $package = new $class($config['name'], $version, $config['version']);
  17159. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  17160. if (isset($config['target-dir'])) {
  17161. $package->setTargetDir($config['target-dir']);
  17162. }
  17163. if (isset($config['extra']) && is_array($config['extra'])) {
  17164. $package->setExtra($config['extra']);
  17165. }
  17166. if (isset($config['bin'])) {
  17167. foreach ((array) $config['bin'] as $key => $bin) {
  17168. $config['bin'][$key] = ltrim($bin, '/');
  17169. }
  17170. $package->setBinaries((array) $config['bin']);
  17171. }
  17172. if (isset($config['installation-source'])) {
  17173. $package->setInstallationSource($config['installation-source']);
  17174. }
  17175. if (isset($config['source'])) {
  17176. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  17177. throw new \UnexpectedValueException(sprintf(
  17178. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  17179. $config['name'],
  17180. json_encode($config['source'])
  17181. ));
  17182. }
  17183. $package->setSourceType($config['source']['type']);
  17184. $package->setSourceUrl($config['source']['url']);
  17185. $package->setSourceReference($config['source']['reference']);
  17186. if (isset($config['source']['mirrors'])) {
  17187. $package->setSourceMirrors($config['source']['mirrors']);
  17188. }
  17189. }
  17190. if (isset($config['dist'])) {
  17191. if (!isset($config['dist']['type'])
  17192. || !isset($config['dist']['url'])) {
  17193. throw new \UnexpectedValueException(sprintf(
  17194. "Package %s's dist key should be specified as ".
  17195. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  17196. $config['name'],
  17197. json_encode($config['dist'])
  17198. ));
  17199. }
  17200. $package->setDistType($config['dist']['type']);
  17201. $package->setDistUrl($config['dist']['url']);
  17202. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  17203. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  17204. if (isset($config['dist']['mirrors'])) {
  17205. $package->setDistMirrors($config['dist']['mirrors']);
  17206. }
  17207. }
  17208. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  17209. if (isset($config[$type])) {
  17210. $method = 'set'.ucfirst($opts['method']);
  17211. $package->{$method}(
  17212. $this->parseLinks(
  17213. $package->getName(),
  17214. $package->getPrettyVersion(),
  17215. $opts['description'],
  17216. $config[$type]
  17217. )
  17218. );
  17219. }
  17220. }
  17221. if (isset($config['suggest']) && is_array($config['suggest'])) {
  17222. foreach ($config['suggest'] as $target => $reason) {
  17223. if ('self.version' === trim($reason)) {
  17224. $config['suggest'][$target] = $package->getPrettyVersion();
  17225. }
  17226. }
  17227. $package->setSuggests($config['suggest']);
  17228. }
  17229. if (isset($config['autoload'])) {
  17230. $package->setAutoload($config['autoload']);
  17231. }
  17232. if (isset($config['autoload-dev'])) {
  17233. $package->setDevAutoload($config['autoload-dev']);
  17234. }
  17235. if (isset($config['include-path'])) {
  17236. $package->setIncludePaths($config['include-path']);
  17237. }
  17238. if (!empty($config['time'])) {
  17239. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  17240. try {
  17241. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  17242. $package->setReleaseDate($date);
  17243. } catch (\Exception $e) {
  17244. }
  17245. }
  17246. if (!empty($config['notification-url'])) {
  17247. $package->setNotificationUrl($config['notification-url']);
  17248. }
  17249. if (!empty($config['archive']['exclude'])) {
  17250. $package->setArchiveExcludes($config['archive']['exclude']);
  17251. }
  17252. if ($package instanceof Package\CompletePackageInterface) {
  17253. if (isset($config['scripts']) && is_array($config['scripts'])) {
  17254. foreach ($config['scripts'] as $event => $listeners) {
  17255. $config['scripts'][$event] = (array) $listeners;
  17256. }
  17257. if (isset($config['scripts']['composer'])) {
  17258. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  17259. }
  17260. $package->setScripts($config['scripts']);
  17261. }
  17262. if (!empty($config['description']) && is_string($config['description'])) {
  17263. $package->setDescription($config['description']);
  17264. }
  17265. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  17266. $package->setHomepage($config['homepage']);
  17267. }
  17268. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  17269. $package->setKeywords($config['keywords']);
  17270. }
  17271. if (!empty($config['license'])) {
  17272. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  17273. }
  17274. if (!empty($config['authors']) && is_array($config['authors'])) {
  17275. $package->setAuthors($config['authors']);
  17276. }
  17277. if (isset($config['support'])) {
  17278. $package->setSupport($config['support']);
  17279. }
  17280. if (isset($config['abandoned'])) {
  17281. $package->setAbandoned($config['abandoned']);
  17282. }
  17283. }
  17284. if ($aliasNormalized = $this->getBranchAlias($config)) {
  17285. if ($package instanceof RootPackageInterface) {
  17286. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17287. } else {
  17288. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17289. }
  17290. }
  17291. if ($this->loadOptions && isset($config['transport-options'])) {
  17292. $package->setTransportOptions($config['transport-options']);
  17293. }
  17294. return $package;
  17295. }
  17296. public function parseLinks($source, $sourceVersion, $description, $links)
  17297. {
  17298. $res = array();
  17299. foreach ($links as $target => $constraint) {
  17300. if (!is_string($constraint)) {
  17301. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  17302. }
  17303. if ('self.version' === $constraint) {
  17304. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  17305. } else {
  17306. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  17307. }
  17308. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  17309. }
  17310. return $res;
  17311. }
  17312. public function getBranchAlias(array $config)
  17313. {
  17314. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  17315. || !isset($config['extra']['branch-alias'])
  17316. || !is_array($config['extra']['branch-alias'])
  17317. ) {
  17318. return;
  17319. }
  17320. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  17321. if ('-dev' !== substr($targetBranch, -4)) {
  17322. continue;
  17323. }
  17324. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  17325. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  17326. continue;
  17327. }
  17328. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  17329. continue;
  17330. }
  17331. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  17332. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  17333. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  17334. ) {
  17335. continue;
  17336. }
  17337. return $validatedTargetBranch;
  17338. }
  17339. }
  17340. }
  17341. <?php
  17342. namespace Composer\Package\Loader;
  17343. class InvalidPackageException extends \Exception
  17344. {
  17345. private $errors;
  17346. private $warnings;
  17347. private $data;
  17348. public function __construct(array $errors, array $warnings, array $data)
  17349. {
  17350. $this->errors = $errors;
  17351. $this->warnings = $warnings;
  17352. $this->data = $data;
  17353. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  17354. }
  17355. public function getData()
  17356. {
  17357. return $this->data;
  17358. }
  17359. public function getErrors()
  17360. {
  17361. return $this->errors;
  17362. }
  17363. public function getWarnings()
  17364. {
  17365. return $this->warnings;
  17366. }
  17367. }
  17368. <?php
  17369. namespace Composer\Package\Loader;
  17370. use Composer\Json\JsonFile;
  17371. class JsonLoader
  17372. {
  17373. private $loader;
  17374. public function __construct(LoaderInterface $loader)
  17375. {
  17376. $this->loader = $loader;
  17377. }
  17378. public function load($json)
  17379. {
  17380. if ($json instanceof JsonFile) {
  17381. $config = $json->read();
  17382. } elseif (file_exists($json)) {
  17383. $config = JsonFile::parseJson(file_get_contents($json), $json);
  17384. } elseif (is_string($json)) {
  17385. $config = JsonFile::parseJson($json);
  17386. }
  17387. return $this->loader->load($config);
  17388. }
  17389. }
  17390. <?php
  17391. namespace Composer\Package\Loader;
  17392. interface LoaderInterface
  17393. {
  17394. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  17395. }
  17396. <?php
  17397. namespace Composer\Package\Loader;
  17398. use Composer\Package\BasePackage;
  17399. use Composer\Package\AliasPackage;
  17400. use Composer\Config;
  17401. use Composer\Package\RootPackageInterface;
  17402. use Composer\Repository\RepositoryFactory;
  17403. use Composer\Package\Version\VersionGuesser;
  17404. use Composer\Package\Version\VersionParser;
  17405. use Composer\Repository\RepositoryManager;
  17406. use Composer\Util\ProcessExecutor;
  17407. class RootPackageLoader extends ArrayLoader
  17408. {
  17409. private $manager;
  17410. private $config;
  17411. private $versionGuesser;
  17412. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null)
  17413. {
  17414. parent::__construct($parser);
  17415. $this->manager = $manager;
  17416. $this->config = $config;
  17417. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  17418. }
  17419. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  17420. {
  17421. if (!isset($config['name'])) {
  17422. $config['name'] = '__root__';
  17423. }
  17424. $autoVersioned = false;
  17425. if (!isset($config['version'])) {
  17426. $commit = null;
  17427. if (getenv('COMPOSER_ROOT_VERSION')) {
  17428. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  17429. } else {
  17430. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  17431. if ($versionData) {
  17432. $config['version'] = $versionData['pretty_version'];
  17433. $config['version_normalized'] = $versionData['version'];
  17434. $commit = $versionData['commit'];
  17435. }
  17436. }
  17437. if (!isset($config['version'])) {
  17438. $config['version'] = '1.0.0';
  17439. $autoVersioned = true;
  17440. }
  17441. if ($commit) {
  17442. $config['source'] = array(
  17443. 'type' => '',
  17444. 'url' => '',
  17445. 'reference' => $commit,
  17446. );
  17447. $config['dist'] = array(
  17448. 'type' => '',
  17449. 'url' => '',
  17450. 'reference' => $commit,
  17451. );
  17452. }
  17453. }
  17454. $realPackage = $package = parent::load($config, $class);
  17455. if ($realPackage instanceof AliasPackage) {
  17456. $realPackage = $package->getAliasOf();
  17457. }
  17458. if ($autoVersioned) {
  17459. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  17460. }
  17461. if (isset($config['minimum-stability'])) {
  17462. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  17463. }
  17464. $aliases = array();
  17465. $stabilityFlags = array();
  17466. $references = array();
  17467. foreach (array('require', 'require-dev') as $linkType) {
  17468. if (isset($config[$linkType])) {
  17469. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  17470. $method = 'get'.ucfirst($linkInfo['method']);
  17471. $links = array();
  17472. foreach ($realPackage->$method() as $link) {
  17473. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  17474. }
  17475. $aliases = $this->extractAliases($links, $aliases);
  17476. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  17477. $references = $this->extractReferences($links, $references);
  17478. }
  17479. }
  17480. if (isset($links[$config['name']])) {
  17481. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  17482. 'Did you accidentally name your root package after an external package?', $config['name']));
  17483. }
  17484. $realPackage->setAliases($aliases);
  17485. $realPackage->setStabilityFlags($stabilityFlags);
  17486. $realPackage->setReferences($references);
  17487. if (isset($config['prefer-stable'])) {
  17488. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  17489. }
  17490. if (isset($config['config'])) {
  17491. $realPackage->setConfig($config['config']);
  17492. }
  17493. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  17494. foreach ($repos as $repo) {
  17495. $this->manager->addRepository($repo);
  17496. }
  17497. $realPackage->setRepositories($this->config->getRepositories());
  17498. return $package;
  17499. }
  17500. private function extractAliases(array $requires, array $aliases)
  17501. {
  17502. foreach ($requires as $reqName => $reqVersion) {
  17503. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  17504. $aliases[] = array(
  17505. 'package' => strtolower($reqName),
  17506. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  17507. 'alias' => $match[2],
  17508. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  17509. );
  17510. }
  17511. }
  17512. return $aliases;
  17513. }
  17514. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  17515. {
  17516. $stabilities = BasePackage::$stabilities;
  17517. $minimumStability = $stabilities[$minimumStability];
  17518. foreach ($requires as $reqName => $reqVersion) {
  17519. $constraints = array();
  17520. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  17521. foreach ($orSplit as $orConstraint) {
  17522. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  17523. foreach ($andSplit as $andConstraint) {
  17524. $constraints[] = $andConstraint;
  17525. }
  17526. }
  17527. $match = false;
  17528. foreach ($constraints as $constraint) {
  17529. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  17530. $name = strtolower($reqName);
  17531. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  17532. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  17533. continue;
  17534. }
  17535. $stabilityFlags[$name] = $stability;
  17536. $match = true;
  17537. }
  17538. }
  17539. if ($match) {
  17540. continue;
  17541. }
  17542. foreach ($constraints as $constraint) {
  17543. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  17544. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  17545. $name = strtolower($reqName);
  17546. $stability = $stabilities[$stabilityName];
  17547. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  17548. continue;
  17549. }
  17550. $stabilityFlags[$name] = $stability;
  17551. }
  17552. }
  17553. }
  17554. return $stabilityFlags;
  17555. }
  17556. private function extractReferences(array $requires, array $references)
  17557. {
  17558. foreach ($requires as $reqName => $reqVersion) {
  17559. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  17560. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  17561. $name = strtolower($reqName);
  17562. $references[$name] = $match[1];
  17563. }
  17564. }
  17565. return $references;
  17566. }
  17567. }
  17568. <?php
  17569. namespace Composer\Package\Loader;
  17570. use Composer\Package\BasePackage;
  17571. use Composer\Semver\Constraint\Constraint;
  17572. use Composer\Package\Version\VersionParser;
  17573. use Composer\Repository\PlatformRepository;
  17574. use Composer\Spdx\SpdxLicenses;
  17575. class ValidatingArrayLoader implements LoaderInterface
  17576. {
  17577. const CHECK_ALL = 3;
  17578. const CHECK_UNBOUND_CONSTRAINTS = 1;
  17579. const CHECK_STRICT_CONSTRAINTS = 2;
  17580. private $loader;
  17581. private $versionParser;
  17582. private $errors;
  17583. private $warnings;
  17584. private $config;
  17585. private $strictName;
  17586. private $flags;
  17587. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  17588. {
  17589. $this->loader = $loader;
  17590. $this->versionParser = $parser ?: new VersionParser();
  17591. $this->strictName = $strictName;
  17592. $this->flags = $flags;
  17593. }
  17594. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17595. {
  17596. $this->errors = array();
  17597. $this->warnings = array();
  17598. $this->config = $config;
  17599. if ($this->strictName) {
  17600. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  17601. } else {
  17602. $this->validateString('name', true);
  17603. }
  17604. if (!empty($this->config['version'])) {
  17605. try {
  17606. $this->versionParser->normalize($this->config['version']);
  17607. } catch (\Exception $e) {
  17608. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  17609. unset($this->config['version']);
  17610. }
  17611. }
  17612. if (!empty($this->config['config']['platform'])) {
  17613. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  17614. try {
  17615. $this->versionParser->normalize($platform);
  17616. } catch (\Exception $e) {
  17617. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  17618. }
  17619. }
  17620. }
  17621. $this->validateRegex('type', '[A-Za-z0-9-]+');
  17622. $this->validateString('target-dir');
  17623. $this->validateArray('extra');
  17624. if (isset($this->config['bin'])) {
  17625. if (is_string($this->config['bin'])) {
  17626. $this->validateString('bin');
  17627. } else {
  17628. $this->validateFlatArray('bin');
  17629. }
  17630. }
  17631. $this->validateArray('scripts');
  17632. $this->validateString('description');
  17633. $this->validateUrl('homepage');
  17634. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  17635. $releaseDate = null;
  17636. $this->validateString('time');
  17637. if (!empty($this->config['time'])) {
  17638. try {
  17639. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  17640. } catch (\Exception $e) {
  17641. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  17642. unset($this->config['time']);
  17643. }
  17644. }
  17645. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  17646. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  17647. $licenses = (array) $this->config['license'];
  17648. foreach ($licenses as $key => $license) {
  17649. if ('proprietary' === $license) {
  17650. unset($licenses[$key]);
  17651. }
  17652. }
  17653. $licenseValidator = new SpdxLicenses();
  17654. if (count($licenses) === 1 && !$licenseValidator->validate($licenses) && $licenseValidator->validate(trim($licenses[0]))) {
  17655. $this->warnings[] = sprintf(
  17656. 'License %s must not contain extra spaces, make sure to trim it.',
  17657. json_encode($this->config['license'])
  17658. );
  17659. } elseif (array() !== $licenses && !$licenseValidator->validate($licenses)) {
  17660. $this->warnings[] = sprintf(
  17661. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  17662. 'If the software is closed-source, you may use "proprietary" as license.',
  17663. json_encode($this->config['license'])
  17664. );
  17665. }
  17666. }
  17667. }
  17668. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  17669. foreach ($this->config['authors'] as $key => $author) {
  17670. if (!is_array($author)) {
  17671. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  17672. unset($this->config['authors'][$key]);
  17673. continue;
  17674. }
  17675. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  17676. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  17677. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  17678. unset($this->config['authors'][$key][$authorData]);
  17679. }
  17680. }
  17681. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  17682. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  17683. unset($this->config['authors'][$key]['homepage']);
  17684. }
  17685. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  17686. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  17687. unset($this->config['authors'][$key]['email']);
  17688. }
  17689. if (empty($this->config['authors'][$key])) {
  17690. unset($this->config['authors'][$key]);
  17691. }
  17692. }
  17693. if (empty($this->config['authors'])) {
  17694. unset($this->config['authors']);
  17695. }
  17696. }
  17697. if ($this->validateArray('support') && !empty($this->config['support'])) {
  17698. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss') as $key) {
  17699. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  17700. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  17701. unset($this->config['support'][$key]);
  17702. }
  17703. }
  17704. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  17705. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  17706. unset($this->config['support']['email']);
  17707. }
  17708. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  17709. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  17710. unset($this->config['support']['irc']);
  17711. }
  17712. foreach (array('issues', 'forum', 'wiki', 'source', 'docs') as $key) {
  17713. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  17714. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  17715. unset($this->config['support'][$key]);
  17716. }
  17717. }
  17718. if (empty($this->config['support'])) {
  17719. unset($this->config['support']);
  17720. }
  17721. }
  17722. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  17723. $stableConstraint = new Constraint('=', '1.0.0');
  17724. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  17725. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  17726. foreach ($this->config[$linkType] as $package => $constraint) {
  17727. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  17728. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  17729. }
  17730. if (!is_string($constraint)) {
  17731. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  17732. unset($this->config[$linkType][$package]);
  17733. } elseif ('self.version' !== $constraint) {
  17734. try {
  17735. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  17736. } catch (\Exception $e) {
  17737. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  17738. unset($this->config[$linkType][$package]);
  17739. continue;
  17740. }
  17741. if (
  17742. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  17743. && 'require' === $linkType
  17744. && $linkConstraint->matches($unboundConstraint)
  17745. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  17746. ) {
  17747. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  17748. } elseif (
  17749. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  17750. && 'require' === $linkType
  17751. && substr($linkConstraint, 0, 1) === '='
  17752. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  17753. ) {
  17754. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  17755. }
  17756. }
  17757. }
  17758. }
  17759. }
  17760. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  17761. foreach ($this->config['suggest'] as $package => $description) {
  17762. if (!is_string($description)) {
  17763. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  17764. unset($this->config['suggest'][$package]);
  17765. }
  17766. }
  17767. }
  17768. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  17769. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  17770. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  17771. unset($this->config['minimum-stability']);
  17772. }
  17773. }
  17774. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  17775. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  17776. foreach ($this->config['autoload'] as $type => $typeConfig) {
  17777. if (!in_array($type, $types)) {
  17778. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  17779. unset($this->config['autoload'][$type]);
  17780. }
  17781. if ($type === 'psr-4') {
  17782. foreach ($typeConfig as $namespace => $dirs) {
  17783. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  17784. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  17785. }
  17786. }
  17787. }
  17788. }
  17789. }
  17790. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  17791. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  17792. unset($this->config['autoload']['psr-4']);
  17793. }
  17794. $this->validateFlatArray('include-path');
  17795. $this->validateArray('transport-options');
  17796. if (isset($this->config['extra']['branch-alias'])) {
  17797. if (!is_array($this->config['extra']['branch-alias'])) {
  17798. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  17799. } else {
  17800. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  17801. if ('-dev' !== substr($targetBranch, -4)) {
  17802. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  17803. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17804. continue;
  17805. }
  17806. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  17807. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  17808. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  17809. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17810. continue;
  17811. }
  17812. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  17813. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  17814. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  17815. ) {
  17816. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  17817. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17818. }
  17819. }
  17820. }
  17821. }
  17822. if ($this->errors) {
  17823. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  17824. }
  17825. $package = $this->loader->load($this->config, $class);
  17826. $this->config = null;
  17827. return $package;
  17828. }
  17829. public function getWarnings()
  17830. {
  17831. return $this->warnings;
  17832. }
  17833. public function getErrors()
  17834. {
  17835. return $this->errors;
  17836. }
  17837. private function validateRegex($property, $regex, $mandatory = false)
  17838. {
  17839. if (!$this->validateString($property, $mandatory)) {
  17840. return false;
  17841. }
  17842. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  17843. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  17844. if ($mandatory) {
  17845. $this->errors[] = $message;
  17846. } else {
  17847. $this->warnings[] = $message;
  17848. }
  17849. unset($this->config[$property]);
  17850. return false;
  17851. }
  17852. return true;
  17853. }
  17854. private function validateString($property, $mandatory = false)
  17855. {
  17856. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  17857. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  17858. unset($this->config[$property]);
  17859. return false;
  17860. }
  17861. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  17862. if ($mandatory) {
  17863. $this->errors[] = $property.' : must be present';
  17864. }
  17865. unset($this->config[$property]);
  17866. return false;
  17867. }
  17868. return true;
  17869. }
  17870. private function validateArray($property, $mandatory = false)
  17871. {
  17872. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  17873. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  17874. unset($this->config[$property]);
  17875. return false;
  17876. }
  17877. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  17878. if ($mandatory) {
  17879. $this->errors[] = $property.' : must be present and contain at least one element';
  17880. }
  17881. unset($this->config[$property]);
  17882. return false;
  17883. }
  17884. return true;
  17885. }
  17886. private function validateFlatArray($property, $regex = null, $mandatory = false)
  17887. {
  17888. if (!$this->validateArray($property, $mandatory)) {
  17889. return false;
  17890. }
  17891. $pass = true;
  17892. foreach ($this->config[$property] as $key => $value) {
  17893. if (!is_string($value) && !is_numeric($value)) {
  17894. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  17895. unset($this->config[$property][$key]);
  17896. $pass = false;
  17897. continue;
  17898. }
  17899. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  17900. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  17901. unset($this->config[$property][$key]);
  17902. $pass = false;
  17903. }
  17904. }
  17905. return $pass;
  17906. }
  17907. private function validateUrl($property, $mandatory = false)
  17908. {
  17909. if (!$this->validateString($property, $mandatory)) {
  17910. return false;
  17911. }
  17912. if (!$this->filterUrl($this->config[$property])) {
  17913. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  17914. unset($this->config[$property]);
  17915. return false;
  17916. }
  17917. return true;
  17918. }
  17919. private function filterUrl($value, array $schemes = array('http', 'https'))
  17920. {
  17921. if ($value === '') {
  17922. return true;
  17923. }
  17924. $bits = parse_url($value);
  17925. if (empty($bits['scheme']) || empty($bits['host'])) {
  17926. return false;
  17927. }
  17928. if (!in_array($bits['scheme'], $schemes, true)) {
  17929. return false;
  17930. }
  17931. return true;
  17932. }
  17933. }
  17934. <?php
  17935. namespace Composer\Package;
  17936. use Composer\Json\JsonFile;
  17937. use Composer\Installer\InstallationManager;
  17938. use Composer\Repository\RepositoryManager;
  17939. use Composer\Util\ProcessExecutor;
  17940. use Composer\Repository\ArrayRepository;
  17941. use Composer\Package\Dumper\ArrayDumper;
  17942. use Composer\Package\Loader\ArrayLoader;
  17943. use Composer\Util\Git as GitUtil;
  17944. use Composer\IO\IOInterface;
  17945. use Seld\JsonLint\ParsingException;
  17946. class Locker
  17947. {
  17948. private $lockFile;
  17949. private $repositoryManager;
  17950. private $installationManager;
  17951. private $hash;
  17952. private $contentHash;
  17953. private $loader;
  17954. private $dumper;
  17955. private $process;
  17956. private $lockDataCache;
  17957. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  17958. {
  17959. $this->lockFile = $lockFile;
  17960. $this->repositoryManager = $repositoryManager;
  17961. $this->installationManager = $installationManager;
  17962. $this->hash = md5($composerFileContents);
  17963. $this->contentHash = self::getContentHash($composerFileContents);
  17964. $this->loader = new ArrayLoader(null, true);
  17965. $this->dumper = new ArrayDumper();
  17966. $this->process = new ProcessExecutor($io);
  17967. }
  17968. public static function getContentHash($composerFileContents)
  17969. {
  17970. $content = json_decode($composerFileContents, true);
  17971. $relevantKeys = array(
  17972. 'name',
  17973. 'version',
  17974. 'require',
  17975. 'require-dev',
  17976. 'conflict',
  17977. 'replace',
  17978. 'provide',
  17979. 'minimum-stability',
  17980. 'prefer-stable',
  17981. 'repositories',
  17982. 'extra',
  17983. );
  17984. $relevantContent = array();
  17985. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  17986. $relevantContent[$key] = $content[$key];
  17987. }
  17988. if (isset($content['config']['platform'])) {
  17989. $relevantContent['config']['platform'] = $content['config']['platform'];
  17990. }
  17991. ksort($relevantContent);
  17992. return md5(json_encode($relevantContent));
  17993. }
  17994. public function isLocked()
  17995. {
  17996. if (!$this->lockFile->exists()) {
  17997. return false;
  17998. }
  17999. $data = $this->getLockData();
  18000. return isset($data['packages']);
  18001. }
  18002. public function isFresh()
  18003. {
  18004. $lock = $this->lockFile->read();
  18005. if (!empty($lock['content-hash'])) {
  18006. return $this->contentHash === $lock['content-hash'];
  18007. }
  18008. if (!empty($lock['hash'])) {
  18009. return $this->hash === $lock['hash'];
  18010. }
  18011. return false;
  18012. }
  18013. public function getLockedRepository($withDevReqs = false)
  18014. {
  18015. $lockData = $this->getLockData();
  18016. $packages = new ArrayRepository();
  18017. $lockedPackages = $lockData['packages'];
  18018. if ($withDevReqs) {
  18019. if (isset($lockData['packages-dev'])) {
  18020. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  18021. } else {
  18022. 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.');
  18023. }
  18024. }
  18025. if (empty($lockedPackages)) {
  18026. return $packages;
  18027. }
  18028. if (isset($lockedPackages[0]['name'])) {
  18029. foreach ($lockedPackages as $info) {
  18030. $packages->addPackage($this->loader->load($info));
  18031. }
  18032. return $packages;
  18033. }
  18034. 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.');
  18035. }
  18036. public function getPlatformRequirements($withDevReqs = false)
  18037. {
  18038. $lockData = $this->getLockData();
  18039. $requirements = array();
  18040. if (!empty($lockData['platform'])) {
  18041. $requirements = $this->loader->parseLinks(
  18042. '__ROOT__',
  18043. '1.0.0',
  18044. 'requires',
  18045. isset($lockData['platform']) ? $lockData['platform'] : array()
  18046. );
  18047. }
  18048. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  18049. $devRequirements = $this->loader->parseLinks(
  18050. '__ROOT__',
  18051. '1.0.0',
  18052. 'requires',
  18053. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  18054. );
  18055. $requirements = array_merge($requirements, $devRequirements);
  18056. }
  18057. return $requirements;
  18058. }
  18059. public function getMinimumStability()
  18060. {
  18061. $lockData = $this->getLockData();
  18062. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  18063. }
  18064. public function getStabilityFlags()
  18065. {
  18066. $lockData = $this->getLockData();
  18067. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  18068. }
  18069. public function getPreferStable()
  18070. {
  18071. $lockData = $this->getLockData();
  18072. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  18073. }
  18074. public function getPreferLowest()
  18075. {
  18076. $lockData = $this->getLockData();
  18077. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  18078. }
  18079. public function getPlatformOverrides()
  18080. {
  18081. $lockData = $this->getLockData();
  18082. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  18083. }
  18084. public function getAliases()
  18085. {
  18086. $lockData = $this->getLockData();
  18087. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  18088. }
  18089. public function getLockData()
  18090. {
  18091. if (null !== $this->lockDataCache) {
  18092. return $this->lockDataCache;
  18093. }
  18094. if (!$this->lockFile->exists()) {
  18095. throw new \LogicException('No lockfile found. Unable to read locked packages');
  18096. }
  18097. return $this->lockDataCache = $this->lockFile->read();
  18098. }
  18099. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  18100. {
  18101. $lock = array(
  18102. '_readme' => array('This file locks the dependencies of your project to a known state',
  18103. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  18104. 'This file is @gener'.'ated automatically', ),
  18105. 'content-hash' => $this->contentHash,
  18106. 'packages' => null,
  18107. 'packages-dev' => null,
  18108. 'aliases' => array(),
  18109. 'minimum-stability' => $minimumStability,
  18110. 'stability-flags' => $stabilityFlags,
  18111. 'prefer-stable' => $preferStable,
  18112. 'prefer-lowest' => $preferLowest,
  18113. );
  18114. foreach ($aliases as $package => $versions) {
  18115. foreach ($versions as $version => $alias) {
  18116. $lock['aliases'][] = array(
  18117. 'alias' => $alias['alias'],
  18118. 'alias_normalized' => $alias['alias_normalized'],
  18119. 'version' => $version,
  18120. 'package' => $package,
  18121. );
  18122. }
  18123. }
  18124. $lock['packages'] = $this->lockPackages($packages);
  18125. if (null !== $devPackages) {
  18126. $lock['packages-dev'] = $this->lockPackages($devPackages);
  18127. }
  18128. $lock['platform'] = $platformReqs;
  18129. $lock['platform-dev'] = $platformDevReqs;
  18130. if ($platformOverrides) {
  18131. $lock['platform-overrides'] = $platformOverrides;
  18132. }
  18133. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  18134. if ($this->lockFile->exists()) {
  18135. unlink($this->lockFile->getPath());
  18136. }
  18137. return false;
  18138. }
  18139. try {
  18140. $isLocked = $this->isLocked();
  18141. } catch (ParsingException $e) {
  18142. $isLocked = false;
  18143. }
  18144. if (!$isLocked || $lock !== $this->getLockData()) {
  18145. $this->lockFile->write($lock);
  18146. $this->lockDataCache = null;
  18147. return true;
  18148. }
  18149. return false;
  18150. }
  18151. private function lockPackages(array $packages)
  18152. {
  18153. $locked = array();
  18154. foreach ($packages as $package) {
  18155. if ($package instanceof AliasPackage) {
  18156. continue;
  18157. }
  18158. $name = $package->getPrettyName();
  18159. $version = $package->getPrettyVersion();
  18160. if (!$name || !$version) {
  18161. throw new \LogicException(sprintf(
  18162. 'Package "%s" has no version or name and can not be locked',
  18163. $package
  18164. ));
  18165. }
  18166. $spec = $this->dumper->dump($package);
  18167. unset($spec['version_normalized']);
  18168. $time = isset($spec['time']) ? $spec['time'] : null;
  18169. unset($spec['time']);
  18170. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  18171. $time = $this->getPackageTime($package) ?: $time;
  18172. }
  18173. if (null !== $time) {
  18174. $spec['time'] = $time;
  18175. }
  18176. unset($spec['installation-source']);
  18177. $locked[] = $spec;
  18178. }
  18179. usort($locked, function ($a, $b) {
  18180. $comparison = strcmp($a['name'], $b['name']);
  18181. if (0 !== $comparison) {
  18182. return $comparison;
  18183. }
  18184. return strcmp($a['version'], $b['version']);
  18185. });
  18186. return $locked;
  18187. }
  18188. private function getPackageTime(PackageInterface $package)
  18189. {
  18190. if (!function_exists('proc_open')) {
  18191. return null;
  18192. }
  18193. $path = realpath($this->installationManager->getInstallPath($package));
  18194. $sourceType = $package->getSourceType();
  18195. $datetime = null;
  18196. if ($path && in_array($sourceType, array('git', 'hg'))) {
  18197. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  18198. switch ($sourceType) {
  18199. case 'git':
  18200. GitUtil::cleanEnv();
  18201. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  18202. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  18203. }
  18204. break;
  18205. case 'hg':
  18206. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  18207. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  18208. }
  18209. break;
  18210. }
  18211. }
  18212. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  18213. }
  18214. }
  18215. <?php
  18216. namespace Composer\Package;
  18217. use Composer\Package\Version\VersionParser;
  18218. use Composer\Util\ComposerMirror;
  18219. class Package extends BasePackage
  18220. {
  18221. protected $type;
  18222. protected $targetDir;
  18223. protected $installationSource;
  18224. protected $sourceType;
  18225. protected $sourceUrl;
  18226. protected $sourceReference;
  18227. protected $sourceMirrors;
  18228. protected $distType;
  18229. protected $distUrl;
  18230. protected $distReference;
  18231. protected $distSha1Checksum;
  18232. protected $distMirrors;
  18233. protected $version;
  18234. protected $prettyVersion;
  18235. protected $releaseDate;
  18236. protected $extra = array();
  18237. protected $binaries = array();
  18238. protected $dev;
  18239. protected $stability;
  18240. protected $notificationUrl;
  18241. protected $requires = array();
  18242. protected $conflicts = array();
  18243. protected $provides = array();
  18244. protected $replaces = array();
  18245. protected $devRequires = array();
  18246. protected $suggests = array();
  18247. protected $autoload = array();
  18248. protected $devAutoload = array();
  18249. protected $includePaths = array();
  18250. protected $archiveExcludes = array();
  18251. public function __construct($name, $version, $prettyVersion)
  18252. {
  18253. parent::__construct($name);
  18254. $this->version = $version;
  18255. $this->prettyVersion = $prettyVersion;
  18256. $this->stability = VersionParser::parseStability($version);
  18257. $this->dev = $this->stability === 'dev';
  18258. }
  18259. public function isDev()
  18260. {
  18261. return $this->dev;
  18262. }
  18263. public function setType($type)
  18264. {
  18265. $this->type = $type;
  18266. }
  18267. public function getType()
  18268. {
  18269. return $this->type ?: 'library';
  18270. }
  18271. public function getStability()
  18272. {
  18273. return $this->stability;
  18274. }
  18275. public function setTargetDir($targetDir)
  18276. {
  18277. $this->targetDir = $targetDir;
  18278. }
  18279. public function getTargetDir()
  18280. {
  18281. if (null === $this->targetDir) {
  18282. return;
  18283. }
  18284. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  18285. }
  18286. public function setExtra(array $extra)
  18287. {
  18288. $this->extra = $extra;
  18289. }
  18290. public function getExtra()
  18291. {
  18292. return $this->extra;
  18293. }
  18294. public function setBinaries(array $binaries)
  18295. {
  18296. $this->binaries = $binaries;
  18297. }
  18298. public function getBinaries()
  18299. {
  18300. return $this->binaries;
  18301. }
  18302. public function setInstallationSource($type)
  18303. {
  18304. $this->installationSource = $type;
  18305. }
  18306. public function getInstallationSource()
  18307. {
  18308. return $this->installationSource;
  18309. }
  18310. public function setSourceType($type)
  18311. {
  18312. $this->sourceType = $type;
  18313. }
  18314. public function getSourceType()
  18315. {
  18316. return $this->sourceType;
  18317. }
  18318. public function setSourceUrl($url)
  18319. {
  18320. $this->sourceUrl = $url;
  18321. }
  18322. public function getSourceUrl()
  18323. {
  18324. return $this->sourceUrl;
  18325. }
  18326. public function setSourceReference($reference)
  18327. {
  18328. $this->sourceReference = $reference;
  18329. }
  18330. public function getSourceReference()
  18331. {
  18332. return $this->sourceReference;
  18333. }
  18334. public function setSourceMirrors($mirrors)
  18335. {
  18336. $this->sourceMirrors = $mirrors;
  18337. }
  18338. public function getSourceMirrors()
  18339. {
  18340. return $this->sourceMirrors;
  18341. }
  18342. public function getSourceUrls()
  18343. {
  18344. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  18345. }
  18346. public function setDistType($type)
  18347. {
  18348. $this->distType = $type;
  18349. }
  18350. public function getDistType()
  18351. {
  18352. return $this->distType;
  18353. }
  18354. public function setDistUrl($url)
  18355. {
  18356. $this->distUrl = $url;
  18357. }
  18358. public function getDistUrl()
  18359. {
  18360. return $this->distUrl;
  18361. }
  18362. public function setDistReference($reference)
  18363. {
  18364. $this->distReference = $reference;
  18365. }
  18366. public function getDistReference()
  18367. {
  18368. return $this->distReference;
  18369. }
  18370. public function setDistSha1Checksum($sha1checksum)
  18371. {
  18372. $this->distSha1Checksum = $sha1checksum;
  18373. }
  18374. public function getDistSha1Checksum()
  18375. {
  18376. return $this->distSha1Checksum;
  18377. }
  18378. public function setDistMirrors($mirrors)
  18379. {
  18380. $this->distMirrors = $mirrors;
  18381. }
  18382. public function getDistMirrors()
  18383. {
  18384. return $this->distMirrors;
  18385. }
  18386. public function getDistUrls()
  18387. {
  18388. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  18389. }
  18390. public function getVersion()
  18391. {
  18392. return $this->version;
  18393. }
  18394. public function getPrettyVersion()
  18395. {
  18396. return $this->prettyVersion;
  18397. }
  18398. public function setReleaseDate(\DateTime $releaseDate)
  18399. {
  18400. $this->releaseDate = $releaseDate;
  18401. }
  18402. public function getReleaseDate()
  18403. {
  18404. return $this->releaseDate;
  18405. }
  18406. public function setRequires(array $requires)
  18407. {
  18408. $this->requires = $requires;
  18409. }
  18410. public function getRequires()
  18411. {
  18412. return $this->requires;
  18413. }
  18414. public function setConflicts(array $conflicts)
  18415. {
  18416. $this->conflicts = $conflicts;
  18417. }
  18418. public function getConflicts()
  18419. {
  18420. return $this->conflicts;
  18421. }
  18422. public function setProvides(array $provides)
  18423. {
  18424. $this->provides = $provides;
  18425. }
  18426. public function getProvides()
  18427. {
  18428. return $this->provides;
  18429. }
  18430. public function setReplaces(array $replaces)
  18431. {
  18432. $this->replaces = $replaces;
  18433. }
  18434. public function getReplaces()
  18435. {
  18436. return $this->replaces;
  18437. }
  18438. public function setDevRequires(array $devRequires)
  18439. {
  18440. $this->devRequires = $devRequires;
  18441. }
  18442. public function getDevRequires()
  18443. {
  18444. return $this->devRequires;
  18445. }
  18446. public function setSuggests(array $suggests)
  18447. {
  18448. $this->suggests = $suggests;
  18449. }
  18450. public function getSuggests()
  18451. {
  18452. return $this->suggests;
  18453. }
  18454. public function setAutoload(array $autoload)
  18455. {
  18456. $this->autoload = $autoload;
  18457. }
  18458. public function getAutoload()
  18459. {
  18460. return $this->autoload;
  18461. }
  18462. public function setDevAutoload(array $devAutoload)
  18463. {
  18464. $this->devAutoload = $devAutoload;
  18465. }
  18466. public function getDevAutoload()
  18467. {
  18468. return $this->devAutoload;
  18469. }
  18470. public function setIncludePaths(array $includePaths)
  18471. {
  18472. $this->includePaths = $includePaths;
  18473. }
  18474. public function getIncludePaths()
  18475. {
  18476. return $this->includePaths;
  18477. }
  18478. public function setNotificationUrl($notificationUrl)
  18479. {
  18480. $this->notificationUrl = $notificationUrl;
  18481. }
  18482. public function getNotificationUrl()
  18483. {
  18484. return $this->notificationUrl;
  18485. }
  18486. public function setArchiveExcludes(array $excludes)
  18487. {
  18488. $this->archiveExcludes = $excludes;
  18489. }
  18490. public function getArchiveExcludes()
  18491. {
  18492. return $this->archiveExcludes;
  18493. }
  18494. public function replaceVersion($version, $prettyVersion)
  18495. {
  18496. $this->version = $version;
  18497. $this->prettyVersion = $prettyVersion;
  18498. $this->stability = VersionParser::parseStability($version);
  18499. $this->dev = $this->stability === 'dev';
  18500. }
  18501. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  18502. {
  18503. if (!$url) {
  18504. return array();
  18505. }
  18506. $urls = array($url);
  18507. if ($mirrors) {
  18508. foreach ($mirrors as $mirror) {
  18509. if ($urlType === 'dist') {
  18510. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  18511. } elseif ($urlType === 'source' && $type === 'git') {
  18512. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  18513. } elseif ($urlType === 'source' && $type === 'hg') {
  18514. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  18515. }
  18516. if (!in_array($mirrorUrl, $urls)) {
  18517. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  18518. $func($urls, $mirrorUrl);
  18519. }
  18520. }
  18521. }
  18522. return $urls;
  18523. }
  18524. }
  18525. <?php
  18526. namespace Composer\Package;
  18527. use Composer\Repository\RepositoryInterface;
  18528. interface PackageInterface
  18529. {
  18530. public function getName();
  18531. public function getPrettyName();
  18532. public function getNames();
  18533. public function setId($id);
  18534. public function getId();
  18535. public function isDev();
  18536. public function getType();
  18537. public function getTargetDir();
  18538. public function getExtra();
  18539. public function setInstallationSource($type);
  18540. public function getInstallationSource();
  18541. public function getSourceType();
  18542. public function getSourceUrl();
  18543. public function getSourceUrls();
  18544. public function getSourceReference();
  18545. public function getSourceMirrors();
  18546. public function getDistType();
  18547. public function getDistUrl();
  18548. public function getDistUrls();
  18549. public function getDistReference();
  18550. public function getDistSha1Checksum();
  18551. public function getDistMirrors();
  18552. public function getVersion();
  18553. public function getPrettyVersion();
  18554. public function getFullPrettyVersion($truncate = true);
  18555. public function getReleaseDate();
  18556. public function getStability();
  18557. public function getRequires();
  18558. public function getConflicts();
  18559. public function getProvides();
  18560. public function getReplaces();
  18561. public function getDevRequires();
  18562. public function getSuggests();
  18563. public function getAutoload();
  18564. public function getDevAutoload();
  18565. public function getIncludePaths();
  18566. public function setRepository(RepositoryInterface $repository);
  18567. public function getRepository();
  18568. public function getBinaries();
  18569. public function getUniqueName();
  18570. public function getNotificationUrl();
  18571. public function __toString();
  18572. public function getPrettyString();
  18573. public function getArchiveExcludes();
  18574. public function getTransportOptions();
  18575. }
  18576. <?php
  18577. namespace Composer\Package;
  18578. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  18579. {
  18580. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  18581. {
  18582. parent::__construct($aliasOf, $version, $prettyVersion);
  18583. }
  18584. public function getAliases()
  18585. {
  18586. return $this->aliasOf->getAliases();
  18587. }
  18588. public function getMinimumStability()
  18589. {
  18590. return $this->aliasOf->getMinimumStability();
  18591. }
  18592. public function getStabilityFlags()
  18593. {
  18594. return $this->aliasOf->getStabilityFlags();
  18595. }
  18596. public function getReferences()
  18597. {
  18598. return $this->aliasOf->getReferences();
  18599. }
  18600. public function getPreferStable()
  18601. {
  18602. return $this->aliasOf->getPreferStable();
  18603. }
  18604. public function getConfig()
  18605. {
  18606. return $this->aliasOf->getConfig();
  18607. }
  18608. public function setRequires(array $require)
  18609. {
  18610. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  18611. $this->aliasOf->setRequires($require);
  18612. }
  18613. public function setDevRequires(array $devRequire)
  18614. {
  18615. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  18616. $this->aliasOf->setDevRequires($devRequire);
  18617. }
  18618. public function setConflicts(array $conflicts)
  18619. {
  18620. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  18621. $this->aliasOf->setConflicts($conflicts);
  18622. }
  18623. public function setProvides(array $provides)
  18624. {
  18625. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  18626. $this->aliasOf->setProvides($provides);
  18627. }
  18628. public function setReplaces(array $replaces)
  18629. {
  18630. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  18631. $this->aliasOf->setReplaces($replaces);
  18632. }
  18633. public function setRepositories($repositories)
  18634. {
  18635. $this->aliasOf->setRepositories($repositories);
  18636. }
  18637. public function setAutoload(array $autoload)
  18638. {
  18639. $this->aliasOf->setAutoload($autoload);
  18640. }
  18641. public function setDevAutoload(array $devAutoload)
  18642. {
  18643. $this->aliasOf->setDevAutoload($devAutoload);
  18644. }
  18645. public function setStabilityFlags(array $stabilityFlags)
  18646. {
  18647. $this->aliasOf->setStabilityFlags($stabilityFlags);
  18648. }
  18649. public function setSuggests(array $suggests)
  18650. {
  18651. $this->aliasOf->setSuggests($suggests);
  18652. }
  18653. public function setExtra(array $extra)
  18654. {
  18655. $this->aliasOf->setExtra($extra);
  18656. }
  18657. public function __clone()
  18658. {
  18659. parent::__clone();
  18660. $this->aliasOf = clone $this->aliasOf;
  18661. }
  18662. }
  18663. <?php
  18664. namespace Composer\Package;
  18665. class RootPackage extends CompletePackage implements RootPackageInterface
  18666. {
  18667. protected $minimumStability = 'stable';
  18668. protected $preferStable = false;
  18669. protected $stabilityFlags = array();
  18670. protected $config = array();
  18671. protected $references = array();
  18672. protected $aliases = array();
  18673. public function setMinimumStability($minimumStability)
  18674. {
  18675. $this->minimumStability = $minimumStability;
  18676. }
  18677. public function getMinimumStability()
  18678. {
  18679. return $this->minimumStability;
  18680. }
  18681. public function setStabilityFlags(array $stabilityFlags)
  18682. {
  18683. $this->stabilityFlags = $stabilityFlags;
  18684. }
  18685. public function getStabilityFlags()
  18686. {
  18687. return $this->stabilityFlags;
  18688. }
  18689. public function setPreferStable($preferStable)
  18690. {
  18691. $this->preferStable = $preferStable;
  18692. }
  18693. public function getPreferStable()
  18694. {
  18695. return $this->preferStable;
  18696. }
  18697. public function setConfig(array $config)
  18698. {
  18699. $this->config = $config;
  18700. }
  18701. public function getConfig()
  18702. {
  18703. return $this->config;
  18704. }
  18705. public function setReferences(array $references)
  18706. {
  18707. $this->references = $references;
  18708. }
  18709. public function getReferences()
  18710. {
  18711. return $this->references;
  18712. }
  18713. public function setAliases(array $aliases)
  18714. {
  18715. $this->aliases = $aliases;
  18716. }
  18717. public function getAliases()
  18718. {
  18719. return $this->aliases;
  18720. }
  18721. }
  18722. <?php
  18723. namespace Composer\Package;
  18724. interface RootPackageInterface extends CompletePackageInterface
  18725. {
  18726. public function getAliases();
  18727. public function getMinimumStability();
  18728. public function getStabilityFlags();
  18729. public function getReferences();
  18730. public function getPreferStable();
  18731. public function getConfig();
  18732. public function setRequires(array $requires);
  18733. public function setDevRequires(array $devRequires);
  18734. public function setConflicts(array $conflicts);
  18735. public function setProvides(array $provides);
  18736. public function setReplaces(array $replaces);
  18737. public function setRepositories($repositories);
  18738. public function setAutoload(array $autoload);
  18739. public function setDevAutoload(array $devAutoload);
  18740. public function setStabilityFlags(array $stabilityFlags);
  18741. public function setSuggests(array $suggests);
  18742. public function setExtra(array $extra);
  18743. }
  18744. <?php
  18745. namespace Composer\Package\Version;
  18746. use Composer\Config;
  18747. use Composer\Repository\Vcs\HgDriver;
  18748. use Composer\IO\NullIO;
  18749. use Composer\Semver\VersionParser as SemverVersionParser;
  18750. use Composer\Util\Git as GitUtil;
  18751. use Composer\Util\ProcessExecutor;
  18752. use Composer\Util\Svn as SvnUtil;
  18753. class VersionGuesser
  18754. {
  18755. private $config;
  18756. private $process;
  18757. private $versionParser;
  18758. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  18759. {
  18760. $this->config = $config;
  18761. $this->process = $process;
  18762. $this->versionParser = $versionParser;
  18763. }
  18764. public function guessVersion(array $packageConfig, $path)
  18765. {
  18766. if (function_exists('proc_open')) {
  18767. $versionData = $this->guessGitVersion($packageConfig, $path);
  18768. if (null !== $versionData && null !== $versionData['version']) {
  18769. return $this->postprocess($versionData);
  18770. }
  18771. $versionData = $this->guessHgVersion($packageConfig, $path);
  18772. if (null !== $versionData && null !== $versionData['version']) {
  18773. return $this->postprocess($versionData);
  18774. }
  18775. $versionData = $this->guessFossilVersion($packageConfig, $path);
  18776. if (null !== $versionData && null !== $versionData['version']) {
  18777. return $this->postprocess($versionData);
  18778. }
  18779. $versionData = $this->guessSvnVersion($packageConfig, $path);
  18780. if (null !== $versionData && null !== $versionData['version']) {
  18781. return $this->postprocess($versionData);
  18782. }
  18783. }
  18784. }
  18785. private function postprocess(array $versionData)
  18786. {
  18787. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  18788. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  18789. }
  18790. return $versionData;
  18791. }
  18792. private function guessGitVersion(array $packageConfig, $path)
  18793. {
  18794. GitUtil::cleanEnv();
  18795. $commit = null;
  18796. $version = null;
  18797. $prettyVersion = null;
  18798. $isDetached = false;
  18799. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  18800. $branches = array();
  18801. $isFeatureBranch = false;
  18802. foreach ($this->process->splitLines($output) as $branch) {
  18803. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  18804. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  18805. $version = 'dev-' . $match[2];
  18806. $prettyVersion = $version;
  18807. $isFeatureBranch = true;
  18808. $isDetached = true;
  18809. } else {
  18810. $version = $this->versionParser->normalizeBranch($match[1]);
  18811. $prettyVersion = 'dev-' . $match[1];
  18812. $isFeatureBranch = 0 === strpos($version, 'dev-');
  18813. }
  18814. if ($match[2]) {
  18815. $commit = $match[2];
  18816. }
  18817. }
  18818. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  18819. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  18820. $branches[] = $match[1];
  18821. }
  18822. }
  18823. }
  18824. if ($isFeatureBranch) {
  18825. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  18826. $version = $result['version'];
  18827. $prettyVersion = $result['pretty_version'];
  18828. }
  18829. }
  18830. if (!$version || $isDetached) {
  18831. $result = $this->versionFromGitTags($path);
  18832. if ($result) {
  18833. $version = $result['version'];
  18834. $prettyVersion = $result['pretty_version'];
  18835. }
  18836. }
  18837. if (!$commit) {
  18838. $command = 'git log --pretty="%H" -n1 HEAD';
  18839. if (0 === $this->process->execute($command, $output, $path)) {
  18840. $commit = trim($output) ?: null;
  18841. }
  18842. }
  18843. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  18844. }
  18845. private function versionFromGitTags($path)
  18846. {
  18847. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  18848. try {
  18849. $version = $this->versionParser->normalize(trim($output));
  18850. return array('version' => $version, 'pretty_version' => trim($output));
  18851. } catch (\Exception $e) {
  18852. }
  18853. }
  18854. return null;
  18855. }
  18856. private function guessHgVersion(array $packageConfig, $path)
  18857. {
  18858. if (0 === $this->process->execute('hg branch', $output, $path)) {
  18859. $branch = trim($output);
  18860. $version = $this->versionParser->normalizeBranch($branch);
  18861. $isFeatureBranch = 0 === strpos($version, 'dev-');
  18862. if ('9999999-dev' === $version) {
  18863. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  18864. }
  18865. if (!$isFeatureBranch) {
  18866. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  18867. }
  18868. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  18869. $branches = array_keys($driver->getBranches());
  18870. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  18871. $result['commit'] = '';
  18872. return $result;
  18873. }
  18874. }
  18875. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  18876. {
  18877. $prettyVersion = $version;
  18878. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  18879. || strpos(json_encode($packageConfig), '"self.version"')
  18880. ) {
  18881. $branch = preg_replace('{^dev-}', '', $version);
  18882. $length = PHP_INT_MAX;
  18883. $nonFeatureBranches = '';
  18884. if (!empty($packageConfig['non-feature-branches'])) {
  18885. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  18886. }
  18887. foreach ($branches as $candidate) {
  18888. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  18889. break;
  18890. }
  18891. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  18892. continue;
  18893. }
  18894. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  18895. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  18896. continue;
  18897. }
  18898. if (strlen($output) < $length) {
  18899. $length = strlen($output);
  18900. $version = $this->versionParser->normalizeBranch($candidate);
  18901. $prettyVersion = 'dev-' . $match[1];
  18902. }
  18903. }
  18904. }
  18905. return array('version' => $version, 'pretty_version' => $prettyVersion);
  18906. }
  18907. private function guessFossilVersion(array $packageConfig, $path)
  18908. {
  18909. $version = null;
  18910. $prettyVersion = null;
  18911. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  18912. $branch = trim($output);
  18913. $version = $this->versionParser->normalizeBranch($branch);
  18914. $prettyVersion = 'dev-' . $branch;
  18915. }
  18916. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  18917. try {
  18918. $version = $this->versionParser->normalize(trim($output));
  18919. $prettyVersion = trim($output);
  18920. } catch (\Exception $e) {
  18921. }
  18922. }
  18923. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18924. }
  18925. private function guessSvnVersion(array $packageConfig, $path)
  18926. {
  18927. SvnUtil::cleanEnv();
  18928. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  18929. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  18930. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  18931. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  18932. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  18933. if (preg_match($urlPattern, $output, $matches)) {
  18934. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  18935. $version = $this->versionParser->normalizeBranch($matches[3]);
  18936. $prettyVersion = 'dev-' . $matches[3];
  18937. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18938. }
  18939. $prettyVersion = trim($matches[1]);
  18940. $version = $this->versionParser->normalize($prettyVersion);
  18941. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18942. }
  18943. }
  18944. }
  18945. }
  18946. <?php
  18947. namespace Composer\Package\Version;
  18948. use Composer\Repository\PlatformRepository;
  18949. use Composer\Semver\VersionParser as SemverVersionParser;
  18950. use Composer\Semver\Semver;
  18951. class VersionParser extends SemverVersionParser
  18952. {
  18953. private static $constraints = array();
  18954. public function parseConstraints($constraints)
  18955. {
  18956. if (!isset(self::$constraints[$constraints])) {
  18957. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  18958. }
  18959. return self::$constraints[$constraints];
  18960. }
  18961. public function parseNameVersionPairs(array $pairs)
  18962. {
  18963. $pairs = array_values($pairs);
  18964. $result = array();
  18965. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  18966. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  18967. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  18968. $pair .= ' '.$pairs[$i + 1];
  18969. $i++;
  18970. }
  18971. if (strpos($pair, ' ')) {
  18972. list($name, $version) = explode(' ', $pair, 2);
  18973. $result[] = array('name' => $name, 'version' => $version);
  18974. } else {
  18975. $result[] = array('name' => $pair);
  18976. }
  18977. }
  18978. return $result;
  18979. }
  18980. public static function isUpgrade($normalizedFrom, $normalizedTo)
  18981. {
  18982. if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') {
  18983. return true;
  18984. }
  18985. $sorted = Semver::sort(array($normalizedTo, $normalizedFrom));
  18986. return $sorted[0] === $normalizedFrom;
  18987. }
  18988. }
  18989. <?php
  18990. namespace Composer\Package\Version;
  18991. use Composer\DependencyResolver\Pool;
  18992. use Composer\Package\BasePackage;
  18993. use Composer\Package\PackageInterface;
  18994. use Composer\Package\Loader\ArrayLoader;
  18995. use Composer\Package\Dumper\ArrayDumper;
  18996. use Composer\Semver\Constraint\Constraint;
  18997. class VersionSelector
  18998. {
  18999. private $pool;
  19000. private $parser;
  19001. public function __construct(Pool $pool)
  19002. {
  19003. $this->pool = $pool;
  19004. }
  19005. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  19006. {
  19007. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  19008. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  19009. if ($targetPhpVersion) {
  19010. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  19011. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  19012. $reqs = $pkg->getRequires();
  19013. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  19014. });
  19015. }
  19016. if (!$candidates) {
  19017. return false;
  19018. }
  19019. $package = reset($candidates);
  19020. $minPriority = BasePackage::$stabilities[$preferredStability];
  19021. foreach ($candidates as $candidate) {
  19022. $candidatePriority = $candidate->getStabilityPriority();
  19023. $currentPriority = $package->getStabilityPriority();
  19024. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  19025. continue;
  19026. }
  19027. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  19028. $package = $candidate;
  19029. continue;
  19030. }
  19031. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  19032. $package = $candidate;
  19033. continue;
  19034. }
  19035. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  19036. $package = $candidate;
  19037. }
  19038. }
  19039. return $package;
  19040. }
  19041. public function findRecommendedRequireVersion(PackageInterface $package)
  19042. {
  19043. $version = $package->getVersion();
  19044. if (!$package->isDev()) {
  19045. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  19046. }
  19047. $loader = new ArrayLoader($this->getParser());
  19048. $dumper = new ArrayDumper();
  19049. $extra = $loader->getBranchAlias($dumper->dump($package));
  19050. if ($extra) {
  19051. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  19052. if ($count) {
  19053. $extra = str_replace('.9999999', '.0', $extra);
  19054. return $this->transformVersion($extra, $extra, 'dev');
  19055. }
  19056. }
  19057. return $package->getPrettyVersion();
  19058. }
  19059. private function transformVersion($version, $prettyVersion, $stability)
  19060. {
  19061. $semanticVersionParts = explode('.', $version);
  19062. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  19063. if ($semanticVersionParts[0] === '0') {
  19064. unset($semanticVersionParts[3]);
  19065. } else {
  19066. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  19067. }
  19068. $version = implode('.', $semanticVersionParts);
  19069. } else {
  19070. return $prettyVersion;
  19071. }
  19072. if ($stability != 'stable') {
  19073. $version .= '@'.$stability;
  19074. }
  19075. return '^' . $version;
  19076. }
  19077. private function getParser()
  19078. {
  19079. if ($this->parser === null) {
  19080. $this->parser = new VersionParser();
  19081. }
  19082. return $this->parser;
  19083. }
  19084. }
  19085. <?php
  19086. namespace Composer\Plugin\Capability;
  19087. interface Capability
  19088. {
  19089. }
  19090. <?php
  19091. namespace Composer\Plugin\Capability;
  19092. interface CommandProvider extends Capability
  19093. {
  19094. public function getCommands();
  19095. }
  19096. <?php
  19097. namespace Composer\Plugin;
  19098. interface Capable
  19099. {
  19100. public function getCapabilities();
  19101. }
  19102. <?php
  19103. namespace Composer\Plugin;
  19104. use Composer\EventDispatcher\Event;
  19105. use Symfony\Component\Console\Input\InputInterface;
  19106. use Symfony\Component\Console\Output\OutputInterface;
  19107. class CommandEvent extends Event
  19108. {
  19109. private $commandName;
  19110. private $input;
  19111. private $output;
  19112. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  19113. {
  19114. parent::__construct($name, $args, $flags);
  19115. $this->commandName = $commandName;
  19116. $this->input = $input;
  19117. $this->output = $output;
  19118. }
  19119. public function getInput()
  19120. {
  19121. return $this->input;
  19122. }
  19123. public function getOutput()
  19124. {
  19125. return $this->output;
  19126. }
  19127. public function getCommandName()
  19128. {
  19129. return $this->commandName;
  19130. }
  19131. }
  19132. <?php
  19133. namespace Composer\Plugin;
  19134. class PluginEvents
  19135. {
  19136. const INIT = 'init';
  19137. const COMMAND = 'command';
  19138. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  19139. const PRE_COMMAND_RUN = 'pre-command-run';
  19140. }
  19141. <?php
  19142. namespace Composer\Plugin;
  19143. use Composer\Composer;
  19144. use Composer\IO\IOInterface;
  19145. interface PluginInterface
  19146. {
  19147. const PLUGIN_API_VERSION = '1.1.0';
  19148. public function activate(Composer $composer, IOInterface $io);
  19149. }
  19150. <?php
  19151. namespace Composer\Plugin;
  19152. use Composer\Composer;
  19153. use Composer\EventDispatcher\EventSubscriberInterface;
  19154. use Composer\IO\IOInterface;
  19155. use Composer\Package\Package;
  19156. use Composer\Package\Version\VersionParser;
  19157. use Composer\Repository\RepositoryInterface;
  19158. use Composer\Package\AliasPackage;
  19159. use Composer\Package\PackageInterface;
  19160. use Composer\Package\Link;
  19161. use Composer\Semver\Constraint\Constraint;
  19162. use Composer\DependencyResolver\Pool;
  19163. use Composer\Plugin\Capability\Capability;
  19164. class PluginManager
  19165. {
  19166. protected $composer;
  19167. protected $io;
  19168. protected $globalComposer;
  19169. protected $versionParser;
  19170. protected $disablePlugins = false;
  19171. protected $plugins = array();
  19172. protected $registeredPlugins = array();
  19173. private static $classCounter = 0;
  19174. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  19175. {
  19176. $this->io = $io;
  19177. $this->composer = $composer;
  19178. $this->globalComposer = $globalComposer;
  19179. $this->versionParser = new VersionParser();
  19180. $this->disablePlugins = $disablePlugins;
  19181. }
  19182. public function loadInstalledPlugins()
  19183. {
  19184. if ($this->disablePlugins) {
  19185. return;
  19186. }
  19187. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  19188. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19189. if ($repo) {
  19190. $this->loadRepository($repo);
  19191. }
  19192. if ($globalRepo) {
  19193. $this->loadRepository($globalRepo);
  19194. }
  19195. }
  19196. public function getPlugins()
  19197. {
  19198. return $this->plugins;
  19199. }
  19200. public function getGlobalComposer()
  19201. {
  19202. return $this->globalComposer;
  19203. }
  19204. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  19205. {
  19206. if ($this->disablePlugins) {
  19207. return;
  19208. }
  19209. if ($package->getType() === 'composer-plugin') {
  19210. $requiresComposer = null;
  19211. foreach ($package->getRequires() as $link) {
  19212. if ('composer-plugin-api' === $link->getTarget()) {
  19213. $requiresComposer = $link->getConstraint();
  19214. break;
  19215. }
  19216. }
  19217. if (!$requiresComposer) {
  19218. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  19219. }
  19220. $currentPluginApiVersion = $this->getPluginApiVersion();
  19221. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  19222. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  19223. $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>');
  19224. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  19225. $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>');
  19226. return;
  19227. }
  19228. }
  19229. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  19230. if (in_array($package->getName(), $this->registeredPlugins)) {
  19231. return;
  19232. }
  19233. $extra = $package->getExtra();
  19234. if (empty($extra['class'])) {
  19235. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  19236. }
  19237. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  19238. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  19239. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19240. $pool = new Pool('dev');
  19241. $pool->addRepository($localRepo);
  19242. if ($globalRepo) {
  19243. $pool->addRepository($globalRepo);
  19244. }
  19245. $autoloadPackages = array($package->getName() => $package);
  19246. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  19247. $generator = $this->composer->getAutoloadGenerator();
  19248. $autoloads = array();
  19249. foreach ($autoloadPackages as $autoloadPackage) {
  19250. $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  19251. $autoloads[] = array($autoloadPackage, $downloadPath);
  19252. }
  19253. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  19254. $classLoader = $generator->createLoader($map);
  19255. $classLoader->register();
  19256. foreach ($classes as $class) {
  19257. if (class_exists($class, false)) {
  19258. $class = trim($class, '\\');
  19259. $path = $classLoader->findFile($class);
  19260. $code = file_get_contents($path);
  19261. $separatorPos = strrpos($class, '\\');
  19262. $className = $class;
  19263. if ($separatorPos) {
  19264. $className = substr($class, $separatorPos + 1);
  19265. }
  19266. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  19267. $code = str_replace('__FILE__', var_export($path, true), $code);
  19268. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  19269. $code = str_replace('__CLASS__', var_export($class, true), $code);
  19270. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  19271. eval($code);
  19272. $class .= '_composer_tmp'.self::$classCounter;
  19273. self::$classCounter++;
  19274. }
  19275. if ($oldInstallerPlugin) {
  19276. $installer = new $class($this->io, $this->composer);
  19277. $this->composer->getInstallationManager()->addInstaller($installer);
  19278. } elseif (class_exists($class)) {
  19279. $plugin = new $class();
  19280. $this->addPlugin($plugin);
  19281. $this->registeredPlugins[] = $package->getName();
  19282. } elseif ($failOnMissingClasses) {
  19283. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  19284. }
  19285. }
  19286. }
  19287. protected function getPluginApiVersion()
  19288. {
  19289. return PluginInterface::PLUGIN_API_VERSION;
  19290. }
  19291. public function addPlugin(PluginInterface $plugin)
  19292. {
  19293. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  19294. $this->plugins[] = $plugin;
  19295. $plugin->activate($this->composer, $this->io);
  19296. if ($plugin instanceof EventSubscriberInterface) {
  19297. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  19298. }
  19299. }
  19300. private function loadRepository(RepositoryInterface $repo)
  19301. {
  19302. foreach ($repo->getPackages() as $package) {
  19303. if ($package instanceof AliasPackage) {
  19304. continue;
  19305. }
  19306. if ('composer-plugin' === $package->getType()) {
  19307. $this->registerPackage($package);
  19308. } elseif ('composer-installer' === $package->getType()) {
  19309. $this->registerPackage($package);
  19310. }
  19311. }
  19312. }
  19313. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  19314. {
  19315. $requires = array_merge(
  19316. $package->getRequires(),
  19317. $package->getDevRequires()
  19318. );
  19319. foreach ($requires as $requireLink) {
  19320. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  19321. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  19322. $collected[$requiredPackage->getName()] = $requiredPackage;
  19323. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  19324. }
  19325. }
  19326. return $collected;
  19327. }
  19328. private function lookupInstalledPackage(Pool $pool, Link $link)
  19329. {
  19330. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  19331. return !empty($packages) ? $packages[0] : null;
  19332. }
  19333. private function getInstallPath(PackageInterface $package, $global = false)
  19334. {
  19335. if (!$global) {
  19336. return $this->composer->getInstallationManager()->getInstallPath($package);
  19337. }
  19338. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  19339. }
  19340. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  19341. {
  19342. if (!($plugin instanceof Capable)) {
  19343. return null;
  19344. }
  19345. $capabilities = (array) $plugin->getCapabilities();
  19346. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  19347. return trim($capabilities[$capability]);
  19348. }
  19349. if (
  19350. array_key_exists($capability, $capabilities)
  19351. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  19352. ) {
  19353. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  19354. }
  19355. }
  19356. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  19357. {
  19358. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  19359. if (!class_exists($capabilityClass)) {
  19360. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  19361. }
  19362. $ctorArgs['plugin'] = $plugin;
  19363. $capabilityObj = new $capabilityClass($ctorArgs);
  19364. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  19365. throw new \RuntimeException(
  19366. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  19367. );
  19368. }
  19369. return $capabilityObj;
  19370. }
  19371. }
  19372. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  19373. {
  19374. $capabilities = array();
  19375. foreach ($this->getPlugins() as $plugin) {
  19376. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  19377. $capabilities[] = $capability;
  19378. }
  19379. }
  19380. return $capabilities;
  19381. }
  19382. }
  19383. <?php
  19384. namespace Composer\Plugin;
  19385. use Composer\EventDispatcher\Event;
  19386. use Symfony\Component\Console\Input\InputInterface;
  19387. class PreCommandRunEvent extends Event
  19388. {
  19389. private $input;
  19390. private $command;
  19391. public function __construct($name, InputInterface $input, $command)
  19392. {
  19393. parent::__construct($name);
  19394. $this->input = $input;
  19395. $this->command = $command;
  19396. }
  19397. public function getInput()
  19398. {
  19399. return $this->input;
  19400. }
  19401. public function getCommand()
  19402. {
  19403. return $this->command;
  19404. }
  19405. }
  19406. <?php
  19407. namespace Composer\Plugin;
  19408. use Composer\EventDispatcher\Event;
  19409. use Composer\Util\RemoteFilesystem;
  19410. class PreFileDownloadEvent extends Event
  19411. {
  19412. private $rfs;
  19413. private $processedUrl;
  19414. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  19415. {
  19416. parent::__construct($name);
  19417. $this->rfs = $rfs;
  19418. $this->processedUrl = $processedUrl;
  19419. }
  19420. public function getRemoteFilesystem()
  19421. {
  19422. return $this->rfs;
  19423. }
  19424. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  19425. {
  19426. $this->rfs = $rfs;
  19427. }
  19428. public function getProcessedUrl()
  19429. {
  19430. return $this->processedUrl;
  19431. }
  19432. }
  19433. <?php
  19434. namespace Composer\Question;
  19435. use Symfony\Component\Console\Exception\InvalidArgumentException;
  19436. use Symfony\Component\Console\Question\Question;
  19437. class StrictConfirmationQuestion extends Question
  19438. {
  19439. private $trueAnswerRegex;
  19440. private $falseAnswerRegex;
  19441. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  19442. {
  19443. parent::__construct($question, (bool) $default);
  19444. $this->trueAnswerRegex = $trueAnswerRegex;
  19445. $this->falseAnswerRegex = $falseAnswerRegex;
  19446. $this->setNormalizer($this->getDefaultNormalizer());
  19447. $this->setValidator($this->getDefaultValidator());
  19448. }
  19449. private function getDefaultNormalizer()
  19450. {
  19451. $default = $this->getDefault();
  19452. $trueRegex = $this->trueAnswerRegex;
  19453. $falseRegex = $this->falseAnswerRegex;
  19454. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  19455. if (is_bool($answer)) {
  19456. return $answer;
  19457. }
  19458. if (empty($answer) && !empty($default)) {
  19459. return $default;
  19460. }
  19461. if (preg_match($trueRegex, $answer)) {
  19462. return true;
  19463. }
  19464. if (preg_match($falseRegex, $answer)) {
  19465. return false;
  19466. }
  19467. return null;
  19468. };
  19469. }
  19470. private function getDefaultValidator()
  19471. {
  19472. return function ($answer) {
  19473. if (!is_bool($answer)) {
  19474. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  19475. }
  19476. return $answer;
  19477. };
  19478. }
  19479. }
  19480. <?php
  19481. namespace Composer\Repository;
  19482. use Composer\Package\AliasPackage;
  19483. use Composer\Package\PackageInterface;
  19484. use Composer\Package\CompletePackageInterface;
  19485. use Composer\Package\Version\VersionParser;
  19486. use Composer\Semver\Constraint\ConstraintInterface;
  19487. use Composer\Semver\Constraint\Constraint;
  19488. class ArrayRepository extends BaseRepository
  19489. {
  19490. protected $packages;
  19491. public function __construct(array $packages = array())
  19492. {
  19493. foreach ($packages as $package) {
  19494. $this->addPackage($package);
  19495. }
  19496. }
  19497. public function findPackage($name, $constraint)
  19498. {
  19499. $name = strtolower($name);
  19500. if (!$constraint instanceof ConstraintInterface) {
  19501. $versionParser = new VersionParser();
  19502. $constraint = $versionParser->parseConstraints($constraint);
  19503. }
  19504. foreach ($this->getPackages() as $package) {
  19505. if ($name === $package->getName()) {
  19506. $pkgConstraint = new Constraint('==', $package->getVersion());
  19507. if ($constraint->matches($pkgConstraint)) {
  19508. return $package;
  19509. }
  19510. }
  19511. }
  19512. return null;
  19513. }
  19514. public function findPackages($name, $constraint = null)
  19515. {
  19516. $name = strtolower($name);
  19517. $packages = array();
  19518. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19519. $versionParser = new VersionParser();
  19520. $constraint = $versionParser->parseConstraints($constraint);
  19521. }
  19522. foreach ($this->getPackages() as $package) {
  19523. if ($name === $package->getName()) {
  19524. $pkgConstraint = new Constraint('==', $package->getVersion());
  19525. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19526. $packages[] = $package;
  19527. }
  19528. }
  19529. }
  19530. return $packages;
  19531. }
  19532. public function search($query, $mode = 0, $type = null)
  19533. {
  19534. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19535. $matches = array();
  19536. foreach ($this->getPackages() as $package) {
  19537. $name = $package->getName();
  19538. if (isset($matches[$name])) {
  19539. continue;
  19540. }
  19541. if (preg_match($regex, $name)
  19542. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  19543. ) {
  19544. if (null !== $type && $package->getType() !== $type) {
  19545. continue;
  19546. }
  19547. $matches[$name] = array(
  19548. 'name' => $package->getPrettyName(),
  19549. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  19550. );
  19551. }
  19552. }
  19553. return array_values($matches);
  19554. }
  19555. public function hasPackage(PackageInterface $package)
  19556. {
  19557. $packageId = $package->getUniqueName();
  19558. foreach ($this->getPackages() as $repoPackage) {
  19559. if ($packageId === $repoPackage->getUniqueName()) {
  19560. return true;
  19561. }
  19562. }
  19563. return false;
  19564. }
  19565. public function addPackage(PackageInterface $package)
  19566. {
  19567. if (null === $this->packages) {
  19568. $this->initialize();
  19569. }
  19570. $package->setRepository($this);
  19571. $this->packages[] = $package;
  19572. if ($package instanceof AliasPackage) {
  19573. $aliasedPackage = $package->getAliasOf();
  19574. if (null === $aliasedPackage->getRepository()) {
  19575. $this->addPackage($aliasedPackage);
  19576. }
  19577. }
  19578. }
  19579. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  19580. {
  19581. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  19582. }
  19583. public function removePackage(PackageInterface $package)
  19584. {
  19585. $packageId = $package->getUniqueName();
  19586. foreach ($this->getPackages() as $key => $repoPackage) {
  19587. if ($packageId === $repoPackage->getUniqueName()) {
  19588. array_splice($this->packages, $key, 1);
  19589. return;
  19590. }
  19591. }
  19592. }
  19593. public function getPackages()
  19594. {
  19595. if (null === $this->packages) {
  19596. $this->initialize();
  19597. }
  19598. return $this->packages;
  19599. }
  19600. public function count()
  19601. {
  19602. return count($this->packages);
  19603. }
  19604. protected function initialize()
  19605. {
  19606. $this->packages = array();
  19607. }
  19608. }
  19609. <?php
  19610. namespace Composer\Repository;
  19611. use Composer\IO\IOInterface;
  19612. use Composer\Json\JsonFile;
  19613. use Composer\Package\Loader\ArrayLoader;
  19614. use Composer\Package\Loader\LoaderInterface;
  19615. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19616. {
  19617. protected $loader;
  19618. protected $lookup;
  19619. protected $repoConfig;
  19620. private $io;
  19621. public function __construct(array $repoConfig, IOInterface $io)
  19622. {
  19623. parent::__construct();
  19624. if (!extension_loaded('zip')) {
  19625. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  19626. }
  19627. $this->loader = new ArrayLoader();
  19628. $this->lookup = $repoConfig['url'];
  19629. $this->io = $io;
  19630. $this->repoConfig = $repoConfig;
  19631. }
  19632. public function getRepoConfig()
  19633. {
  19634. return $this->repoConfig;
  19635. }
  19636. protected function initialize()
  19637. {
  19638. parent::initialize();
  19639. $this->scanDirectory($this->lookup);
  19640. }
  19641. private function scanDirectory($path)
  19642. {
  19643. $io = $this->io;
  19644. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  19645. $iterator = new \RecursiveIteratorIterator($directory);
  19646. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  19647. foreach ($regex as $file) {
  19648. if (!$file->isFile()) {
  19649. continue;
  19650. }
  19651. $package = $this->getComposerInformation($file);
  19652. if (!$package) {
  19653. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  19654. continue;
  19655. }
  19656. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  19657. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  19658. $this->addPackage($package);
  19659. }
  19660. }
  19661. private function locateFile(\ZipArchive $zip, $filename)
  19662. {
  19663. $indexOfShortestMatch = false;
  19664. $lengthOfShortestMatch = -1;
  19665. for ($i = 0; $i < $zip->numFiles; $i++) {
  19666. $stat = $zip->statIndex($i);
  19667. if (strcmp(basename($stat['name']), $filename) === 0) {
  19668. $directoryName = dirname($stat['name']);
  19669. if ($directoryName == '.') {
  19670. return $i;
  19671. }
  19672. if (strpos($directoryName, '\\') !== false ||
  19673. strpos($directoryName, '/') !== false) {
  19674. continue;
  19675. }
  19676. $length = strlen($stat['name']);
  19677. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  19678. $contents = $zip->getFromIndex($i);
  19679. if ($contents !== false) {
  19680. $indexOfShortestMatch = $i;
  19681. $lengthOfShortestMatch = $length;
  19682. }
  19683. }
  19684. }
  19685. }
  19686. return $indexOfShortestMatch;
  19687. }
  19688. private function getComposerInformation(\SplFileInfo $file)
  19689. {
  19690. $zip = new \ZipArchive();
  19691. $zip->open($file->getPathname());
  19692. if (0 == $zip->numFiles) {
  19693. $zip->close();
  19694. return false;
  19695. }
  19696. $foundFileIndex = $this->locateFile($zip, 'composer.json');
  19697. if (false === $foundFileIndex) {
  19698. $zip->close();
  19699. return false;
  19700. }
  19701. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  19702. $zip->close();
  19703. $composerFile = "zip://{$file->getPathname()}#$configurationFileName";
  19704. $json = file_get_contents($composerFile);
  19705. $package = JsonFile::parseJson($json, $composerFile);
  19706. $package['dist'] = array(
  19707. 'type' => 'zip',
  19708. 'url' => strtr($file->getPathname(), '\\', '/'),
  19709. 'shasum' => sha1_file($file->getRealPath()),
  19710. );
  19711. try {
  19712. $package = $this->loader->load($package);
  19713. } catch (\UnexpectedValueException $e) {
  19714. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  19715. }
  19716. return $package;
  19717. }
  19718. }
  19719. <?php
  19720. namespace Composer\Repository;
  19721. use Composer\Package\RootPackageInterface;
  19722. use Composer\Semver\Constraint\ConstraintInterface;
  19723. use Composer\Semver\Constraint\Constraint;
  19724. use Composer\Package\Link;
  19725. abstract class BaseRepository implements RepositoryInterface
  19726. {
  19727. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  19728. {
  19729. $needles = array_map('strtolower', (array) $needle);
  19730. $results = array();
  19731. if (null === $packagesFound) {
  19732. $packagesFound = $needles;
  19733. }
  19734. $rootPackage = null;
  19735. foreach ($this->getPackages() as $package) {
  19736. if ($package instanceof RootPackageInterface) {
  19737. $rootPackage = $package;
  19738. break;
  19739. }
  19740. }
  19741. foreach ($this->getPackages() as $package) {
  19742. $links = $package->getRequires();
  19743. $packagesInTree = $packagesFound;
  19744. if (!$invert) {
  19745. $links += $package->getReplaces();
  19746. }
  19747. if ($package instanceof RootPackageInterface) {
  19748. $links += $package->getDevRequires();
  19749. }
  19750. foreach ($links as $link) {
  19751. foreach ($needles as $needle) {
  19752. if ($link->getTarget() === $needle) {
  19753. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  19754. if (in_array($link->getSource(), $packagesInTree)) {
  19755. $results[$link->getSource()] = array($package, $link, false);
  19756. continue;
  19757. }
  19758. $packagesInTree[] = $link->getSource();
  19759. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  19760. $results[$link->getSource()] = array($package, $link, $dependents);
  19761. }
  19762. }
  19763. }
  19764. }
  19765. if ($invert && in_array($package->getName(), $needles)) {
  19766. foreach ($package->getConflicts() as $link) {
  19767. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  19768. $version = new Constraint('=', $pkg->getVersion());
  19769. if ($link->getConstraint()->matches($version) === $invert) {
  19770. $results[] = array($package, $link, false);
  19771. }
  19772. }
  19773. }
  19774. }
  19775. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  19776. foreach ($package->getRequires() as $link) {
  19777. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  19778. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  19779. continue;
  19780. }
  19781. $platformPkg = $this->findPackage($link->getTarget(), '*');
  19782. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  19783. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  19784. continue;
  19785. }
  19786. foreach ($this->getPackages() as $pkg) {
  19787. if (!in_array($link->getTarget(), $pkg->getNames())) {
  19788. continue;
  19789. }
  19790. $version = new Constraint('=', $pkg->getVersion());
  19791. if (!$link->getConstraint()->matches($version)) {
  19792. if ($rootPackage) {
  19793. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  19794. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  19795. $results[] = array($package, $link, false);
  19796. $results[] = array($rootPackage, $rootReq, false);
  19797. continue 3;
  19798. }
  19799. }
  19800. $results[] = array($package, $link, false);
  19801. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  19802. } else {
  19803. $results[] = array($package, $link, false);
  19804. }
  19805. }
  19806. continue 2;
  19807. }
  19808. }
  19809. }
  19810. }
  19811. ksort($results);
  19812. return $results;
  19813. }
  19814. }
  19815. <?php
  19816. namespace Composer\Repository;
  19817. use Composer\Package\Loader\ArrayLoader;
  19818. use Composer\Package\PackageInterface;
  19819. use Composer\Package\AliasPackage;
  19820. use Composer\Package\Version\VersionParser;
  19821. use Composer\DependencyResolver\Pool;
  19822. use Composer\Json\JsonFile;
  19823. use Composer\Cache;
  19824. use Composer\Config;
  19825. use Composer\Factory;
  19826. use Composer\IO\IOInterface;
  19827. use Composer\Util\RemoteFilesystem;
  19828. use Composer\Plugin\PluginEvents;
  19829. use Composer\Plugin\PreFileDownloadEvent;
  19830. use Composer\EventDispatcher\EventDispatcher;
  19831. use Composer\Downloader\TransportException;
  19832. use Composer\Semver\Constraint\ConstraintInterface;
  19833. use Composer\Semver\Constraint\Constraint;
  19834. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19835. {
  19836. protected $config;
  19837. protected $repoConfig;
  19838. protected $options;
  19839. protected $url;
  19840. protected $baseUrl;
  19841. protected $io;
  19842. protected $rfs;
  19843. protected $cache;
  19844. protected $notifyUrl;
  19845. protected $searchUrl;
  19846. protected $hasProviders = false;
  19847. protected $providersUrl;
  19848. protected $lazyProvidersUrl;
  19849. protected $providerListing;
  19850. protected $providers = array();
  19851. protected $providersByUid = array();
  19852. protected $loader;
  19853. protected $rootAliases;
  19854. protected $allowSslDowngrade = false;
  19855. protected $eventDispatcher;
  19856. protected $sourceMirrors;
  19857. protected $distMirrors;
  19858. private $degradedMode = false;
  19859. private $rootData;
  19860. private $hasPartialPackages;
  19861. private $partialPackagesByName;
  19862. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  19863. {
  19864. parent::__construct();
  19865. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  19866. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  19867. }
  19868. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  19869. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  19870. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  19871. }
  19872. $urlBits = parse_url($repoConfig['url']);
  19873. if ($urlBits === false || empty($urlBits['scheme'])) {
  19874. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  19875. }
  19876. if (!isset($repoConfig['options'])) {
  19877. $repoConfig['options'] = array();
  19878. }
  19879. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  19880. $this->allowSslDowngrade = true;
  19881. }
  19882. $this->config = $config;
  19883. $this->options = $repoConfig['options'];
  19884. $this->url = $repoConfig['url'];
  19885. if (preg_match('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  19886. $this->url = $match['proto'].'://repo.packagist.org';
  19887. }
  19888. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  19889. $this->io = $io;
  19890. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  19891. $this->loader = new ArrayLoader();
  19892. if ($rfs && $this->options) {
  19893. $rfs = clone $rfs;
  19894. $rfs->setOptions($this->options);
  19895. }
  19896. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  19897. $this->eventDispatcher = $eventDispatcher;
  19898. $this->repoConfig = $repoConfig;
  19899. }
  19900. public function getRepoConfig()
  19901. {
  19902. return $this->repoConfig;
  19903. }
  19904. public function setRootAliases(array $rootAliases)
  19905. {
  19906. $this->rootAliases = $rootAliases;
  19907. }
  19908. public function findPackage($name, $constraint)
  19909. {
  19910. if (!$this->hasProviders()) {
  19911. return parent::findPackage($name, $constraint);
  19912. }
  19913. $name = strtolower($name);
  19914. if (!$constraint instanceof ConstraintInterface) {
  19915. $versionParser = new VersionParser();
  19916. $constraint = $versionParser->parseConstraints($constraint);
  19917. }
  19918. foreach ($this->getProviderNames() as $providerName) {
  19919. if ($name === $providerName) {
  19920. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  19921. foreach ($packages as $package) {
  19922. if ($name === $package->getName()) {
  19923. $pkgConstraint = new Constraint('==', $package->getVersion());
  19924. if ($constraint->matches($pkgConstraint)) {
  19925. return $package;
  19926. }
  19927. }
  19928. }
  19929. break;
  19930. }
  19931. }
  19932. }
  19933. public function findPackages($name, $constraint = null)
  19934. {
  19935. if (!$this->hasProviders()) {
  19936. return parent::findPackages($name, $constraint);
  19937. }
  19938. $name = strtolower($name);
  19939. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19940. $versionParser = new VersionParser();
  19941. $constraint = $versionParser->parseConstraints($constraint);
  19942. }
  19943. $packages = array();
  19944. foreach ($this->getProviderNames() as $providerName) {
  19945. if ($name === $providerName) {
  19946. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  19947. foreach ($candidates as $package) {
  19948. if ($name === $package->getName()) {
  19949. $pkgConstraint = new Constraint('==', $package->getVersion());
  19950. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19951. $packages[] = $package;
  19952. }
  19953. }
  19954. }
  19955. break;
  19956. }
  19957. }
  19958. return $packages;
  19959. }
  19960. public function getPackages()
  19961. {
  19962. if ($this->hasProviders()) {
  19963. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  19964. }
  19965. return parent::getPackages();
  19966. }
  19967. public function search($query, $mode = 0, $type = null)
  19968. {
  19969. $this->loadRootServerFile();
  19970. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  19971. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  19972. $hostname = parse_url($url, PHP_URL_HOST) ?: $url;
  19973. $json = $this->rfs->getContents($hostname, $url, false);
  19974. $search = JsonFile::parseJson($json, $url);
  19975. if (empty($search['results'])) {
  19976. return array();
  19977. }
  19978. $results = array();
  19979. foreach ($search['results'] as $result) {
  19980. if (empty($result['virtual'])) {
  19981. $results[] = $result;
  19982. }
  19983. }
  19984. return $results;
  19985. }
  19986. if ($this->hasProviders()) {
  19987. $results = array();
  19988. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19989. foreach ($this->getProviderNames() as $name) {
  19990. if (preg_match($regex, $name)) {
  19991. $results[] = array('name' => $name);
  19992. }
  19993. }
  19994. return $results;
  19995. }
  19996. return parent::search($query, $mode);
  19997. }
  19998. public function getProviderNames()
  19999. {
  20000. $this->loadRootServerFile();
  20001. if (null === $this->providerListing) {
  20002. $this->loadProviderListings($this->loadRootServerFile());
  20003. }
  20004. if ($this->lazyProvidersUrl) {
  20005. return array();
  20006. }
  20007. if ($this->providersUrl) {
  20008. return array_keys($this->providerListing);
  20009. }
  20010. return array();
  20011. }
  20012. protected function configurePackageTransportOptions(PackageInterface $package)
  20013. {
  20014. foreach ($package->getDistUrls() as $url) {
  20015. if (strpos($url, $this->baseUrl) === 0) {
  20016. $package->setTransportOptions($this->options);
  20017. return;
  20018. }
  20019. }
  20020. }
  20021. public function hasProviders()
  20022. {
  20023. $this->loadRootServerFile();
  20024. return $this->hasProviders;
  20025. }
  20026. public function resetPackageIds()
  20027. {
  20028. foreach ($this->providersByUid as $package) {
  20029. if ($package instanceof AliasPackage) {
  20030. $package->getAliasOf()->setId(-1);
  20031. }
  20032. $package->setId(-1);
  20033. }
  20034. }
  20035. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  20036. {
  20037. if (isset($this->providers[$name]) && !$bypassFilters) {
  20038. return $this->providers[$name];
  20039. }
  20040. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  20041. $this->initializePartialPackages();
  20042. }
  20043. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  20044. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  20045. return array();
  20046. }
  20047. if (null === $this->providerListing) {
  20048. $this->loadProviderListings($this->loadRootServerFile());
  20049. }
  20050. $useLastModifiedCheck = false;
  20051. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  20052. $hash = null;
  20053. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  20054. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20055. $useLastModifiedCheck = true;
  20056. } elseif ($this->providersUrl) {
  20057. if (!isset($this->providerListing[$name])) {
  20058. return array();
  20059. }
  20060. $hash = $this->providerListing[$name]['sha256'];
  20061. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  20062. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20063. } else {
  20064. return array();
  20065. }
  20066. $packages = null;
  20067. if ($cacheKey) {
  20068. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  20069. $packages = json_decode($this->cache->read($cacheKey), true);
  20070. } elseif ($useLastModifiedCheck) {
  20071. if ($contents = $this->cache->read($cacheKey)) {
  20072. $contents = json_decode($contents, true);
  20073. if (isset($contents['last-modified'])) {
  20074. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  20075. if (true === $response) {
  20076. $packages = $contents;
  20077. } elseif ($response) {
  20078. $packages = $response;
  20079. }
  20080. }
  20081. }
  20082. }
  20083. }
  20084. if (!$packages) {
  20085. try {
  20086. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  20087. } catch (TransportException $e) {
  20088. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  20089. $packages = array('packages' => array());
  20090. } else {
  20091. throw $e;
  20092. }
  20093. }
  20094. }
  20095. $loadingPartialPackage = false;
  20096. } else {
  20097. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  20098. $loadingPartialPackage = true;
  20099. }
  20100. $this->providers[$name] = array();
  20101. foreach ($packages['packages'] as $versions) {
  20102. foreach ($versions as $version) {
  20103. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  20104. continue;
  20105. }
  20106. if (isset($this->providersByUid[$version['uid']])) {
  20107. if (!isset($this->providers[$name][$version['uid']])) {
  20108. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  20109. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  20110. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  20111. } else {
  20112. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  20113. }
  20114. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  20115. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  20116. }
  20117. }
  20118. } else {
  20119. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  20120. continue;
  20121. }
  20122. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  20123. $package->setRepository($this);
  20124. if ($package instanceof AliasPackage) {
  20125. $aliased = $package->getAliasOf();
  20126. $aliased->setRepository($this);
  20127. $this->providers[$name][$version['uid']] = $aliased;
  20128. $this->providers[$name][$version['uid'].'-alias'] = $package;
  20129. $this->providersByUid[$version['uid']] = $package;
  20130. } else {
  20131. $this->providers[$name][$version['uid']] = $package;
  20132. $this->providersByUid[$version['uid']] = $package;
  20133. }
  20134. unset($rootAliasData);
  20135. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  20136. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  20137. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  20138. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  20139. }
  20140. if (isset($rootAliasData)) {
  20141. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  20142. $alias->setRepository($this);
  20143. $this->providers[$name][$version['uid'].'-root'] = $alias;
  20144. $this->providersByUid[$version['uid'].'-root'] = $alias;
  20145. }
  20146. }
  20147. }
  20148. }
  20149. $result = $this->providers[$name];
  20150. if ($bypassFilters) {
  20151. foreach ($this->providers[$name] as $uid => $provider) {
  20152. unset($this->providersByUid[$uid]);
  20153. }
  20154. unset($this->providers[$name]);
  20155. }
  20156. return $result;
  20157. }
  20158. protected function initialize()
  20159. {
  20160. parent::initialize();
  20161. $repoData = $this->loadDataFromServer();
  20162. foreach ($repoData as $package) {
  20163. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  20164. }
  20165. }
  20166. public function addPackage(PackageInterface $package)
  20167. {
  20168. parent::addPackage($package);
  20169. $this->configurePackageTransportOptions($package);
  20170. }
  20171. protected function loadRootServerFile()
  20172. {
  20173. if (null !== $this->rootData) {
  20174. return $this->rootData;
  20175. }
  20176. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  20177. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  20178. }
  20179. $jsonUrlParts = parse_url($this->url);
  20180. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  20181. $jsonUrl = $this->url;
  20182. } else {
  20183. $jsonUrl = $this->url . '/packages.json';
  20184. }
  20185. $data = $this->fetchFile($jsonUrl, 'packages.json');
  20186. if (!empty($data['notify-batch'])) {
  20187. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  20188. } elseif (!empty($data['notify'])) {
  20189. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  20190. }
  20191. if (!empty($data['search'])) {
  20192. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  20193. }
  20194. if (!empty($data['mirrors'])) {
  20195. foreach ($data['mirrors'] as $mirror) {
  20196. if (!empty($mirror['git-url'])) {
  20197. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  20198. }
  20199. if (!empty($mirror['hg-url'])) {
  20200. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  20201. }
  20202. if (!empty($mirror['dist-url'])) {
  20203. $this->distMirrors[] = array(
  20204. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  20205. 'preferred' => !empty($mirror['preferred']),
  20206. );
  20207. }
  20208. }
  20209. }
  20210. if (!empty($data['providers-lazy-url'])) {
  20211. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  20212. $this->hasProviders = true;
  20213. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  20214. }
  20215. if ($this->allowSslDowngrade) {
  20216. $this->url = str_replace('https://', 'http://', $this->url);
  20217. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  20218. }
  20219. if (!empty($data['providers-url'])) {
  20220. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  20221. $this->hasProviders = true;
  20222. }
  20223. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  20224. $this->hasProviders = true;
  20225. }
  20226. if (preg_match('{^https?://repo\.packagist\.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  20227. $this->url = 'https://repo.packagist.org';
  20228. $this->baseUrl = 'https://repo.packagist.org';
  20229. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://repo.packagist.org/p/%package%.json');
  20230. $this->providersUrl = null;
  20231. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  20232. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  20233. $this->providersUrl = null;
  20234. }
  20235. return $this->rootData = $data;
  20236. }
  20237. protected function canonicalizeUrl($url)
  20238. {
  20239. if ('/' === $url[0]) {
  20240. return preg_replace('{(https?://[^/]+).*}i', '$1' . $url, $this->url);
  20241. }
  20242. return $url;
  20243. }
  20244. protected function loadDataFromServer()
  20245. {
  20246. $data = $this->loadRootServerFile();
  20247. return $this->loadIncludes($data);
  20248. }
  20249. protected function loadProviderListings($data)
  20250. {
  20251. if (isset($data['providers'])) {
  20252. if (!is_array($this->providerListing)) {
  20253. $this->providerListing = array();
  20254. }
  20255. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  20256. }
  20257. if ($this->providersUrl && isset($data['provider-includes'])) {
  20258. $includes = $data['provider-includes'];
  20259. foreach ($includes as $include => $metadata) {
  20260. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  20261. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  20262. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  20263. $includedData = json_decode($this->cache->read($cacheKey), true);
  20264. } else {
  20265. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  20266. }
  20267. $this->loadProviderListings($includedData);
  20268. }
  20269. }
  20270. }
  20271. protected function loadIncludes($data)
  20272. {
  20273. $packages = array();
  20274. if (!isset($data['packages']) && !isset($data['includes'])) {
  20275. foreach ($data as $pkg) {
  20276. foreach ($pkg['versions'] as $metadata) {
  20277. $packages[] = $metadata;
  20278. }
  20279. }
  20280. return $packages;
  20281. }
  20282. if (isset($data['packages'])) {
  20283. foreach ($data['packages'] as $package => $versions) {
  20284. foreach ($versions as $version => $metadata) {
  20285. $packages[] = $metadata;
  20286. }
  20287. }
  20288. }
  20289. if (isset($data['includes'])) {
  20290. foreach ($data['includes'] as $include => $metadata) {
  20291. if ($this->cache->sha1($include) === $metadata['sha1']) {
  20292. $includedData = json_decode($this->cache->read($include), true);
  20293. } else {
  20294. $includedData = $this->fetchFile($include);
  20295. }
  20296. $packages = array_merge($packages, $this->loadIncludes($includedData));
  20297. }
  20298. }
  20299. return $packages;
  20300. }
  20301. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  20302. {
  20303. try {
  20304. if (!isset($data['notification-url'])) {
  20305. $data['notification-url'] = $this->notifyUrl;
  20306. }
  20307. $package = $this->loader->load($data, $class);
  20308. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  20309. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  20310. }
  20311. $package->setDistMirrors($this->distMirrors);
  20312. $this->configurePackageTransportOptions($package);
  20313. return $package;
  20314. } catch (\Exception $e) {
  20315. 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);
  20316. }
  20317. }
  20318. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  20319. {
  20320. if (null === $cacheKey) {
  20321. $cacheKey = $filename;
  20322. $filename = $this->baseUrl.'/'.$filename;
  20323. }
  20324. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  20325. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  20326. }
  20327. $retries = 3;
  20328. while ($retries--) {
  20329. try {
  20330. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20331. if ($this->eventDispatcher) {
  20332. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20333. }
  20334. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  20335. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20336. $json = $rfs->getContents($hostname, $filename, false);
  20337. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  20338. if ($this->allowSslDowngrade) {
  20339. $this->url = str_replace('http://', 'https://', $this->url);
  20340. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  20341. $filename = str_replace('http://', 'https://', $filename);
  20342. }
  20343. if ($retries) {
  20344. usleep(100000);
  20345. continue;
  20346. }
  20347. 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.');
  20348. }
  20349. $data = JsonFile::parseJson($json, $filename);
  20350. if (!empty($data['warning'])) {
  20351. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  20352. }
  20353. if (!empty($data['info'])) {
  20354. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  20355. }
  20356. if ($cacheKey) {
  20357. if ($storeLastModifiedTime) {
  20358. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20359. if ($lastModifiedDate) {
  20360. $data['last-modified'] = $lastModifiedDate;
  20361. $json = json_encode($data);
  20362. }
  20363. }
  20364. $this->cache->write($cacheKey, $json);
  20365. }
  20366. break;
  20367. } catch (\Exception $e) {
  20368. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20369. throw $e;
  20370. }
  20371. if ($retries) {
  20372. usleep(100000);
  20373. continue;
  20374. }
  20375. if ($e instanceof RepositorySecurityException) {
  20376. throw $e;
  20377. }
  20378. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  20379. if (!$this->degradedMode) {
  20380. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20381. $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>');
  20382. }
  20383. $this->degradedMode = true;
  20384. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  20385. break;
  20386. }
  20387. throw $e;
  20388. }
  20389. }
  20390. return $data;
  20391. }
  20392. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  20393. {
  20394. $retries = 3;
  20395. while ($retries--) {
  20396. try {
  20397. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20398. if ($this->eventDispatcher) {
  20399. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20400. }
  20401. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  20402. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20403. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  20404. $json = $rfs->getContents($hostname, $filename, false, $options);
  20405. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  20406. return true;
  20407. }
  20408. $data = JsonFile::parseJson($json, $filename);
  20409. if (!empty($data['warning'])) {
  20410. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  20411. }
  20412. if (!empty($data['info'])) {
  20413. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  20414. }
  20415. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20416. if ($lastModifiedDate) {
  20417. $data['last-modified'] = $lastModifiedDate;
  20418. $json = json_encode($data);
  20419. }
  20420. $this->cache->write($cacheKey, $json);
  20421. return $data;
  20422. } catch (\Exception $e) {
  20423. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20424. throw $e;
  20425. }
  20426. if ($retries) {
  20427. usleep(100000);
  20428. continue;
  20429. }
  20430. if (!$this->degradedMode) {
  20431. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20432. $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>');
  20433. }
  20434. $this->degradedMode = true;
  20435. return true;
  20436. }
  20437. }
  20438. }
  20439. private function initializePartialPackages()
  20440. {
  20441. $rootData = $this->loadRootServerFile();
  20442. $this->partialPackagesByName = array();
  20443. foreach ($rootData['packages'] as $package => $versions) {
  20444. $package = strtolower($package);
  20445. foreach ($versions as $version) {
  20446. $this->partialPackagesByName[$package][] = $version;
  20447. if (!empty($version['provide']) && is_array($version['provide'])) {
  20448. foreach ($version['provide'] as $provided => $providedVersion) {
  20449. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20450. }
  20451. }
  20452. if (!empty($version['replace']) && is_array($version['replace'])) {
  20453. foreach ($version['replace'] as $provided => $providedVersion) {
  20454. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20455. }
  20456. }
  20457. }
  20458. }
  20459. $this->rootData = true;
  20460. }
  20461. }
  20462. <?php
  20463. namespace Composer\Repository;
  20464. use Composer\Package\PackageInterface;
  20465. class CompositeRepository extends BaseRepository
  20466. {
  20467. private $repositories;
  20468. public function __construct(array $repositories)
  20469. {
  20470. $this->repositories = array();
  20471. foreach ($repositories as $repo) {
  20472. $this->addRepository($repo);
  20473. }
  20474. }
  20475. public function getRepositories()
  20476. {
  20477. return $this->repositories;
  20478. }
  20479. public function hasPackage(PackageInterface $package)
  20480. {
  20481. foreach ($this->repositories as $repository) {
  20482. if ($repository->hasPackage($package)) {
  20483. return true;
  20484. }
  20485. }
  20486. return false;
  20487. }
  20488. public function findPackage($name, $constraint)
  20489. {
  20490. foreach ($this->repositories as $repository) {
  20491. $package = $repository->findPackage($name, $constraint);
  20492. if (null !== $package) {
  20493. return $package;
  20494. }
  20495. }
  20496. return null;
  20497. }
  20498. public function findPackages($name, $constraint = null)
  20499. {
  20500. $packages = array();
  20501. foreach ($this->repositories as $repository) {
  20502. $packages[] = $repository->findPackages($name, $constraint);
  20503. }
  20504. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20505. }
  20506. public function search($query, $mode = 0, $type = null)
  20507. {
  20508. $matches = array();
  20509. foreach ($this->repositories as $repository) {
  20510. $matches[] = $repository->search($query, $mode, $type);
  20511. }
  20512. return $matches ? call_user_func_array('array_merge', $matches) : array();
  20513. }
  20514. public function getPackages()
  20515. {
  20516. $packages = array();
  20517. foreach ($this->repositories as $repository) {
  20518. $packages[] = $repository->getPackages();
  20519. }
  20520. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20521. }
  20522. public function removePackage(PackageInterface $package)
  20523. {
  20524. foreach ($this->repositories as $repository) {
  20525. $repository->removePackage($package);
  20526. }
  20527. }
  20528. public function count()
  20529. {
  20530. $total = 0;
  20531. foreach ($this->repositories as $repository) {
  20532. $total += $repository->count();
  20533. }
  20534. return $total;
  20535. }
  20536. public function addRepository(RepositoryInterface $repository)
  20537. {
  20538. if ($repository instanceof self) {
  20539. foreach ($repository->getRepositories() as $repo) {
  20540. $this->addRepository($repo);
  20541. }
  20542. } else {
  20543. $this->repositories[] = $repository;
  20544. }
  20545. }
  20546. }
  20547. <?php
  20548. namespace Composer\Repository;
  20549. interface ConfigurableRepositoryInterface
  20550. {
  20551. public function getRepoConfig();
  20552. }
  20553. <?php
  20554. namespace Composer\Repository;
  20555. use Composer\Json\JsonFile;
  20556. use Composer\Package\Loader\ArrayLoader;
  20557. use Composer\Package\Dumper\ArrayDumper;
  20558. class FilesystemRepository extends WritableArrayRepository
  20559. {
  20560. private $file;
  20561. public function __construct(JsonFile $repositoryFile)
  20562. {
  20563. parent::__construct();
  20564. $this->file = $repositoryFile;
  20565. }
  20566. protected function initialize()
  20567. {
  20568. parent::initialize();
  20569. if (!$this->file->exists()) {
  20570. return;
  20571. }
  20572. try {
  20573. $packages = $this->file->read();
  20574. if (!is_array($packages)) {
  20575. throw new \UnexpectedValueException('Could not parse package list from the repository');
  20576. }
  20577. } catch (\Exception $e) {
  20578. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  20579. }
  20580. $loader = new ArrayLoader(null, true);
  20581. foreach ($packages as $packageData) {
  20582. $package = $loader->load($packageData);
  20583. $this->addPackage($package);
  20584. }
  20585. }
  20586. public function reload()
  20587. {
  20588. $this->packages = null;
  20589. $this->initialize();
  20590. }
  20591. public function write()
  20592. {
  20593. $data = array();
  20594. $dumper = new ArrayDumper();
  20595. foreach ($this->getCanonicalPackages() as $package) {
  20596. $data[] = $dumper->dump($package);
  20597. }
  20598. usort($data, function ($a, $b) {
  20599. return strcmp($a['name'], $b['name']);
  20600. });
  20601. $this->file->write($data);
  20602. }
  20603. }
  20604. <?php
  20605. namespace Composer\Repository;
  20606. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  20607. {
  20608. }
  20609. <?php
  20610. namespace Composer\Repository;
  20611. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  20612. {
  20613. }
  20614. <?php
  20615. namespace Composer\Repository;
  20616. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  20617. {
  20618. }
  20619. <?php
  20620. namespace Composer\Repository;
  20621. class InvalidRepositoryException extends \Exception
  20622. {
  20623. }
  20624. <?php
  20625. namespace Composer\Repository;
  20626. use Composer\Package\Loader\ArrayLoader;
  20627. use Composer\Package\Loader\ValidatingArrayLoader;
  20628. class PackageRepository extends ArrayRepository
  20629. {
  20630. private $config;
  20631. public function __construct(array $config)
  20632. {
  20633. parent::__construct();
  20634. $this->config = $config['package'];
  20635. if (!is_numeric(key($this->config))) {
  20636. $this->config = array($this->config);
  20637. }
  20638. }
  20639. protected function initialize()
  20640. {
  20641. parent::initialize();
  20642. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  20643. foreach ($this->config as $package) {
  20644. try {
  20645. $package = $loader->load($package);
  20646. } catch (\Exception $e) {
  20647. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  20648. }
  20649. $this->addPackage($package);
  20650. }
  20651. }
  20652. }
  20653. <?php
  20654. namespace Composer\Repository;
  20655. use Composer\Config;
  20656. use Composer\IO\IOInterface;
  20657. use Composer\Json\JsonFile;
  20658. use Composer\Package\Loader\ArrayLoader;
  20659. use Composer\Package\Version\VersionGuesser;
  20660. use Composer\Package\Version\VersionParser;
  20661. use Composer\Util\Platform;
  20662. use Composer\Util\ProcessExecutor;
  20663. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20664. {
  20665. private $loader;
  20666. private $versionGuesser;
  20667. private $url;
  20668. private $repoConfig;
  20669. private $process;
  20670. private $options;
  20671. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  20672. {
  20673. if (!isset($repoConfig['url'])) {
  20674. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  20675. }
  20676. $this->loader = new ArrayLoader(null, true);
  20677. $this->url = Platform::expandPath($repoConfig['url']);
  20678. $this->process = new ProcessExecutor($io);
  20679. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  20680. $this->repoConfig = $repoConfig;
  20681. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  20682. parent::__construct();
  20683. }
  20684. public function getRepoConfig()
  20685. {
  20686. return $this->repoConfig;
  20687. }
  20688. protected function initialize()
  20689. {
  20690. parent::initialize();
  20691. foreach ($this->getUrlMatches() as $url) {
  20692. $path = realpath($url) . DIRECTORY_SEPARATOR;
  20693. $composerFilePath = $path.'composer.json';
  20694. if (!file_exists($composerFilePath)) {
  20695. continue;
  20696. }
  20697. $json = file_get_contents($composerFilePath);
  20698. $package = JsonFile::parseJson($json, $composerFilePath);
  20699. $package['dist'] = array(
  20700. 'type' => 'path',
  20701. 'url' => $url,
  20702. 'reference' => sha1($json . serialize($this->options)),
  20703. );
  20704. $package['transport-options'] = $this->options;
  20705. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  20706. if (
  20707. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  20708. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  20709. && $ref1 === $ref2
  20710. ) {
  20711. $package['version'] = $rootVersion;
  20712. }
  20713. }
  20714. if (!isset($package['version'])) {
  20715. $versionData = $this->versionGuesser->guessVersion($package, $path);
  20716. $package['version'] = $versionData['pretty_version'] ?: 'dev-master';
  20717. }
  20718. $output = '';
  20719. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  20720. $package['dist']['reference'] = trim($output);
  20721. }
  20722. $package = $this->loader->load($package);
  20723. $this->addPackage($package);
  20724. }
  20725. }
  20726. private function getUrlMatches()
  20727. {
  20728. $flags = GLOB_MARK | GLOB_ONLYDIR;
  20729. if (defined('GLOB_BRACE')) {
  20730. $flags |= GLOB_BRACE;
  20731. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  20732. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  20733. }
  20734. return array_map(function ($val) {
  20735. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  20736. }, glob($this->url, $flags));
  20737. }
  20738. }
  20739. <?php
  20740. namespace Composer\Repository\Pear;
  20741. use Composer\Util\RemoteFilesystem;
  20742. abstract class BaseChannelReader
  20743. {
  20744. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  20745. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  20746. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  20747. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  20748. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  20749. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  20750. private $rfs;
  20751. protected function __construct(RemoteFilesystem $rfs)
  20752. {
  20753. $this->rfs = $rfs;
  20754. }
  20755. protected function requestContent($origin, $path)
  20756. {
  20757. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  20758. $content = $this->rfs->getContents($origin, $url, false);
  20759. if (!$content) {
  20760. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  20761. }
  20762. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  20763. }
  20764. protected function requestXml($origin, $path)
  20765. {
  20766. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  20767. if (false === $xml) {
  20768. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  20769. }
  20770. return $xml;
  20771. }
  20772. }
  20773. <?php
  20774. namespace Composer\Repository\Pear;
  20775. class ChannelInfo
  20776. {
  20777. private $name;
  20778. private $alias;
  20779. private $packages;
  20780. public function __construct($name, $alias, array $packages)
  20781. {
  20782. $this->name = $name;
  20783. $this->alias = $alias;
  20784. $this->packages = $packages;
  20785. }
  20786. public function getName()
  20787. {
  20788. return $this->name;
  20789. }
  20790. public function getAlias()
  20791. {
  20792. return $this->alias;
  20793. }
  20794. public function getPackages()
  20795. {
  20796. return $this->packages;
  20797. }
  20798. }
  20799. <?php
  20800. namespace Composer\Repository\Pear;
  20801. use Composer\Util\RemoteFilesystem;
  20802. class ChannelReader extends BaseChannelReader
  20803. {
  20804. private $readerMap;
  20805. public function __construct(RemoteFilesystem $rfs)
  20806. {
  20807. parent::__construct($rfs);
  20808. $rest10reader = new ChannelRest10Reader($rfs);
  20809. $rest11reader = new ChannelRest11Reader($rfs);
  20810. $this->readerMap = array(
  20811. 'REST1.3' => $rest11reader,
  20812. 'REST1.2' => $rest11reader,
  20813. 'REST1.1' => $rest11reader,
  20814. 'REST1.0' => $rest10reader,
  20815. );
  20816. }
  20817. public function read($url)
  20818. {
  20819. $xml = $this->requestXml($url, "/channel.xml");
  20820. $channelName = (string) $xml->name;
  20821. $channelAlias = (string) $xml->suggestedalias;
  20822. $supportedVersions = array_keys($this->readerMap);
  20823. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  20824. if (!$selectedRestVersion) {
  20825. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  20826. }
  20827. $reader = $this->readerMap[$selectedRestVersion['version']];
  20828. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  20829. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  20830. }
  20831. private function selectRestVersion($channelXml, $supportedVersions)
  20832. {
  20833. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  20834. foreach ($supportedVersions as $version) {
  20835. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  20836. $testResult = $channelXml->xpath($xpathTest);
  20837. foreach ($testResult as $result) {
  20838. $result = (string) $result;
  20839. if (preg_match('{^https://}i', $result)) {
  20840. return array('version' => $version, 'baseUrl' => $result);
  20841. }
  20842. }
  20843. if (count($testResult) > 0) {
  20844. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  20845. }
  20846. }
  20847. return null;
  20848. }
  20849. }
  20850. <?php
  20851. namespace Composer\Repository\Pear;
  20852. use Composer\Downloader\TransportException;
  20853. class ChannelRest10Reader extends BaseChannelReader
  20854. {
  20855. private $dependencyReader;
  20856. public function __construct($rfs)
  20857. {
  20858. parent::__construct($rfs);
  20859. $this->dependencyReader = new PackageDependencyParser();
  20860. }
  20861. public function read($baseUrl)
  20862. {
  20863. return $this->readPackages($baseUrl);
  20864. }
  20865. private function readPackages($baseUrl)
  20866. {
  20867. $result = array();
  20868. $xmlPath = '/p/packages.xml';
  20869. $xml = $this->requestXml($baseUrl, $xmlPath);
  20870. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  20871. foreach ($xml->xpath('ns:p') as $node) {
  20872. $packageName = (string) $node;
  20873. $packageInfo = $this->readPackage($baseUrl, $packageName);
  20874. $result[] = $packageInfo;
  20875. }
  20876. return $result;
  20877. }
  20878. private function readPackage($baseUrl, $packageName)
  20879. {
  20880. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  20881. $xml = $this->requestXml($baseUrl, $xmlPath);
  20882. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  20883. $channelName = (string) $xml->c;
  20884. $packageName = (string) $xml->n;
  20885. $license = (string) $xml->l;
  20886. $shortDescription = (string) $xml->s;
  20887. $description = (string) $xml->d;
  20888. return new PackageInfo(
  20889. $channelName,
  20890. $packageName,
  20891. $license,
  20892. $shortDescription,
  20893. $description,
  20894. $this->readPackageReleases($baseUrl, $packageName)
  20895. );
  20896. }
  20897. private function readPackageReleases($baseUrl, $packageName)
  20898. {
  20899. $result = array();
  20900. try {
  20901. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  20902. $xml = $this->requestXml($baseUrl, $xmlPath);
  20903. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  20904. foreach ($xml->xpath('ns:r') as $node) {
  20905. $releaseVersion = (string) $node->v;
  20906. $releaseStability = (string) $node->s;
  20907. try {
  20908. $result[$releaseVersion] = new ReleaseInfo(
  20909. $releaseStability,
  20910. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  20911. );
  20912. } catch (TransportException $exception) {
  20913. if ($exception->getCode() != 404) {
  20914. throw $exception;
  20915. }
  20916. }
  20917. }
  20918. } catch (TransportException $exception) {
  20919. if ($exception->getCode() != 404) {
  20920. throw $exception;
  20921. }
  20922. }
  20923. return $result;
  20924. }
  20925. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  20926. {
  20927. $dependencyReader = new PackageDependencyParser();
  20928. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  20929. $content = $this->requestContent($baseUrl, $depthPath);
  20930. $dependencyArray = unserialize($content);
  20931. return $dependencyReader->buildDependencyInfo($dependencyArray);
  20932. }
  20933. }
  20934. <?php
  20935. namespace Composer\Repository\Pear;
  20936. class ChannelRest11Reader extends BaseChannelReader
  20937. {
  20938. private $dependencyReader;
  20939. public function __construct($rfs)
  20940. {
  20941. parent::__construct($rfs);
  20942. $this->dependencyReader = new PackageDependencyParser();
  20943. }
  20944. public function read($baseUrl)
  20945. {
  20946. return $this->readChannelPackages($baseUrl);
  20947. }
  20948. private function readChannelPackages($baseUrl)
  20949. {
  20950. $result = array();
  20951. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  20952. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  20953. foreach ($xml->xpath('ns:c') as $node) {
  20954. $categoryName = (string) $node;
  20955. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  20956. $result = array_merge($result, $categoryPackages);
  20957. }
  20958. return $result;
  20959. }
  20960. private function readCategoryPackages($baseUrl, $categoryName)
  20961. {
  20962. $result = array();
  20963. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  20964. $xml = $this->requestXml($baseUrl, $categoryPath);
  20965. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  20966. foreach ($xml->xpath('ns:pi') as $node) {
  20967. $packageInfo = $this->parsePackage($node);
  20968. $result[] = $packageInfo;
  20969. }
  20970. return $result;
  20971. }
  20972. private function parsePackage($packageInfo)
  20973. {
  20974. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  20975. $channelName = (string) $packageInfo->p->c;
  20976. $packageName = (string) $packageInfo->p->n;
  20977. $license = (string) $packageInfo->p->l;
  20978. $shortDescription = (string) $packageInfo->p->s;
  20979. $description = (string) $packageInfo->p->d;
  20980. $dependencies = array();
  20981. foreach ($packageInfo->xpath('ns:deps') as $node) {
  20982. $dependencyVersion = (string) $node->v;
  20983. $dependencyArray = unserialize((string) $node->d);
  20984. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  20985. $dependencies[$dependencyVersion] = $dependencyInfo;
  20986. }
  20987. $releases = array();
  20988. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  20989. if ($releasesInfo) {
  20990. foreach ($releasesInfo as $node) {
  20991. $releaseVersion = (string) $node->v;
  20992. $releaseStability = (string) $node->s;
  20993. $releases[$releaseVersion] = new ReleaseInfo(
  20994. $releaseStability,
  20995. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  20996. );
  20997. }
  20998. }
  20999. return new PackageInfo(
  21000. $channelName,
  21001. $packageName,
  21002. $license,
  21003. $shortDescription,
  21004. $description,
  21005. $releases
  21006. );
  21007. }
  21008. }
  21009. <?php
  21010. namespace Composer\Repository\Pear;
  21011. class DependencyConstraint
  21012. {
  21013. private $type;
  21014. private $constraint;
  21015. private $channelName;
  21016. private $packageName;
  21017. public function __construct($type, $constraint, $channelName, $packageName)
  21018. {
  21019. $this->type = $type;
  21020. $this->constraint = $constraint;
  21021. $this->channelName = $channelName;
  21022. $this->packageName = $packageName;
  21023. }
  21024. public function getChannelName()
  21025. {
  21026. return $this->channelName;
  21027. }
  21028. public function getConstraint()
  21029. {
  21030. return $this->constraint;
  21031. }
  21032. public function getPackageName()
  21033. {
  21034. return $this->packageName;
  21035. }
  21036. public function getType()
  21037. {
  21038. return $this->type;
  21039. }
  21040. }
  21041. <?php
  21042. namespace Composer\Repository\Pear;
  21043. class DependencyInfo
  21044. {
  21045. private $requires;
  21046. private $optionals;
  21047. public function __construct($requires, $optionals)
  21048. {
  21049. $this->requires = $requires;
  21050. $this->optionals = $optionals;
  21051. }
  21052. public function getRequires()
  21053. {
  21054. return $this->requires;
  21055. }
  21056. public function getOptionals()
  21057. {
  21058. return $this->optionals;
  21059. }
  21060. }
  21061. <?php
  21062. namespace Composer\Repository\Pear;
  21063. class PackageDependencyParser
  21064. {
  21065. public function buildDependencyInfo($depArray)
  21066. {
  21067. if (!is_array($depArray)) {
  21068. return new DependencyInfo(array(), array());
  21069. }
  21070. if (!$this->isHash($depArray)) {
  21071. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  21072. }
  21073. return $this->buildDependency20Info($depArray);
  21074. }
  21075. private function buildDependency10Info($depArray)
  21076. {
  21077. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  21078. $result = array();
  21079. foreach ($depArray as $depItem) {
  21080. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  21081. continue;
  21082. }
  21083. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  21084. ? 'optional'
  21085. : 'required';
  21086. $depType = 'not' == $depItem['rel']
  21087. ? 'conflicts'
  21088. : $depType;
  21089. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  21090. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  21091. ? '*'
  21092. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  21093. switch ($depItem['type']) {
  21094. case 'php':
  21095. $depChannelName = 'php';
  21096. $depPackageName = '';
  21097. break;
  21098. case 'pkg':
  21099. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  21100. $depPackageName = $depItem['name'];
  21101. break;
  21102. case 'ext':
  21103. $depChannelName = 'ext';
  21104. $depPackageName = $depItem['name'];
  21105. break;
  21106. case 'os':
  21107. case 'sapi':
  21108. $depChannelName = '';
  21109. $depPackageName = '';
  21110. break;
  21111. default:
  21112. $depChannelName = '';
  21113. $depPackageName = '';
  21114. break;
  21115. }
  21116. if ('' != $depChannelName) {
  21117. $result[] = new DependencyConstraint(
  21118. $depType,
  21119. $depVersionConstraint,
  21120. $depChannelName,
  21121. $depPackageName
  21122. );
  21123. }
  21124. }
  21125. return $result;
  21126. }
  21127. private function buildDependency20Info($depArray)
  21128. {
  21129. $result = array();
  21130. $optionals = array();
  21131. $defaultOptionals = array();
  21132. foreach ($depArray as $depType => $depTypeGroup) {
  21133. if (!is_array($depTypeGroup)) {
  21134. continue;
  21135. }
  21136. if ('required' == $depType || 'optional' == $depType) {
  21137. foreach ($depTypeGroup as $depItemType => $depItem) {
  21138. switch ($depItemType) {
  21139. case 'php':
  21140. $result[] = new DependencyConstraint(
  21141. $depType,
  21142. $this->parse20VersionConstraint($depItem),
  21143. 'php',
  21144. ''
  21145. );
  21146. break;
  21147. case 'package':
  21148. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  21149. $result = array_merge($result, $deps);
  21150. break;
  21151. case 'extension':
  21152. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  21153. $result = array_merge($result, $deps);
  21154. break;
  21155. case 'subpackage':
  21156. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  21157. $defaultOptionals += $deps;
  21158. break;
  21159. case 'os':
  21160. case 'pearinstaller':
  21161. break;
  21162. default:
  21163. break;
  21164. }
  21165. }
  21166. } elseif ('group' == $depType) {
  21167. if ($this->isHash($depTypeGroup)) {
  21168. $depTypeGroup = array($depTypeGroup);
  21169. }
  21170. foreach ($depTypeGroup as $depItem) {
  21171. $groupName = $depItem['attribs']['name'];
  21172. if (!isset($optionals[$groupName])) {
  21173. $optionals[$groupName] = array();
  21174. }
  21175. if (isset($depItem['subpackage'])) {
  21176. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  21177. } else {
  21178. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  21179. }
  21180. }
  21181. }
  21182. }
  21183. if (count($defaultOptionals) > 0) {
  21184. $optionals['*'] = $defaultOptionals;
  21185. }
  21186. return new DependencyInfo($result, $optionals);
  21187. }
  21188. private function buildDepExtensionConstraints($depItem, $depType)
  21189. {
  21190. if ($this->isHash($depItem)) {
  21191. $depItem = array($depItem);
  21192. }
  21193. $result = array();
  21194. foreach ($depItem as $subDepItem) {
  21195. $depChannelName = 'ext';
  21196. $depPackageName = $subDepItem['name'];
  21197. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21198. $result[] = new DependencyConstraint(
  21199. $depType,
  21200. $depVersionConstraint,
  21201. $depChannelName,
  21202. $depPackageName
  21203. );
  21204. }
  21205. return $result;
  21206. }
  21207. private function buildDepPackageConstraints($depItem, $depType)
  21208. {
  21209. if ($this->isHash($depItem)) {
  21210. $depItem = array($depItem);
  21211. }
  21212. $result = array();
  21213. foreach ($depItem as $subDepItem) {
  21214. if (!array_key_exists('channel', $subDepItem)) {
  21215. $subDepItem['channel'] = $subDepItem['uri'];
  21216. }
  21217. $depChannelName = $subDepItem['channel'];
  21218. $depPackageName = $subDepItem['name'];
  21219. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21220. if (isset($subDepItem['conflicts'])) {
  21221. $depType = 'conflicts';
  21222. }
  21223. $result[] = new DependencyConstraint(
  21224. $depType,
  21225. $depVersionConstraint,
  21226. $depChannelName,
  21227. $depPackageName
  21228. );
  21229. }
  21230. return $result;
  21231. }
  21232. private function parse20VersionConstraint(array $data)
  21233. {
  21234. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  21235. $versions = array();
  21236. $values = array_intersect_key($data, $dep20toOperatorMap);
  21237. if (0 == count($values)) {
  21238. return '*';
  21239. }
  21240. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  21241. $versions[] = '>' . $this->parseVersion($values['min']);
  21242. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  21243. $versions[] = '<' . $this->parseVersion($values['max']);
  21244. } else {
  21245. foreach ($values as $op => $version) {
  21246. if ('exclude' == $op && is_array($version)) {
  21247. foreach ($version as $versionPart) {
  21248. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  21249. }
  21250. } else {
  21251. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  21252. }
  21253. }
  21254. }
  21255. return implode(',', $versions);
  21256. }
  21257. private function parseVersion($version)
  21258. {
  21259. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  21260. $version = $matches[1]
  21261. .(!empty($matches[2]) ? $matches[2] : '.0')
  21262. .(!empty($matches[3]) ? $matches[3] : '.0')
  21263. .(!empty($matches[4]) ? $matches[4] : '.0');
  21264. return $version;
  21265. }
  21266. return null;
  21267. }
  21268. private function isHash(array $array)
  21269. {
  21270. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  21271. }
  21272. }
  21273. <?php
  21274. namespace Composer\Repository\Pear;
  21275. class PackageInfo
  21276. {
  21277. private $channelName;
  21278. private $packageName;
  21279. private $license;
  21280. private $shortDescription;
  21281. private $description;
  21282. private $releases;
  21283. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  21284. {
  21285. $this->channelName = $channelName;
  21286. $this->packageName = $packageName;
  21287. $this->license = $license;
  21288. $this->shortDescription = $shortDescription;
  21289. $this->description = $description;
  21290. $this->releases = $releases;
  21291. }
  21292. public function getChannelName()
  21293. {
  21294. return $this->channelName;
  21295. }
  21296. public function getPackageName()
  21297. {
  21298. return $this->packageName;
  21299. }
  21300. public function getDescription()
  21301. {
  21302. return $this->description;
  21303. }
  21304. public function getShortDescription()
  21305. {
  21306. return $this->shortDescription;
  21307. }
  21308. public function getLicense()
  21309. {
  21310. return $this->license;
  21311. }
  21312. public function getReleases()
  21313. {
  21314. return $this->releases;
  21315. }
  21316. }
  21317. <?php
  21318. namespace Composer\Repository\Pear;
  21319. class ReleaseInfo
  21320. {
  21321. private $stability;
  21322. private $dependencyInfo;
  21323. public function __construct($stability, $dependencyInfo)
  21324. {
  21325. $this->stability = $stability;
  21326. $this->dependencyInfo = $dependencyInfo;
  21327. }
  21328. public function getDependencyInfo()
  21329. {
  21330. return $this->dependencyInfo;
  21331. }
  21332. public function getStability()
  21333. {
  21334. return $this->stability;
  21335. }
  21336. }
  21337. <?php
  21338. namespace Composer\Repository;
  21339. use Composer\IO\IOInterface;
  21340. use Composer\Semver\VersionParser as SemverVersionParser;
  21341. use Composer\Package\Version\VersionParser;
  21342. use Composer\Repository\Pear\ChannelReader;
  21343. use Composer\Package\CompletePackage;
  21344. use Composer\Repository\Pear\ChannelInfo;
  21345. use Composer\EventDispatcher\EventDispatcher;
  21346. use Composer\Package\Link;
  21347. use Composer\Semver\Constraint\Constraint;
  21348. use Composer\Util\RemoteFilesystem;
  21349. use Composer\Config;
  21350. use Composer\Factory;
  21351. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21352. {
  21353. private $url;
  21354. private $io;
  21355. private $rfs;
  21356. private $versionParser;
  21357. private $repoConfig;
  21358. private $vendorAlias;
  21359. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  21360. {
  21361. parent::__construct();
  21362. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  21363. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  21364. }
  21365. $urlBits = parse_url($repoConfig['url']);
  21366. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  21367. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  21368. }
  21369. $this->url = rtrim($repoConfig['url'], '/');
  21370. $this->io = $io;
  21371. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  21372. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  21373. $this->versionParser = new VersionParser();
  21374. $this->repoConfig = $repoConfig;
  21375. }
  21376. public function getRepoConfig()
  21377. {
  21378. return $this->repoConfig;
  21379. }
  21380. protected function initialize()
  21381. {
  21382. parent::initialize();
  21383. $this->io->writeError('Initializing PEAR repository '.$this->url);
  21384. $reader = new ChannelReader($this->rfs);
  21385. try {
  21386. $channelInfo = $reader->read($this->url);
  21387. } catch (\Exception $e) {
  21388. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  21389. return;
  21390. }
  21391. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  21392. foreach ($packages as $package) {
  21393. $this->addPackage($package);
  21394. }
  21395. }
  21396. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  21397. {
  21398. $result = array();
  21399. foreach ($channelInfo->getPackages() as $packageDefinition) {
  21400. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  21401. try {
  21402. $normalizedVersion = $versionParser->normalize($version);
  21403. } catch (\UnexpectedValueException $e) {
  21404. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  21405. continue;
  21406. }
  21407. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  21408. $urlBits = parse_url($this->url);
  21409. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  21410. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  21411. $requires = array();
  21412. $suggests = array();
  21413. $conflicts = array();
  21414. $replaces = array();
  21415. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  21416. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  21417. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21418. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21419. }
  21420. if (!empty($this->vendorAlias)
  21421. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  21422. ) {
  21423. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  21424. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21425. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21426. }
  21427. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  21428. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21429. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  21430. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  21431. switch ($dependencyConstraint->getType()) {
  21432. case 'required':
  21433. $requires[] = $link;
  21434. break;
  21435. case 'conflicts':
  21436. $conflicts[] = $link;
  21437. break;
  21438. case 'replaces':
  21439. $replaces[] = $link;
  21440. break;
  21441. }
  21442. }
  21443. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  21444. foreach ($dependencyConstraints as $dependencyConstraint) {
  21445. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21446. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  21447. }
  21448. }
  21449. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  21450. $package->setType('pear-library');
  21451. $package->setDescription($packageDefinition->getDescription());
  21452. $package->setLicense(array($packageDefinition->getLicense()));
  21453. $package->setDistType('file');
  21454. $package->setDistUrl($distUrl);
  21455. $package->setAutoload(array('classmap' => array('')));
  21456. $package->setIncludePaths(array('/'));
  21457. $package->setRequires($requires);
  21458. $package->setConflicts($conflicts);
  21459. $package->setSuggests($suggests);
  21460. $package->setReplaces($replaces);
  21461. $result[] = $package;
  21462. }
  21463. }
  21464. return $result;
  21465. }
  21466. private function buildComposerPackageName($channelName, $packageName)
  21467. {
  21468. if ('php' === $channelName) {
  21469. return "php";
  21470. }
  21471. if ('ext' === $channelName) {
  21472. return "ext-{$packageName}";
  21473. }
  21474. return "pear-{$channelName}/{$packageName}";
  21475. }
  21476. }
  21477. <?php
  21478. namespace Composer\Repository;
  21479. use Composer\Package\CompletePackage;
  21480. use Composer\Package\PackageInterface;
  21481. use Composer\Package\Version\VersionParser;
  21482. use Composer\Plugin\PluginInterface;
  21483. use Composer\Util\Silencer;
  21484. use Composer\XdebugHandler\XdebugHandler;
  21485. class PlatformRepository extends ArrayRepository
  21486. {
  21487. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[^/ ]+)$}i';
  21488. private $versionParser;
  21489. private $overrides = array();
  21490. public function __construct(array $packages = array(), array $overrides = array())
  21491. {
  21492. foreach ($overrides as $name => $version) {
  21493. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  21494. }
  21495. parent::__construct($packages);
  21496. }
  21497. protected function initialize()
  21498. {
  21499. parent::initialize();
  21500. $this->versionParser = new VersionParser();
  21501. foreach ($this->overrides as $override) {
  21502. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  21503. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  21504. }
  21505. $this->addOverriddenPackage($override);
  21506. }
  21507. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  21508. $version = $this->versionParser->normalize($prettyVersion);
  21509. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  21510. $composerPluginApi->setDescription('The Composer Plugin API');
  21511. $this->addPackage($composerPluginApi);
  21512. try {
  21513. $prettyVersion = PHP_VERSION;
  21514. $version = $this->versionParser->normalize($prettyVersion);
  21515. } catch (\UnexpectedValueException $e) {
  21516. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  21517. $version = $this->versionParser->normalize($prettyVersion);
  21518. }
  21519. $php = new CompletePackage('php', $version, $prettyVersion);
  21520. $php->setDescription('The PHP interpreter');
  21521. $this->addPackage($php);
  21522. if (PHP_DEBUG) {
  21523. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  21524. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  21525. $this->addPackage($phpdebug);
  21526. }
  21527. if (defined('PHP_ZTS') && PHP_ZTS) {
  21528. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  21529. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  21530. $this->addPackage($phpzts);
  21531. }
  21532. if (PHP_INT_SIZE === 8) {
  21533. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  21534. $php64->setDescription('The PHP interpreter, 64bit');
  21535. $this->addPackage($php64);
  21536. }
  21537. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  21538. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  21539. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  21540. $this->addPackage($phpIpv6);
  21541. }
  21542. $loadedExtensions = get_loaded_extensions();
  21543. foreach ($loadedExtensions as $name) {
  21544. if (in_array($name, array('standard', 'Core'))) {
  21545. continue;
  21546. }
  21547. $reflExt = new \ReflectionExtension($name);
  21548. $prettyVersion = $reflExt->getVersion();
  21549. $this->addExtension($name, $prettyVersion);
  21550. }
  21551. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  21552. $this->addExtension('xdebug', $prettyVersion);
  21553. }
  21554. foreach ($loadedExtensions as $name) {
  21555. $prettyVersion = null;
  21556. $description = 'The '.$name.' PHP library';
  21557. switch ($name) {
  21558. case 'curl':
  21559. $curlVersion = curl_version();
  21560. $prettyVersion = $curlVersion['version'];
  21561. break;
  21562. case 'iconv':
  21563. $prettyVersion = ICONV_VERSION;
  21564. break;
  21565. case 'intl':
  21566. $name = 'ICU';
  21567. if (defined('INTL_ICU_VERSION')) {
  21568. $prettyVersion = INTL_ICU_VERSION;
  21569. } else {
  21570. $reflector = new \ReflectionExtension('intl');
  21571. ob_start();
  21572. $reflector->info();
  21573. $output = ob_get_clean();
  21574. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  21575. $prettyVersion = $matches[1];
  21576. }
  21577. break;
  21578. case 'libxml':
  21579. $prettyVersion = LIBXML_DOTTED_VERSION;
  21580. break;
  21581. case 'openssl':
  21582. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  21583. if (empty($match[2])) {
  21584. return $match[1];
  21585. }
  21586. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  21587. return 0;
  21588. }
  21589. $len = strlen($match[2]);
  21590. $patchVersion = ($len - 1) * 26;
  21591. $patchVersion += ord($match[2][$len - 1]) - 96;
  21592. return $match[1].'.'.$patchVersion;
  21593. }, OPENSSL_VERSION_TEXT);
  21594. $description = OPENSSL_VERSION_TEXT;
  21595. break;
  21596. case 'pcre':
  21597. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  21598. break;
  21599. case 'uuid':
  21600. $prettyVersion = phpversion('uuid');
  21601. break;
  21602. case 'xsl':
  21603. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  21604. break;
  21605. default:
  21606. continue 2;
  21607. }
  21608. try {
  21609. $version = $this->versionParser->normalize($prettyVersion);
  21610. } catch (\UnexpectedValueException $e) {
  21611. continue;
  21612. }
  21613. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  21614. $lib->setDescription($description);
  21615. $this->addPackage($lib);
  21616. }
  21617. if (defined('HHVM_VERSION')) {
  21618. try {
  21619. $prettyVersion = HHVM_VERSION;
  21620. $version = $this->versionParser->normalize($prettyVersion);
  21621. } catch (\UnexpectedValueException $e) {
  21622. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', HHVM_VERSION);
  21623. $version = $this->versionParser->normalize($prettyVersion);
  21624. }
  21625. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  21626. $hhvm->setDescription('The HHVM Runtime (64bit)');
  21627. $this->addPackage($hhvm);
  21628. }
  21629. }
  21630. public function addPackage(PackageInterface $package)
  21631. {
  21632. if (isset($this->overrides[$package->getName()])) {
  21633. $overrider = $this->findPackage($package->getName(), '*');
  21634. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  21635. return;
  21636. }
  21637. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  21638. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  21639. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  21640. return;
  21641. }
  21642. parent::addPackage($package);
  21643. }
  21644. private function addOverriddenPackage(array $override, $name = null)
  21645. {
  21646. $version = $this->versionParser->normalize($override['version']);
  21647. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  21648. $package->setDescription('Package overridden via config.platform');
  21649. $package->setExtra(array('config.platform' => true));
  21650. parent::addPackage($package);
  21651. return $package;
  21652. }
  21653. private function addExtension($name, $prettyVersion)
  21654. {
  21655. $extraDescription = null;
  21656. try {
  21657. $version = $this->versionParser->normalize($prettyVersion);
  21658. } catch (\UnexpectedValueException $e) {
  21659. $extraDescription = ' (actual version: '.$prettyVersion.')';
  21660. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  21661. $prettyVersion = $match[1];
  21662. } else {
  21663. $prettyVersion = '0';
  21664. }
  21665. $version = $this->versionParser->normalize($prettyVersion);
  21666. }
  21667. $packageName = $this->buildPackageName($name);
  21668. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  21669. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  21670. $this->addPackage($ext);
  21671. }
  21672. private function buildPackageName($name)
  21673. {
  21674. return 'ext-' . str_replace(' ', '-', $name);
  21675. }
  21676. }
  21677. <?php
  21678. namespace Composer\Repository;
  21679. use Composer\Factory;
  21680. use Composer\IO\IOInterface;
  21681. use Composer\Config;
  21682. use Composer\EventDispatcher\EventDispatcher;
  21683. use Composer\Util\RemoteFilesystem;
  21684. use Composer\Json\JsonFile;
  21685. class RepositoryFactory
  21686. {
  21687. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  21688. {
  21689. if (0 === strpos($repository, 'http')) {
  21690. $repoConfig = array('type' => 'composer', 'url' => $repository);
  21691. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  21692. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  21693. $data = $json->read();
  21694. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  21695. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  21696. } elseif ($allowFilesystem) {
  21697. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  21698. } else {
  21699. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  21700. }
  21701. } elseif ('{' === substr($repository, 0, 1)) {
  21702. $repoConfig = JsonFile::parseJson($repository);
  21703. } else {
  21704. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  21705. }
  21706. return $repoConfig;
  21707. }
  21708. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  21709. {
  21710. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  21711. return static::createRepo($io, $config, $repoConfig);
  21712. }
  21713. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  21714. {
  21715. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  21716. $repos = static::createRepos($rm, array($repoConfig));
  21717. return reset($repos);
  21718. }
  21719. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  21720. {
  21721. if (!$config) {
  21722. $config = Factory::createConfig($io);
  21723. }
  21724. if (!$rm) {
  21725. if (!$io) {
  21726. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  21727. }
  21728. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  21729. }
  21730. return static::createRepos($rm, $config->getRepositories());
  21731. }
  21732. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21733. {
  21734. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  21735. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  21736. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  21737. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  21738. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  21739. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  21740. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  21741. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  21742. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  21743. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  21744. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  21745. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  21746. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  21747. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  21748. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  21749. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  21750. return $rm;
  21751. }
  21752. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  21753. {
  21754. $repos = array();
  21755. foreach ($repoConfigs as $index => $repo) {
  21756. if (is_string($repo)) {
  21757. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  21758. }
  21759. if (!is_array($repo)) {
  21760. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  21761. }
  21762. if (!isset($repo['type'])) {
  21763. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  21764. }
  21765. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  21766. while (isset($repos[$name])) {
  21767. $name .= '2';
  21768. }
  21769. if ($repo['type'] === 'filesystem') {
  21770. $repos[$name] = new FilesystemRepository($repo['json']);
  21771. } else {
  21772. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  21773. }
  21774. }
  21775. return $repos;
  21776. }
  21777. }
  21778. <?php
  21779. namespace Composer\Repository;
  21780. use Composer\Package\PackageInterface;
  21781. interface RepositoryInterface extends \Countable
  21782. {
  21783. const SEARCH_FULLTEXT = 0;
  21784. const SEARCH_NAME = 1;
  21785. public function hasPackage(PackageInterface $package);
  21786. public function findPackage($name, $constraint);
  21787. public function findPackages($name, $constraint = null);
  21788. public function getPackages();
  21789. public function search($query, $mode = 0);
  21790. }
  21791. <?php
  21792. namespace Composer\Repository;
  21793. use Composer\IO\IOInterface;
  21794. use Composer\Config;
  21795. use Composer\EventDispatcher\EventDispatcher;
  21796. use Composer\Package\PackageInterface;
  21797. use Composer\Util\RemoteFilesystem;
  21798. class RepositoryManager
  21799. {
  21800. private $localRepository;
  21801. private $repositories = array();
  21802. private $repositoryClasses = array();
  21803. private $io;
  21804. private $config;
  21805. private $eventDispatcher;
  21806. private $rfs;
  21807. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21808. {
  21809. $this->io = $io;
  21810. $this->config = $config;
  21811. $this->eventDispatcher = $eventDispatcher;
  21812. $this->rfs = $rfs;
  21813. }
  21814. public function findPackage($name, $constraint)
  21815. {
  21816. foreach ($this->repositories as $repository) {
  21817. if ($package = $repository->findPackage($name, $constraint)) {
  21818. return $package;
  21819. }
  21820. }
  21821. return null;
  21822. }
  21823. public function findPackages($name, $constraint)
  21824. {
  21825. $packages = array();
  21826. foreach ($this->getRepositories() as $repository) {
  21827. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  21828. }
  21829. return $packages;
  21830. }
  21831. public function addRepository(RepositoryInterface $repository)
  21832. {
  21833. $this->repositories[] = $repository;
  21834. }
  21835. public function prependRepository(RepositoryInterface $repository)
  21836. {
  21837. array_unshift($this->repositories, $repository);
  21838. }
  21839. public function createRepository($type, $config, $name = null)
  21840. {
  21841. if (!isset($this->repositoryClasses[$type])) {
  21842. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  21843. }
  21844. if (isset($config['packagist']) && false === $config['packagist']) {
  21845. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  21846. }
  21847. $class = $this->repositoryClasses[$type];
  21848. $reflMethod = new \ReflectionMethod($class, '__construct');
  21849. $params = $reflMethod->getParameters();
  21850. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  21851. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  21852. }
  21853. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  21854. }
  21855. public function setRepositoryClass($type, $class)
  21856. {
  21857. $this->repositoryClasses[$type] = $class;
  21858. }
  21859. public function getRepositories()
  21860. {
  21861. return $this->repositories;
  21862. }
  21863. public function setLocalRepository(WritableRepositoryInterface $repository)
  21864. {
  21865. $this->localRepository = $repository;
  21866. }
  21867. public function getLocalRepository()
  21868. {
  21869. return $this->localRepository;
  21870. }
  21871. }
  21872. <?php
  21873. namespace Composer\Repository;
  21874. class RepositorySecurityException extends \Exception
  21875. {
  21876. }
  21877. <?php
  21878. namespace Composer\Repository\Vcs;
  21879. use Composer\Cache;
  21880. use Composer\Downloader\TransportException;
  21881. use Composer\Json\JsonFile;
  21882. use Composer\Util\Bitbucket;
  21883. abstract class BitbucketDriver extends VcsDriver
  21884. {
  21885. protected $cache;
  21886. protected $owner;
  21887. protected $repository;
  21888. protected $hasIssues;
  21889. protected $rootIdentifier;
  21890. protected $tags;
  21891. protected $branches;
  21892. protected $infoCache = array();
  21893. protected $branchesUrl = '';
  21894. protected $tagsUrl = '';
  21895. protected $homeUrl = '';
  21896. protected $website = '';
  21897. protected $cloneHttpsUrl = '';
  21898. protected $fallbackDriver;
  21899. protected $vcsType;
  21900. public function initialize()
  21901. {
  21902. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#', $this->url, $match);
  21903. $this->owner = $match[1];
  21904. $this->repository = $match[2];
  21905. $this->originUrl = 'bitbucket.org';
  21906. $this->cache = new Cache(
  21907. $this->io,
  21908. implode('/', array(
  21909. $this->config->get('cache-repo-dir'),
  21910. $this->originUrl,
  21911. $this->owner,
  21912. $this->repository,
  21913. ))
  21914. );
  21915. }
  21916. public function getUrl()
  21917. {
  21918. if ($this->fallbackDriver) {
  21919. return $this->fallbackDriver->getUrl();
  21920. }
  21921. return $this->cloneHttpsUrl;
  21922. }
  21923. protected function getRepoData()
  21924. {
  21925. $resource = sprintf(
  21926. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  21927. $this->owner,
  21928. $this->repository,
  21929. http_build_query(
  21930. array('fields' => '-project,-owner'),
  21931. null,
  21932. '&'
  21933. )
  21934. );
  21935. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  21936. if ($this->fallbackDriver) {
  21937. return false;
  21938. }
  21939. $this->parseCloneUrls($repoData['links']['clone']);
  21940. $this->hasIssues = !empty($repoData['has_issues']);
  21941. $this->branchesUrl = $repoData['links']['branches']['href'];
  21942. $this->tagsUrl = $repoData['links']['tags']['href'];
  21943. $this->homeUrl = $repoData['links']['html']['href'];
  21944. $this->website = $repoData['website'];
  21945. $this->vcsType = $repoData['scm'];
  21946. return true;
  21947. }
  21948. public function getComposerInformation($identifier)
  21949. {
  21950. if ($this->fallbackDriver) {
  21951. return $this->fallbackDriver->getComposerInformation($identifier);
  21952. }
  21953. if (!isset($this->infoCache[$identifier])) {
  21954. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  21955. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  21956. }
  21957. $composer = $this->getBaseComposerInformation($identifier);
  21958. if (!isset($composer['support']['source'])) {
  21959. $label = array_search(
  21960. $identifier,
  21961. $this->getTags()
  21962. ) ?: array_search(
  21963. $identifier,
  21964. $this->getBranches()
  21965. ) ?: $identifier;
  21966. if (array_key_exists($label, $tags = $this->getTags())) {
  21967. $hash = $tags[$label];
  21968. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  21969. $hash = $branches[$label];
  21970. }
  21971. if (! isset($hash)) {
  21972. $composer['support']['source'] = sprintf(
  21973. 'https://%s/%s/%s/src',
  21974. $this->originUrl,
  21975. $this->owner,
  21976. $this->repository
  21977. );
  21978. } else {
  21979. $composer['support']['source'] = sprintf(
  21980. 'https://%s/%s/%s/src/%s/?at=%s',
  21981. $this->originUrl,
  21982. $this->owner,
  21983. $this->repository,
  21984. $hash,
  21985. $label
  21986. );
  21987. }
  21988. }
  21989. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  21990. $composer['support']['issues'] = sprintf(
  21991. 'https://%s/%s/%s/issues',
  21992. $this->originUrl,
  21993. $this->owner,
  21994. $this->repository
  21995. );
  21996. }
  21997. if (!isset($composer['homepage'])) {
  21998. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  21999. }
  22000. $this->infoCache[$identifier] = $composer;
  22001. if ($this->shouldCache($identifier)) {
  22002. $this->cache->write($identifier, json_encode($composer));
  22003. }
  22004. }
  22005. return $this->infoCache[$identifier];
  22006. }
  22007. public function getFileContent($file, $identifier)
  22008. {
  22009. if ($this->fallbackDriver) {
  22010. return $this->fallbackDriver->getFileContent($file, $identifier);
  22011. }
  22012. $resource = sprintf(
  22013. 'https://api.bitbucket.org/1.0/repositories/%s/%s/raw/%s/%s',
  22014. $this->owner,
  22015. $this->repository,
  22016. $identifier,
  22017. $file
  22018. );
  22019. return $this->getContentsWithOAuthCredentials($resource);
  22020. }
  22021. public function getChangeDate($identifier)
  22022. {
  22023. if ($this->fallbackDriver) {
  22024. return $this->fallbackDriver->getChangeDate($identifier);
  22025. }
  22026. $resource = sprintf(
  22027. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  22028. $this->owner,
  22029. $this->repository,
  22030. $identifier
  22031. );
  22032. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22033. return new \DateTime($commit['date']);
  22034. }
  22035. public function getSource($identifier)
  22036. {
  22037. if ($this->fallbackDriver) {
  22038. return $this->fallbackDriver->getSource($identifier);
  22039. }
  22040. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  22041. }
  22042. public function getDist($identifier)
  22043. {
  22044. if ($this->fallbackDriver) {
  22045. return $this->fallbackDriver->getDist($identifier);
  22046. }
  22047. $url = sprintf(
  22048. 'https://bitbucket.org/%s/%s/get/%s.zip',
  22049. $this->owner,
  22050. $this->repository,
  22051. $identifier
  22052. );
  22053. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22054. }
  22055. public function getTags()
  22056. {
  22057. if ($this->fallbackDriver) {
  22058. return $this->fallbackDriver->getTags();
  22059. }
  22060. if (null === $this->tags) {
  22061. $this->tags = array();
  22062. $resource = sprintf(
  22063. '%s?%s',
  22064. $this->tagsUrl,
  22065. http_build_query(
  22066. array(
  22067. 'pagelen' => 100,
  22068. 'fields' => 'values.name,values.target.hash,next',
  22069. 'sort' => '-target.date',
  22070. ),
  22071. null,
  22072. '&'
  22073. )
  22074. );
  22075. $hasNext = true;
  22076. while ($hasNext) {
  22077. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22078. foreach ($tagsData['values'] as $data) {
  22079. $this->tags[$data['name']] = $data['target']['hash'];
  22080. }
  22081. if (empty($tagsData['next'])) {
  22082. $hasNext = false;
  22083. } else {
  22084. $resource = $tagsData['next'];
  22085. }
  22086. }
  22087. if ($this->vcsType === 'hg') {
  22088. unset($this->tags['tip']);
  22089. }
  22090. }
  22091. return $this->tags;
  22092. }
  22093. public function getBranches()
  22094. {
  22095. if ($this->fallbackDriver) {
  22096. return $this->fallbackDriver->getBranches();
  22097. }
  22098. if (null === $this->branches) {
  22099. $this->branches = array();
  22100. $resource = sprintf(
  22101. '%s?%s',
  22102. $this->branchesUrl,
  22103. http_build_query(
  22104. array(
  22105. 'pagelen' => 100,
  22106. 'fields' => 'values.name,values.target.hash,values.heads,next',
  22107. 'sort' => '-target.date',
  22108. ),
  22109. null,
  22110. '&'
  22111. )
  22112. );
  22113. $hasNext = true;
  22114. while ($hasNext) {
  22115. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22116. foreach ($branchData['values'] as $data) {
  22117. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  22118. continue;
  22119. }
  22120. $this->branches[$data['name']] = $data['target']['hash'];
  22121. }
  22122. if (empty($branchData['next'])) {
  22123. $hasNext = false;
  22124. } else {
  22125. $resource = $branchData['next'];
  22126. }
  22127. }
  22128. }
  22129. return $this->branches;
  22130. }
  22131. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  22132. {
  22133. try {
  22134. return parent::getContents($url);
  22135. } catch (TransportException $e) {
  22136. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22137. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  22138. if (!$this->io->hasAuthentication($this->originUrl)
  22139. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  22140. ) {
  22141. return parent::getContents($url);
  22142. }
  22143. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22144. return $this->attemptCloneFallback();
  22145. }
  22146. }
  22147. throw $e;
  22148. }
  22149. }
  22150. abstract protected function generateSshUrl();
  22151. protected function attemptCloneFallback()
  22152. {
  22153. try {
  22154. $this->setupFallbackDriver($this->generateSshUrl());
  22155. } catch (\RuntimeException $e) {
  22156. $this->fallbackDriver = null;
  22157. $this->io->writeError(
  22158. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  22159. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  22160. );
  22161. throw $e;
  22162. }
  22163. }
  22164. abstract protected function setupFallbackDriver($url);
  22165. protected function parseCloneUrls(array $cloneLinks)
  22166. {
  22167. foreach ($cloneLinks as $cloneLink) {
  22168. if ($cloneLink['name'] === 'https') {
  22169. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  22170. }
  22171. }
  22172. }
  22173. protected function getMainBranchData()
  22174. {
  22175. $resource = sprintf(
  22176. 'https://api.bitbucket.org/1.0/repositories/%s/%s/main-branch',
  22177. $this->owner,
  22178. $this->repository
  22179. );
  22180. return JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22181. }
  22182. }
  22183. <?php
  22184. namespace Composer\Repository\Vcs;
  22185. use Composer\Config;
  22186. use Composer\Util\ProcessExecutor;
  22187. use Composer\Util\Filesystem;
  22188. use Composer\IO\IOInterface;
  22189. class FossilDriver extends VcsDriver
  22190. {
  22191. protected $tags;
  22192. protected $branches;
  22193. protected $rootIdentifier;
  22194. protected $repoFile;
  22195. protected $checkoutDir;
  22196. protected $infoCache = array();
  22197. public function initialize()
  22198. {
  22199. $this->checkFossil();
  22200. $this->config->prohibitUrlByConfig($this->url, $this->io);
  22201. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  22202. $this->checkoutDir = $this->url;
  22203. } else {
  22204. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  22205. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  22206. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  22207. $this->updateLocalRepo();
  22208. }
  22209. $this->getTags();
  22210. $this->getBranches();
  22211. }
  22212. protected function checkFossil()
  22213. {
  22214. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  22215. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  22216. }
  22217. }
  22218. protected function updateLocalRepo()
  22219. {
  22220. $fs = new Filesystem();
  22221. $fs->ensureDirectoryExists($this->checkoutDir);
  22222. if (!is_writable(dirname($this->checkoutDir))) {
  22223. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  22224. }
  22225. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  22226. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  22227. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  22228. }
  22229. } else {
  22230. $fs->removeDirectory($this->checkoutDir);
  22231. $fs->remove($this->repoFile);
  22232. $fs->ensureDirectoryExists($this->checkoutDir);
  22233. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  22234. $output = $this->process->getErrorOutput();
  22235. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  22236. }
  22237. if (0 !== $this->process->execute(sprintf('fossil open %s --nested', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  22238. $output = $this->process->getErrorOutput();
  22239. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  22240. }
  22241. }
  22242. }
  22243. public function getRootIdentifier()
  22244. {
  22245. if (null === $this->rootIdentifier) {
  22246. $this->rootIdentifier = 'trunk';
  22247. }
  22248. return $this->rootIdentifier;
  22249. }
  22250. public function getUrl()
  22251. {
  22252. return $this->url;
  22253. }
  22254. public function getSource($identifier)
  22255. {
  22256. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  22257. }
  22258. public function getDist($identifier)
  22259. {
  22260. return null;
  22261. }
  22262. public function getFileContent($file, $identifier)
  22263. {
  22264. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22265. $this->process->execute($command, $content, $this->checkoutDir);
  22266. if (!trim($content)) {
  22267. return null;
  22268. }
  22269. return $content;
  22270. }
  22271. public function getChangeDate($identifier)
  22272. {
  22273. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  22274. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  22275. return new \DateTime($date, new \DateTimeZone('UTC'));
  22276. }
  22277. public function getTags()
  22278. {
  22279. if (null === $this->tags) {
  22280. $tags = array();
  22281. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  22282. foreach ($this->process->splitLines($output) as $tag) {
  22283. $tags[$tag] = $tag;
  22284. }
  22285. $this->tags = $tags;
  22286. }
  22287. return $this->tags;
  22288. }
  22289. public function getBranches()
  22290. {
  22291. if (null === $this->branches) {
  22292. $branches = array();
  22293. $bookmarks = array();
  22294. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  22295. foreach ($this->process->splitLines($output) as $branch) {
  22296. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  22297. $branches[$branch] = $branch;
  22298. }
  22299. $this->branches = $branches;
  22300. }
  22301. return $this->branches;
  22302. }
  22303. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22304. {
  22305. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  22306. return true;
  22307. }
  22308. if (preg_match('!/fossil/|\.fossil!', $url)) {
  22309. return true;
  22310. }
  22311. if (Filesystem::isLocalPath($url)) {
  22312. $url = Filesystem::getPlatformPath($url);
  22313. if (!is_dir($url)) {
  22314. return false;
  22315. }
  22316. $process = new ProcessExecutor();
  22317. if ($process->execute('fossil info', $output, $url) === 0) {
  22318. return true;
  22319. }
  22320. }
  22321. return false;
  22322. }
  22323. }
  22324. <?php
  22325. namespace Composer\Repository\Vcs;
  22326. use Composer\Config;
  22327. use Composer\IO\IOInterface;
  22328. class GitBitbucketDriver extends BitbucketDriver
  22329. {
  22330. public function getRootIdentifier()
  22331. {
  22332. if ($this->fallbackDriver) {
  22333. return $this->fallbackDriver->getRootIdentifier();
  22334. }
  22335. if (null === $this->rootIdentifier) {
  22336. if (! $this->getRepoData()) {
  22337. return $this->fallbackDriver->getRootIdentifier();
  22338. }
  22339. if ($this->vcsType !== 'git') {
  22340. throw new \RuntimeException(
  22341. $this->url.' does not appear to be a git repository, use '.
  22342. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  22343. );
  22344. }
  22345. $mainBranchData = $this->getMainBranchData();
  22346. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  22347. }
  22348. return $this->rootIdentifier;
  22349. }
  22350. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22351. {
  22352. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
  22353. return false;
  22354. }
  22355. if (!extension_loaded('openssl')) {
  22356. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22357. return false;
  22358. }
  22359. return true;
  22360. }
  22361. protected function setupFallbackDriver($url)
  22362. {
  22363. $this->fallbackDriver = new GitDriver(
  22364. array('url' => $url),
  22365. $this->io,
  22366. $this->config,
  22367. $this->process,
  22368. $this->remoteFilesystem
  22369. );
  22370. $this->fallbackDriver->initialize();
  22371. }
  22372. protected function generateSshUrl()
  22373. {
  22374. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  22375. }
  22376. }
  22377. <?php
  22378. namespace Composer\Repository\Vcs;
  22379. use Composer\Util\ProcessExecutor;
  22380. use Composer\Util\Filesystem;
  22381. use Composer\Util\Git as GitUtil;
  22382. use Composer\IO\IOInterface;
  22383. use Composer\Cache;
  22384. use Composer\Config;
  22385. class GitDriver extends VcsDriver
  22386. {
  22387. protected $cache;
  22388. protected $tags;
  22389. protected $branches;
  22390. protected $rootIdentifier;
  22391. protected $repoDir;
  22392. protected $infoCache = array();
  22393. public function initialize()
  22394. {
  22395. if (Filesystem::isLocalPath($this->url)) {
  22396. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  22397. $this->repoDir = $this->url;
  22398. $cacheUrl = realpath($this->url);
  22399. } else {
  22400. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  22401. GitUtil::cleanEnv();
  22402. $fs = new Filesystem();
  22403. $fs->ensureDirectoryExists(dirname($this->repoDir));
  22404. if (!is_writable(dirname($this->repoDir))) {
  22405. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  22406. }
  22407. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  22408. 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.');
  22409. }
  22410. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  22411. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  22412. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  22413. }
  22414. $cacheUrl = $this->url;
  22415. }
  22416. $this->getTags();
  22417. $this->getBranches();
  22418. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  22419. }
  22420. public function getRootIdentifier()
  22421. {
  22422. if (null === $this->rootIdentifier) {
  22423. $this->rootIdentifier = 'master';
  22424. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  22425. $branches = $this->process->splitLines($output);
  22426. if (!in_array('* master', $branches)) {
  22427. foreach ($branches as $branch) {
  22428. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  22429. $this->rootIdentifier = $match[1];
  22430. break;
  22431. }
  22432. }
  22433. }
  22434. }
  22435. return $this->rootIdentifier;
  22436. }
  22437. public function getUrl()
  22438. {
  22439. return $this->url;
  22440. }
  22441. public function getSource($identifier)
  22442. {
  22443. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  22444. }
  22445. public function getDist($identifier)
  22446. {
  22447. return null;
  22448. }
  22449. public function getFileContent($file, $identifier)
  22450. {
  22451. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22452. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  22453. if (!trim($content)) {
  22454. return null;
  22455. }
  22456. return $content;
  22457. }
  22458. public function getChangeDate($identifier)
  22459. {
  22460. $this->process->execute(sprintf(
  22461. 'git log -1 --format=%%at %s',
  22462. ProcessExecutor::escape($identifier)
  22463. ), $output, $this->repoDir);
  22464. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  22465. }
  22466. public function getTags()
  22467. {
  22468. if (null === $this->tags) {
  22469. $this->tags = array();
  22470. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  22471. foreach ($output = $this->process->splitLines($output) as $tag) {
  22472. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  22473. $this->tags[$match[2]] = $match[1];
  22474. }
  22475. }
  22476. }
  22477. return $this->tags;
  22478. }
  22479. public function getBranches()
  22480. {
  22481. if (null === $this->branches) {
  22482. $branches = array();
  22483. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  22484. foreach ($this->process->splitLines($output) as $branch) {
  22485. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  22486. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  22487. $branches[$match[1]] = $match[2];
  22488. }
  22489. }
  22490. }
  22491. $this->branches = $branches;
  22492. }
  22493. return $this->branches;
  22494. }
  22495. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22496. {
  22497. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  22498. return true;
  22499. }
  22500. if (Filesystem::isLocalPath($url)) {
  22501. $url = Filesystem::getPlatformPath($url);
  22502. if (!is_dir($url)) {
  22503. return false;
  22504. }
  22505. $process = new ProcessExecutor($io);
  22506. if ($process->execute('git tag', $output, $url) === 0) {
  22507. return true;
  22508. }
  22509. }
  22510. if (!$deep) {
  22511. return false;
  22512. }
  22513. $process = new ProcessExecutor($io);
  22514. return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
  22515. }
  22516. }
  22517. <?php
  22518. namespace Composer\Repository\Vcs;
  22519. use Composer\Config;
  22520. use Composer\Downloader\TransportException;
  22521. use Composer\Json\JsonFile;
  22522. use Composer\Cache;
  22523. use Composer\IO\IOInterface;
  22524. use Composer\Util\GitHub;
  22525. class GitHubDriver extends VcsDriver
  22526. {
  22527. protected $cache;
  22528. protected $owner;
  22529. protected $repository;
  22530. protected $tags;
  22531. protected $branches;
  22532. protected $rootIdentifier;
  22533. protected $repoData;
  22534. protected $hasIssues;
  22535. protected $infoCache = array();
  22536. protected $isPrivate = false;
  22537. protected $gitDriver;
  22538. public function initialize()
  22539. {
  22540. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  22541. $this->owner = $match[3];
  22542. $this->repository = $match[4];
  22543. $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
  22544. if ($this->originUrl === 'www.github.com') {
  22545. $this->originUrl = 'github.com';
  22546. }
  22547. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  22548. if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
  22549. $this->setupGitDriver($this->url);
  22550. return;
  22551. }
  22552. $this->fetchRootIdentifier();
  22553. }
  22554. public function getRepositoryUrl()
  22555. {
  22556. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  22557. }
  22558. public function getRootIdentifier()
  22559. {
  22560. if ($this->gitDriver) {
  22561. return $this->gitDriver->getRootIdentifier();
  22562. }
  22563. return $this->rootIdentifier;
  22564. }
  22565. public function getUrl()
  22566. {
  22567. if ($this->gitDriver) {
  22568. return $this->gitDriver->getUrl();
  22569. }
  22570. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  22571. }
  22572. protected function getApiUrl()
  22573. {
  22574. if ('github.com' === $this->originUrl) {
  22575. $apiUrl = 'api.github.com';
  22576. } else {
  22577. $apiUrl = $this->originUrl . '/api/v3';
  22578. }
  22579. return 'https://' . $apiUrl;
  22580. }
  22581. public function getSource($identifier)
  22582. {
  22583. if ($this->gitDriver) {
  22584. return $this->gitDriver->getSource($identifier);
  22585. }
  22586. if ($this->isPrivate) {
  22587. $url = $this->generateSshUrl();
  22588. } else {
  22589. $url = $this->getUrl();
  22590. }
  22591. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  22592. }
  22593. public function getDist($identifier)
  22594. {
  22595. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  22596. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22597. }
  22598. public function getComposerInformation($identifier)
  22599. {
  22600. if ($this->gitDriver) {
  22601. return $this->gitDriver->getComposerInformation($identifier);
  22602. }
  22603. if (!isset($this->infoCache[$identifier])) {
  22604. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22605. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22606. }
  22607. $composer = $this->getBaseComposerInformation($identifier);
  22608. if ($composer) {
  22609. if (!isset($composer['support']['source'])) {
  22610. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  22611. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  22612. }
  22613. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22614. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  22615. }
  22616. }
  22617. if ($this->shouldCache($identifier)) {
  22618. $this->cache->write($identifier, json_encode($composer));
  22619. }
  22620. $this->infoCache[$identifier] = $composer;
  22621. }
  22622. return $this->infoCache[$identifier];
  22623. }
  22624. public function getFileContent($file, $identifier)
  22625. {
  22626. if ($this->gitDriver) {
  22627. return $this->gitDriver->getFileContent($file, $identifier);
  22628. }
  22629. $notFoundRetries = 2;
  22630. while ($notFoundRetries) {
  22631. try {
  22632. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  22633. $resource = JsonFile::parseJson($this->getContents($resource));
  22634. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  22635. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  22636. }
  22637. return $content;
  22638. } catch (TransportException $e) {
  22639. if (404 !== $e->getCode()) {
  22640. throw $e;
  22641. }
  22642. $notFoundRetries--;
  22643. return null;
  22644. }
  22645. }
  22646. return null;
  22647. }
  22648. public function getChangeDate($identifier)
  22649. {
  22650. if ($this->gitDriver) {
  22651. return $this->gitDriver->getChangeDate($identifier);
  22652. }
  22653. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  22654. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  22655. return new \DateTime($commit['commit']['committer']['date']);
  22656. }
  22657. public function getTags()
  22658. {
  22659. if ($this->gitDriver) {
  22660. return $this->gitDriver->getTags();
  22661. }
  22662. if (null === $this->tags) {
  22663. $this->tags = array();
  22664. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  22665. do {
  22666. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  22667. foreach ($tagsData as $tag) {
  22668. $this->tags[$tag['name']] = $tag['commit']['sha'];
  22669. }
  22670. $resource = $this->getNextPage();
  22671. } while ($resource);
  22672. }
  22673. return $this->tags;
  22674. }
  22675. public function getBranches()
  22676. {
  22677. if ($this->gitDriver) {
  22678. return $this->gitDriver->getBranches();
  22679. }
  22680. if (null === $this->branches) {
  22681. $this->branches = array();
  22682. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  22683. $branchBlacklist = array('gh-pages');
  22684. do {
  22685. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  22686. foreach ($branchData as $branch) {
  22687. $name = substr($branch['ref'], 11);
  22688. if (!in_array($name, $branchBlacklist)) {
  22689. $this->branches[$name] = $branch['object']['sha'];
  22690. }
  22691. }
  22692. $resource = $this->getNextPage();
  22693. } while ($resource);
  22694. }
  22695. return $this->branches;
  22696. }
  22697. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22698. {
  22699. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  22700. return false;
  22701. }
  22702. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  22703. if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
  22704. return false;
  22705. }
  22706. if (!extension_loaded('openssl')) {
  22707. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22708. return false;
  22709. }
  22710. return true;
  22711. }
  22712. public function getRepoData()
  22713. {
  22714. $this->fetchRootIdentifier();
  22715. return $this->repoData;
  22716. }
  22717. protected function generateSshUrl()
  22718. {
  22719. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  22720. }
  22721. protected function getContents($url, $fetchingRepoData = false)
  22722. {
  22723. try {
  22724. return parent::getContents($url);
  22725. } catch (TransportException $e) {
  22726. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22727. switch ($e->getCode()) {
  22728. case 401:
  22729. case 404:
  22730. if (!$fetchingRepoData) {
  22731. throw $e;
  22732. }
  22733. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  22734. return parent::getContents($url);
  22735. }
  22736. if (!$this->io->isInteractive()) {
  22737. return $this->attemptCloneFallback();
  22738. }
  22739. $scopesIssued = array();
  22740. $scopesNeeded = array();
  22741. if ($headers = $e->getHeaders()) {
  22742. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  22743. $scopesIssued = explode(' ', $scopes);
  22744. }
  22745. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  22746. $scopesNeeded = explode(' ', $scopes);
  22747. }
  22748. }
  22749. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  22750. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  22751. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  22752. }
  22753. return parent::getContents($url);
  22754. case 403:
  22755. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  22756. return parent::getContents($url);
  22757. }
  22758. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22759. return $this->attemptCloneFallback();
  22760. }
  22761. $rateLimited = $githubUtil->isRateLimited($e->getHeaders());
  22762. if (!$this->io->hasAuthentication($this->originUrl)) {
  22763. if (!$this->io->isInteractive()) {
  22764. $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>');
  22765. throw $e;
  22766. }
  22767. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  22768. return parent::getContents($url);
  22769. }
  22770. if ($rateLimited) {
  22771. $rateLimit = $githubUtil->getRateLimit($e->getHeaders());
  22772. $this->io->writeError(sprintf(
  22773. '<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>',
  22774. $rateLimit['limit'],
  22775. $rateLimit['reset']
  22776. ));
  22777. }
  22778. throw $e;
  22779. default:
  22780. throw $e;
  22781. }
  22782. }
  22783. }
  22784. protected function fetchRootIdentifier()
  22785. {
  22786. if ($this->repoData) {
  22787. return;
  22788. }
  22789. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  22790. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  22791. if (null === $this->repoData && null !== $this->gitDriver) {
  22792. return;
  22793. }
  22794. $this->owner = $this->repoData['owner']['login'];
  22795. $this->repository = $this->repoData['name'];
  22796. $this->isPrivate = !empty($this->repoData['private']);
  22797. if (isset($this->repoData['default_branch'])) {
  22798. $this->rootIdentifier = $this->repoData['default_branch'];
  22799. } elseif (isset($this->repoData['master_branch'])) {
  22800. $this->rootIdentifier = $this->repoData['master_branch'];
  22801. } else {
  22802. $this->rootIdentifier = 'master';
  22803. }
  22804. $this->hasIssues = !empty($this->repoData['has_issues']);
  22805. }
  22806. protected function attemptCloneFallback()
  22807. {
  22808. $this->isPrivate = true;
  22809. try {
  22810. $this->setupGitDriver($this->generateSshUrl());
  22811. return;
  22812. } catch (\RuntimeException $e) {
  22813. $this->gitDriver = null;
  22814. $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>');
  22815. throw $e;
  22816. }
  22817. }
  22818. protected function setupGitDriver($url)
  22819. {
  22820. $this->gitDriver = new GitDriver(
  22821. array('url' => $url),
  22822. $this->io,
  22823. $this->config,
  22824. $this->process,
  22825. $this->remoteFilesystem
  22826. );
  22827. $this->gitDriver->initialize();
  22828. }
  22829. protected function getNextPage()
  22830. {
  22831. $headers = $this->remoteFilesystem->getLastHeaders();
  22832. foreach ($headers as $header) {
  22833. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  22834. $links = explode(',', $match[1]);
  22835. foreach ($links as $link) {
  22836. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  22837. return $match[1];
  22838. }
  22839. }
  22840. }
  22841. }
  22842. }
  22843. }
  22844. <?php
  22845. namespace Composer\Repository\Vcs;
  22846. use Composer\Config;
  22847. use Composer\Cache;
  22848. use Composer\IO\IOInterface;
  22849. use Composer\Json\JsonFile;
  22850. use Composer\Downloader\TransportException;
  22851. use Composer\Util\RemoteFilesystem;
  22852. use Composer\Util\GitLab;
  22853. class GitLabDriver extends VcsDriver
  22854. {
  22855. private $scheme;
  22856. private $namespace;
  22857. private $repository;
  22858. private $project;
  22859. private $commits = array();
  22860. private $tags;
  22861. private $branches;
  22862. protected $gitDriver;
  22863. private $isPrivate = true;
  22864. protected $portNumber;
  22865. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  22866. public function initialize()
  22867. {
  22868. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  22869. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  22870. }
  22871. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  22872. $configuredDomains = $this->config->get('gitlab-domains');
  22873. $urlParts = explode('/', $match['parts']);
  22874. $this->scheme = !empty($match['scheme'])
  22875. ? $match['scheme']
  22876. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  22877. ;
  22878. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts);
  22879. if (!empty($match['port']) && true === is_numeric($match['port'])) {
  22880. $this->portNumber = (int) $match['port'];
  22881. }
  22882. $this->namespace = implode('/', $urlParts);
  22883. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  22884. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  22885. $this->fetchProject();
  22886. }
  22887. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  22888. {
  22889. $this->remoteFilesystem = $remoteFilesystem;
  22890. }
  22891. public function getFileContent($file, $identifier)
  22892. {
  22893. if ($this->gitDriver) {
  22894. return $this->gitDriver->getFileContent($file, $identifier);
  22895. }
  22896. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  22897. $branches = $this->getBranches();
  22898. if (isset($branches[$identifier])) {
  22899. $identifier = $branches[$identifier];
  22900. }
  22901. }
  22902. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  22903. try {
  22904. $content = $this->getContents($resource);
  22905. } catch (TransportException $e) {
  22906. if ($e->getCode() !== 404) {
  22907. throw $e;
  22908. }
  22909. return null;
  22910. }
  22911. return $content;
  22912. }
  22913. public function getChangeDate($identifier)
  22914. {
  22915. if ($this->gitDriver) {
  22916. return $this->gitDriver->getChangeDate($identifier);
  22917. }
  22918. if (isset($this->commits[$identifier])) {
  22919. return new \DateTime($this->commits[$identifier]['committed_date']);
  22920. }
  22921. return new \DateTime();
  22922. }
  22923. public function getRepositoryUrl()
  22924. {
  22925. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  22926. }
  22927. public function getUrl()
  22928. {
  22929. if ($this->gitDriver) {
  22930. return $this->gitDriver->getUrl();
  22931. }
  22932. return $this->project['web_url'];
  22933. }
  22934. public function getDist($identifier)
  22935. {
  22936. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  22937. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22938. }
  22939. public function getSource($identifier)
  22940. {
  22941. if ($this->gitDriver) {
  22942. return $this->gitDriver->getSource($identifier);
  22943. }
  22944. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  22945. }
  22946. public function getRootIdentifier()
  22947. {
  22948. if ($this->gitDriver) {
  22949. return $this->gitDriver->getRootIdentifier();
  22950. }
  22951. return $this->project['default_branch'];
  22952. }
  22953. public function getBranches()
  22954. {
  22955. if ($this->gitDriver) {
  22956. return $this->gitDriver->getBranches();
  22957. }
  22958. if (!$this->branches) {
  22959. $this->branches = $this->getReferences('branches');
  22960. }
  22961. return $this->branches;
  22962. }
  22963. public function getTags()
  22964. {
  22965. if ($this->gitDriver) {
  22966. return $this->gitDriver->getTags();
  22967. }
  22968. if (!$this->tags) {
  22969. $this->tags = $this->getReferences('tags');
  22970. }
  22971. return $this->tags;
  22972. }
  22973. public function getApiUrl()
  22974. {
  22975. $domainName = $this->originUrl;
  22976. $portNumber = (true === is_numeric($this->portNumber)) ? sprintf(':%s', $this->portNumber) : '';
  22977. return $this->scheme.'://'.$domainName.$portNumber.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  22978. }
  22979. private function urlEncodeAll($string)
  22980. {
  22981. $encoded = '';
  22982. for ($i = 0; isset($string[$i]); $i++) {
  22983. $character = $string[$i];
  22984. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  22985. $character = '%' . sprintf('%02X', ord($character));
  22986. }
  22987. $encoded .= $character;
  22988. }
  22989. return $encoded;
  22990. }
  22991. protected function getReferences($type)
  22992. {
  22993. $perPage = 100;
  22994. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  22995. $references = array();
  22996. do {
  22997. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  22998. foreach ($data as $datum) {
  22999. $references[$datum['name']] = $datum['commit']['id'];
  23000. $this->commits[$datum['commit']['id']] = $datum['commit'];
  23001. }
  23002. if (count($data) >= $perPage) {
  23003. $resource = $this->getNextPage();
  23004. } else {
  23005. $resource = false;
  23006. }
  23007. } while ($resource);
  23008. return $references;
  23009. }
  23010. protected function fetchProject()
  23011. {
  23012. $resource = $this->getApiUrl();
  23013. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  23014. if (isset($this->project['visibility'])) {
  23015. $this->isPrivate = $this->project['visibility'] !== 'public';
  23016. } else {
  23017. $this->isPrivate = false;
  23018. }
  23019. }
  23020. protected function attemptCloneFallback()
  23021. {
  23022. try {
  23023. if ($this->isPrivate === false) {
  23024. $url = $this->generatePublicUrl();
  23025. } else {
  23026. $url = $this->generateSshUrl();
  23027. }
  23028. $this->setupGitDriver($url);
  23029. return;
  23030. } catch (\RuntimeException $e) {
  23031. $this->gitDriver = null;
  23032. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  23033. throw $e;
  23034. }
  23035. }
  23036. protected function generateSshUrl()
  23037. {
  23038. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  23039. }
  23040. protected function generatePublicUrl()
  23041. {
  23042. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  23043. }
  23044. protected function setupGitDriver($url)
  23045. {
  23046. $this->gitDriver = new GitDriver(
  23047. array('url' => $url),
  23048. $this->io,
  23049. $this->config,
  23050. $this->process,
  23051. $this->remoteFilesystem
  23052. );
  23053. $this->gitDriver->initialize();
  23054. }
  23055. protected function getContents($url, $fetchingRepoData = false)
  23056. {
  23057. try {
  23058. $res = parent::getContents($url);
  23059. if ($fetchingRepoData) {
  23060. $json = JsonFile::parseJson($res, $url);
  23061. if (!isset($json['default_branch'])) {
  23062. if (!empty($json['id'])) {
  23063. $this->isPrivate = false;
  23064. }
  23065. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  23066. }
  23067. }
  23068. return $res;
  23069. } catch (TransportException $e) {
  23070. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23071. switch ($e->getCode()) {
  23072. case 401:
  23073. case 404:
  23074. if (!$fetchingRepoData) {
  23075. throw $e;
  23076. }
  23077. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  23078. return parent::getContents($url);
  23079. }
  23080. if (!$this->io->isInteractive()) {
  23081. return $this->attemptCloneFallback();
  23082. }
  23083. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  23084. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  23085. return parent::getContents($url);
  23086. case 403:
  23087. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  23088. return parent::getContents($url);
  23089. }
  23090. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23091. return $this->attemptCloneFallback();
  23092. }
  23093. throw $e;
  23094. default:
  23095. throw $e;
  23096. }
  23097. }
  23098. }
  23099. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23100. {
  23101. if (!preg_match(self::URL_REGEX, $url, $match)) {
  23102. return false;
  23103. }
  23104. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  23105. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  23106. $urlParts = explode('/', $match['parts']);
  23107. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts)) {
  23108. return false;
  23109. }
  23110. if ('https' === $scheme && !extension_loaded('openssl')) {
  23111. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23112. return false;
  23113. }
  23114. return true;
  23115. }
  23116. private function getNextPage()
  23117. {
  23118. $headers = $this->remoteFilesystem->getLastHeaders();
  23119. foreach ($headers as $header) {
  23120. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  23121. $links = explode(',', $match[1]);
  23122. foreach ($links as $link) {
  23123. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  23124. return $match[1];
  23125. }
  23126. }
  23127. }
  23128. }
  23129. }
  23130. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts)
  23131. {
  23132. if (in_array($guessedDomain, $configuredDomains)) {
  23133. return $guessedDomain;
  23134. }
  23135. while (null !== ($part = array_shift($urlParts))) {
  23136. $guessedDomain .= '/' . $part;
  23137. if (in_array($guessedDomain, $configuredDomains)) {
  23138. return $guessedDomain;
  23139. }
  23140. }
  23141. return false;
  23142. }
  23143. }
  23144. <?php
  23145. namespace Composer\Repository\Vcs;
  23146. use Composer\Config;
  23147. use Composer\IO\IOInterface;
  23148. class HgBitbucketDriver extends BitbucketDriver
  23149. {
  23150. public function getRootIdentifier()
  23151. {
  23152. if ($this->fallbackDriver) {
  23153. return $this->fallbackDriver->getRootIdentifier();
  23154. }
  23155. if (null === $this->rootIdentifier) {
  23156. if (! $this->getRepoData()) {
  23157. return $this->fallbackDriver->getRootIdentifier();
  23158. }
  23159. if ($this->vcsType !== 'hg') {
  23160. throw new \RuntimeException(
  23161. $this->url.' does not appear to be a mercurial repository, use '.
  23162. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  23163. );
  23164. }
  23165. $mainBranchData = $this->getMainBranchData();
  23166. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  23167. }
  23168. return $this->rootIdentifier;
  23169. }
  23170. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23171. {
  23172. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
  23173. return false;
  23174. }
  23175. if (!extension_loaded('openssl')) {
  23176. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23177. return false;
  23178. }
  23179. return true;
  23180. }
  23181. protected function setupFallbackDriver($url)
  23182. {
  23183. $this->fallbackDriver = new HgDriver(
  23184. array('url' => $url),
  23185. $this->io,
  23186. $this->config,
  23187. $this->process,
  23188. $this->remoteFilesystem
  23189. );
  23190. $this->fallbackDriver->initialize();
  23191. }
  23192. protected function generateSshUrl()
  23193. {
  23194. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  23195. }
  23196. }
  23197. <?php
  23198. namespace Composer\Repository\Vcs;
  23199. use Composer\Config;
  23200. use Composer\Util\Hg as HgUtils;
  23201. use Composer\Util\ProcessExecutor;
  23202. use Composer\Util\Filesystem;
  23203. use Composer\IO\IOInterface;
  23204. class HgDriver extends VcsDriver
  23205. {
  23206. protected $tags;
  23207. protected $branches;
  23208. protected $rootIdentifier;
  23209. protected $repoDir;
  23210. protected $infoCache = array();
  23211. public function initialize()
  23212. {
  23213. if (Filesystem::isLocalPath($this->url)) {
  23214. $this->repoDir = $this->url;
  23215. } else {
  23216. $cacheDir = $this->config->get('cache-vcs-dir');
  23217. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  23218. $fs = new Filesystem();
  23219. $fs->ensureDirectoryExists($cacheDir);
  23220. if (!is_writable(dirname($this->repoDir))) {
  23221. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  23222. }
  23223. $this->config->prohibitUrlByConfig($this->url, $this->io);
  23224. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  23225. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  23226. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  23227. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  23228. }
  23229. } else {
  23230. $fs->removeDirectory($this->repoDir);
  23231. $command = function ($url) {
  23232. return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($this->repoDir));
  23233. };
  23234. $hgUtils->runCommand($command, $this->url, $this->repoDir);
  23235. }
  23236. }
  23237. $this->getTags();
  23238. $this->getBranches();
  23239. }
  23240. public function getRootIdentifier()
  23241. {
  23242. if (null === $this->rootIdentifier) {
  23243. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  23244. $output = $this->process->splitLines($output);
  23245. $this->rootIdentifier = $output[0];
  23246. }
  23247. return $this->rootIdentifier;
  23248. }
  23249. public function getUrl()
  23250. {
  23251. return $this->url;
  23252. }
  23253. public function getSource($identifier)
  23254. {
  23255. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  23256. }
  23257. public function getDist($identifier)
  23258. {
  23259. return null;
  23260. }
  23261. public function getFileContent($file, $identifier)
  23262. {
  23263. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23264. $this->process->execute($resource, $content, $this->repoDir);
  23265. if (!trim($content)) {
  23266. return;
  23267. }
  23268. return $content;
  23269. }
  23270. public function getChangeDate($identifier)
  23271. {
  23272. $this->process->execute(
  23273. sprintf(
  23274. 'hg log --template "{date|rfc3339date}" -r %s',
  23275. ProcessExecutor::escape($identifier)
  23276. ),
  23277. $output,
  23278. $this->repoDir
  23279. );
  23280. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  23281. }
  23282. public function getTags()
  23283. {
  23284. if (null === $this->tags) {
  23285. $tags = array();
  23286. $this->process->execute('hg tags', $output, $this->repoDir);
  23287. foreach ($this->process->splitLines($output) as $tag) {
  23288. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  23289. $tags[$match[1]] = $match[2];
  23290. }
  23291. }
  23292. unset($tags['tip']);
  23293. $this->tags = $tags;
  23294. }
  23295. return $this->tags;
  23296. }
  23297. public function getBranches()
  23298. {
  23299. if (null === $this->branches) {
  23300. $branches = array();
  23301. $bookmarks = array();
  23302. $this->process->execute('hg branches', $output, $this->repoDir);
  23303. foreach ($this->process->splitLines($output) as $branch) {
  23304. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  23305. $branches[$match[1]] = $match[2];
  23306. }
  23307. }
  23308. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  23309. foreach ($this->process->splitLines($output) as $branch) {
  23310. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  23311. $bookmarks[$match[1]] = $match[2];
  23312. }
  23313. }
  23314. $this->branches = array_merge($bookmarks, $branches);
  23315. }
  23316. return $this->branches;
  23317. }
  23318. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23319. {
  23320. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  23321. return true;
  23322. }
  23323. if (Filesystem::isLocalPath($url)) {
  23324. $url = Filesystem::getPlatformPath($url);
  23325. if (!is_dir($url)) {
  23326. return false;
  23327. }
  23328. $process = new ProcessExecutor();
  23329. if ($process->execute('hg summary', $output, $url) === 0) {
  23330. return true;
  23331. }
  23332. }
  23333. if (!$deep) {
  23334. return false;
  23335. }
  23336. $processExecutor = new ProcessExecutor();
  23337. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  23338. return $exit === 0;
  23339. }
  23340. }
  23341. <?php
  23342. namespace Composer\Repository\Vcs;
  23343. use Composer\Config;
  23344. use Composer\IO\IOInterface;
  23345. use Composer\Util\ProcessExecutor;
  23346. use Composer\Util\Perforce;
  23347. class PerforceDriver extends VcsDriver
  23348. {
  23349. protected $depot;
  23350. protected $branch;
  23351. protected $perforce;
  23352. public function initialize()
  23353. {
  23354. $this->depot = $this->repoConfig['depot'];
  23355. $this->branch = '';
  23356. if (!empty($this->repoConfig['branch'])) {
  23357. $this->branch = $this->repoConfig['branch'];
  23358. }
  23359. $this->initPerforce($this->repoConfig);
  23360. $this->perforce->p4Login();
  23361. $this->perforce->checkStream();
  23362. $this->perforce->writeP4ClientSpec();
  23363. $this->perforce->connectClient();
  23364. return true;
  23365. }
  23366. private function initPerforce($repoConfig)
  23367. {
  23368. if (!empty($this->perforce)) {
  23369. return;
  23370. }
  23371. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  23372. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  23373. }
  23374. public function getFileContent($file, $identifier)
  23375. {
  23376. return $this->perforce->getFileContent($file, $identifier);
  23377. }
  23378. public function getChangeDate($identifier)
  23379. {
  23380. return null;
  23381. }
  23382. public function getRootIdentifier()
  23383. {
  23384. return $this->branch;
  23385. }
  23386. public function getBranches()
  23387. {
  23388. return $this->perforce->getBranches();
  23389. }
  23390. public function getTags()
  23391. {
  23392. return $this->perforce->getTags();
  23393. }
  23394. public function getDist($identifier)
  23395. {
  23396. return null;
  23397. }
  23398. public function getSource($identifier)
  23399. {
  23400. $source = array(
  23401. 'type' => 'perforce',
  23402. 'url' => $this->repoConfig['url'],
  23403. 'reference' => $identifier,
  23404. 'p4user' => $this->perforce->getUser(),
  23405. );
  23406. return $source;
  23407. }
  23408. public function getUrl()
  23409. {
  23410. return $this->url;
  23411. }
  23412. public function hasComposerFile($identifier)
  23413. {
  23414. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  23415. $composerInfoIdentifier = $identifier;
  23416. return !empty($composerInfo);
  23417. }
  23418. public function getContents($url)
  23419. {
  23420. return false;
  23421. }
  23422. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23423. {
  23424. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  23425. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  23426. }
  23427. return false;
  23428. }
  23429. public function cleanup()
  23430. {
  23431. $this->perforce->cleanupClientSpec();
  23432. $this->perforce = null;
  23433. }
  23434. public function getDepot()
  23435. {
  23436. return $this->depot;
  23437. }
  23438. public function getBranch()
  23439. {
  23440. return $this->branch;
  23441. }
  23442. }
  23443. <?php
  23444. namespace Composer\Repository\Vcs;
  23445. use Composer\Cache;
  23446. use Composer\Config;
  23447. use Composer\Json\JsonFile;
  23448. use Composer\Util\ProcessExecutor;
  23449. use Composer\Util\Filesystem;
  23450. use Composer\Util\Svn as SvnUtil;
  23451. use Composer\IO\IOInterface;
  23452. use Composer\Downloader\TransportException;
  23453. class SvnDriver extends VcsDriver
  23454. {
  23455. protected $cache;
  23456. protected $baseUrl;
  23457. protected $tags;
  23458. protected $branches;
  23459. protected $rootIdentifier;
  23460. protected $infoCache = array();
  23461. protected $trunkPath = 'trunk';
  23462. protected $branchesPath = 'branches';
  23463. protected $tagsPath = 'tags';
  23464. protected $packagePath = '';
  23465. protected $cacheCredentials = true;
  23466. private $util;
  23467. public function initialize()
  23468. {
  23469. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  23470. SvnUtil::cleanEnv();
  23471. if (isset($this->repoConfig['trunk-path'])) {
  23472. $this->trunkPath = $this->repoConfig['trunk-path'];
  23473. }
  23474. if (isset($this->repoConfig['branches-path'])) {
  23475. $this->branchesPath = $this->repoConfig['branches-path'];
  23476. }
  23477. if (isset($this->repoConfig['tags-path'])) {
  23478. $this->tagsPath = $this->repoConfig['tags-path'];
  23479. }
  23480. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  23481. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  23482. }
  23483. if (isset($this->repoConfig['package-path'])) {
  23484. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  23485. }
  23486. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  23487. $this->baseUrl = substr($this->url, 0, $pos);
  23488. }
  23489. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  23490. $this->getBranches();
  23491. $this->getTags();
  23492. }
  23493. public function getRootIdentifier()
  23494. {
  23495. return $this->rootIdentifier ?: $this->trunkPath;
  23496. }
  23497. public function getUrl()
  23498. {
  23499. return $this->url;
  23500. }
  23501. public function getSource($identifier)
  23502. {
  23503. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  23504. }
  23505. public function getDist($identifier)
  23506. {
  23507. return null;
  23508. }
  23509. protected function shouldCache($identifier)
  23510. {
  23511. return $this->cache && preg_match('{@\d+$}', $identifier);
  23512. }
  23513. public function getComposerInformation($identifier)
  23514. {
  23515. if (!isset($this->infoCache[$identifier])) {
  23516. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  23517. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23518. }
  23519. try {
  23520. $composer = $this->getBaseComposerInformation($identifier);
  23521. } catch (TransportException $e) {
  23522. $message = $e->getMessage();
  23523. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  23524. throw $e;
  23525. }
  23526. $composer = '';
  23527. }
  23528. if ($this->shouldCache($identifier)) {
  23529. $this->cache->write($identifier.'.json', json_encode($composer));
  23530. }
  23531. $this->infoCache[$identifier] = $composer;
  23532. }
  23533. return $this->infoCache[$identifier];
  23534. }
  23535. public function getFileContent($file, $identifier)
  23536. {
  23537. $identifier = '/' . trim($identifier, '/') . '/';
  23538. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23539. if (!empty($match[2])) {
  23540. $path = $match[1];
  23541. $rev = $match[2];
  23542. } else {
  23543. $path = $identifier;
  23544. $rev = '';
  23545. }
  23546. try {
  23547. $resource = $path.$file;
  23548. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  23549. if (!trim($output)) {
  23550. return null;
  23551. }
  23552. } catch (\RuntimeException $e) {
  23553. throw new TransportException($e->getMessage());
  23554. }
  23555. return $output;
  23556. }
  23557. public function getChangeDate($identifier)
  23558. {
  23559. $identifier = '/' . trim($identifier, '/') . '/';
  23560. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23561. if (!empty($match[2])) {
  23562. $path = $match[1];
  23563. $rev = $match[2];
  23564. } else {
  23565. $path = $identifier;
  23566. $rev = '';
  23567. }
  23568. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  23569. foreach ($this->process->splitLines($output) as $line) {
  23570. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  23571. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  23572. }
  23573. }
  23574. return null;
  23575. }
  23576. public function getTags()
  23577. {
  23578. if (null === $this->tags) {
  23579. $this->tags = array();
  23580. if ($this->tagsPath !== false) {
  23581. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  23582. if ($output) {
  23583. foreach ($this->process->splitLines($output) as $line) {
  23584. $line = trim($line);
  23585. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23586. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23587. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  23588. '/' . $this->tagsPath . '/' . $match[2],
  23589. $match[1]
  23590. );
  23591. }
  23592. }
  23593. }
  23594. }
  23595. }
  23596. }
  23597. return $this->tags;
  23598. }
  23599. public function getBranches()
  23600. {
  23601. if (null === $this->branches) {
  23602. $this->branches = array();
  23603. if (false === $this->trunkPath) {
  23604. $trunkParent = $this->baseUrl . '/';
  23605. } else {
  23606. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  23607. }
  23608. $output = $this->execute('svn ls --verbose', $trunkParent);
  23609. if ($output) {
  23610. foreach ($this->process->splitLines($output) as $line) {
  23611. $line = trim($line);
  23612. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23613. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  23614. $this->branches['trunk'] = $this->buildIdentifier(
  23615. '/' . $this->trunkPath,
  23616. $match[1]
  23617. );
  23618. $this->rootIdentifier = $this->branches['trunk'];
  23619. break;
  23620. }
  23621. }
  23622. }
  23623. }
  23624. unset($output);
  23625. if ($this->branchesPath !== false) {
  23626. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  23627. if ($output) {
  23628. foreach ($this->process->splitLines(trim($output)) as $line) {
  23629. $line = trim($line);
  23630. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23631. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23632. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  23633. '/' . $this->branchesPath . '/' . $match[2],
  23634. $match[1]
  23635. );
  23636. }
  23637. }
  23638. }
  23639. }
  23640. }
  23641. }
  23642. return $this->branches;
  23643. }
  23644. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23645. {
  23646. $url = self::normalizeUrl($url);
  23647. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  23648. return true;
  23649. }
  23650. if (!$deep && !Filesystem::isLocalPath($url)) {
  23651. return false;
  23652. }
  23653. $processExecutor = new ProcessExecutor();
  23654. $exit = $processExecutor->execute(
  23655. "svn info --non-interactive {$url}",
  23656. $ignoredOutput
  23657. );
  23658. if ($exit === 0) {
  23659. return true;
  23660. }
  23661. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  23662. return true;
  23663. }
  23664. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  23665. return true;
  23666. }
  23667. return false;
  23668. }
  23669. protected static function normalizeUrl($url)
  23670. {
  23671. $fs = new Filesystem();
  23672. if ($fs->isAbsolutePath($url)) {
  23673. return 'file://' . strtr($url, '\\', '/');
  23674. }
  23675. return $url;
  23676. }
  23677. protected function execute($command, $url)
  23678. {
  23679. if (null === $this->util) {
  23680. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  23681. $this->util->setCacheCredentials($this->cacheCredentials);
  23682. }
  23683. try {
  23684. return $this->util->execute($command, $url);
  23685. } catch (\RuntimeException $e) {
  23686. if (null === $this->util->binaryVersion()) {
  23687. 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());
  23688. }
  23689. throw new \RuntimeException(
  23690. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  23691. );
  23692. }
  23693. }
  23694. protected function buildIdentifier($baseDir, $revision)
  23695. {
  23696. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  23697. }
  23698. }
  23699. <?php
  23700. namespace Composer\Repository\Vcs;
  23701. use Composer\Cache;
  23702. use Composer\Downloader\TransportException;
  23703. use Composer\Config;
  23704. use Composer\Factory;
  23705. use Composer\IO\IOInterface;
  23706. use Composer\Json\JsonFile;
  23707. use Composer\Util\ProcessExecutor;
  23708. use Composer\Util\RemoteFilesystem;
  23709. use Composer\Util\Filesystem;
  23710. abstract class VcsDriver implements VcsDriverInterface
  23711. {
  23712. protected $url;
  23713. protected $originUrl;
  23714. protected $repoConfig;
  23715. protected $io;
  23716. protected $config;
  23717. protected $process;
  23718. protected $remoteFilesystem;
  23719. protected $infoCache = array();
  23720. protected $cache;
  23721. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  23722. {
  23723. if (Filesystem::isLocalPath($repoConfig['url'])) {
  23724. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  23725. }
  23726. $this->url = $repoConfig['url'];
  23727. $this->originUrl = $repoConfig['url'];
  23728. $this->repoConfig = $repoConfig;
  23729. $this->io = $io;
  23730. $this->config = $config;
  23731. $this->process = $process ?: new ProcessExecutor($io);
  23732. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23733. }
  23734. protected function shouldCache($identifier)
  23735. {
  23736. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  23737. }
  23738. public function getComposerInformation($identifier)
  23739. {
  23740. if (!isset($this->infoCache[$identifier])) {
  23741. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23742. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23743. }
  23744. $composer = $this->getBaseComposerInformation($identifier);
  23745. if ($this->shouldCache($identifier)) {
  23746. $this->cache->write($identifier, json_encode($composer));
  23747. }
  23748. $this->infoCache[$identifier] = $composer;
  23749. }
  23750. return $this->infoCache[$identifier];
  23751. }
  23752. protected function getBaseComposerInformation($identifier)
  23753. {
  23754. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  23755. if (!$composerFileContent) {
  23756. return null;
  23757. }
  23758. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  23759. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  23760. $composer['time'] = $changeDate->format(DATE_RFC3339);
  23761. }
  23762. return $composer;
  23763. }
  23764. public function hasComposerFile($identifier)
  23765. {
  23766. try {
  23767. return (bool) $this->getComposerInformation($identifier);
  23768. } catch (TransportException $e) {
  23769. }
  23770. return false;
  23771. }
  23772. protected function getScheme()
  23773. {
  23774. if (extension_loaded('openssl')) {
  23775. return 'https';
  23776. }
  23777. return 'http';
  23778. }
  23779. protected function getContents($url)
  23780. {
  23781. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  23782. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  23783. }
  23784. public function cleanup()
  23785. {
  23786. return;
  23787. }
  23788. }
  23789. <?php
  23790. namespace Composer\Repository\Vcs;
  23791. use Composer\Config;
  23792. use Composer\IO\IOInterface;
  23793. interface VcsDriverInterface
  23794. {
  23795. public function initialize();
  23796. public function getComposerInformation($identifier);
  23797. public function getFileContent($file, $identifier);
  23798. public function getChangeDate($identifier);
  23799. public function getRootIdentifier();
  23800. public function getBranches();
  23801. public function getTags();
  23802. public function getDist($identifier);
  23803. public function getSource($identifier);
  23804. public function getUrl();
  23805. public function hasComposerFile($identifier);
  23806. public function cleanup();
  23807. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  23808. }
  23809. <?php
  23810. namespace Composer\Repository;
  23811. use Composer\Downloader\TransportException;
  23812. use Composer\Repository\Vcs\VcsDriverInterface;
  23813. use Composer\Package\Version\VersionParser;
  23814. use Composer\Package\Loader\ArrayLoader;
  23815. use Composer\Package\Loader\ValidatingArrayLoader;
  23816. use Composer\Package\Loader\InvalidPackageException;
  23817. use Composer\Package\Loader\LoaderInterface;
  23818. use Composer\EventDispatcher\EventDispatcher;
  23819. use Composer\IO\IOInterface;
  23820. use Composer\Config;
  23821. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  23822. {
  23823. protected $url;
  23824. protected $packageName;
  23825. protected $verbose;
  23826. protected $io;
  23827. protected $config;
  23828. protected $versionParser;
  23829. protected $type;
  23830. protected $loader;
  23831. protected $repoConfig;
  23832. protected $branchErrorOccurred = false;
  23833. private $drivers;
  23834. private $driver;
  23835. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null)
  23836. {
  23837. parent::__construct();
  23838. $this->drivers = $drivers ?: array(
  23839. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  23840. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  23841. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  23842. 'git' => 'Composer\Repository\Vcs\GitDriver',
  23843. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  23844. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  23845. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  23846. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  23847. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  23848. );
  23849. $this->url = $repoConfig['url'];
  23850. $this->io = $io;
  23851. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  23852. $this->verbose = $io->isVeryVerbose();
  23853. $this->config = $config;
  23854. $this->repoConfig = $repoConfig;
  23855. }
  23856. public function getRepoConfig()
  23857. {
  23858. return $this->repoConfig;
  23859. }
  23860. public function setLoader(LoaderInterface $loader)
  23861. {
  23862. $this->loader = $loader;
  23863. }
  23864. public function getDriver()
  23865. {
  23866. if ($this->driver) {
  23867. return $this->driver;
  23868. }
  23869. if (isset($this->drivers[$this->type])) {
  23870. $class = $this->drivers[$this->type];
  23871. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  23872. $this->driver->initialize();
  23873. return $this->driver;
  23874. }
  23875. foreach ($this->drivers as $driver) {
  23876. if ($driver::supports($this->io, $this->config, $this->url)) {
  23877. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  23878. $this->driver->initialize();
  23879. return $this->driver;
  23880. }
  23881. }
  23882. foreach ($this->drivers as $driver) {
  23883. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  23884. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  23885. $this->driver->initialize();
  23886. return $this->driver;
  23887. }
  23888. }
  23889. }
  23890. public function hadInvalidBranches()
  23891. {
  23892. return $this->branchErrorOccurred;
  23893. }
  23894. protected function initialize()
  23895. {
  23896. parent::initialize();
  23897. $verbose = $this->verbose;
  23898. $driver = $this->getDriver();
  23899. if (!$driver) {
  23900. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  23901. }
  23902. $this->versionParser = new VersionParser;
  23903. if (!$this->loader) {
  23904. $this->loader = new ArrayLoader($this->versionParser);
  23905. }
  23906. try {
  23907. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  23908. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  23909. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  23910. }
  23911. } catch (\Exception $e) {
  23912. if ($verbose) {
  23913. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  23914. }
  23915. }
  23916. foreach ($driver->getTags() as $tag => $identifier) {
  23917. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  23918. if ($verbose) {
  23919. $this->io->writeError($msg);
  23920. } else {
  23921. $this->io->overwriteError($msg, false);
  23922. }
  23923. $tag = str_replace('release-', '', $tag);
  23924. if (!$parsedTag = $this->validateTag($tag)) {
  23925. if ($verbose) {
  23926. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  23927. }
  23928. continue;
  23929. }
  23930. try {
  23931. if (!$data = $driver->getComposerInformation($identifier)) {
  23932. if ($verbose) {
  23933. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  23934. }
  23935. continue;
  23936. }
  23937. if (isset($data['version'])) {
  23938. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  23939. } else {
  23940. $data['version'] = $tag;
  23941. $data['version_normalized'] = $parsedTag;
  23942. }
  23943. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  23944. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  23945. if ($data['version_normalized'] !== $parsedTag) {
  23946. if ($verbose) {
  23947. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  23948. }
  23949. continue;
  23950. }
  23951. if ($existingPackage = $this->findPackage($data['name'], $data['version_normalized'])) {
  23952. if ($verbose) {
  23953. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  23954. }
  23955. continue;
  23956. }
  23957. if ($verbose) {
  23958. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  23959. }
  23960. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  23961. } catch (\Exception $e) {
  23962. if ($verbose) {
  23963. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  23964. }
  23965. continue;
  23966. }
  23967. }
  23968. if (!$verbose) {
  23969. $this->io->overwriteError('', false);
  23970. }
  23971. $branches = $driver->getBranches();
  23972. foreach ($branches as $branch => $identifier) {
  23973. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  23974. if ($verbose) {
  23975. $this->io->writeError($msg);
  23976. } else {
  23977. $this->io->overwriteError($msg, false);
  23978. }
  23979. if ($branch === 'trunk' && isset($branches['master'])) {
  23980. if ($verbose) {
  23981. $this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
  23982. }
  23983. continue;
  23984. }
  23985. if (!$parsedBranch = $this->validateBranch($branch)) {
  23986. if ($verbose) {
  23987. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  23988. }
  23989. continue;
  23990. }
  23991. try {
  23992. if (!$data = $driver->getComposerInformation($identifier)) {
  23993. if ($verbose) {
  23994. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  23995. }
  23996. continue;
  23997. }
  23998. $data['version'] = $branch;
  23999. $data['version_normalized'] = $parsedBranch;
  24000. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  24001. $data['version'] = 'dev-' . $data['version'];
  24002. } else {
  24003. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  24004. $data['version'] = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  24005. }
  24006. if ($verbose) {
  24007. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  24008. }
  24009. $packageData = $this->preProcess($driver, $data, $identifier);
  24010. $package = $this->loader->load($packageData);
  24011. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  24012. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  24013. }
  24014. $this->addPackage($package);
  24015. } catch (TransportException $e) {
  24016. if ($verbose) {
  24017. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  24018. }
  24019. continue;
  24020. } catch (\Exception $e) {
  24021. if (!$verbose) {
  24022. $this->io->writeError('');
  24023. }
  24024. $this->branchErrorOccurred = true;
  24025. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  24026. $this->io->writeError('');
  24027. continue;
  24028. }
  24029. }
  24030. $driver->cleanup();
  24031. if (!$verbose) {
  24032. $this->io->overwriteError('', false);
  24033. }
  24034. if (!$this->getPackages()) {
  24035. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  24036. }
  24037. }
  24038. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  24039. {
  24040. $data['name'] = $this->packageName ?: $data['name'];
  24041. if (!isset($data['dist'])) {
  24042. $data['dist'] = $driver->getDist($identifier);
  24043. }
  24044. if (!isset($data['source'])) {
  24045. $data['source'] = $driver->getSource($identifier);
  24046. }
  24047. return $data;
  24048. }
  24049. private function validateBranch($branch)
  24050. {
  24051. try {
  24052. return $this->versionParser->normalizeBranch($branch);
  24053. } catch (\Exception $e) {
  24054. }
  24055. return false;
  24056. }
  24057. private function validateTag($version)
  24058. {
  24059. try {
  24060. return $this->versionParser->normalize($version);
  24061. } catch (\Exception $e) {
  24062. }
  24063. return false;
  24064. }
  24065. }
  24066. <?php
  24067. namespace Composer\Repository;
  24068. use Composer\Package\AliasPackage;
  24069. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  24070. {
  24071. public function write()
  24072. {
  24073. }
  24074. public function reload()
  24075. {
  24076. }
  24077. public function getCanonicalPackages()
  24078. {
  24079. $packages = $this->getPackages();
  24080. $packagesByName = array();
  24081. foreach ($packages as $package) {
  24082. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  24083. $packagesByName[$package->getName()] = $package;
  24084. }
  24085. }
  24086. $canonicalPackages = array();
  24087. foreach ($packagesByName as $package) {
  24088. while ($package instanceof AliasPackage) {
  24089. $package = $package->getAliasOf();
  24090. }
  24091. $canonicalPackages[] = $package;
  24092. }
  24093. return $canonicalPackages;
  24094. }
  24095. }
  24096. <?php
  24097. namespace Composer\Repository;
  24098. use Composer\Package\PackageInterface;
  24099. interface WritableRepositoryInterface extends RepositoryInterface
  24100. {
  24101. public function write();
  24102. public function addPackage(PackageInterface $package);
  24103. public function removePackage(PackageInterface $package);
  24104. public function getCanonicalPackages();
  24105. public function reload();
  24106. }
  24107. <?php
  24108. namespace Composer\Script;
  24109. class CommandEvent extends Event
  24110. {
  24111. }
  24112. <?php
  24113. namespace Composer\Script;
  24114. use Composer\Composer;
  24115. use Composer\IO\IOInterface;
  24116. use Composer\EventDispatcher\Event as BaseEvent;
  24117. class Event extends BaseEvent
  24118. {
  24119. private $composer;
  24120. private $io;
  24121. private $devMode;
  24122. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  24123. {
  24124. parent::__construct($name, $args, $flags);
  24125. $this->composer = $composer;
  24126. $this->io = $io;
  24127. $this->devMode = $devMode;
  24128. }
  24129. public function getComposer()
  24130. {
  24131. return $this->composer;
  24132. }
  24133. public function getIO()
  24134. {
  24135. return $this->io;
  24136. }
  24137. public function isDevMode()
  24138. {
  24139. return $this->devMode;
  24140. }
  24141. }
  24142. <?php
  24143. namespace Composer\Script;
  24144. use Composer\Installer\PackageEvent as BasePackageEvent;
  24145. class PackageEvent extends BasePackageEvent
  24146. {
  24147. }
  24148. <?php
  24149. namespace Composer\Script;
  24150. class ScriptEvents
  24151. {
  24152. const PRE_INSTALL_CMD = 'pre-install-cmd';
  24153. const POST_INSTALL_CMD = 'post-install-cmd';
  24154. const PRE_UPDATE_CMD = 'pre-update-cmd';
  24155. const POST_UPDATE_CMD = 'post-update-cmd';
  24156. const PRE_STATUS_CMD = 'pre-status-cmd';
  24157. const POST_STATUS_CMD = 'post-status-cmd';
  24158. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  24159. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  24160. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  24161. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  24162. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  24163. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  24164. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  24165. const POST_PACKAGE_INSTALL = 'post-package-install';
  24166. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  24167. const POST_PACKAGE_UPDATE = 'post-package-update';
  24168. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  24169. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  24170. }
  24171. <?php
  24172. namespace Composer\SelfUpdate;
  24173. class Keys
  24174. {
  24175. public static function fingerprint($path)
  24176. {
  24177. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  24178. return implode(' ', array(
  24179. substr($hash, 0, 8),
  24180. substr($hash, 8, 8),
  24181. substr($hash, 16, 8),
  24182. substr($hash, 24, 8),
  24183. '',
  24184. substr($hash, 32, 8),
  24185. substr($hash, 40, 8),
  24186. substr($hash, 48, 8),
  24187. substr($hash, 56, 8),
  24188. ));
  24189. }
  24190. }
  24191. <?php
  24192. namespace Composer\SelfUpdate;
  24193. use Composer\Util\RemoteFilesystem;
  24194. use Composer\Config;
  24195. use Composer\Json\JsonFile;
  24196. class Versions
  24197. {
  24198. private $rfs;
  24199. private $config;
  24200. private $channel;
  24201. public function __construct(Config $config, RemoteFilesystem $rfs)
  24202. {
  24203. $this->rfs = $rfs;
  24204. $this->config = $config;
  24205. }
  24206. public function getChannel()
  24207. {
  24208. if ($this->channel) {
  24209. return $this->channel;
  24210. }
  24211. $channelFile = $this->config->get('home').'/update-channel';
  24212. if (file_exists($channelFile)) {
  24213. $channel = trim(file_get_contents($channelFile));
  24214. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24215. return $this->channel = $channel;
  24216. }
  24217. }
  24218. return $this->channel = 'stable';
  24219. }
  24220. public function setChannel($channel)
  24221. {
  24222. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24223. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  24224. }
  24225. $channelFile = $this->config->get('home').'/update-channel';
  24226. $this->channel = $channel;
  24227. file_put_contents($channelFile, $channel.PHP_EOL);
  24228. }
  24229. public function getLatest()
  24230. {
  24231. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  24232. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  24233. foreach ($versions[$this->getChannel()] as $version) {
  24234. if ($version['min-php'] <= PHP_VERSION_ID) {
  24235. return $version;
  24236. }
  24237. }
  24238. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  24239. }
  24240. }
  24241. <?php
  24242. namespace Composer\Util;
  24243. use Composer\Config;
  24244. use Composer\IO\IOInterface;
  24245. class AuthHelper
  24246. {
  24247. protected $io;
  24248. protected $config;
  24249. public function __construct(IOInterface $io, Config $config)
  24250. {
  24251. $this->io = $io;
  24252. $this->config = $config;
  24253. }
  24254. public function storeAuth($originUrl, $storeAuth)
  24255. {
  24256. $store = false;
  24257. $configSource = $this->config->getAuthConfigSource();
  24258. if ($storeAuth === true) {
  24259. $store = $configSource;
  24260. } elseif ($storeAuth === 'prompt') {
  24261. $answer = $this->io->askAndValidate(
  24262. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  24263. function ($value) {
  24264. $input = strtolower(substr(trim($value), 0, 1));
  24265. if (in_array($input, array('y','n'))) {
  24266. return $input;
  24267. }
  24268. throw new \RuntimeException('Please answer (y)es or (n)o');
  24269. },
  24270. null,
  24271. 'y'
  24272. );
  24273. if ($answer === 'y') {
  24274. $store = $configSource;
  24275. }
  24276. }
  24277. if ($store) {
  24278. $store->addConfigSetting(
  24279. 'http-basic.'.$originUrl,
  24280. $this->io->getAuthentication($originUrl)
  24281. );
  24282. }
  24283. }
  24284. }
  24285. <?php
  24286. namespace Composer\Util;
  24287. use Composer\Factory;
  24288. use Composer\IO\IOInterface;
  24289. use Composer\Config;
  24290. use Composer\Downloader\TransportException;
  24291. class Bitbucket
  24292. {
  24293. private $io;
  24294. private $config;
  24295. private $process;
  24296. private $remoteFilesystem;
  24297. private $token = array();
  24298. private $time;
  24299. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  24300. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  24301. {
  24302. $this->io = $io;
  24303. $this->config = $config;
  24304. $this->process = $process ?: new ProcessExecutor;
  24305. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24306. $this->time = $time;
  24307. }
  24308. public function getToken()
  24309. {
  24310. if (!isset($this->token['access_token'])) {
  24311. return '';
  24312. }
  24313. return $this->token['access_token'];
  24314. }
  24315. public function authorizeOAuth($originUrl)
  24316. {
  24317. if ($originUrl !== 'bitbucket.org') {
  24318. return false;
  24319. }
  24320. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  24321. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  24322. return true;
  24323. }
  24324. return false;
  24325. }
  24326. private function requestAccessToken($originUrl)
  24327. {
  24328. try {
  24329. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  24330. 'retry-auth-failure' => false,
  24331. 'http' => array(
  24332. 'method' => 'POST',
  24333. 'content' => 'grant_type=client_credentials',
  24334. ),
  24335. ));
  24336. $this->token = json_decode($json, true);
  24337. } catch (TransportException $e) {
  24338. if ($e->getCode() === 400) {
  24339. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  24340. $this->io->writeError('This can have two reasons:');
  24341. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  24342. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  24343. return false;
  24344. } elseif (in_array($e->getCode(), array(403, 401))) {
  24345. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  24346. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24347. return false;
  24348. }
  24349. throw $e;
  24350. }
  24351. return true;
  24352. }
  24353. public function authorizeOAuthInteractively($originUrl, $message = null)
  24354. {
  24355. if ($message) {
  24356. $this->io->writeError($message);
  24357. }
  24358. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  24359. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  24360. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  24361. $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)');
  24362. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  24363. if (!$consumerKey) {
  24364. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  24365. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24366. return false;
  24367. }
  24368. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  24369. if (!$consumerSecret) {
  24370. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  24371. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24372. return false;
  24373. }
  24374. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  24375. if (!$this->requestAccessToken($originUrl)) {
  24376. return false;
  24377. }
  24378. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  24379. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  24380. $this->io->writeError('<info>Consumer stored successfully.</info>');
  24381. return true;
  24382. }
  24383. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  24384. {
  24385. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  24386. return $this->token['access_token'];
  24387. }
  24388. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  24389. if (!$this->requestAccessToken($originUrl)) {
  24390. return '';
  24391. }
  24392. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  24393. return $this->token['access_token'];
  24394. }
  24395. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  24396. {
  24397. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  24398. $time = null === $this->time ? time() : $this->time;
  24399. $consumer = array(
  24400. "consumer-key" => $consumerKey,
  24401. "consumer-secret" => $consumerSecret,
  24402. "access-token" => $this->token['access_token'],
  24403. "access-token-expiration" => $time + $this->token['expires_in'],
  24404. );
  24405. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  24406. }
  24407. private function getTokenFromConfig($originUrl)
  24408. {
  24409. $authConfig = $this->config->get('bitbucket-oauth');
  24410. if (
  24411. !isset($authConfig[$originUrl]['access-token'])
  24412. || !isset($authConfig[$originUrl]['access-token-expiration'])
  24413. || time() > $authConfig[$originUrl]['access-token-expiration']
  24414. ) {
  24415. return false;
  24416. }
  24417. $this->token = array(
  24418. 'access_token' => $authConfig[$originUrl]['access-token'],
  24419. );
  24420. return true;
  24421. }
  24422. }
  24423. <?php
  24424. namespace Composer\Util;
  24425. class ComposerMirror
  24426. {
  24427. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  24428. {
  24429. if ($reference) {
  24430. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  24431. }
  24432. $version = strpos($version, '/') === false ? $version : md5($version);
  24433. return str_replace(
  24434. array('%package%', '%version%', '%reference%', '%type%'),
  24435. array($packageName, $version, $reference, $type),
  24436. $mirrorUrl
  24437. );
  24438. }
  24439. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  24440. {
  24441. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  24442. $url = 'gh-'.$match[1].'/'.$match[2];
  24443. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  24444. $url = 'bb-'.$match[1].'/'.$match[2];
  24445. } else {
  24446. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  24447. }
  24448. return str_replace(
  24449. array('%package%', '%normalizedUrl%', '%type%'),
  24450. array($packageName, $url, $type),
  24451. $mirrorUrl
  24452. );
  24453. }
  24454. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  24455. {
  24456. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  24457. }
  24458. }
  24459. <?php
  24460. namespace Composer\Util;
  24461. use Composer\Package\Loader\ArrayLoader;
  24462. use Composer\Package\Loader\ValidatingArrayLoader;
  24463. use Composer\Package\Loader\InvalidPackageException;
  24464. use Composer\Json\JsonValidationException;
  24465. use Composer\IO\IOInterface;
  24466. use Composer\Json\JsonFile;
  24467. use Composer\Spdx\SpdxLicenses;
  24468. class ConfigValidator
  24469. {
  24470. private $io;
  24471. public function __construct(IOInterface $io)
  24472. {
  24473. $this->io = $io;
  24474. }
  24475. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  24476. {
  24477. $errors = array();
  24478. $publishErrors = array();
  24479. $warnings = array();
  24480. $laxValid = false;
  24481. try {
  24482. $json = new JsonFile($file, null, $this->io);
  24483. $manifest = $json->read();
  24484. $json->validateSchema(JsonFile::LAX_SCHEMA);
  24485. $laxValid = true;
  24486. $json->validateSchema();
  24487. } catch (JsonValidationException $e) {
  24488. foreach ($e->getErrors() as $message) {
  24489. if ($laxValid) {
  24490. $publishErrors[] = $message;
  24491. } else {
  24492. $errors[] = $message;
  24493. }
  24494. }
  24495. } catch (\Exception $e) {
  24496. $errors[] = $e->getMessage();
  24497. return array($errors, $publishErrors, $warnings);
  24498. }
  24499. if (empty($manifest['license'])) {
  24500. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  24501. } else {
  24502. $licenses = (array) $manifest['license'];
  24503. foreach ($licenses as $key => $license) {
  24504. if ('proprietary' === $license) {
  24505. unset($licenses[$key]);
  24506. }
  24507. }
  24508. $licenseValidator = new SpdxLicenses();
  24509. foreach ($licenses as $license) {
  24510. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  24511. if ($spdxLicense && $spdxLicense[3]) {
  24512. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  24513. $warnings[] = sprintf(
  24514. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  24515. $license
  24516. );
  24517. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  24518. $warnings[] = sprintf(
  24519. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  24520. $license
  24521. );
  24522. } else {
  24523. $warnings[] = sprintf(
  24524. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  24525. $license
  24526. );
  24527. }
  24528. }
  24529. }
  24530. }
  24531. if (isset($manifest['version'])) {
  24532. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  24533. }
  24534. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  24535. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  24536. $suggestName = strtolower($suggestName);
  24537. $publishErrors[] = sprintf(
  24538. '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.',
  24539. $manifest['name'],
  24540. $suggestName
  24541. );
  24542. }
  24543. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  24544. $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.";
  24545. }
  24546. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  24547. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  24548. if (!empty($requireOverrides)) {
  24549. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  24550. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  24551. }
  24552. }
  24553. $require = isset($manifest['require']) ? $manifest['require'] : array();
  24554. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  24555. $packages = array_merge($require, $requireDev);
  24556. foreach ($packages as $package => $version) {
  24557. if (preg_match('/#/', $version) === 1) {
  24558. $warnings[] = sprintf(
  24559. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  24560. $package
  24561. );
  24562. }
  24563. }
  24564. $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();
  24565. $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();
  24566. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  24567. if (!array_key_exists($scriptName, $scripts)) {
  24568. $warnings[] = sprintf(
  24569. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  24570. $scriptName
  24571. );
  24572. }
  24573. }
  24574. if (isset($manifest['autoload']['psr-0'][''])) {
  24575. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  24576. }
  24577. if (isset($manifest['autoload']['psr-4'][''])) {
  24578. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  24579. }
  24580. try {
  24581. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  24582. if (!isset($manifest['version'])) {
  24583. $manifest['version'] = '1.0.0';
  24584. }
  24585. if (!isset($manifest['name'])) {
  24586. $manifest['name'] = 'dummy/dummy';
  24587. }
  24588. $loader->load($manifest);
  24589. } catch (InvalidPackageException $e) {
  24590. $errors = array_merge($errors, $e->getErrors());
  24591. }
  24592. $warnings = array_merge($warnings, $loader->getWarnings());
  24593. return array($errors, $publishErrors, $warnings);
  24594. }
  24595. }
  24596. <?php
  24597. namespace Composer\Util;
  24598. use Composer\IO\IOInterface;
  24599. class ErrorHandler
  24600. {
  24601. private static $io;
  24602. public static function handle($level, $message, $file, $line)
  24603. {
  24604. if (!(error_reporting() & $level)) {
  24605. return;
  24606. }
  24607. if (ini_get('xdebug.scream')) {
  24608. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  24609. "\na legitimately suppressed error that you were not supposed to see.";
  24610. }
  24611. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  24612. throw new \ErrorException($message, 0, $level, $file, $line);
  24613. }
  24614. if (self::$io) {
  24615. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  24616. if (self::$io->isVerbose()) {
  24617. self::$io->writeError('<warning>Stack trace:</warning>');
  24618. self::$io->writeError(array_filter(array_map(function ($a) {
  24619. if (isset($a['line'], $a['file'])) {
  24620. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  24621. }
  24622. return null;
  24623. }, array_slice(debug_backtrace(), 2))));
  24624. }
  24625. }
  24626. }
  24627. public static function register(IOInterface $io = null)
  24628. {
  24629. set_error_handler(array(__CLASS__, 'handle'));
  24630. error_reporting(E_ALL | E_STRICT);
  24631. self::$io = $io;
  24632. }
  24633. }
  24634. <?php
  24635. namespace Composer\Util;
  24636. use RecursiveDirectoryIterator;
  24637. use RecursiveIteratorIterator;
  24638. use Symfony\Component\Filesystem\Exception\IOException;
  24639. use Symfony\Component\Finder\Finder;
  24640. class Filesystem
  24641. {
  24642. private $processExecutor;
  24643. public function __construct(ProcessExecutor $executor = null)
  24644. {
  24645. $this->processExecutor = $executor ?: new ProcessExecutor();
  24646. }
  24647. public function remove($file)
  24648. {
  24649. if (is_dir($file)) {
  24650. return $this->removeDirectory($file);
  24651. }
  24652. if (file_exists($file)) {
  24653. return $this->unlink($file);
  24654. }
  24655. return false;
  24656. }
  24657. public function isDirEmpty($dir)
  24658. {
  24659. $finder = Finder::create()
  24660. ->ignoreVCS(false)
  24661. ->ignoreDotFiles(false)
  24662. ->depth(0)
  24663. ->in($dir);
  24664. return count($finder) === 0;
  24665. }
  24666. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  24667. {
  24668. if (file_exists($dir) && is_link($dir)) {
  24669. $this->unlink($dir);
  24670. }
  24671. if ($ensureDirectoryExists) {
  24672. $this->ensureDirectoryExists($dir);
  24673. }
  24674. if (is_dir($dir)) {
  24675. $finder = Finder::create()
  24676. ->ignoreVCS(false)
  24677. ->ignoreDotFiles(false)
  24678. ->depth(0)
  24679. ->in($dir);
  24680. foreach ($finder as $path) {
  24681. $this->remove((string) $path);
  24682. }
  24683. }
  24684. }
  24685. public function removeDirectory($directory)
  24686. {
  24687. if ($this->isSymlinkedDirectory($directory)) {
  24688. return $this->unlinkSymlinkedDirectory($directory);
  24689. }
  24690. if ($this->isJunction($directory)) {
  24691. return $this->removeJunction($directory);
  24692. }
  24693. if (is_link($directory)) {
  24694. return unlink($directory);
  24695. }
  24696. if (!file_exists($directory) || !is_dir($directory)) {
  24697. return true;
  24698. }
  24699. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  24700. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  24701. }
  24702. if (!function_exists('proc_open')) {
  24703. return $this->removeDirectoryPhp($directory);
  24704. }
  24705. if (Platform::isWindows()) {
  24706. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  24707. } else {
  24708. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  24709. }
  24710. $result = $this->getProcess()->execute($cmd, $output) === 0;
  24711. clearstatcache();
  24712. if ($result && !file_exists($directory)) {
  24713. return true;
  24714. }
  24715. return $this->removeDirectoryPhp($directory);
  24716. }
  24717. public function removeDirectoryPhp($directory)
  24718. {
  24719. try {
  24720. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24721. } catch (\UnexpectedValueException $e) {
  24722. clearstatcache();
  24723. usleep(100000);
  24724. if (!is_dir($directory)) {
  24725. return true;
  24726. }
  24727. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24728. }
  24729. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  24730. foreach ($ri as $file) {
  24731. if ($file->isDir()) {
  24732. $this->rmdir($file->getPathname());
  24733. } else {
  24734. $this->unlink($file->getPathname());
  24735. }
  24736. }
  24737. return $this->rmdir($directory);
  24738. }
  24739. public function ensureDirectoryExists($directory)
  24740. {
  24741. if (!is_dir($directory)) {
  24742. if (file_exists($directory)) {
  24743. throw new \RuntimeException(
  24744. $directory.' exists and is not a directory.'
  24745. );
  24746. }
  24747. if (!@mkdir($directory, 0777, true)) {
  24748. throw new \RuntimeException(
  24749. $directory.' does not exist and could not be created.'
  24750. );
  24751. }
  24752. }
  24753. }
  24754. public function unlink($path)
  24755. {
  24756. if (!@$this->unlinkImplementation($path)) {
  24757. if (!Platform::isWindows() || (usleep(350000) && !@$this->unlinkImplementation($path))) {
  24758. $error = error_get_last();
  24759. $message = 'Could not delete '.$path.': ' . @$error['message'];
  24760. if (Platform::isWindows()) {
  24761. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  24762. }
  24763. throw new \RuntimeException($message);
  24764. }
  24765. }
  24766. return true;
  24767. }
  24768. public function rmdir($path)
  24769. {
  24770. if (!@rmdir($path)) {
  24771. if (!Platform::isWindows() || (usleep(350000) && !@rmdir($path))) {
  24772. $error = error_get_last();
  24773. $message = 'Could not delete '.$path.': ' . @$error['message'];
  24774. if (Platform::isWindows()) {
  24775. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  24776. }
  24777. throw new \RuntimeException($message);
  24778. }
  24779. }
  24780. return true;
  24781. }
  24782. public function copyThenRemove($source, $target)
  24783. {
  24784. $this->copy($source, $target);
  24785. if (!is_dir($source)) {
  24786. $this->unlink($source);
  24787. return;
  24788. }
  24789. $this->removeDirectoryPhp($source);
  24790. }
  24791. public function copy($source, $target)
  24792. {
  24793. if (!is_dir($source)) {
  24794. return copy($source, $target);
  24795. }
  24796. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  24797. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  24798. $this->ensureDirectoryExists($target);
  24799. $result = true;
  24800. foreach ($ri as $file) {
  24801. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  24802. if ($file->isDir()) {
  24803. $this->ensureDirectoryExists($targetPath);
  24804. } else {
  24805. $result = $result && copy($file->getPathname(), $targetPath);
  24806. }
  24807. }
  24808. return $result;
  24809. }
  24810. public function rename($source, $target)
  24811. {
  24812. if (true === @rename($source, $target)) {
  24813. return;
  24814. }
  24815. if (!function_exists('proc_open')) {
  24816. return $this->copyThenRemove($source, $target);
  24817. }
  24818. if (Platform::isWindows()) {
  24819. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  24820. $result = $this->processExecutor->execute($command, $output);
  24821. clearstatcache();
  24822. if (0 === $result) {
  24823. $this->remove($source);
  24824. return;
  24825. }
  24826. } else {
  24827. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  24828. $result = $this->processExecutor->execute($command, $output);
  24829. clearstatcache();
  24830. if (0 === $result) {
  24831. return;
  24832. }
  24833. }
  24834. return $this->copyThenRemove($source, $target);
  24835. }
  24836. public function findShortestPath($from, $to, $directories = false)
  24837. {
  24838. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  24839. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  24840. }
  24841. $from = lcfirst($this->normalizePath($from));
  24842. $to = lcfirst($this->normalizePath($to));
  24843. if ($directories) {
  24844. $from = rtrim($from, '/') . '/dummy_file';
  24845. }
  24846. if (dirname($from) === dirname($to)) {
  24847. return './'.basename($to);
  24848. }
  24849. $commonPath = $to;
  24850. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  24851. $commonPath = strtr(dirname($commonPath), '\\', '/');
  24852. }
  24853. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  24854. return $to;
  24855. }
  24856. $commonPath = rtrim($commonPath, '/') . '/';
  24857. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  24858. $commonPathCode = str_repeat('../', $sourcePathDepth);
  24859. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  24860. }
  24861. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  24862. {
  24863. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  24864. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  24865. }
  24866. $from = lcfirst($this->normalizePath($from));
  24867. $to = lcfirst($this->normalizePath($to));
  24868. if ($from === $to) {
  24869. return $directories ? '__DIR__' : '__FILE__';
  24870. }
  24871. $commonPath = $to;
  24872. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  24873. $commonPath = strtr(dirname($commonPath), '\\', '/');
  24874. }
  24875. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  24876. return var_export($to, true);
  24877. }
  24878. $commonPath = rtrim($commonPath, '/') . '/';
  24879. if (strpos($to, $from.'/') === 0) {
  24880. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  24881. }
  24882. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  24883. if ($staticCode) {
  24884. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  24885. } else {
  24886. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  24887. }
  24888. $relTarget = substr($to, strlen($commonPath));
  24889. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  24890. }
  24891. public function isAbsolutePath($path)
  24892. {
  24893. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
  24894. }
  24895. public function size($path)
  24896. {
  24897. if (!file_exists($path)) {
  24898. throw new \RuntimeException("$path does not exist.");
  24899. }
  24900. if (is_dir($path)) {
  24901. return $this->directorySize($path);
  24902. }
  24903. return filesize($path);
  24904. }
  24905. public function normalizePath($path)
  24906. {
  24907. $parts = array();
  24908. $path = strtr($path, '\\', '/');
  24909. $prefix = '';
  24910. $absolute = false;
  24911. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  24912. $prefix = $match[1];
  24913. $path = substr($path, strlen($prefix));
  24914. }
  24915. if (substr($path, 0, 1) === '/') {
  24916. $absolute = true;
  24917. $path = substr($path, 1);
  24918. }
  24919. $up = false;
  24920. foreach (explode('/', $path) as $chunk) {
  24921. if ('..' === $chunk && ($absolute || $up)) {
  24922. array_pop($parts);
  24923. $up = !(empty($parts) || '..' === end($parts));
  24924. } elseif ('.' !== $chunk && '' !== $chunk) {
  24925. $parts[] = $chunk;
  24926. $up = '..' !== $chunk;
  24927. }
  24928. }
  24929. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  24930. }
  24931. public static function isLocalPath($path)
  24932. {
  24933. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  24934. }
  24935. public static function getPlatformPath($path)
  24936. {
  24937. if (Platform::isWindows()) {
  24938. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  24939. }
  24940. return preg_replace('{^file://}i', '', $path);
  24941. }
  24942. protected function directorySize($directory)
  24943. {
  24944. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24945. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  24946. $size = 0;
  24947. foreach ($ri as $file) {
  24948. if ($file->isFile()) {
  24949. $size += $file->getSize();
  24950. }
  24951. }
  24952. return $size;
  24953. }
  24954. protected function getProcess()
  24955. {
  24956. return new ProcessExecutor;
  24957. }
  24958. private function unlinkImplementation($path)
  24959. {
  24960. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  24961. return rmdir($path);
  24962. }
  24963. return unlink($path);
  24964. }
  24965. public function relativeSymlink($target, $link)
  24966. {
  24967. $cwd = getcwd();
  24968. $relativePath = $this->findShortestPath($link, $target);
  24969. chdir(dirname($link));
  24970. $result = @symlink($relativePath, $link);
  24971. chdir($cwd);
  24972. return $result;
  24973. }
  24974. public function isSymlinkedDirectory($directory)
  24975. {
  24976. if (!is_dir($directory)) {
  24977. return false;
  24978. }
  24979. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  24980. return is_link($resolved);
  24981. }
  24982. private function unlinkSymlinkedDirectory($directory)
  24983. {
  24984. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  24985. return $this->unlink($resolved);
  24986. }
  24987. private function resolveSymlinkedDirectorySymlink($pathname)
  24988. {
  24989. if (!is_dir($pathname)) {
  24990. return $pathname;
  24991. }
  24992. $resolved = rtrim($pathname, '/');
  24993. if (!strlen($resolved)) {
  24994. return $pathname;
  24995. }
  24996. return $resolved;
  24997. }
  24998. public function junction($target, $junction)
  24999. {
  25000. if (!Platform::isWindows()) {
  25001. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  25002. }
  25003. if (!is_dir($target)) {
  25004. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  25005. }
  25006. $cmd = sprintf(
  25007. 'mklink /J %s %s',
  25008. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  25009. ProcessExecutor::escape(realpath($target))
  25010. );
  25011. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  25012. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  25013. }
  25014. clearstatcache(true, $junction);
  25015. }
  25016. public function isJunction($junction)
  25017. {
  25018. if (!Platform::isWindows()) {
  25019. return false;
  25020. }
  25021. if (!is_dir($junction) || is_link($junction)) {
  25022. return false;
  25023. }
  25024. clearstatcache(true, $junction);
  25025. clearstatcache(false);
  25026. $stat = lstat($junction);
  25027. return !($stat['mode'] & 0xC000);
  25028. }
  25029. public function removeJunction($junction)
  25030. {
  25031. if (!Platform::isWindows()) {
  25032. return false;
  25033. }
  25034. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  25035. if (!$this->isJunction($junction)) {
  25036. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  25037. }
  25038. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction));
  25039. clearstatcache(true, $junction);
  25040. return ($this->getProcess()->execute($cmd, $output) === 0);
  25041. }
  25042. }
  25043. <?php
  25044. namespace Composer\Util;
  25045. use Composer\Config;
  25046. use Composer\IO\IOInterface;
  25047. class Git
  25048. {
  25049. private static $version;
  25050. protected $io;
  25051. protected $config;
  25052. protected $process;
  25053. protected $filesystem;
  25054. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  25055. {
  25056. $this->io = $io;
  25057. $this->config = $config;
  25058. $this->process = $process;
  25059. $this->filesystem = $fs;
  25060. }
  25061. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  25062. {
  25063. $this->config->prohibitUrlByConfig($url, $this->io);
  25064. if ($initialClone) {
  25065. $origCwd = $cwd;
  25066. $cwd = null;
  25067. }
  25068. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  25069. 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.');
  25070. }
  25071. if (!$initialClone) {
  25072. $this->process->execute('git remote -v', $output, $cwd);
  25073. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
  25074. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  25075. }
  25076. }
  25077. $protocols = $this->config->get('github-protocols');
  25078. if (!is_array($protocols)) {
  25079. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  25080. }
  25081. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  25082. $messages = array();
  25083. foreach ($protocols as $protocol) {
  25084. if ('ssh' === $protocol) {
  25085. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  25086. } else {
  25087. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  25088. }
  25089. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  25090. return;
  25091. }
  25092. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  25093. if ($initialClone) {
  25094. $this->filesystem->removeDirectory($origCwd);
  25095. }
  25096. }
  25097. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  25098. }
  25099. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  25100. $command = call_user_func($commandCallable, $url);
  25101. $auth = null;
  25102. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  25103. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)) {
  25104. if (!$this->io->hasAuthentication($match[1])) {
  25105. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  25106. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  25107. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25108. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  25109. }
  25110. }
  25111. if ($this->io->hasAuthentication($match[1])) {
  25112. $auth = $this->io->getAuthentication($match[1]);
  25113. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25114. $command = call_user_func($commandCallable, $authUrl);
  25115. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25116. return;
  25117. }
  25118. }
  25119. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  25120. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  25121. if (!$this->io->hasAuthentication($match[1])) {
  25122. $message = 'Enter your Bitbucket credentials to access private repos';
  25123. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25124. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  25125. $accessToken = $bitbucketUtil->getToken();
  25126. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25127. }
  25128. } else {
  25129. $auth = $this->io->getAuthentication($match[1]);
  25130. if ($auth['username'] !== 'x-token-auth') {
  25131. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  25132. if (! empty($accessToken)) {
  25133. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25134. }
  25135. }
  25136. }
  25137. if ($this->io->hasAuthentication($match[1])) {
  25138. $auth = $this->io->getAuthentication($match[1]);
  25139. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25140. $command = call_user_func($commandCallable, $authUrl);
  25141. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25142. return;
  25143. }
  25144. } else {
  25145. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  25146. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  25147. $command = call_user_func($commandCallable, $sshUrl);
  25148. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25149. return;
  25150. }
  25151. }
  25152. } elseif ($this->isAuthenticationFailure($url, $match)) {
  25153. if (strpos($match[2], '@')) {
  25154. list($authParts, $match[2]) = explode('@', $match[2], 2);
  25155. }
  25156. $storeAuth = false;
  25157. if ($this->io->hasAuthentication($match[2])) {
  25158. $auth = $this->io->getAuthentication($match[2]);
  25159. } elseif ($this->io->isInteractive()) {
  25160. $defaultUsername = null;
  25161. if (isset($authParts) && $authParts) {
  25162. if (false !== strpos($authParts, ':')) {
  25163. list($defaultUsername, ) = explode(':', $authParts, 2);
  25164. } else {
  25165. $defaultUsername = $authParts;
  25166. }
  25167. }
  25168. $this->io->writeError(' Authentication required (<info>' . parse_url($url, PHP_URL_HOST) . '</info>):');
  25169. $auth = array(
  25170. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  25171. 'password' => $this->io->askAndHideAnswer(' Password: '),
  25172. );
  25173. $storeAuth = $this->config->get('store-auths');
  25174. }
  25175. if ($auth) {
  25176. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  25177. $command = call_user_func($commandCallable, $authUrl);
  25178. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25179. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  25180. $authHelper = new AuthHelper($this->io, $this->config);
  25181. $authHelper->storeAuth($match[2], $storeAuth);
  25182. return;
  25183. }
  25184. }
  25185. }
  25186. if ($initialClone) {
  25187. $this->filesystem->removeDirectory($origCwd);
  25188. }
  25189. $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url);
  25190. }
  25191. }
  25192. public function syncMirror($url, $dir)
  25193. {
  25194. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25195. try {
  25196. $commandCallable = function ($url) {
  25197. return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
  25198. };
  25199. $this->runCommand($commandCallable, $url, $dir);
  25200. } catch (\Exception $e) {
  25201. return false;
  25202. }
  25203. return true;
  25204. }
  25205. $this->filesystem->removeDirectory($dir);
  25206. $commandCallable = function ($url) use ($dir) {
  25207. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  25208. };
  25209. $this->runCommand($commandCallable, $url, $dir, true);
  25210. return true;
  25211. }
  25212. public function fetchRefOrSyncMirror($url, $dir, $ref)
  25213. {
  25214. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25215. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  25216. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $output, $dir);
  25217. if ($exitCode === 0) {
  25218. return true;
  25219. }
  25220. }
  25221. $this->syncMirror($url, $dir);
  25222. return false;
  25223. }
  25224. private function isAuthenticationFailure($url, &$match)
  25225. {
  25226. if (!preg_match('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  25227. return false;
  25228. }
  25229. $authFailures = array(
  25230. 'fatal: Authentication failed',
  25231. 'remote error: Invalid username or password.',
  25232. 'error: 401 Unauthorized',
  25233. 'fatal: unable to access',
  25234. 'fatal: could not read Username',
  25235. );
  25236. $errorOutput = $this->process->getErrorOutput();
  25237. foreach ($authFailures as $authFailure) {
  25238. if (strpos($errorOutput, $authFailure) !== false) {
  25239. return true;
  25240. }
  25241. }
  25242. return false;
  25243. }
  25244. public static function cleanEnv()
  25245. {
  25246. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  25247. 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');
  25248. }
  25249. if (getenv('GIT_ASKPASS') !== 'echo') {
  25250. putenv('GIT_ASKPASS=echo');
  25251. unset($_SERVER['GIT_ASKPASS']);
  25252. }
  25253. if (getenv('GIT_DIR')) {
  25254. putenv('GIT_DIR');
  25255. unset($_SERVER['GIT_DIR']);
  25256. }
  25257. if (getenv('GIT_WORK_TREE')) {
  25258. putenv('GIT_WORK_TREE');
  25259. unset($_SERVER['GIT_WORK_TREE']);
  25260. }
  25261. if (getenv('LANGUAGE') !== 'C') {
  25262. putenv('LANGUAGE=C');
  25263. }
  25264. putenv("DYLD_LIBRARY_PATH");
  25265. unset($_SERVER['DYLD_LIBRARY_PATH']);
  25266. }
  25267. public static function getGitHubDomainsRegex(Config $config)
  25268. {
  25269. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  25270. }
  25271. public static function sanitizeUrl($message)
  25272. {
  25273. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  25274. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  25275. return '://***:***@';
  25276. }
  25277. return '://' . $m[1] . ':***@';
  25278. }, $message);
  25279. }
  25280. private function throwException($message, $url)
  25281. {
  25282. clearstatcache();
  25283. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  25284. 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()));
  25285. }
  25286. throw new \RuntimeException(self::sanitizeUrl($message));
  25287. }
  25288. public function getVersion()
  25289. {
  25290. if (isset(self::$version)) {
  25291. return self::$version;
  25292. }
  25293. if (0 !== $this->process->execute('git --version', $output)) {
  25294. return;
  25295. }
  25296. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  25297. return self::$version = $matches[1];
  25298. }
  25299. }
  25300. }
  25301. <?php
  25302. namespace Composer\Util;
  25303. use Composer\Factory;
  25304. use Composer\IO\IOInterface;
  25305. use Composer\Config;
  25306. use Composer\Downloader\TransportException;
  25307. class GitHub
  25308. {
  25309. protected $io;
  25310. protected $config;
  25311. protected $process;
  25312. protected $remoteFilesystem;
  25313. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25314. {
  25315. $this->io = $io;
  25316. $this->config = $config;
  25317. $this->process = $process ?: new ProcessExecutor;
  25318. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25319. }
  25320. public function authorizeOAuth($originUrl)
  25321. {
  25322. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  25323. return false;
  25324. }
  25325. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  25326. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  25327. return true;
  25328. }
  25329. return false;
  25330. }
  25331. public function authorizeOAuthInteractively($originUrl, $message = null)
  25332. {
  25333. if ($message) {
  25334. $this->io->writeError($message);
  25335. }
  25336. $note = 'Composer';
  25337. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  25338. $note .= ' on ' . trim($output);
  25339. }
  25340. $note .= ' ' . date('Y-m-d Hi');
  25341. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  25342. $this->io->writeError(sprintf('Head to %s', $url));
  25343. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  25344. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  25345. if (!$token) {
  25346. $this->io->writeError('<warning>No token given, aborting.</warning>');
  25347. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  25348. return false;
  25349. }
  25350. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  25351. try {
  25352. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  25353. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  25354. 'retry-auth-failure' => false,
  25355. ));
  25356. } catch (TransportException $e) {
  25357. if (in_array($e->getCode(), array(403, 401))) {
  25358. $this->io->writeError('<error>Invalid token provided.</error>');
  25359. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  25360. return false;
  25361. }
  25362. throw $e;
  25363. }
  25364. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  25365. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  25366. $this->io->writeError('<info>Token stored successfully.</info>');
  25367. return true;
  25368. }
  25369. public function getRateLimit(array $headers)
  25370. {
  25371. $rateLimit = array(
  25372. 'limit' => '?',
  25373. 'reset' => '?',
  25374. );
  25375. foreach ($headers as $header) {
  25376. $header = trim($header);
  25377. if (false === strpos($header, 'X-RateLimit-')) {
  25378. continue;
  25379. }
  25380. list($type, $value) = explode(':', $header, 2);
  25381. switch ($type) {
  25382. case 'X-RateLimit-Limit':
  25383. $rateLimit['limit'] = (int) trim($value);
  25384. break;
  25385. case 'X-RateLimit-Reset':
  25386. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  25387. break;
  25388. }
  25389. }
  25390. return $rateLimit;
  25391. }
  25392. public function isRateLimited(array $headers)
  25393. {
  25394. foreach ($headers as $header) {
  25395. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  25396. return true;
  25397. }
  25398. }
  25399. return false;
  25400. }
  25401. }
  25402. <?php
  25403. namespace Composer\Util;
  25404. use Composer\IO\IOInterface;
  25405. use Composer\Config;
  25406. use Composer\Factory;
  25407. use Composer\Downloader\TransportException;
  25408. use Composer\Json\JsonFile;
  25409. class GitLab
  25410. {
  25411. protected $io;
  25412. protected $config;
  25413. protected $process;
  25414. protected $remoteFilesystem;
  25415. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25416. {
  25417. $this->io = $io;
  25418. $this->config = $config;
  25419. $this->process = $process ?: new ProcessExecutor();
  25420. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25421. }
  25422. public function authorizeOAuth($originUrl)
  25423. {
  25424. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  25425. return false;
  25426. }
  25427. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  25428. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  25429. return true;
  25430. }
  25431. $authTokens = $this->config->get('gitlab-token');
  25432. if (isset($authTokens[$originUrl])) {
  25433. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  25434. return true;
  25435. }
  25436. return false;
  25437. }
  25438. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  25439. {
  25440. if ($message) {
  25441. $this->io->writeError($message);
  25442. }
  25443. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  25444. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  25445. $attemptCounter = 0;
  25446. while ($attemptCounter++ < 5) {
  25447. try {
  25448. $response = $this->createToken($scheme, $originUrl);
  25449. } catch (TransportException $e) {
  25450. if (in_array($e->getCode(), array(403, 401))) {
  25451. if (401 === $e->getCode()) {
  25452. $this->io->writeError('Bad credentials.');
  25453. } else {
  25454. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  25455. }
  25456. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  25457. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  25458. continue;
  25459. }
  25460. throw $e;
  25461. }
  25462. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  25463. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  25464. return true;
  25465. }
  25466. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  25467. }
  25468. private function createToken($scheme, $originUrl)
  25469. {
  25470. $username = $this->io->ask('Username: ');
  25471. $password = $this->io->askAndHideAnswer('Password: ');
  25472. $headers = array('Content-Type: application/x-www-form-urlencoded');
  25473. $apiUrl = $originUrl;
  25474. $data = http_build_query(array(
  25475. 'username' => $username,
  25476. 'password' => $password,
  25477. 'grant_type' => 'password',
  25478. ), null, '&');
  25479. $options = array(
  25480. 'retry-auth-failure' => false,
  25481. 'http' => array(
  25482. 'method' => 'POST',
  25483. 'header' => $headers,
  25484. 'content' => $data,
  25485. ),
  25486. );
  25487. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  25488. $this->io->writeError('Token successfully created');
  25489. return JsonFile::parseJson($json);
  25490. }
  25491. }
  25492. <?php
  25493. namespace Composer\Util;
  25494. use Composer\Config;
  25495. use Composer\IO\IOInterface;
  25496. class Hg
  25497. {
  25498. private $io;
  25499. private $config;
  25500. private $process;
  25501. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  25502. {
  25503. $this->io = $io;
  25504. $this->config = $config;
  25505. $this->process = $process;
  25506. }
  25507. public function runCommand($commandCallable, $url, $cwd)
  25508. {
  25509. $this->config->prohibitUrlByConfig($url, $this->io);
  25510. $command = call_user_func($commandCallable, $url);
  25511. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25512. return;
  25513. }
  25514. if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
  25515. $auth = $this->io->getAuthentication($match[5]);
  25516. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
  25517. $command = call_user_func($commandCallable, $authenticatedUrl);
  25518. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25519. return;
  25520. }
  25521. $error = $this->process->getErrorOutput();
  25522. } else {
  25523. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  25524. }
  25525. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  25526. }
  25527. public static function sanitizeUrl($message)
  25528. {
  25529. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  25530. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  25531. return '://***:***@';
  25532. }
  25533. return '://' . $m[1] . ':***@';
  25534. }, $message);
  25535. }
  25536. private function throwException($message, $url)
  25537. {
  25538. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  25539. 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()));
  25540. }
  25541. throw new \RuntimeException(self::sanitizeUrl($message));
  25542. }
  25543. }
  25544. <?php
  25545. namespace Composer\Util;
  25546. use Composer\XdebugHandler\XdebugHandler;
  25547. class IniHelper
  25548. {
  25549. public static function getAll()
  25550. {
  25551. return XdebugHandler::getAllIniFiles();
  25552. }
  25553. public static function getMessage()
  25554. {
  25555. $paths = self::getAll();
  25556. if (empty($paths[0])) {
  25557. array_shift($paths);
  25558. }
  25559. $ini = array_shift($paths);
  25560. if (empty($ini)) {
  25561. return 'A php.ini file does not exist. You will have to create one.';
  25562. }
  25563. if (!empty($paths)) {
  25564. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  25565. }
  25566. return 'The php.ini used by your command-line PHP is: '.$ini;
  25567. }
  25568. }
  25569. <?php
  25570. namespace Composer\Util;
  25571. class NoProxyPattern
  25572. {
  25573. protected $rules = array();
  25574. public function __construct($pattern)
  25575. {
  25576. $this->rules = preg_split("/[\s,]+/", $pattern);
  25577. }
  25578. public function test($url)
  25579. {
  25580. $host = parse_url($url, PHP_URL_HOST);
  25581. $port = parse_url($url, PHP_URL_PORT);
  25582. if (empty($port)) {
  25583. switch (parse_url($url, PHP_URL_SCHEME)) {
  25584. case 'http':
  25585. $port = 80;
  25586. break;
  25587. case 'https':
  25588. $port = 443;
  25589. break;
  25590. }
  25591. }
  25592. foreach ($this->rules as $rule) {
  25593. if ($rule == '*') {
  25594. return true;
  25595. }
  25596. $match = false;
  25597. list($ruleHost) = explode(':', $rule);
  25598. list($base) = explode('/', $ruleHost);
  25599. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  25600. if (!isset($ip)) {
  25601. $ip = gethostbyname($host);
  25602. }
  25603. if (strpos($ruleHost, '/') === false) {
  25604. $match = $ip === $ruleHost;
  25605. } else {
  25606. if ($ip === $host) {
  25607. $match = false;
  25608. } else {
  25609. $match = self::inCIDRBlock($ruleHost, $ip);
  25610. }
  25611. }
  25612. } else {
  25613. $haystack = '.' . trim($host, '.') . '.';
  25614. $needle = '.'. trim($ruleHost, '.') .'.';
  25615. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  25616. }
  25617. if ($match && strpos($rule, ':') !== false) {
  25618. list(, $rulePort) = explode(':', $rule);
  25619. if (!empty($rulePort) && $port != $rulePort) {
  25620. $match = false;
  25621. }
  25622. }
  25623. if ($match) {
  25624. return true;
  25625. }
  25626. }
  25627. return false;
  25628. }
  25629. private static function inCIDRBlock($cidr, $ip)
  25630. {
  25631. list($base, $bits) = explode('/', $cidr);
  25632. list($a, $b, $c, $d) = explode('.', $base);
  25633. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  25634. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  25635. $low = $i & $mask;
  25636. $high = $i | (~$mask & 0xFFFFFFFF);
  25637. list($a, $b, $c, $d) = explode('.', $ip);
  25638. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  25639. return $check >= $low && $check <= $high;
  25640. }
  25641. }
  25642. <?php
  25643. namespace Composer\Util;
  25644. use Composer\IO\IOInterface;
  25645. use Symfony\Component\Process\Process;
  25646. class Perforce
  25647. {
  25648. protected $path;
  25649. protected $p4Depot;
  25650. protected $p4Client;
  25651. protected $p4User;
  25652. protected $p4Password;
  25653. protected $p4Port;
  25654. protected $p4Stream;
  25655. protected $p4ClientSpec;
  25656. protected $p4DepotType;
  25657. protected $p4Branch;
  25658. protected $process;
  25659. protected $uniquePerforceClientName;
  25660. protected $windowsFlag;
  25661. protected $commandResult;
  25662. protected $io;
  25663. protected $filesystem;
  25664. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  25665. {
  25666. $this->windowsFlag = $isWindows;
  25667. $this->p4Port = $port;
  25668. $this->initializePath($path);
  25669. $this->process = $process;
  25670. $this->initialize($repoConfig);
  25671. $this->io = $io;
  25672. }
  25673. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  25674. {
  25675. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  25676. }
  25677. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  25678. {
  25679. $output = null;
  25680. return 0 === $processExecutor->execute('p4 -p ' . $url . ' info -s', $output);
  25681. }
  25682. public function initialize($repoConfig)
  25683. {
  25684. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  25685. if (!$repoConfig) {
  25686. return;
  25687. }
  25688. if (isset($repoConfig['unique_perforce_client_name'])) {
  25689. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  25690. }
  25691. if (isset($repoConfig['depot'])) {
  25692. $this->p4Depot = $repoConfig['depot'];
  25693. }
  25694. if (isset($repoConfig['branch'])) {
  25695. $this->p4Branch = $repoConfig['branch'];
  25696. }
  25697. if (isset($repoConfig['p4user'])) {
  25698. $this->p4User = $repoConfig['p4user'];
  25699. } else {
  25700. $this->p4User = $this->getP4variable('P4USER');
  25701. }
  25702. if (isset($repoConfig['p4password'])) {
  25703. $this->p4Password = $repoConfig['p4password'];
  25704. }
  25705. }
  25706. public function initializeDepotAndBranch($depot, $branch)
  25707. {
  25708. if (isset($depot)) {
  25709. $this->p4Depot = $depot;
  25710. }
  25711. if (isset($branch)) {
  25712. $this->p4Branch = $branch;
  25713. }
  25714. }
  25715. public function generateUniquePerforceClientName()
  25716. {
  25717. return gethostname() . "_" . time();
  25718. }
  25719. public function cleanupClientSpec()
  25720. {
  25721. $client = $this->getClient();
  25722. $task = 'client -d ' . $client;
  25723. $useP4Client = false;
  25724. $command = $this->generateP4Command($task, $useP4Client);
  25725. $this->executeCommand($command);
  25726. $clientSpec = $this->getP4ClientSpec();
  25727. $fileSystem = $this->getFilesystem();
  25728. $fileSystem->remove($clientSpec);
  25729. }
  25730. protected function executeCommand($command)
  25731. {
  25732. $this->commandResult = '';
  25733. return $this->process->execute($command, $this->commandResult);
  25734. }
  25735. public function getClient()
  25736. {
  25737. if (!isset($this->p4Client)) {
  25738. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  25739. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  25740. }
  25741. return $this->p4Client;
  25742. }
  25743. protected function getPath()
  25744. {
  25745. return $this->path;
  25746. }
  25747. public function initializePath($path)
  25748. {
  25749. $this->path = $path;
  25750. $fs = $this->getFilesystem();
  25751. $fs->ensureDirectoryExists($path);
  25752. }
  25753. protected function getPort()
  25754. {
  25755. return $this->p4Port;
  25756. }
  25757. public function setStream($stream)
  25758. {
  25759. $this->p4Stream = $stream;
  25760. $index = strrpos($stream, '/');
  25761. if ($index > 2) {
  25762. $this->p4DepotType = 'stream';
  25763. }
  25764. }
  25765. public function isStream()
  25766. {
  25767. return (strcmp($this->p4DepotType, 'stream') === 0);
  25768. }
  25769. public function getStream()
  25770. {
  25771. if (!isset($this->p4Stream)) {
  25772. if ($this->isStream()) {
  25773. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  25774. } else {
  25775. $this->p4Stream = '//' . $this->p4Depot;
  25776. }
  25777. }
  25778. return $this->p4Stream;
  25779. }
  25780. public function getStreamWithoutLabel($stream)
  25781. {
  25782. $index = strpos($stream, '@');
  25783. if ($index === false) {
  25784. return $stream;
  25785. }
  25786. return substr($stream, 0, $index);
  25787. }
  25788. public function getP4ClientSpec()
  25789. {
  25790. return $this->path . '/' . $this->getClient() . '.p4.spec';
  25791. }
  25792. public function getUser()
  25793. {
  25794. return $this->p4User;
  25795. }
  25796. public function setUser($user)
  25797. {
  25798. $this->p4User = $user;
  25799. }
  25800. public function queryP4User()
  25801. {
  25802. $this->getUser();
  25803. if (strlen($this->p4User) > 0) {
  25804. return;
  25805. }
  25806. $this->p4User = $this->getP4variable('P4USER');
  25807. if (strlen($this->p4User) > 0) {
  25808. return;
  25809. }
  25810. $this->p4User = $this->io->ask('Enter P4 User:');
  25811. if ($this->windowsFlag) {
  25812. $command = 'p4 set P4USER=' . $this->p4User;
  25813. } else {
  25814. $command = 'export P4USER=' . $this->p4User;
  25815. }
  25816. $this->executeCommand($command);
  25817. }
  25818. protected function getP4variable($name)
  25819. {
  25820. if ($this->windowsFlag) {
  25821. $command = 'p4 set';
  25822. $this->executeCommand($command);
  25823. $result = trim($this->commandResult);
  25824. $resArray = explode(PHP_EOL, $result);
  25825. foreach ($resArray as $line) {
  25826. $fields = explode('=', $line);
  25827. if (strcmp($name, $fields[0]) == 0) {
  25828. $index = strpos($fields[1], ' ');
  25829. if ($index === false) {
  25830. $value = $fields[1];
  25831. } else {
  25832. $value = substr($fields[1], 0, $index);
  25833. }
  25834. $value = trim($value);
  25835. return $value;
  25836. }
  25837. }
  25838. return null;
  25839. }
  25840. $command = 'echo $' . $name;
  25841. $this->executeCommand($command);
  25842. $result = trim($this->commandResult);
  25843. return $result;
  25844. }
  25845. public function queryP4Password()
  25846. {
  25847. if (isset($this->p4Password)) {
  25848. return $this->p4Password;
  25849. }
  25850. $password = $this->getP4variable('P4PASSWD');
  25851. if (strlen($password) <= 0) {
  25852. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  25853. }
  25854. $this->p4Password = $password;
  25855. return $password;
  25856. }
  25857. public function generateP4Command($command, $useClient = true)
  25858. {
  25859. $p4Command = 'p4 ';
  25860. $p4Command = $p4Command . '-u ' . $this->getUser() . ' ';
  25861. if ($useClient) {
  25862. $p4Command = $p4Command . '-c ' . $this->getClient() . ' ';
  25863. }
  25864. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  25865. return $p4Command;
  25866. }
  25867. public function isLoggedIn()
  25868. {
  25869. $command = $this->generateP4Command('login -s', false);
  25870. $exitCode = $this->executeCommand($command);
  25871. if ($exitCode) {
  25872. $errorOutput = $this->process->getErrorOutput();
  25873. $index = strpos($errorOutput, $this->getUser());
  25874. if ($index === false) {
  25875. $index = strpos($errorOutput, 'p4');
  25876. if ($index === false) {
  25877. return false;
  25878. }
  25879. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  25880. }
  25881. throw new \Exception('Invalid user name: ' . $this->getUser());
  25882. }
  25883. return true;
  25884. }
  25885. public function connectClient()
  25886. {
  25887. $p4CreateClientCommand = $this->generateP4Command(
  25888. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  25889. );
  25890. $this->executeCommand($p4CreateClientCommand);
  25891. }
  25892. public function syncCodeBase($sourceReference)
  25893. {
  25894. $prevDir = getcwd();
  25895. chdir($this->path);
  25896. $p4SyncCommand = $this->generateP4Command('sync -f ');
  25897. if (null !== $sourceReference) {
  25898. $p4SyncCommand = $p4SyncCommand . '@' . $sourceReference;
  25899. }
  25900. $this->executeCommand($p4SyncCommand);
  25901. chdir($prevDir);
  25902. }
  25903. public function writeClientSpecToFile($spec)
  25904. {
  25905. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  25906. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  25907. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  25908. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  25909. fwrite($spec, 'Description:' . PHP_EOL);
  25910. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  25911. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  25912. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  25913. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  25914. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  25915. if ($this->isStream()) {
  25916. fwrite($spec, 'Stream:' . PHP_EOL);
  25917. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  25918. } else {
  25919. fwrite(
  25920. $spec,
  25921. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  25922. );
  25923. }
  25924. }
  25925. public function writeP4ClientSpec()
  25926. {
  25927. $clientSpec = $this->getP4ClientSpec();
  25928. $spec = fopen($clientSpec, 'w');
  25929. try {
  25930. $this->writeClientSpecToFile($spec);
  25931. } catch (\Exception $e) {
  25932. fclose($spec);
  25933. throw $e;
  25934. }
  25935. fclose($spec);
  25936. }
  25937. protected function read($pipe, $name)
  25938. {
  25939. if (feof($pipe)) {
  25940. return;
  25941. }
  25942. $line = fgets($pipe);
  25943. while ($line !== false) {
  25944. $line = fgets($pipe);
  25945. }
  25946. return;
  25947. }
  25948. public function windowsLogin($password)
  25949. {
  25950. $command = $this->generateP4Command(' login -a');
  25951. $process = new Process($command, null, null, $password);
  25952. return $process->run();
  25953. }
  25954. public function p4Login()
  25955. {
  25956. $this->queryP4User();
  25957. if (!$this->isLoggedIn()) {
  25958. $password = $this->queryP4Password();
  25959. if ($this->windowsFlag) {
  25960. $this->windowsLogin($password);
  25961. } else {
  25962. $command = 'echo ' . $password . ' | ' . $this->generateP4Command(' login -a', false);
  25963. $exitCode = $this->executeCommand($command);
  25964. $result = trim($this->commandResult);
  25965. if ($exitCode) {
  25966. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  25967. }
  25968. }
  25969. }
  25970. }
  25971. public function getComposerInformation($identifier)
  25972. {
  25973. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  25974. if (!$composerFileContent) {
  25975. return;
  25976. }
  25977. return json_decode($composerFileContent, true);
  25978. }
  25979. public function getFileContent($file, $identifier)
  25980. {
  25981. $path = $this->getFilePath($file, $identifier);
  25982. $command = $this->generateP4Command(' print ' . $path);
  25983. $this->executeCommand($command);
  25984. $result = $this->commandResult;
  25985. if (!trim($result)) {
  25986. return null;
  25987. }
  25988. return $result;
  25989. }
  25990. public function getFilePath($file, $identifier)
  25991. {
  25992. $index = strpos($identifier, '@');
  25993. if ($index === false) {
  25994. $path = $identifier. '/' . $file;
  25995. return $path;
  25996. }
  25997. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  25998. $command = $this->generateP4Command(' files ' . $path, false);
  25999. $this->executeCommand($command);
  26000. $result = $this->commandResult;
  26001. $index2 = strpos($result, 'no such file(s).');
  26002. if ($index2 === false) {
  26003. $index3 = strpos($result, 'change');
  26004. if ($index3 !== false) {
  26005. $phrase = trim(substr($result, $index3));
  26006. $fields = explode(' ', $phrase);
  26007. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  26008. }
  26009. }
  26010. return null;
  26011. }
  26012. public function getBranches()
  26013. {
  26014. $possibleBranches = array();
  26015. if (!$this->isStream()) {
  26016. $possibleBranches[$this->p4Branch] = $this->getStream();
  26017. } else {
  26018. $command = $this->generateP4Command('streams //' . $this->p4Depot . '/...');
  26019. $this->executeCommand($command);
  26020. $result = $this->commandResult;
  26021. $resArray = explode(PHP_EOL, $result);
  26022. foreach ($resArray as $line) {
  26023. $resBits = explode(' ', $line);
  26024. if (count($resBits) > 4) {
  26025. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  26026. $possibleBranches[$branch] = $resBits[1];
  26027. }
  26028. }
  26029. }
  26030. $command = $this->generateP4Command('changes '. $this->getStream() . '/...', false);
  26031. $this->executeCommand($command);
  26032. $result = $this->commandResult;
  26033. $resArray = explode(PHP_EOL, $result);
  26034. $lastCommit = $resArray[0];
  26035. $lastCommitArr = explode(' ', $lastCommit);
  26036. $lastCommitNum = $lastCommitArr[1];
  26037. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  26038. return $branches;
  26039. }
  26040. public function getTags()
  26041. {
  26042. $command = $this->generateP4Command('labels');
  26043. $this->executeCommand($command);
  26044. $result = $this->commandResult;
  26045. $resArray = explode(PHP_EOL, $result);
  26046. $tags = array();
  26047. foreach ($resArray as $line) {
  26048. $index = strpos($line, 'Label');
  26049. if (!($index === false)) {
  26050. $fields = explode(' ', $line);
  26051. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  26052. }
  26053. }
  26054. return $tags;
  26055. }
  26056. public function checkStream()
  26057. {
  26058. $command = $this->generateP4Command('depots', false);
  26059. $this->executeCommand($command);
  26060. $result = $this->commandResult;
  26061. $resArray = explode(PHP_EOL, $result);
  26062. foreach ($resArray as $line) {
  26063. $index = strpos($line, 'Depot');
  26064. if (!($index === false)) {
  26065. $fields = explode(' ', $line);
  26066. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  26067. $this->p4DepotType = $fields[3];
  26068. return $this->isStream();
  26069. }
  26070. }
  26071. }
  26072. return false;
  26073. }
  26074. protected function getChangeList($reference)
  26075. {
  26076. $index = strpos($reference, '@');
  26077. if ($index === false) {
  26078. return null;
  26079. }
  26080. $label = substr($reference, $index);
  26081. $command = $this->generateP4Command(' changes -m1 ' . $label);
  26082. $this->executeCommand($command);
  26083. $changes = $this->commandResult;
  26084. if (strpos($changes, 'Change') !== 0) {
  26085. return null;
  26086. }
  26087. $fields = explode(' ', $changes);
  26088. return $fields[1];
  26089. }
  26090. public function getCommitLogs($fromReference, $toReference)
  26091. {
  26092. $fromChangeList = $this->getChangeList($fromReference);
  26093. if ($fromChangeList === null) {
  26094. return null;
  26095. }
  26096. $toChangeList = $this->getChangeList($toReference);
  26097. if ($toChangeList === null) {
  26098. return null;
  26099. }
  26100. $index = strpos($fromReference, '@');
  26101. $main = substr($fromReference, 0, $index) . '/...';
  26102. $command = $this->generateP4Command('filelog ' . $main . '@' . $fromChangeList. ',' . $toChangeList);
  26103. $this->executeCommand($command);
  26104. return $this->commandResult;
  26105. }
  26106. public function getFilesystem()
  26107. {
  26108. if (empty($this->filesystem)) {
  26109. $this->filesystem = new Filesystem($this->process);
  26110. }
  26111. return $this->filesystem;
  26112. }
  26113. public function setFilesystem(Filesystem $fs)
  26114. {
  26115. $this->filesystem = $fs;
  26116. }
  26117. }
  26118. <?php
  26119. namespace Composer\Util;
  26120. class Platform
  26121. {
  26122. public static function expandPath($path)
  26123. {
  26124. if (preg_match('#^~[\\/]#', $path)) {
  26125. return self::getUserDirectory() . substr($path, 1);
  26126. }
  26127. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  26128. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  26129. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  26130. }
  26131. return getenv($matches['var']) . $matches['path'];
  26132. }, $path);
  26133. }
  26134. public static function getUserDirectory()
  26135. {
  26136. if (false !== ($home = getenv('HOME'))) {
  26137. return $home;
  26138. }
  26139. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  26140. return $home;
  26141. }
  26142. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  26143. $info = posix_getpwuid(posix_getuid());
  26144. return $info['dir'];
  26145. }
  26146. throw new \RuntimeException('Could not determine user directory');
  26147. }
  26148. public static function isWindows()
  26149. {
  26150. return defined('PHP_WINDOWS_VERSION_BUILD');
  26151. }
  26152. public static function strlen($str)
  26153. {
  26154. static $useMbString = null;
  26155. if (null === $useMbString) {
  26156. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  26157. }
  26158. if ($useMbString) {
  26159. return mb_strlen($str, '8bit');
  26160. }
  26161. return strlen($str);
  26162. }
  26163. }
  26164. <?php
  26165. namespace Composer\Util;
  26166. use Composer\IO\IOInterface;
  26167. use Symfony\Component\Process\Process;
  26168. use Symfony\Component\Process\ProcessUtils;
  26169. class ProcessExecutor
  26170. {
  26171. protected static $timeout = 300;
  26172. protected $captureOutput;
  26173. protected $errorOutput;
  26174. protected $io;
  26175. public function __construct(IOInterface $io = null)
  26176. {
  26177. $this->io = $io;
  26178. }
  26179. public function execute($command, &$output = null, $cwd = null)
  26180. {
  26181. if ($this->io && $this->io->isDebug()) {
  26182. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  26183. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  26184. return '://***:***@';
  26185. }
  26186. return '://'.$m['user'].':***@';
  26187. }, $command);
  26188. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  26189. }
  26190. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  26191. $cwd = realpath(getcwd());
  26192. }
  26193. $this->captureOutput = count(func_get_args()) > 1;
  26194. $this->errorOutput = null;
  26195. $process = new Process($command, $cwd, null, null, static::getTimeout());
  26196. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  26197. $process->run($callback);
  26198. if ($this->captureOutput && !is_callable($output)) {
  26199. $output = $process->getOutput();
  26200. }
  26201. $this->errorOutput = $process->getErrorOutput();
  26202. return $process->getExitCode();
  26203. }
  26204. public function splitLines($output)
  26205. {
  26206. $output = trim($output);
  26207. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  26208. }
  26209. public function getErrorOutput()
  26210. {
  26211. return $this->errorOutput;
  26212. }
  26213. public function outputHandler($type, $buffer)
  26214. {
  26215. if ($this->captureOutput) {
  26216. return;
  26217. }
  26218. if (null === $this->io) {
  26219. echo $buffer;
  26220. return;
  26221. }
  26222. if (Process::ERR === $type) {
  26223. $this->io->writeError($buffer, false);
  26224. } else {
  26225. $this->io->write($buffer, false);
  26226. }
  26227. }
  26228. public static function getTimeout()
  26229. {
  26230. return static::$timeout;
  26231. }
  26232. public static function setTimeout($timeout)
  26233. {
  26234. static::$timeout = $timeout;
  26235. }
  26236. public static function escape($argument)
  26237. {
  26238. if (method_exists('Symfony\Component\Process\ProcessUtils', 'escapeArgument')) {
  26239. return ProcessUtils::escapeArgument($argument);
  26240. }
  26241. return self::escapeArgument($argument);
  26242. }
  26243. private static function escapeArgument($argument)
  26244. {
  26245. if ('\\' === DIRECTORY_SEPARATOR) {
  26246. if ('' === $argument) {
  26247. return escapeshellarg($argument);
  26248. }
  26249. $escapedArgument = '';
  26250. $quote = false;
  26251. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  26252. if ('"' === $part) {
  26253. $escapedArgument .= '\\"';
  26254. } elseif (self::isSurroundedBy($part, '%')) {
  26255. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  26256. } else {
  26257. if ('\\' === substr($part, -1)) {
  26258. $part .= '\\';
  26259. }
  26260. $quote = true;
  26261. $escapedArgument .= $part;
  26262. }
  26263. }
  26264. if ($quote) {
  26265. $escapedArgument = '"'.$escapedArgument.'"';
  26266. }
  26267. return $escapedArgument;
  26268. }
  26269. return "'".str_replace("'", "'\\''", $argument)."'";
  26270. }
  26271. private static function isSurroundedBy($arg, $char)
  26272. {
  26273. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  26274. }
  26275. }
  26276. <?php
  26277. namespace Composer\Util;
  26278. use Composer\Config;
  26279. use Composer\IO\IOInterface;
  26280. use Composer\Downloader\TransportException;
  26281. use Composer\CaBundle\CaBundle;
  26282. use Psr\Log\LoggerInterface;
  26283. class RemoteFilesystem
  26284. {
  26285. private $io;
  26286. private $config;
  26287. private $scheme;
  26288. private $bytesMax;
  26289. private $originUrl;
  26290. private $fileUrl;
  26291. private $fileName;
  26292. private $retry;
  26293. private $progress;
  26294. private $lastProgress;
  26295. private $options = array();
  26296. private $peerCertificateMap = array();
  26297. private $disableTls = false;
  26298. private $retryAuthFailure;
  26299. private $lastHeaders;
  26300. private $storeAuth;
  26301. private $degradedMode = false;
  26302. private $redirects;
  26303. private $maxRedirects = 20;
  26304. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  26305. {
  26306. $this->io = $io;
  26307. if ($disableTls === false) {
  26308. $this->options = $this->getTlsDefaults($options);
  26309. } else {
  26310. $this->disableTls = true;
  26311. }
  26312. $this->options = array_replace_recursive($this->options, $options);
  26313. $this->config = $config;
  26314. }
  26315. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  26316. {
  26317. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  26318. }
  26319. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  26320. {
  26321. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  26322. }
  26323. public function getOptions()
  26324. {
  26325. return $this->options;
  26326. }
  26327. public function setOptions(array $options)
  26328. {
  26329. $this->options = array_replace_recursive($this->options, $options);
  26330. }
  26331. public function isTlsDisabled()
  26332. {
  26333. return $this->disableTls === true;
  26334. }
  26335. public function getLastHeaders()
  26336. {
  26337. return $this->lastHeaders;
  26338. }
  26339. public function findHeaderValue(array $headers, $name)
  26340. {
  26341. $value = null;
  26342. foreach ($headers as $header) {
  26343. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  26344. $value = $match[1];
  26345. } elseif (preg_match('{^HTTP/}i', $header)) {
  26346. $value = null;
  26347. }
  26348. }
  26349. return $value;
  26350. }
  26351. public function findStatusCode(array $headers)
  26352. {
  26353. $value = null;
  26354. foreach ($headers as $header) {
  26355. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  26356. $value = (int) $match[1];
  26357. }
  26358. }
  26359. return $value;
  26360. }
  26361. public function findStatusMessage(array $headers)
  26362. {
  26363. $value = null;
  26364. foreach ($headers as $header) {
  26365. if (preg_match('{^HTTP/\S+ \d+}i', $header)) {
  26366. $value = $header;
  26367. }
  26368. }
  26369. return $value;
  26370. }
  26371. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  26372. {
  26373. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  26374. $originUrl = 'github.com';
  26375. }
  26376. if (
  26377. $this->config
  26378. && is_array($this->config->get('gitlab-domains'))
  26379. && false === strpos($originUrl, '/')
  26380. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  26381. ) {
  26382. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  26383. if (0 === strpos($gitlabDomain, $originUrl)) {
  26384. $originUrl = $gitlabDomain;
  26385. break;
  26386. }
  26387. }
  26388. unset($gitlabDomain);
  26389. }
  26390. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  26391. $this->bytesMax = 0;
  26392. $this->originUrl = $originUrl;
  26393. $this->fileUrl = $fileUrl;
  26394. $this->fileName = $fileName;
  26395. $this->progress = $progress;
  26396. $this->lastProgress = null;
  26397. $this->retryAuthFailure = true;
  26398. $this->lastHeaders = array();
  26399. $this->redirects = 1;
  26400. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  26401. $this->io->setAuthentication($originUrl, rawurldecode($match[1]), rawurldecode($match[2]));
  26402. }
  26403. $tempAdditionalOptions = $additionalOptions;
  26404. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  26405. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  26406. unset($tempAdditionalOptions['retry-auth-failure']);
  26407. }
  26408. $isRedirect = false;
  26409. if (isset($tempAdditionalOptions['redirects'])) {
  26410. $this->redirects = $tempAdditionalOptions['redirects'];
  26411. $isRedirect = true;
  26412. unset($tempAdditionalOptions['redirects']);
  26413. }
  26414. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  26415. unset($tempAdditionalOptions);
  26416. $origFileUrl = $fileUrl;
  26417. if (isset($options['github-token'])) {
  26418. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  26419. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  26420. }
  26421. unset($options['github-token']);
  26422. }
  26423. if (isset($options['gitlab-token'])) {
  26424. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  26425. unset($options['gitlab-token']);
  26426. }
  26427. if (isset($options['http'])) {
  26428. $options['http']['ignore_errors'] = true;
  26429. }
  26430. if ($this->degradedMode && substr($fileUrl, 0, 26) === 'http://repo.packagist.org/') {
  26431. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  26432. $degradedPackagist = true;
  26433. }
  26434. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  26435. $actualContextOptions = stream_context_get_options($ctx);
  26436. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  26437. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $origFileUrl . $usingProxy, true, IOInterface::DEBUG);
  26438. unset($origFileUrl, $actualContextOptions);
  26439. if ((!preg_match('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  26440. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  26441. }
  26442. if ($this->progress && !$isRedirect) {
  26443. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  26444. }
  26445. $errorMessage = '';
  26446. $errorCode = 0;
  26447. $result = false;
  26448. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  26449. if ($errorMessage) {
  26450. $errorMessage .= "\n";
  26451. }
  26452. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  26453. });
  26454. try {
  26455. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header);
  26456. if (!empty($http_response_header[0])) {
  26457. $statusCode = $this->findStatusCode($http_response_header);
  26458. if (in_array($statusCode, array(401, 403)) && $this->retryAuthFailure) {
  26459. $warning = null;
  26460. if ($this->findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  26461. $data = json_decode($result, true);
  26462. if (!empty($data['warning'])) {
  26463. $warning = $data['warning'];
  26464. }
  26465. }
  26466. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), $warning, $http_response_header);
  26467. }
  26468. }
  26469. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  26470. if ($contentLength && Platform::strlen($result) < $contentLength) {
  26471. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  26472. $e->setHeaders($http_response_header);
  26473. $e->setStatusCode($this->findStatusCode($http_response_header));
  26474. $e->setResponse($result);
  26475. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  26476. throw $e;
  26477. }
  26478. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  26479. $params = stream_context_get_params($ctx);
  26480. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  26481. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  26482. if ($expectedPeerFingerprint !== $peerFingerprint) {
  26483. throw new TransportException('Peer fingerprint did not match');
  26484. }
  26485. }
  26486. } catch (\Exception $e) {
  26487. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  26488. $e->setHeaders($http_response_header);
  26489. $e->setStatusCode($this->findStatusCode($http_response_header));
  26490. }
  26491. if ($e instanceof TransportException && $result !== false) {
  26492. $e->setResponse($result);
  26493. }
  26494. $result = false;
  26495. }
  26496. if ($errorMessage && !ini_get('allow_url_fopen')) {
  26497. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  26498. }
  26499. restore_error_handler();
  26500. if (isset($e) && !$this->retry) {
  26501. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  26502. $this->degradedMode = true;
  26503. $this->io->writeError('');
  26504. $this->io->writeError(array(
  26505. '<error>'.$e->getMessage().'</error>',
  26506. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26507. ));
  26508. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26509. }
  26510. throw $e;
  26511. }
  26512. $statusCode = null;
  26513. $contentType = null;
  26514. if (!empty($http_response_header[0])) {
  26515. $statusCode = $this->findStatusCode($http_response_header);
  26516. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  26517. }
  26518. if ($originUrl === 'bitbucket.org'
  26519. && !$this->isPublicBitBucketDownload($fileUrl)
  26520. && substr($fileUrl, -4) === '.zip'
  26521. && $contentType && preg_match('{^text/html\b}i', $contentType)
  26522. ) {
  26523. $result = false;
  26524. if ($this->retryAuthFailure) {
  26525. $this->promptAuthAndRetry(401);
  26526. }
  26527. }
  26528. if ($statusCode === 404
  26529. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  26530. && false !== strpos($fileUrl, 'archive.zip')
  26531. ) {
  26532. $result = false;
  26533. if ($this->retryAuthFailure) {
  26534. $this->promptAuthAndRetry(401);
  26535. }
  26536. }
  26537. $hasFollowedRedirect = false;
  26538. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  26539. $hasFollowedRedirect = true;
  26540. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  26541. }
  26542. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  26543. if (!$this->retry) {
  26544. if ($this->progress && !$this->retry && !$isRedirect) {
  26545. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  26546. }
  26547. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  26548. $e->setHeaders($http_response_header);
  26549. $e->setResponse($result);
  26550. $e->setStatusCode($statusCode);
  26551. throw $e;
  26552. }
  26553. $result = false;
  26554. }
  26555. if ($this->progress && !$this->retry && !$isRedirect) {
  26556. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  26557. }
  26558. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  26559. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  26560. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  26561. if ($decode) {
  26562. try {
  26563. if (PHP_VERSION_ID >= 50400) {
  26564. $result = zlib_decode($result);
  26565. } else {
  26566. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  26567. }
  26568. if (!$result) {
  26569. throw new TransportException('Failed to decode zlib stream');
  26570. }
  26571. } catch (\Exception $e) {
  26572. if ($this->degradedMode) {
  26573. throw $e;
  26574. }
  26575. $this->degradedMode = true;
  26576. $this->io->writeError(array(
  26577. '',
  26578. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  26579. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26580. ));
  26581. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26582. }
  26583. }
  26584. }
  26585. if (false !== $result && null !== $fileName && !$isRedirect) {
  26586. if ('' === $result) {
  26587. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  26588. }
  26589. $errorMessage = '';
  26590. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  26591. if ($errorMessage) {
  26592. $errorMessage .= "\n";
  26593. }
  26594. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  26595. });
  26596. $result = (bool) file_put_contents($fileName, $result);
  26597. restore_error_handler();
  26598. if (false === $result) {
  26599. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  26600. }
  26601. }
  26602. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  26603. if (CaBundle::isOpensslParseSafe()) {
  26604. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  26605. if ($certDetails) {
  26606. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  26607. $this->retry = true;
  26608. }
  26609. } else {
  26610. $this->io->writeError('');
  26611. $this->io->writeError(sprintf(
  26612. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  26613. PHP_VERSION
  26614. ));
  26615. }
  26616. }
  26617. if ($this->retry) {
  26618. $this->retry = false;
  26619. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26620. if ($this->storeAuth && $this->config) {
  26621. $authHelper = new AuthHelper($this->io, $this->config);
  26622. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  26623. $this->storeAuth = false;
  26624. }
  26625. return $result;
  26626. }
  26627. if (false === $result) {
  26628. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  26629. if (!empty($http_response_header[0])) {
  26630. $e->setHeaders($http_response_header);
  26631. }
  26632. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  26633. $this->degradedMode = true;
  26634. $this->io->writeError('');
  26635. $this->io->writeError(array(
  26636. '<error>'.$e->getMessage().'</error>',
  26637. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26638. ));
  26639. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26640. }
  26641. throw $e;
  26642. }
  26643. if (!empty($http_response_header[0])) {
  26644. $this->lastHeaders = $http_response_header;
  26645. }
  26646. return $result;
  26647. }
  26648. protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null)
  26649. {
  26650. try {
  26651. $e = null;
  26652. $result = file_get_contents($fileUrl, false, $context);
  26653. } catch (\Throwable $e) {
  26654. } catch (\Exception $e) {
  26655. }
  26656. $responseHeaders = isset($http_response_header) ? $http_response_header : array();
  26657. if (null !== $e) {
  26658. throw $e;
  26659. }
  26660. return $result;
  26661. }
  26662. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  26663. {
  26664. switch ($notificationCode) {
  26665. case STREAM_NOTIFY_FAILURE:
  26666. if (400 === $messageCode) {
  26667. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  26668. }
  26669. break;
  26670. case STREAM_NOTIFY_FILE_SIZE_IS:
  26671. $this->bytesMax = $bytesMax;
  26672. break;
  26673. case STREAM_NOTIFY_PROGRESS:
  26674. if ($this->bytesMax > 0 && $this->progress) {
  26675. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  26676. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  26677. $this->lastProgress = $progression;
  26678. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  26679. }
  26680. }
  26681. break;
  26682. default:
  26683. break;
  26684. }
  26685. }
  26686. protected function promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())
  26687. {
  26688. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  26689. $gitHubUtil = new GitHub($this->io, $this->config, null);
  26690. $message = "\n";
  26691. $rateLimited = $gitHubUtil->isRateLimited($headers);
  26692. if ($rateLimited) {
  26693. $rateLimit = $gitHubUtil->getRateLimit($headers);
  26694. if ($this->io->hasAuthentication($this->originUrl)) {
  26695. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  26696. } else {
  26697. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  26698. }
  26699. $message = sprintf(
  26700. '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.',
  26701. $rateLimit['limit'],
  26702. $rateLimit['reset']
  26703. )."\n";
  26704. } else {
  26705. $message .= 'Could not fetch '.$this->fileUrl.', please ';
  26706. if ($this->io->hasAuthentication($this->originUrl)) {
  26707. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  26708. } else {
  26709. $message .= 'create a GitHub OAuth token to access private repos';
  26710. }
  26711. }
  26712. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  26713. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  26714. ) {
  26715. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  26716. }
  26717. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  26718. $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');
  26719. $gitLabUtil = new GitLab($this->io, $this->config, null);
  26720. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && $auth['password'] === 'private-token') {
  26721. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  26722. }
  26723. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  26724. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  26725. ) {
  26726. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  26727. }
  26728. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  26729. $askForOAuthToken = true;
  26730. if ($this->io->hasAuthentication($this->originUrl)) {
  26731. $auth = $this->io->getAuthentication($this->originUrl);
  26732. if ($auth['username'] !== 'x-token-auth') {
  26733. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  26734. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  26735. if (!empty($accessToken)) {
  26736. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  26737. $askForOAuthToken = false;
  26738. }
  26739. } else {
  26740. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  26741. }
  26742. }
  26743. if ($askForOAuthToken) {
  26744. $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');
  26745. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  26746. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  26747. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  26748. ) {
  26749. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  26750. }
  26751. }
  26752. } else {
  26753. if ($httpStatus === 404) {
  26754. return;
  26755. }
  26756. if (!$this->io->isInteractive()) {
  26757. if ($httpStatus === 401) {
  26758. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  26759. }
  26760. if ($httpStatus === 403) {
  26761. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  26762. }
  26763. throw new TransportException($message, $httpStatus);
  26764. }
  26765. if ($this->io->hasAuthentication($this->originUrl)) {
  26766. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  26767. }
  26768. $this->io->overwriteError('');
  26769. if ($warning) {
  26770. $this->io->writeError(' <warning>'.$warning.'</warning>');
  26771. }
  26772. $this->io->writeError(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
  26773. $username = $this->io->ask(' Username: ');
  26774. $password = $this->io->askAndHideAnswer(' Password: ');
  26775. $this->io->setAuthentication($this->originUrl, $username, $password);
  26776. $this->storeAuth = $this->config->get('store-auths');
  26777. }
  26778. $this->retry = true;
  26779. throw new TransportException('RETRY');
  26780. }
  26781. protected function getOptionsForUrl($originUrl, $additionalOptions)
  26782. {
  26783. $tlsOptions = array();
  26784. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  26785. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  26786. if (PHP_VERSION_ID < 50304) {
  26787. if ($host === 'github.com' || $host === 'api.github.com') {
  26788. $host = '*.github.com';
  26789. }
  26790. }
  26791. $tlsOptions['ssl']['CN_match'] = $host;
  26792. $tlsOptions['ssl']['SNI_server_name'] = $host;
  26793. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  26794. if (isset($this->peerCertificateMap[$urlAuthority])) {
  26795. $certMap = $this->peerCertificateMap[$urlAuthority];
  26796. $this->io->writeError('', true, IOInterface::DEBUG);
  26797. $this->io->writeError(sprintf(
  26798. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  26799. $certMap['cn'],
  26800. $urlAuthority
  26801. ), true, IOInterface::DEBUG);
  26802. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  26803. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  26804. } elseif (!CaBundle::isOpensslParseSafe() && $host === 'repo.packagist.org') {
  26805. $tlsOptions['ssl']['CN_match'] = 'packagist.org';
  26806. }
  26807. }
  26808. $headers = array();
  26809. if (extension_loaded('zlib')) {
  26810. $headers[] = 'Accept-Encoding: gzip';
  26811. }
  26812. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  26813. if (!$this->degradedMode) {
  26814. $options['http']['protocol_version'] = 1.1;
  26815. $headers[] = 'Connection: close';
  26816. }
  26817. if ($this->io->hasAuthentication($originUrl)) {
  26818. $auth = $this->io->getAuthentication($originUrl);
  26819. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  26820. $options['github-token'] = $auth['username'];
  26821. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  26822. if ($auth['password'] === 'oauth2') {
  26823. $headers[] = 'Authorization: Bearer '.$auth['username'];
  26824. } elseif ($auth['password'] === 'private-token') {
  26825. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  26826. }
  26827. } elseif ('bitbucket.org' === $originUrl
  26828. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  26829. ) {
  26830. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  26831. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  26832. }
  26833. } else {
  26834. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  26835. $headers[] = 'Authorization: Basic '.$authStr;
  26836. }
  26837. }
  26838. $options['http']['follow_location'] = 0;
  26839. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  26840. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  26841. }
  26842. foreach ($headers as $header) {
  26843. $options['http']['header'][] = $header;
  26844. }
  26845. return $options;
  26846. }
  26847. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  26848. {
  26849. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  26850. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  26851. $targetUrl = $locationHeader;
  26852. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  26853. $targetUrl = $this->scheme.':'.$locationHeader;
  26854. } elseif ('/' === $locationHeader[0]) {
  26855. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  26856. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  26857. } else {
  26858. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  26859. }
  26860. }
  26861. if (!empty($targetUrl)) {
  26862. $this->redirects++;
  26863. $this->io->writeError('', true, IOInterface::DEBUG);
  26864. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $targetUrl), true, IOInterface::DEBUG);
  26865. $additionalOptions['redirects'] = $this->redirects;
  26866. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  26867. }
  26868. if (!$this->retry) {
  26869. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  26870. $e->setHeaders($http_response_header);
  26871. $e->setResponse($result);
  26872. throw $e;
  26873. }
  26874. return false;
  26875. }
  26876. private function getTlsDefaults(array $options)
  26877. {
  26878. $ciphers = implode(':', array(
  26879. 'ECDHE-RSA-AES128-GCM-SHA256',
  26880. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  26881. 'ECDHE-RSA-AES256-GCM-SHA384',
  26882. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  26883. 'DHE-RSA-AES128-GCM-SHA256',
  26884. 'DHE-DSS-AES128-GCM-SHA256',
  26885. 'kEDH+AESGCM',
  26886. 'ECDHE-RSA-AES128-SHA256',
  26887. 'ECDHE-ECDSA-AES128-SHA256',
  26888. 'ECDHE-RSA-AES128-SHA',
  26889. 'ECDHE-ECDSA-AES128-SHA',
  26890. 'ECDHE-RSA-AES256-SHA384',
  26891. 'ECDHE-ECDSA-AES256-SHA384',
  26892. 'ECDHE-RSA-AES256-SHA',
  26893. 'ECDHE-ECDSA-AES256-SHA',
  26894. 'DHE-RSA-AES128-SHA256',
  26895. 'DHE-RSA-AES128-SHA',
  26896. 'DHE-DSS-AES128-SHA256',
  26897. 'DHE-RSA-AES256-SHA256',
  26898. 'DHE-DSS-AES256-SHA',
  26899. 'DHE-RSA-AES256-SHA',
  26900. 'AES128-GCM-SHA256',
  26901. 'AES256-GCM-SHA384',
  26902. 'AES128-SHA256',
  26903. 'AES256-SHA256',
  26904. 'AES128-SHA',
  26905. 'AES256-SHA',
  26906. 'AES',
  26907. 'CAMELLIA',
  26908. 'DES-CBC3-SHA',
  26909. '!aNULL',
  26910. '!eNULL',
  26911. '!EXPORT',
  26912. '!DES',
  26913. '!RC4',
  26914. '!MD5',
  26915. '!PSK',
  26916. '!aECDH',
  26917. '!EDH-DSS-DES-CBC3-SHA',
  26918. '!EDH-RSA-DES-CBC3-SHA',
  26919. '!KRB5-DES-CBC3-SHA',
  26920. ));
  26921. $defaults = array(
  26922. 'ssl' => array(
  26923. 'ciphers' => $ciphers,
  26924. 'verify_peer' => true,
  26925. 'verify_depth' => 7,
  26926. 'SNI_enabled' => true,
  26927. 'capture_peer_cert' => true,
  26928. ),
  26929. );
  26930. if (isset($options['ssl'])) {
  26931. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  26932. }
  26933. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  26934. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  26935. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  26936. if (is_dir($result)) {
  26937. $defaults['ssl']['capath'] = $result;
  26938. } else {
  26939. $defaults['ssl']['cafile'] = $result;
  26940. }
  26941. }
  26942. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  26943. throw new TransportException('The configured cafile was not valid or could not be read.');
  26944. }
  26945. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  26946. throw new TransportException('The configured capath was not valid or could not be read.');
  26947. }
  26948. if (PHP_VERSION_ID >= 50413) {
  26949. $defaults['ssl']['disable_compression'] = true;
  26950. }
  26951. return $defaults;
  26952. }
  26953. private function getCertificateCnAndFp($url, $options)
  26954. {
  26955. if (PHP_VERSION_ID >= 50600) {
  26956. throw new \BadMethodCallException(sprintf(
  26957. '%s must not be used on PHP >= 5.6',
  26958. __METHOD__
  26959. ));
  26960. }
  26961. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  26962. 'ssl' => array(
  26963. 'capture_peer_cert' => true,
  26964. 'verify_peer' => false,
  26965. ), ),
  26966. ));
  26967. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  26968. return;
  26969. }
  26970. fclose($handle);
  26971. $handle = null;
  26972. $params = stream_context_get_params($context);
  26973. if (!empty($params['options']['ssl']['peer_certificate'])) {
  26974. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  26975. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  26976. return array(
  26977. 'cn' => $commonName,
  26978. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  26979. );
  26980. }
  26981. }
  26982. }
  26983. private function getUrlAuthority($url)
  26984. {
  26985. $defaultPorts = array(
  26986. 'ftp' => 21,
  26987. 'http' => 80,
  26988. 'https' => 443,
  26989. 'ssh2.sftp' => 22,
  26990. 'ssh2.scp' => 22,
  26991. );
  26992. $scheme = parse_url($url, PHP_URL_SCHEME);
  26993. if (!isset($defaultPorts[$scheme])) {
  26994. throw new \InvalidArgumentException(sprintf(
  26995. 'Could not get default port for unknown scheme: %s',
  26996. $scheme
  26997. ));
  26998. }
  26999. $defaultPort = $defaultPorts[$scheme];
  27000. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  27001. return parse_url($url, PHP_URL_HOST).':'.$port;
  27002. }
  27003. private function isPublicBitBucketDownload($urlToBitBucketFile)
  27004. {
  27005. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  27006. if (strpos($domain, 'bitbucket.org') === false) {
  27007. return true;
  27008. }
  27009. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  27010. $pathParts = explode('/', $path);
  27011. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  27012. }
  27013. }
  27014. <?php
  27015. namespace Composer\Util;
  27016. class Silencer
  27017. {
  27018. private static $stack = array();
  27019. public static function suppress($mask = null)
  27020. {
  27021. if (!isset($mask)) {
  27022. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  27023. }
  27024. $old = error_reporting();
  27025. self::$stack[] = $old;
  27026. error_reporting($old & ~$mask);
  27027. return $old;
  27028. }
  27029. public static function restore()
  27030. {
  27031. if (!empty(self::$stack)) {
  27032. error_reporting(array_pop(self::$stack));
  27033. }
  27034. }
  27035. public static function call($callable )
  27036. {
  27037. try {
  27038. self::suppress();
  27039. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  27040. self::restore();
  27041. return $result;
  27042. } catch (\Exception $e) {
  27043. self::restore();
  27044. throw $e;
  27045. }
  27046. }
  27047. }
  27048. <?php
  27049. namespace Composer\Util;
  27050. use Composer\Spdx\SpdxLicenses;
  27051. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  27052. class SpdxLicense extends SpdxLicenses
  27053. {
  27054. }
  27055. <?php
  27056. namespace Composer\Util;
  27057. use Composer\Composer;
  27058. final class StreamContextFactory
  27059. {
  27060. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  27061. {
  27062. $options = array('http' => array(
  27063. 'follow_location' => 1,
  27064. 'max_redirects' => 20,
  27065. ));
  27066. if (PHP_SAPI === 'cli' && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  27067. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  27068. }
  27069. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  27070. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  27071. }
  27072. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  27073. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  27074. }
  27075. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  27076. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  27077. if ($pattern->test($url)) {
  27078. unset($proxy);
  27079. }
  27080. }
  27081. if (!empty($proxy)) {
  27082. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  27083. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  27084. if (isset($proxy['port'])) {
  27085. $proxyURL .= ":" . $proxy['port'];
  27086. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  27087. $proxyURL .= ":80";
  27088. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  27089. $proxyURL .= ":443";
  27090. }
  27091. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  27092. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  27093. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  27094. }
  27095. $options['http']['proxy'] = $proxyURL;
  27096. switch (parse_url($url, PHP_URL_SCHEME)) {
  27097. case 'http':
  27098. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  27099. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27100. $options['http']['request_fulluri'] = true;
  27101. }
  27102. break;
  27103. case 'https':
  27104. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  27105. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27106. $options['http']['request_fulluri'] = true;
  27107. }
  27108. break;
  27109. }
  27110. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  27111. $options['ssl']['SNI_enabled'] = true;
  27112. if (PHP_VERSION_ID < 50600) {
  27113. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  27114. }
  27115. }
  27116. if (isset($proxy['user'])) {
  27117. $auth = rawurldecode($proxy['user']);
  27118. if (isset($proxy['pass'])) {
  27119. $auth .= ':' . rawurldecode($proxy['pass']);
  27120. }
  27121. $auth = base64_encode($auth);
  27122. if (isset($defaultOptions['http']['header'])) {
  27123. if (is_string($defaultOptions['http']['header'])) {
  27124. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  27125. }
  27126. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  27127. } else {
  27128. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  27129. }
  27130. }
  27131. }
  27132. $options = array_replace_recursive($options, $defaultOptions);
  27133. if (isset($options['http']['header'])) {
  27134. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  27135. }
  27136. if (defined('HHVM_VERSION')) {
  27137. $phpVersion = 'HHVM ' . HHVM_VERSION;
  27138. } else {
  27139. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  27140. }
  27141. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  27142. $options['http']['header'][] = sprintf(
  27143. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  27144. Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
  27145. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  27146. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  27147. $phpVersion,
  27148. getenv('CI') ? '; CI' : ''
  27149. );
  27150. }
  27151. return stream_context_create($options, $defaultParams);
  27152. }
  27153. private static function fixHttpHeaderField($header)
  27154. {
  27155. if (!is_array($header)) {
  27156. $header = explode("\r\n", $header);
  27157. }
  27158. uasort($header, function ($el) {
  27159. return stripos($el, 'content-type') === 0 ? 1 : -1;
  27160. });
  27161. return $header;
  27162. }
  27163. }
  27164. <?php
  27165. namespace Composer\Util;
  27166. use Composer\Config;
  27167. use Composer\IO\IOInterface;
  27168. class Svn
  27169. {
  27170. const MAX_QTY_AUTH_TRIES = 5;
  27171. protected $credentials;
  27172. protected $hasAuth;
  27173. protected $io;
  27174. protected $url;
  27175. protected $cacheCredentials = true;
  27176. protected $process;
  27177. protected $qtyAuthTries = 0;
  27178. protected $config;
  27179. private static $version;
  27180. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  27181. {
  27182. $this->url = $url;
  27183. $this->io = $io;
  27184. $this->config = $config;
  27185. $this->process = $process ?: new ProcessExecutor;
  27186. }
  27187. public static function cleanEnv()
  27188. {
  27189. putenv("DYLD_LIBRARY_PATH");
  27190. unset($_SERVER['DYLD_LIBRARY_PATH']);
  27191. }
  27192. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  27193. {
  27194. $this->config->prohibitUrlByConfig($url, $this->io);
  27195. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  27196. }
  27197. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  27198. {
  27199. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  27200. }
  27201. private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose)
  27202. {
  27203. $command = $this->getCommand($svnCommand, $url, $path);
  27204. $output = null;
  27205. $io = $this->io;
  27206. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  27207. if ($type !== 'out') {
  27208. return;
  27209. }
  27210. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  27211. return;
  27212. }
  27213. $output .= $buffer;
  27214. if ($verbose) {
  27215. $io->writeError($buffer, false);
  27216. }
  27217. };
  27218. $status = $this->process->execute($command, $handler, $cwd);
  27219. if (0 === $status) {
  27220. return $output;
  27221. }
  27222. $errorOutput = $this->process->getErrorOutput();
  27223. $fullOutput = implode("\n", array($output, $errorOutput));
  27224. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  27225. && false === stripos($fullOutput, 'authorization failed')
  27226. && false === stripos($fullOutput, 'svn: E170001:')
  27227. && false === stripos($fullOutput, 'svn: E215004:')) {
  27228. throw new \RuntimeException($fullOutput);
  27229. }
  27230. if (!$this->hasAuth()) {
  27231. $this->doAuthDance();
  27232. }
  27233. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  27234. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  27235. }
  27236. throw new \RuntimeException(
  27237. 'wrong credentials provided ('.$fullOutput.')'
  27238. );
  27239. }
  27240. public function setCacheCredentials($cacheCredentials)
  27241. {
  27242. $this->cacheCredentials = $cacheCredentials;
  27243. }
  27244. protected function doAuthDance()
  27245. {
  27246. if (!$this->io->isInteractive()) {
  27247. throw new \RuntimeException(
  27248. 'can not ask for authentication in non interactive mode'
  27249. );
  27250. }
  27251. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  27252. $this->hasAuth = true;
  27253. $this->credentials['username'] = $this->io->ask("Username: ");
  27254. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  27255. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  27256. return $this;
  27257. }
  27258. protected function getCommand($cmd, $url, $path = null)
  27259. {
  27260. $cmd = sprintf(
  27261. '%s %s%s %s',
  27262. $cmd,
  27263. '--non-interactive ',
  27264. $this->getCredentialString(),
  27265. ProcessExecutor::escape($url)
  27266. );
  27267. if ($path) {
  27268. $cmd .= ' ' . ProcessExecutor::escape($path);
  27269. }
  27270. return $cmd;
  27271. }
  27272. protected function getCredentialString()
  27273. {
  27274. if (!$this->hasAuth()) {
  27275. return '';
  27276. }
  27277. return sprintf(
  27278. ' %s--username %s --password %s ',
  27279. $this->getAuthCache(),
  27280. ProcessExecutor::escape($this->getUsername()),
  27281. ProcessExecutor::escape($this->getPassword())
  27282. );
  27283. }
  27284. protected function getPassword()
  27285. {
  27286. if ($this->credentials === null) {
  27287. throw new \LogicException("No svn auth detected.");
  27288. }
  27289. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  27290. }
  27291. protected function getUsername()
  27292. {
  27293. if ($this->credentials === null) {
  27294. throw new \LogicException("No svn auth detected.");
  27295. }
  27296. return $this->credentials['username'];
  27297. }
  27298. protected function hasAuth()
  27299. {
  27300. if (null !== $this->hasAuth) {
  27301. return $this->hasAuth;
  27302. }
  27303. if (false === $this->createAuthFromConfig()) {
  27304. $this->createAuthFromUrl();
  27305. }
  27306. return $this->hasAuth;
  27307. }
  27308. protected function getAuthCache()
  27309. {
  27310. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  27311. }
  27312. private function createAuthFromConfig()
  27313. {
  27314. if (!$this->config->has('http-basic')) {
  27315. return $this->hasAuth = false;
  27316. }
  27317. $authConfig = $this->config->get('http-basic');
  27318. $host = parse_url($this->url, PHP_URL_HOST);
  27319. if (isset($authConfig[$host])) {
  27320. $this->credentials['username'] = $authConfig[$host]['username'];
  27321. $this->credentials['password'] = $authConfig[$host]['password'];
  27322. return $this->hasAuth = true;
  27323. }
  27324. return $this->hasAuth = false;
  27325. }
  27326. private function createAuthFromUrl()
  27327. {
  27328. $uri = parse_url($this->url);
  27329. if (empty($uri['user'])) {
  27330. return $this->hasAuth = false;
  27331. }
  27332. $this->credentials['username'] = $uri['user'];
  27333. if (!empty($uri['pass'])) {
  27334. $this->credentials['password'] = $uri['pass'];
  27335. }
  27336. return $this->hasAuth = true;
  27337. }
  27338. public function binaryVersion()
  27339. {
  27340. if (!self::$version) {
  27341. if (0 === $this->process->execute('svn --version', $output)) {
  27342. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
  27343. self::$version = $match[1];
  27344. }
  27345. }
  27346. }
  27347. return self::$version;
  27348. }
  27349. }
  27350. <?php
  27351. namespace Composer\Util;
  27352. use Composer\CaBundle\CaBundle;
  27353. final class TlsHelper
  27354. {
  27355. private static $useOpensslParse;
  27356. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  27357. {
  27358. $names = self::getCertificateNames($certificate);
  27359. if (empty($names)) {
  27360. return false;
  27361. }
  27362. $combinedNames = array_merge($names['san'], array($names['cn']));
  27363. $hostname = strtolower($hostname);
  27364. foreach ($combinedNames as $certName) {
  27365. $matcher = self::certNameMatcher($certName);
  27366. if ($matcher && $matcher($hostname)) {
  27367. $cn = $names['cn'];
  27368. return true;
  27369. }
  27370. }
  27371. return false;
  27372. }
  27373. public static function getCertificateNames($certificate)
  27374. {
  27375. if (is_array($certificate)) {
  27376. $info = $certificate;
  27377. } elseif (CaBundle::isOpensslParseSafe()) {
  27378. $info = openssl_x509_parse($certificate, false);
  27379. }
  27380. if (!isset($info['subject']['commonName'])) {
  27381. return null;
  27382. }
  27383. $commonName = strtolower($info['subject']['commonName']);
  27384. $subjectAltNames = array();
  27385. if (isset($info['extensions']['subjectAltName'])) {
  27386. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  27387. $subjectAltNames = array_filter(array_map(function ($name) {
  27388. if (0 === strpos($name, 'DNS:')) {
  27389. return strtolower(ltrim(substr($name, 4)));
  27390. }
  27391. return null;
  27392. }, $subjectAltNames));
  27393. $subjectAltNames = array_values($subjectAltNames);
  27394. }
  27395. return array(
  27396. 'cn' => $commonName,
  27397. 'san' => $subjectAltNames,
  27398. );
  27399. }
  27400. public static function getCertificateFingerprint($certificate)
  27401. {
  27402. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  27403. $pubkeypem = $pubkeydetails['key'];
  27404. $start = '-----BEGIN PUBLIC KEY-----';
  27405. $end = '-----END PUBLIC KEY-----';
  27406. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  27407. $der = base64_decode($pemtrim);
  27408. return sha1($der);
  27409. }
  27410. public static function isOpensslParseSafe()
  27411. {
  27412. return CaBundle::isOpensslParseSafe();
  27413. }
  27414. private static function certNameMatcher($certName)
  27415. {
  27416. $wildcards = substr_count($certName, '*');
  27417. if (0 === $wildcards) {
  27418. return function ($hostname) use ($certName) {
  27419. return $hostname === $certName;
  27420. };
  27421. }
  27422. if (1 === $wildcards) {
  27423. $components = explode('.', $certName);
  27424. if (3 > count($components)) {
  27425. return;
  27426. }
  27427. $firstComponent = $components[0];
  27428. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  27429. return;
  27430. }
  27431. $wildcardRegex = preg_quote($certName);
  27432. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  27433. $wildcardRegex = "{^{$wildcardRegex}$}";
  27434. return function ($hostname) use ($wildcardRegex) {
  27435. return 1 === preg_match($wildcardRegex, $hostname);
  27436. };
  27437. }
  27438. }
  27439. }
  27440. <?php
  27441. namespace Composer\Util;
  27442. use Composer\Config;
  27443. class Url
  27444. {
  27445. public static function updateDistReference(Config $config, $url, $ref)
  27446. {
  27447. $host = parse_url($url, PHP_URL_HOST);
  27448. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  27449. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  27450. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  27451. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  27452. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  27453. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  27454. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  27455. }
  27456. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  27457. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  27458. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  27459. }
  27460. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  27461. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  27462. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  27463. }
  27464. } elseif (in_array($host, $config->get('github-domains'), true)) {
  27465. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  27466. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  27467. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  27468. }
  27469. return $url;
  27470. }
  27471. }
  27472. <?php
  27473. namespace Composer;
  27474. use Symfony\Component\Console\Output\OutputInterface;
  27475. trigger_error('The ' . __NAMESPACE__ . '\XdebugHandler class is deprecated, use Composer\XdebugHandler\XdebugHandler instead,', E_USER_DEPRECATED);
  27476. class XdebugHandler extends XdebugHandler\XdebugHandler
  27477. {
  27478. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  27479. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  27480. public function __construct(OutputInterface $output)
  27481. {
  27482. parent::__construct('composer', '--ansi');
  27483. }
  27484. }
  27485. <?php
  27486. function includeIfExists($file)
  27487. {
  27488. return file_exists($file) ? include $file : false;
  27489. }
  27490. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  27491. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  27492. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  27493. exit(1);
  27494. }
  27495. return $loader;
  27496. <?php
  27497. /*
  27498. * This file is part of Composer.
  27499. *
  27500. * (c) Nils Adermann <naderman@naderman.de>
  27501. * Jordi Boggiano <j.boggiano@seld.be>
  27502. *
  27503. * For the full copyright and license information, please view the LICENSE
  27504. * file that was distributed with this source code.
  27505. */
  27506. namespace Composer\Autoload;
  27507. /**
  27508. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  27509. *
  27510. * $loader = new \Composer\Autoload\ClassLoader();
  27511. *
  27512. * // register classes with namespaces
  27513. * $loader->add('Symfony\Component', __DIR__.'/component');
  27514. * $loader->add('Symfony', __DIR__.'/framework');
  27515. *
  27516. * // activate the autoloader
  27517. * $loader->register();
  27518. *
  27519. * // to enable searching the include path (eg. for PEAR packages)
  27520. * $loader->setUseIncludePath(true);
  27521. *
  27522. * In this example, if you try to use a class in the Symfony\Component
  27523. * namespace or one of its children (Symfony\Component\Console for instance),
  27524. * the autoloader will first look for the class under the component/
  27525. * directory, and it will then fallback to the framework/ directory if not
  27526. * found before giving up.
  27527. *
  27528. * This class is loosely based on the Symfony UniversalClassLoader.
  27529. *
  27530. * @author Fabien Potencier <fabien@symfony.com>
  27531. * @author Jordi Boggiano <j.boggiano@seld.be>
  27532. * @see http://www.php-fig.org/psr/psr-0/
  27533. * @see http://www.php-fig.org/psr/psr-4/
  27534. */
  27535. class ClassLoader
  27536. {
  27537. // PSR-4
  27538. private $prefixLengthsPsr4 = array();
  27539. private $prefixDirsPsr4 = array();
  27540. private $fallbackDirsPsr4 = array();
  27541. // PSR-0
  27542. private $prefixesPsr0 = array();
  27543. private $fallbackDirsPsr0 = array();
  27544. private $useIncludePath = false;
  27545. private $classMap = array();
  27546. private $classMapAuthoritative = false;
  27547. private $missingClasses = array();
  27548. private $apcuPrefix;
  27549. public function getPrefixes()
  27550. {
  27551. if (!empty($this->prefixesPsr0)) {
  27552. return call_user_func_array('array_merge', $this->prefixesPsr0);
  27553. }
  27554. return array();
  27555. }
  27556. public function getPrefixesPsr4()
  27557. {
  27558. return $this->prefixDirsPsr4;
  27559. }
  27560. public function getFallbackDirs()
  27561. {
  27562. return $this->fallbackDirsPsr0;
  27563. }
  27564. public function getFallbackDirsPsr4()
  27565. {
  27566. return $this->fallbackDirsPsr4;
  27567. }
  27568. public function getClassMap()
  27569. {
  27570. return $this->classMap;
  27571. }
  27572. /**
  27573. * @param array $classMap Class to filename map
  27574. */
  27575. public function addClassMap(array $classMap)
  27576. {
  27577. if ($this->classMap) {
  27578. $this->classMap = array_merge($this->classMap, $classMap);
  27579. } else {
  27580. $this->classMap = $classMap;
  27581. }
  27582. }
  27583. /**
  27584. * Registers a set of PSR-0 directories for a given prefix, either
  27585. * appending or prepending to the ones previously set for this prefix.
  27586. *
  27587. * @param string $prefix The prefix
  27588. * @param array|string $paths The PSR-0 root directories
  27589. * @param bool $prepend Whether to prepend the directories
  27590. */
  27591. public function add($prefix, $paths, $prepend = false)
  27592. {
  27593. if (!$prefix) {
  27594. if ($prepend) {
  27595. $this->fallbackDirsPsr0 = array_merge(
  27596. (array) $paths,
  27597. $this->fallbackDirsPsr0
  27598. );
  27599. } else {
  27600. $this->fallbackDirsPsr0 = array_merge(
  27601. $this->fallbackDirsPsr0,
  27602. (array) $paths
  27603. );
  27604. }
  27605. return;
  27606. }
  27607. $first = $prefix[0];
  27608. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  27609. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  27610. return;
  27611. }
  27612. if ($prepend) {
  27613. $this->prefixesPsr0[$first][$prefix] = array_merge(
  27614. (array) $paths,
  27615. $this->prefixesPsr0[$first][$prefix]
  27616. );
  27617. } else {
  27618. $this->prefixesPsr0[$first][$prefix] = array_merge(
  27619. $this->prefixesPsr0[$first][$prefix],
  27620. (array) $paths
  27621. );
  27622. }
  27623. }
  27624. /**
  27625. * Registers a set of PSR-4 directories for a given namespace, either
  27626. * appending or prepending to the ones previously set for this namespace.
  27627. *
  27628. * @param string $prefix The prefix/namespace, with trailing '\\'
  27629. * @param array|string $paths The PSR-4 base directories
  27630. * @param bool $prepend Whether to prepend the directories
  27631. *
  27632. * @throws \InvalidArgumentException
  27633. */
  27634. public function addPsr4($prefix, $paths, $prepend = false)
  27635. {
  27636. if (!$prefix) {
  27637. // Register directories for the root namespace.
  27638. if ($prepend) {
  27639. $this->fallbackDirsPsr4 = array_merge(
  27640. (array) $paths,
  27641. $this->fallbackDirsPsr4
  27642. );
  27643. } else {
  27644. $this->fallbackDirsPsr4 = array_merge(
  27645. $this->fallbackDirsPsr4,
  27646. (array) $paths
  27647. );
  27648. }
  27649. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  27650. // Register directories for a new namespace.
  27651. $length = strlen($prefix);
  27652. if ('\\' !== $prefix[$length - 1]) {
  27653. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  27654. }
  27655. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  27656. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  27657. } elseif ($prepend) {
  27658. // Prepend directories for an already registered namespace.
  27659. $this->prefixDirsPsr4[$prefix] = array_merge(
  27660. (array) $paths,
  27661. $this->prefixDirsPsr4[$prefix]
  27662. );
  27663. } else {
  27664. // Append directories for an already registered namespace.
  27665. $this->prefixDirsPsr4[$prefix] = array_merge(
  27666. $this->prefixDirsPsr4[$prefix],
  27667. (array) $paths
  27668. );
  27669. }
  27670. }
  27671. /**
  27672. * Registers a set of PSR-0 directories for a given prefix,
  27673. * replacing any others previously set for this prefix.
  27674. *
  27675. * @param string $prefix The prefix
  27676. * @param array|string $paths The PSR-0 base directories
  27677. */
  27678. public function set($prefix, $paths)
  27679. {
  27680. if (!$prefix) {
  27681. $this->fallbackDirsPsr0 = (array) $paths;
  27682. } else {
  27683. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  27684. }
  27685. }
  27686. /**
  27687. * Registers a set of PSR-4 directories for a given namespace,
  27688. * replacing any others previously set for this namespace.
  27689. *
  27690. * @param string $prefix The prefix/namespace, with trailing '\\'
  27691. * @param array|string $paths The PSR-4 base directories
  27692. *
  27693. * @throws \InvalidArgumentException
  27694. */
  27695. public function setPsr4($prefix, $paths)
  27696. {
  27697. if (!$prefix) {
  27698. $this->fallbackDirsPsr4 = (array) $paths;
  27699. } else {
  27700. $length = strlen($prefix);
  27701. if ('\\' !== $prefix[$length - 1]) {
  27702. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  27703. }
  27704. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  27705. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  27706. }
  27707. }
  27708. /**
  27709. * Turns on searching the include path for class files.
  27710. *
  27711. * @param bool $useIncludePath
  27712. */
  27713. public function setUseIncludePath($useIncludePath)
  27714. {
  27715. $this->useIncludePath = $useIncludePath;
  27716. }
  27717. /**
  27718. * Can be used to check if the autoloader uses the include path to check
  27719. * for classes.
  27720. *
  27721. * @return bool
  27722. */
  27723. public function getUseIncludePath()
  27724. {
  27725. return $this->useIncludePath;
  27726. }
  27727. /**
  27728. * Turns off searching the prefix and fallback directories for classes
  27729. * that have not been registered with the class map.
  27730. *
  27731. * @param bool $classMapAuthoritative
  27732. */
  27733. public function setClassMapAuthoritative($classMapAuthoritative)
  27734. {
  27735. $this->classMapAuthoritative = $classMapAuthoritative;
  27736. }
  27737. /**
  27738. * Should class lookup fail if not found in the current class map?
  27739. *
  27740. * @return bool
  27741. */
  27742. public function isClassMapAuthoritative()
  27743. {
  27744. return $this->classMapAuthoritative;
  27745. }
  27746. /**
  27747. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  27748. *
  27749. * @param string|null $apcuPrefix
  27750. */
  27751. public function setApcuPrefix($apcuPrefix)
  27752. {
  27753. $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
  27754. }
  27755. /**
  27756. * The APCu prefix in use, or null if APCu caching is not enabled.
  27757. *
  27758. * @return string|null
  27759. */
  27760. public function getApcuPrefix()
  27761. {
  27762. return $this->apcuPrefix;
  27763. }
  27764. /**
  27765. * Registers this instance as an autoloader.
  27766. *
  27767. * @param bool $prepend Whether to prepend the autoloader or not
  27768. */
  27769. public function register($prepend = false)
  27770. {
  27771. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  27772. }
  27773. /**
  27774. * Unregisters this instance as an autoloader.
  27775. */
  27776. public function unregister()
  27777. {
  27778. spl_autoload_unregister(array($this, 'loadClass'));
  27779. }
  27780. /**
  27781. * Loads the given class or interface.
  27782. *
  27783. * @param string $class The name of the class
  27784. * @return bool|null True if loaded, null otherwise
  27785. */
  27786. public function loadClass($class)
  27787. {
  27788. if ($file = $this->findFile($class)) {
  27789. includeFile($file);
  27790. return true;
  27791. }
  27792. }
  27793. /**
  27794. * Finds the path to the file where the class is defined.
  27795. *
  27796. * @param string $class The name of the class
  27797. *
  27798. * @return string|false The path if found, false otherwise
  27799. */
  27800. public function findFile($class)
  27801. {
  27802. // class map lookup
  27803. if (isset($this->classMap[$class])) {
  27804. return $this->classMap[$class];
  27805. }
  27806. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  27807. return false;
  27808. }
  27809. if (null !== $this->apcuPrefix) {
  27810. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  27811. if ($hit) {
  27812. return $file;
  27813. }
  27814. }
  27815. $file = $this->findFileWithExtension($class, '.php');
  27816. // Search for Hack files if we are running on HHVM
  27817. if (false === $file && defined('HHVM_VERSION')) {
  27818. $file = $this->findFileWithExtension($class, '.hh');
  27819. }
  27820. if (null !== $this->apcuPrefix) {
  27821. apcu_add($this->apcuPrefix.$class, $file);
  27822. }
  27823. if (false === $file) {
  27824. // Remember that this class does not exist.
  27825. $this->missingClasses[$class] = true;
  27826. }
  27827. return $file;
  27828. }
  27829. private function findFileWithExtension($class, $ext)
  27830. {
  27831. // PSR-4 lookup
  27832. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  27833. $first = $class[0];
  27834. if (isset($this->prefixLengthsPsr4[$first])) {
  27835. $subPath = $class;
  27836. while (false !== $lastPos = strrpos($subPath, '\\')) {
  27837. $subPath = substr($subPath, 0, $lastPos);
  27838. $search = $subPath . '\\';
  27839. if (isset($this->prefixDirsPsr4[$search])) {
  27840. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  27841. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  27842. if (file_exists($file = $dir . $pathEnd)) {
  27843. return $file;
  27844. }
  27845. }
  27846. }
  27847. }
  27848. }
  27849. // PSR-4 fallback dirs
  27850. foreach ($this->fallbackDirsPsr4 as $dir) {
  27851. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  27852. return $file;
  27853. }
  27854. }
  27855. // PSR-0 lookup
  27856. if (false !== $pos = strrpos($class, '\\')) {
  27857. // namespaced class name
  27858. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  27859. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  27860. } else {
  27861. // PEAR-like class name
  27862. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  27863. }
  27864. if (isset($this->prefixesPsr0[$first])) {
  27865. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  27866. if (0 === strpos($class, $prefix)) {
  27867. foreach ($dirs as $dir) {
  27868. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  27869. return $file;
  27870. }
  27871. }
  27872. }
  27873. }
  27874. }
  27875. // PSR-0 fallback dirs
  27876. foreach ($this->fallbackDirsPsr0 as $dir) {
  27877. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  27878. return $file;
  27879. }
  27880. }
  27881. // PSR-0 include paths.
  27882. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  27883. return $file;
  27884. }
  27885. return false;
  27886. }
  27887. }
  27888. /**
  27889. * Scope isolated include.
  27890. *
  27891. * Prevents access to $this/self from included files.
  27892. */
  27893. function includeFile($file)
  27894. {
  27895. include $file;
  27896. }
  27897. {
  27898. "$schema": "http://json-schema.org/draft-04/schema#",
  27899. "description": "A representation of packages metadata.",
  27900. "type": "object",
  27901. "oneOf": [
  27902. { "required": [ "packages" ] },
  27903. { "required": [ "providers" ] },
  27904. { "required": [ "provider-includes", "providers-url" ] }
  27905. ],
  27906. "properties": {
  27907. "packages": {
  27908. "type": ["object", "array"],
  27909. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  27910. "additionalProperties": { "$ref": "#/definitions/versions" }
  27911. },
  27912. "providers-url": {
  27913. "type": "string",
  27914. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  27915. },
  27916. "provider-includes": {
  27917. "type": "object",
  27918. "description": "A hashmap of provider listings.",
  27919. "additionalProperties": { "$ref": "#/definitions/provider" }
  27920. },
  27921. "providers": {
  27922. "type": "object",
  27923. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  27924. "additionalProperties": { "$ref": "#/definitions/provider" }
  27925. },
  27926. "notify-batch": {
  27927. "type": "string",
  27928. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  27929. },
  27930. "search": {
  27931. "type": "string",
  27932. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  27933. },
  27934. "warning": {
  27935. "type": "string",
  27936. "description": "A message that will be output by Composer as a warning when this source is consulted."
  27937. }
  27938. },
  27939. "definitions": {
  27940. "versions": {
  27941. "type": "object",
  27942. "description": "A hashmap of versions and their metadata.",
  27943. "additionalProperties": { "$ref": "#/definitions/version" }
  27944. },
  27945. "version": {
  27946. "type": "object",
  27947. "oneOf": [
  27948. { "$ref": "#/definitions/package" },
  27949. { "$ref": "#/definitions/metapackage" }
  27950. ]
  27951. },
  27952. "package-base": {
  27953. "properties": {
  27954. "name": { "type": "string" },
  27955. "type": { "type": "string" },
  27956. "version": { "type": "string" },
  27957. "version_normalized": {
  27958. "type": "string",
  27959. "description": "Normalized version, optional but can save computational time on client side."
  27960. },
  27961. "autoload": { "type": "object" },
  27962. "require": { "type": "object" },
  27963. "replace": { "type": "object" },
  27964. "conflict": { "type": "object" },
  27965. "provide": { "type": "object" },
  27966. "time": { "type": "string" }
  27967. },
  27968. "additionalProperties": true
  27969. },
  27970. "package": {
  27971. "allOf": [
  27972. { "$ref": "#/definitions/package-base" },
  27973. {
  27974. "properties": {
  27975. "dist": { "type": "object" },
  27976. "source": { "type": "object" }
  27977. }
  27978. },
  27979. { "oneOf": [
  27980. { "required": [ "name", "version", "source" ] },
  27981. { "required": [ "name", "version", "dist" ] }
  27982. ] }
  27983. ]
  27984. },
  27985. "metapackage": {
  27986. "allOf": [
  27987. { "$ref": "#/definitions/package-base" },
  27988. {
  27989. "properties": {
  27990. "type": { "type": "string", "enum": [ "metapackage" ] }
  27991. },
  27992. "required": [ "name", "version", "type" ]
  27993. }
  27994. ]
  27995. },
  27996. "provider": {
  27997. "type": "object",
  27998. "properties": {
  27999. "sha256": {
  28000. "type": "string",
  28001. "description": "Hash value that can be used to validate the resource."
  28002. }
  28003. }
  28004. }
  28005. }
  28006. }
  28007. {
  28008. "$schema": "http://json-schema.org/draft-04/schema#",
  28009. "name": "Package",
  28010. "type": "object",
  28011. "additionalProperties": false,
  28012. "required": [ "name", "description" ],
  28013. "properties": {
  28014. "name": {
  28015. "type": "string",
  28016. "description": "Package name, including 'vendor-name/' prefix."
  28017. },
  28018. "type": {
  28019. "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.",
  28020. "type": "string"
  28021. },
  28022. "target-dir": {
  28023. "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.",
  28024. "type": "string"
  28025. },
  28026. "description": {
  28027. "type": "string",
  28028. "description": "Short package description."
  28029. },
  28030. "keywords": {
  28031. "type": "array",
  28032. "items": {
  28033. "type": "string",
  28034. "description": "A tag/keyword that this package relates to."
  28035. }
  28036. },
  28037. "homepage": {
  28038. "type": "string",
  28039. "description": "Homepage URL for the project.",
  28040. "format": "uri"
  28041. },
  28042. "readme": {
  28043. "type": "string",
  28044. "description": "Relative path to the readme document."
  28045. },
  28046. "version": {
  28047. "type": "string",
  28048. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
  28049. },
  28050. "time": {
  28051. "type": "string",
  28052. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  28053. },
  28054. "license": {
  28055. "type": ["string", "array"],
  28056. "description": "License name. Or an array of license names."
  28057. },
  28058. "authors": {
  28059. "$ref": "#/definitions/authors"
  28060. },
  28061. "require": {
  28062. "type": "object",
  28063. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  28064. "additionalProperties": {
  28065. "type": "string"
  28066. }
  28067. },
  28068. "replace": {
  28069. "type": "object",
  28070. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  28071. "additionalProperties": {
  28072. "type": "string"
  28073. }
  28074. },
  28075. "conflict": {
  28076. "type": "object",
  28077. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  28078. "additionalProperties": {
  28079. "type": "string"
  28080. }
  28081. },
  28082. "provide": {
  28083. "type": "object",
  28084. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  28085. "additionalProperties": {
  28086. "type": "string"
  28087. }
  28088. },
  28089. "require-dev": {
  28090. "type": "object",
  28091. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  28092. "additionalProperties": {
  28093. "type": "string"
  28094. }
  28095. },
  28096. "suggest": {
  28097. "type": "object",
  28098. "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).",
  28099. "additionalProperties": {
  28100. "type": "string"
  28101. }
  28102. },
  28103. "config": {
  28104. "type": "object",
  28105. "description": "Composer options.",
  28106. "properties": {
  28107. "process-timeout": {
  28108. "type": "integer",
  28109. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  28110. },
  28111. "use-include-path": {
  28112. "type": "boolean",
  28113. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  28114. },
  28115. "preferred-install": {
  28116. "type": ["string", "object"],
  28117. "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\"}."
  28118. },
  28119. "notify-on-install": {
  28120. "type": "boolean",
  28121. "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."
  28122. },
  28123. "github-protocols": {
  28124. "type": "array",
  28125. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  28126. "items": {
  28127. "type": "string"
  28128. }
  28129. },
  28130. "github-oauth": {
  28131. "type": "object",
  28132. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  28133. "additionalProperties": {
  28134. "type": "string"
  28135. }
  28136. },
  28137. "gitlab-oauth": {
  28138. "type": "object",
  28139. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  28140. "additionalProperties": {
  28141. "type": "string"
  28142. }
  28143. },
  28144. "gitlab-token": {
  28145. "type": "object",
  28146. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  28147. "additionalProperties": true
  28148. },
  28149. "disable-tls": {
  28150. "type": "boolean",
  28151. "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."
  28152. },
  28153. "secure-http": {
  28154. "type": "boolean",
  28155. "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."
  28156. },
  28157. "cafile": {
  28158. "type": "string",
  28159. "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."
  28160. },
  28161. "capath": {
  28162. "type": "string",
  28163. "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."
  28164. },
  28165. "http-basic": {
  28166. "type": "object",
  28167. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  28168. "additionalProperties": {
  28169. "type": "object",
  28170. "required": ["username", "password"],
  28171. "properties": {
  28172. "username": {
  28173. "type": "string",
  28174. "description": "The username used for HTTP Basic authentication"
  28175. },
  28176. "password": {
  28177. "type": "string",
  28178. "description": "The password used for HTTP Basic authentication"
  28179. }
  28180. }
  28181. }
  28182. },
  28183. "store-auths": {
  28184. "type": ["string", "boolean"],
  28185. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  28186. },
  28187. "platform": {
  28188. "type": "object",
  28189. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  28190. "additionalProperties": {
  28191. "type": "string"
  28192. }
  28193. },
  28194. "vendor-dir": {
  28195. "type": "string",
  28196. "description": "The location where all packages are installed, defaults to \"vendor\"."
  28197. },
  28198. "bin-dir": {
  28199. "type": "string",
  28200. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  28201. },
  28202. "data-dir": {
  28203. "type": "string",
  28204. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  28205. },
  28206. "cache-dir": {
  28207. "type": "string",
  28208. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  28209. },
  28210. "cache-files-dir": {
  28211. "type": "string",
  28212. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  28213. },
  28214. "cache-repo-dir": {
  28215. "type": "string",
  28216. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  28217. },
  28218. "cache-vcs-dir": {
  28219. "type": "string",
  28220. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  28221. },
  28222. "cache-ttl": {
  28223. "type": "integer",
  28224. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  28225. },
  28226. "cache-files-ttl": {
  28227. "type": "integer",
  28228. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  28229. },
  28230. "cache-files-maxsize": {
  28231. "type": ["string", "integer"],
  28232. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  28233. },
  28234. "bin-compat": {
  28235. "enum": ["auto", "full"],
  28236. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  28237. },
  28238. "discard-changes": {
  28239. "type": ["string", "boolean"],
  28240. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  28241. },
  28242. "autoloader-suffix": {
  28243. "type": "string",
  28244. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  28245. },
  28246. "optimize-autoloader": {
  28247. "type": "boolean",
  28248. "description": "Always optimize when dumping the autoloader."
  28249. },
  28250. "prepend-autoloader": {
  28251. "type": "boolean",
  28252. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  28253. },
  28254. "classmap-authoritative": {
  28255. "type": "boolean",
  28256. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  28257. },
  28258. "apcu-autoloader": {
  28259. "type": "boolean",
  28260. "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."
  28261. },
  28262. "github-domains": {
  28263. "type": "array",
  28264. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  28265. "items": {
  28266. "type": "string"
  28267. }
  28268. },
  28269. "github-expose-hostname": {
  28270. "type": "boolean",
  28271. "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."
  28272. },
  28273. "gitlab-domains": {
  28274. "type": "array",
  28275. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  28276. "items": {
  28277. "type": "string"
  28278. }
  28279. },
  28280. "archive-format": {
  28281. "type": "string",
  28282. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  28283. },
  28284. "archive-dir": {
  28285. "type": "string",
  28286. "description": "The default archive path when not provided on cli, defaults to \".\"."
  28287. },
  28288. "htaccess-protect": {
  28289. "type": "boolean",
  28290. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  28291. },
  28292. "sort-packages": {
  28293. "type": "boolean",
  28294. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  28295. }
  28296. }
  28297. },
  28298. "extra": {
  28299. "type": ["object", "array"],
  28300. "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.",
  28301. "additionalProperties": true
  28302. },
  28303. "autoload": {
  28304. "$ref": "#/definitions/autoload"
  28305. },
  28306. "autoload-dev": {
  28307. "type": "object",
  28308. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  28309. "properties": {
  28310. "psr-0": {
  28311. "type": "object",
  28312. "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.",
  28313. "additionalProperties": {
  28314. "type": ["string", "array"],
  28315. "items": {
  28316. "type": "string"
  28317. }
  28318. }
  28319. },
  28320. "psr-4": {
  28321. "type": "object",
  28322. "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.",
  28323. "additionalProperties": {
  28324. "type": ["string", "array"],
  28325. "items": {
  28326. "type": "string"
  28327. }
  28328. }
  28329. },
  28330. "classmap": {
  28331. "type": "array",
  28332. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  28333. },
  28334. "files": {
  28335. "type": "array",
  28336. "description": "This is an array of files that are always required on every request."
  28337. }
  28338. }
  28339. },
  28340. "archive": {
  28341. "type": ["object"],
  28342. "description": "Options for creating package archives for distribution.",
  28343. "properties": {
  28344. "exclude": {
  28345. "type": "array",
  28346. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  28347. }
  28348. }
  28349. },
  28350. "repositories": {
  28351. "type": ["object", "array"],
  28352. "description": "A set of additional repositories where packages can be found.",
  28353. "additionalProperties": {
  28354. "oneOf": [
  28355. { "$ref": "#/definitions/repository" },
  28356. { "type": "boolean", "enum": [false] }
  28357. ]
  28358. },
  28359. "items": {
  28360. "oneOf": [
  28361. { "$ref": "#/definitions/repository" },
  28362. {
  28363. "type": "object",
  28364. "additionalProperties": { "type": "boolean", "enum": [false] },
  28365. "minProperties": 1,
  28366. "maxProperties": 1
  28367. }
  28368. ]
  28369. }
  28370. },
  28371. "minimum-stability": {
  28372. "type": ["string"],
  28373. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  28374. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  28375. },
  28376. "prefer-stable": {
  28377. "type": ["boolean"],
  28378. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  28379. },
  28380. "bin": {
  28381. "type": ["string", "array"],
  28382. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  28383. "items": {
  28384. "type": "string"
  28385. }
  28386. },
  28387. "include-path": {
  28388. "type": ["array"],
  28389. "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.",
  28390. "items": {
  28391. "type": "string"
  28392. }
  28393. },
  28394. "scripts": {
  28395. "type": ["object"],
  28396. "description": "Script listeners that will be executed before/after some events.",
  28397. "properties": {
  28398. "pre-install-cmd": {
  28399. "type": ["array", "string"],
  28400. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  28401. },
  28402. "post-install-cmd": {
  28403. "type": ["array", "string"],
  28404. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  28405. },
  28406. "pre-update-cmd": {
  28407. "type": ["array", "string"],
  28408. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  28409. },
  28410. "post-update-cmd": {
  28411. "type": ["array", "string"],
  28412. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  28413. },
  28414. "pre-status-cmd": {
  28415. "type": ["array", "string"],
  28416. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  28417. },
  28418. "post-status-cmd": {
  28419. "type": ["array", "string"],
  28420. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  28421. },
  28422. "pre-package-install": {
  28423. "type": ["array", "string"],
  28424. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  28425. },
  28426. "post-package-install": {
  28427. "type": ["array", "string"],
  28428. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  28429. },
  28430. "pre-package-update": {
  28431. "type": ["array", "string"],
  28432. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  28433. },
  28434. "post-package-update": {
  28435. "type": ["array", "string"],
  28436. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  28437. },
  28438. "pre-package-uninstall": {
  28439. "type": ["array", "string"],
  28440. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  28441. },
  28442. "post-package-uninstall": {
  28443. "type": ["array", "string"],
  28444. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  28445. },
  28446. "pre-autoload-dump": {
  28447. "type": ["array", "string"],
  28448. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  28449. },
  28450. "post-autoload-dump": {
  28451. "type": ["array", "string"],
  28452. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  28453. },
  28454. "post-root-package-install": {
  28455. "type": ["array", "string"],
  28456. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  28457. },
  28458. "post-create-project-cmd": {
  28459. "type": ["array", "string"],
  28460. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  28461. }
  28462. }
  28463. },
  28464. "scripts-descriptions": {
  28465. "type": ["object"],
  28466. "description": "Descriptions for custom commands, shown in console help.",
  28467. "additionalProperties": {
  28468. "type": "string"
  28469. }
  28470. },
  28471. "support": {
  28472. "type": "object",
  28473. "properties": {
  28474. "email": {
  28475. "type": "string",
  28476. "description": "Email address for support.",
  28477. "format": "email"
  28478. },
  28479. "issues": {
  28480. "type": "string",
  28481. "description": "URL to the issue tracker.",
  28482. "format": "uri"
  28483. },
  28484. "forum": {
  28485. "type": "string",
  28486. "description": "URL to the forum.",
  28487. "format": "uri"
  28488. },
  28489. "wiki": {
  28490. "type": "string",
  28491. "description": "URL to the wiki.",
  28492. "format": "uri"
  28493. },
  28494. "irc": {
  28495. "type": "string",
  28496. "description": "IRC channel for support, as irc://server/channel.",
  28497. "format": "uri"
  28498. },
  28499. "source": {
  28500. "type": "string",
  28501. "description": "URL to browse or download the sources.",
  28502. "format": "uri"
  28503. },
  28504. "docs": {
  28505. "type": "string",
  28506. "description": "URL to the documentation.",
  28507. "format": "uri"
  28508. },
  28509. "rss": {
  28510. "type": "string",
  28511. "description": "URL to the RSS feed.",
  28512. "format": "uri"
  28513. }
  28514. }
  28515. },
  28516. "non-feature-branches": {
  28517. "type": ["array"],
  28518. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  28519. "items": {
  28520. "type": "string"
  28521. }
  28522. },
  28523. "abandoned": {
  28524. "type": ["boolean", "string"],
  28525. "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."
  28526. },
  28527. "_comment": {
  28528. "type": ["array", "string"],
  28529. "description": "A key to store comments in"
  28530. }
  28531. },
  28532. "definitions": {
  28533. "authors": {
  28534. "type": "array",
  28535. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  28536. "items": {
  28537. "type": "object",
  28538. "additionalProperties": false,
  28539. "required": [ "name"],
  28540. "properties": {
  28541. "name": {
  28542. "type": "string",
  28543. "description": "Full name of the author."
  28544. },
  28545. "email": {
  28546. "type": "string",
  28547. "description": "Email address of the author.",
  28548. "format": "email"
  28549. },
  28550. "homepage": {
  28551. "type": "string",
  28552. "description": "Homepage URL for the author.",
  28553. "format": "uri"
  28554. },
  28555. "role": {
  28556. "type": "string",
  28557. "description": "Author's role in the project."
  28558. }
  28559. }
  28560. }
  28561. },
  28562. "autoload": {
  28563. "type": "object",
  28564. "description": "Description of how the package can be autoloaded.",
  28565. "properties": {
  28566. "psr-0": {
  28567. "type": "object",
  28568. "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.",
  28569. "additionalProperties": {
  28570. "type": ["string", "array"],
  28571. "items": {
  28572. "type": "string"
  28573. }
  28574. }
  28575. },
  28576. "psr-4": {
  28577. "type": "object",
  28578. "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.",
  28579. "additionalProperties": {
  28580. "type": ["string", "array"],
  28581. "items": {
  28582. "type": "string"
  28583. }
  28584. }
  28585. },
  28586. "classmap": {
  28587. "type": "array",
  28588. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  28589. },
  28590. "files": {
  28591. "type": "array",
  28592. "description": "This is an array of files that are always required on every request."
  28593. },
  28594. "exclude-from-classmap": {
  28595. "type": "array",
  28596. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  28597. }
  28598. }
  28599. },
  28600. "repository": {
  28601. "type": "object",
  28602. "oneOf": [
  28603. { "$ref": "#/definitions/composer-repository" },
  28604. { "$ref": "#/definitions/vcs-repository" },
  28605. { "$ref": "#/definitions/path-repository" },
  28606. { "$ref": "#/definitions/artifact-repository" },
  28607. { "$ref": "#/definitions/pear-repository" },
  28608. { "$ref": "#/definitions/package-repository" }
  28609. ]
  28610. },
  28611. "composer-repository": {
  28612. "type": "object",
  28613. "required": ["type", "url"],
  28614. "properties": {
  28615. "type": { "type": "string", "enum": ["composer"] },
  28616. "url": { "type": "string" },
  28617. "options": {
  28618. "type": "object",
  28619. "additionalProperties": true
  28620. },
  28621. "allow_ssl_downgrade": { "type": "boolean" },
  28622. "force-lazy-providers": { "type": "boolean" }
  28623. }
  28624. },
  28625. "vcs-repository": {
  28626. "type": "object",
  28627. "required": ["type", "url"],
  28628. "properties": {
  28629. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  28630. "url": { "type": "string" },
  28631. "no-api": { "type": "boolean" },
  28632. "secure-http": { "type": "boolean" },
  28633. "svn-cache-credentials": { "type": "boolean" },
  28634. "trunk-path": { "type": ["string", "boolean"] },
  28635. "branches-path": { "type": ["string", "boolean"] },
  28636. "tags-path": { "type": ["string", "boolean"] },
  28637. "package-path": { "type": "string" },
  28638. "depot": { "type": "string" },
  28639. "branch": { "type": "string" },
  28640. "unique_perforce_client_name": { "type": "string" },
  28641. "p4user": { "type": "string" },
  28642. "p4password": { "type": "string" }
  28643. }
  28644. },
  28645. "path-repository": {
  28646. "type": "object",
  28647. "required": ["type", "url"],
  28648. "properties": {
  28649. "type": { "type": "string", "enum": ["path"] },
  28650. "url": { "type": "string" },
  28651. "options": {
  28652. "type": "object",
  28653. "properties": {
  28654. "symlink": { "type": ["boolean", "null"] }
  28655. },
  28656. "additionalProperties": true
  28657. }
  28658. }
  28659. },
  28660. "artifact-repository": {
  28661. "type": "object",
  28662. "required": ["type", "url"],
  28663. "properties": {
  28664. "type": { "type": "string", "enum": ["artifact"] },
  28665. "url": { "type": "string" }
  28666. }
  28667. },
  28668. "pear-repository": {
  28669. "type": "object",
  28670. "required": ["type", "url"],
  28671. "properties": {
  28672. "type": { "type": "string", "enum": ["pear"] },
  28673. "url": { "type": "string" },
  28674. "vendor-alias": { "type": "string" }
  28675. }
  28676. },
  28677. "package-repository": {
  28678. "type": "object",
  28679. "required": ["type", "package"],
  28680. "properties": {
  28681. "type": { "type": "string", "enum": ["package"] },
  28682. "package": {
  28683. "oneOf": [
  28684. { "$ref": "#/definitions/inline-package" },
  28685. {
  28686. "type": "array",
  28687. "items": { "$ref": "#/definitions/inline-package" }
  28688. }
  28689. ]
  28690. }
  28691. }
  28692. },
  28693. "inline-package": {
  28694. "type": "object",
  28695. "required": ["name", "version"],
  28696. "properties": {
  28697. "name": {
  28698. "type": "string",
  28699. "description": "Package name, including 'vendor-name/' prefix."
  28700. },
  28701. "type": {
  28702. "type": "string"
  28703. },
  28704. "target-dir": {
  28705. "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.",
  28706. "type": "string"
  28707. },
  28708. "description": {
  28709. "type": "string"
  28710. },
  28711. "keywords": {
  28712. "type": "array",
  28713. "items": {
  28714. "type": "string"
  28715. }
  28716. },
  28717. "homepage": {
  28718. "type": "string",
  28719. "format": "uri"
  28720. },
  28721. "version": {
  28722. "type": "string"
  28723. },
  28724. "time": {
  28725. "type": "string"
  28726. },
  28727. "license": {
  28728. "type": [
  28729. "string",
  28730. "array"
  28731. ]
  28732. },
  28733. "authors": {
  28734. "$ref": "#/definitions/authors"
  28735. },
  28736. "require": {
  28737. "type": "object",
  28738. "additionalProperties": {
  28739. "type": "string"
  28740. }
  28741. },
  28742. "replace": {
  28743. "type": "object",
  28744. "additionalProperties": {
  28745. "type": "string"
  28746. }
  28747. },
  28748. "conflict": {
  28749. "type": "object",
  28750. "additionalProperties": {
  28751. "type": "string"
  28752. }
  28753. },
  28754. "provide": {
  28755. "type": "object",
  28756. "additionalProperties": {
  28757. "type": "string"
  28758. }
  28759. },
  28760. "require-dev": {
  28761. "type": "object",
  28762. "additionalProperties": {
  28763. "type": "string"
  28764. }
  28765. },
  28766. "suggest": {
  28767. "type": "object",
  28768. "additionalProperties": {
  28769. "type": "string"
  28770. }
  28771. },
  28772. "extra": {
  28773. "type": ["object", "array"],
  28774. "additionalProperties": true
  28775. },
  28776. "autoload": {
  28777. "$ref": "#/definitions/autoload"
  28778. },
  28779. "archive": {
  28780. "type": ["object"],
  28781. "properties": {
  28782. "exclude": {
  28783. "type": "array"
  28784. }
  28785. }
  28786. },
  28787. "bin": {
  28788. "type": ["string", "array"],
  28789. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  28790. "items": {
  28791. "type": "string"
  28792. }
  28793. },
  28794. "include-path": {
  28795. "type": ["array"],
  28796. "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.",
  28797. "items": {
  28798. "type": "string"
  28799. }
  28800. },
  28801. "source": {
  28802. "type": "object",
  28803. "required": ["type", "url", "reference"],
  28804. "properties": {
  28805. "type": {
  28806. "type": "string"
  28807. },
  28808. "url": {
  28809. "type": "string"
  28810. },
  28811. "reference": {
  28812. "type": "string"
  28813. },
  28814. "mirrors": {
  28815. "type": "array"
  28816. }
  28817. }
  28818. },
  28819. "dist": {
  28820. "type": "object",
  28821. "required": ["type", "url"],
  28822. "properties": {
  28823. "type": {
  28824. "type": "string"
  28825. },
  28826. "url": {
  28827. "type": "string"
  28828. },
  28829. "reference": {
  28830. "type": "string"
  28831. },
  28832. "shasum": {
  28833. "type": "string"
  28834. },
  28835. "mirrors": {
  28836. "type": "array"
  28837. }
  28838. }
  28839. }
  28840. },
  28841. "additionalProperties": true
  28842. }
  28843. }
  28844. }
  28845. {
  28846. "389-exception": [
  28847. "389 Directory Server Exception"
  28848. ],
  28849. "Autoconf-exception-2.0": [
  28850. "Autoconf exception 2.0"
  28851. ],
  28852. "Autoconf-exception-3.0": [
  28853. "Autoconf exception 3.0"
  28854. ],
  28855. "Bison-exception-2.2": [
  28856. "Bison exception 2.2"
  28857. ],
  28858. "Bootloader-exception": [
  28859. "Bootloader Distribution Exception"
  28860. ],
  28861. "Classpath-exception-2.0": [
  28862. "Classpath exception 2.0"
  28863. ],
  28864. "CLISP-exception-2.0": [
  28865. "CLISP exception 2.0"
  28866. ],
  28867. "DigiRule-FOSS-exception": [
  28868. "DigiRule FOSS License Exception"
  28869. ],
  28870. "eCos-exception-2.0": [
  28871. "eCos exception 2.0"
  28872. ],
  28873. "Fawkes-Runtime-exception": [
  28874. "Fawkes Runtime Exception"
  28875. ],
  28876. "FLTK-exception": [
  28877. "FLTK exception"
  28878. ],
  28879. "Font-exception-2.0": [
  28880. "Font exception 2.0"
  28881. ],
  28882. "freertos-exception-2.0": [
  28883. "FreeRTOS Exception 2.0"
  28884. ],
  28885. "GCC-exception-2.0": [
  28886. "GCC Runtime Library exception 2.0"
  28887. ],
  28888. "GCC-exception-3.1": [
  28889. "GCC Runtime Library exception 3.1"
  28890. ],
  28891. "gnu-javamail-exception": [
  28892. "GNU JavaMail exception"
  28893. ],
  28894. "i2p-gpl-java-exception": [
  28895. "i2p GPL+Java Exception"
  28896. ],
  28897. "Libtool-exception": [
  28898. "Libtool Exception"
  28899. ],
  28900. "Linux-syscall-note": [
  28901. "Linux Syscall Note"
  28902. ],
  28903. "LLVM-exception": [
  28904. "LLVM Exception"
  28905. ],
  28906. "LZMA-exception": [
  28907. "LZMA exception"
  28908. ],
  28909. "mif-exception": [
  28910. "Macros and Inline Functions Exception"
  28911. ],
  28912. "Nokia-Qt-exception-1.1": [
  28913. "Nokia Qt LGPL exception 1.1"
  28914. ],
  28915. "OCCT-exception-1.0": [
  28916. "Open CASCADE Exception 1.0"
  28917. ],
  28918. "OpenJDK-assembly-exception-1.0": [
  28919. "OpenJDK Assembly exception 1.0"
  28920. ],
  28921. "openvpn-openssl-exception": [
  28922. "OpenVPN OpenSSL Exception"
  28923. ],
  28924. "Qwt-exception-1.0": [
  28925. "Qwt exception 1.0"
  28926. ],
  28927. "u-boot-exception-2.0": [
  28928. "U-Boot exception 2.0"
  28929. ],
  28930. "WxWindows-exception-3.1": [
  28931. "WxWindows Library Exception 3.1"
  28932. ]
  28933. }{
  28934. "0BSD": [
  28935. "BSD Zero Clause License",
  28936. false,
  28937. false
  28938. ],
  28939. "AAL": [
  28940. "Attribution Assurance License",
  28941. true,
  28942. false
  28943. ],
  28944. "Abstyles": [
  28945. "Abstyles License",
  28946. false,
  28947. false
  28948. ],
  28949. "Adobe-2006": [
  28950. "Adobe Systems Incorporated Source Code License Agreement",
  28951. false,
  28952. false
  28953. ],
  28954. "Adobe-Glyph": [
  28955. "Adobe Glyph List License",
  28956. false,
  28957. false
  28958. ],
  28959. "ADSL": [
  28960. "Amazon Digital Services License",
  28961. false,
  28962. false
  28963. ],
  28964. "AFL-1.1": [
  28965. "Academic Free License v1.1",
  28966. true,
  28967. false
  28968. ],
  28969. "AFL-1.2": [
  28970. "Academic Free License v1.2",
  28971. true,
  28972. false
  28973. ],
  28974. "AFL-2.0": [
  28975. "Academic Free License v2.0",
  28976. true,
  28977. false
  28978. ],
  28979. "AFL-2.1": [
  28980. "Academic Free License v2.1",
  28981. true,
  28982. false
  28983. ],
  28984. "AFL-3.0": [
  28985. "Academic Free License v3.0",
  28986. true,
  28987. false
  28988. ],
  28989. "Afmparse": [
  28990. "Afmparse License",
  28991. false,
  28992. false
  28993. ],
  28994. "AGPL-1.0": [
  28995. "Affero General Public License v1.0",
  28996. false,
  28997. true
  28998. ],
  28999. "AGPL-1.0-only": [
  29000. "Affero General Public License v1.0 only",
  29001. false,
  29002. false
  29003. ],
  29004. "AGPL-1.0-or-later": [
  29005. "Affero General Public License v1.0 or later",
  29006. false,
  29007. false
  29008. ],
  29009. "AGPL-3.0": [
  29010. "GNU Affero General Public License v3.0",
  29011. true,
  29012. true
  29013. ],
  29014. "AGPL-3.0-only": [
  29015. "GNU Affero General Public License v3.0 only",
  29016. true,
  29017. false
  29018. ],
  29019. "AGPL-3.0-or-later": [
  29020. "GNU Affero General Public License v3.0 or later",
  29021. true,
  29022. false
  29023. ],
  29024. "Aladdin": [
  29025. "Aladdin Free Public License",
  29026. false,
  29027. false
  29028. ],
  29029. "AMDPLPA": [
  29030. "AMD's plpa_map.c License",
  29031. false,
  29032. false
  29033. ],
  29034. "AML": [
  29035. "Apple MIT License",
  29036. false,
  29037. false
  29038. ],
  29039. "AMPAS": [
  29040. "Academy of Motion Picture Arts and Sciences BSD",
  29041. false,
  29042. false
  29043. ],
  29044. "ANTLR-PD": [
  29045. "ANTLR Software Rights Notice",
  29046. false,
  29047. false
  29048. ],
  29049. "Apache-1.0": [
  29050. "Apache License 1.0",
  29051. false,
  29052. false
  29053. ],
  29054. "Apache-1.1": [
  29055. "Apache License 1.1",
  29056. true,
  29057. false
  29058. ],
  29059. "Apache-2.0": [
  29060. "Apache License 2.0",
  29061. true,
  29062. false
  29063. ],
  29064. "APAFML": [
  29065. "Adobe Postscript AFM License",
  29066. false,
  29067. false
  29068. ],
  29069. "APL-1.0": [
  29070. "Adaptive Public License 1.0",
  29071. true,
  29072. false
  29073. ],
  29074. "APSL-1.0": [
  29075. "Apple Public Source License 1.0",
  29076. true,
  29077. false
  29078. ],
  29079. "APSL-1.1": [
  29080. "Apple Public Source License 1.1",
  29081. true,
  29082. false
  29083. ],
  29084. "APSL-1.2": [
  29085. "Apple Public Source License 1.2",
  29086. true,
  29087. false
  29088. ],
  29089. "APSL-2.0": [
  29090. "Apple Public Source License 2.0",
  29091. true,
  29092. false
  29093. ],
  29094. "Artistic-1.0": [
  29095. "Artistic License 1.0",
  29096. true,
  29097. false
  29098. ],
  29099. "Artistic-1.0-cl8": [
  29100. "Artistic License 1.0 w/clause 8",
  29101. true,
  29102. false
  29103. ],
  29104. "Artistic-1.0-Perl": [
  29105. "Artistic License 1.0 (Perl)",
  29106. true,
  29107. false
  29108. ],
  29109. "Artistic-2.0": [
  29110. "Artistic License 2.0",
  29111. true,
  29112. false
  29113. ],
  29114. "Bahyph": [
  29115. "Bahyph License",
  29116. false,
  29117. false
  29118. ],
  29119. "Barr": [
  29120. "Barr License",
  29121. false,
  29122. false
  29123. ],
  29124. "Beerware": [
  29125. "Beerware License",
  29126. false,
  29127. false
  29128. ],
  29129. "BitTorrent-1.0": [
  29130. "BitTorrent Open Source License v1.0",
  29131. false,
  29132. false
  29133. ],
  29134. "BitTorrent-1.1": [
  29135. "BitTorrent Open Source License v1.1",
  29136. false,
  29137. false
  29138. ],
  29139. "Borceux": [
  29140. "Borceux license",
  29141. false,
  29142. false
  29143. ],
  29144. "BSD-1-Clause": [
  29145. "BSD 1-Clause License",
  29146. false,
  29147. false
  29148. ],
  29149. "BSD-2-Clause": [
  29150. "BSD 2-Clause \"Simplified\" License",
  29151. true,
  29152. false
  29153. ],
  29154. "BSD-2-Clause-FreeBSD": [
  29155. "BSD 2-Clause FreeBSD License",
  29156. false,
  29157. false
  29158. ],
  29159. "BSD-2-Clause-NetBSD": [
  29160. "BSD 2-Clause NetBSD License",
  29161. false,
  29162. false
  29163. ],
  29164. "BSD-2-Clause-Patent": [
  29165. "BSD-2-Clause Plus Patent License",
  29166. true,
  29167. false
  29168. ],
  29169. "BSD-3-Clause": [
  29170. "BSD 3-Clause \"New\" or \"Revised\" License",
  29171. true,
  29172. false
  29173. ],
  29174. "BSD-3-Clause-Attribution": [
  29175. "BSD with attribution",
  29176. false,
  29177. false
  29178. ],
  29179. "BSD-3-Clause-Clear": [
  29180. "BSD 3-Clause Clear License",
  29181. false,
  29182. false
  29183. ],
  29184. "BSD-3-Clause-LBNL": [
  29185. "Lawrence Berkeley National Labs BSD variant license",
  29186. false,
  29187. false
  29188. ],
  29189. "BSD-3-Clause-No-Nuclear-License": [
  29190. "BSD 3-Clause No Nuclear License",
  29191. false,
  29192. false
  29193. ],
  29194. "BSD-3-Clause-No-Nuclear-License-2014": [
  29195. "BSD 3-Clause No Nuclear License 2014",
  29196. false,
  29197. false
  29198. ],
  29199. "BSD-3-Clause-No-Nuclear-Warranty": [
  29200. "BSD 3-Clause No Nuclear Warranty",
  29201. false,
  29202. false
  29203. ],
  29204. "BSD-4-Clause": [
  29205. "BSD 4-Clause \"Original\" or \"Old\" License",
  29206. false,
  29207. false
  29208. ],
  29209. "BSD-4-Clause-UC": [
  29210. "BSD-4-Clause (University of California-Specific)",
  29211. false,
  29212. false
  29213. ],
  29214. "BSD-Protection": [
  29215. "BSD Protection License",
  29216. false,
  29217. false
  29218. ],
  29219. "BSD-Source-Code": [
  29220. "BSD Source Code Attribution",
  29221. false,
  29222. false
  29223. ],
  29224. "BSL-1.0": [
  29225. "Boost Software License 1.0",
  29226. true,
  29227. false
  29228. ],
  29229. "bzip2-1.0.5": [
  29230. "bzip2 and libbzip2 License v1.0.5",
  29231. false,
  29232. false
  29233. ],
  29234. "bzip2-1.0.6": [
  29235. "bzip2 and libbzip2 License v1.0.6",
  29236. false,
  29237. false
  29238. ],
  29239. "Caldera": [
  29240. "Caldera License",
  29241. false,
  29242. false
  29243. ],
  29244. "CATOSL-1.1": [
  29245. "Computer Associates Trusted Open Source License 1.1",
  29246. true,
  29247. false
  29248. ],
  29249. "CC-BY-1.0": [
  29250. "Creative Commons Attribution 1.0 Generic",
  29251. false,
  29252. false
  29253. ],
  29254. "CC-BY-2.0": [
  29255. "Creative Commons Attribution 2.0 Generic",
  29256. false,
  29257. false
  29258. ],
  29259. "CC-BY-2.5": [
  29260. "Creative Commons Attribution 2.5 Generic",
  29261. false,
  29262. false
  29263. ],
  29264. "CC-BY-3.0": [
  29265. "Creative Commons Attribution 3.0 Unported",
  29266. false,
  29267. false
  29268. ],
  29269. "CC-BY-4.0": [
  29270. "Creative Commons Attribution 4.0 International",
  29271. false,
  29272. false
  29273. ],
  29274. "CC-BY-NC-1.0": [
  29275. "Creative Commons Attribution Non Commercial 1.0 Generic",
  29276. false,
  29277. false
  29278. ],
  29279. "CC-BY-NC-2.0": [
  29280. "Creative Commons Attribution Non Commercial 2.0 Generic",
  29281. false,
  29282. false
  29283. ],
  29284. "CC-BY-NC-2.5": [
  29285. "Creative Commons Attribution Non Commercial 2.5 Generic",
  29286. false,
  29287. false
  29288. ],
  29289. "CC-BY-NC-3.0": [
  29290. "Creative Commons Attribution Non Commercial 3.0 Unported",
  29291. false,
  29292. false
  29293. ],
  29294. "CC-BY-NC-4.0": [
  29295. "Creative Commons Attribution Non Commercial 4.0 International",
  29296. false,
  29297. false
  29298. ],
  29299. "CC-BY-NC-ND-1.0": [
  29300. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  29301. false,
  29302. false
  29303. ],
  29304. "CC-BY-NC-ND-2.0": [
  29305. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  29306. false,
  29307. false
  29308. ],
  29309. "CC-BY-NC-ND-2.5": [
  29310. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  29311. false,
  29312. false
  29313. ],
  29314. "CC-BY-NC-ND-3.0": [
  29315. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  29316. false,
  29317. false
  29318. ],
  29319. "CC-BY-NC-ND-4.0": [
  29320. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  29321. false,
  29322. false
  29323. ],
  29324. "CC-BY-NC-SA-1.0": [
  29325. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  29326. false,
  29327. false
  29328. ],
  29329. "CC-BY-NC-SA-2.0": [
  29330. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  29331. false,
  29332. false
  29333. ],
  29334. "CC-BY-NC-SA-2.5": [
  29335. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  29336. false,
  29337. false
  29338. ],
  29339. "CC-BY-NC-SA-3.0": [
  29340. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  29341. false,
  29342. false
  29343. ],
  29344. "CC-BY-NC-SA-4.0": [
  29345. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  29346. false,
  29347. false
  29348. ],
  29349. "CC-BY-ND-1.0": [
  29350. "Creative Commons Attribution No Derivatives 1.0 Generic",
  29351. false,
  29352. false
  29353. ],
  29354. "CC-BY-ND-2.0": [
  29355. "Creative Commons Attribution No Derivatives 2.0 Generic",
  29356. false,
  29357. false
  29358. ],
  29359. "CC-BY-ND-2.5": [
  29360. "Creative Commons Attribution No Derivatives 2.5 Generic",
  29361. false,
  29362. false
  29363. ],
  29364. "CC-BY-ND-3.0": [
  29365. "Creative Commons Attribution No Derivatives 3.0 Unported",
  29366. false,
  29367. false
  29368. ],
  29369. "CC-BY-ND-4.0": [
  29370. "Creative Commons Attribution No Derivatives 4.0 International",
  29371. false,
  29372. false
  29373. ],
  29374. "CC-BY-SA-1.0": [
  29375. "Creative Commons Attribution Share Alike 1.0 Generic",
  29376. false,
  29377. false
  29378. ],
  29379. "CC-BY-SA-2.0": [
  29380. "Creative Commons Attribution Share Alike 2.0 Generic",
  29381. false,
  29382. false
  29383. ],
  29384. "CC-BY-SA-2.5": [
  29385. "Creative Commons Attribution Share Alike 2.5 Generic",
  29386. false,
  29387. false
  29388. ],
  29389. "CC-BY-SA-3.0": [
  29390. "Creative Commons Attribution Share Alike 3.0 Unported",
  29391. false,
  29392. false
  29393. ],
  29394. "CC-BY-SA-4.0": [
  29395. "Creative Commons Attribution Share Alike 4.0 International",
  29396. false,
  29397. false
  29398. ],
  29399. "CC0-1.0": [
  29400. "Creative Commons Zero v1.0 Universal",
  29401. false,
  29402. false
  29403. ],
  29404. "CDDL-1.0": [
  29405. "Common Development and Distribution License 1.0",
  29406. true,
  29407. false
  29408. ],
  29409. "CDDL-1.1": [
  29410. "Common Development and Distribution License 1.1",
  29411. false,
  29412. false
  29413. ],
  29414. "CDLA-Permissive-1.0": [
  29415. "Community Data License Agreement Permissive 1.0",
  29416. false,
  29417. false
  29418. ],
  29419. "CDLA-Sharing-1.0": [
  29420. "Community Data License Agreement Sharing 1.0",
  29421. false,
  29422. false
  29423. ],
  29424. "CECILL-1.0": [
  29425. "CeCILL Free Software License Agreement v1.0",
  29426. false,
  29427. false
  29428. ],
  29429. "CECILL-1.1": [
  29430. "CeCILL Free Software License Agreement v1.1",
  29431. false,
  29432. false
  29433. ],
  29434. "CECILL-2.0": [
  29435. "CeCILL Free Software License Agreement v2.0",
  29436. false,
  29437. false
  29438. ],
  29439. "CECILL-2.1": [
  29440. "CeCILL Free Software License Agreement v2.1",
  29441. true,
  29442. false
  29443. ],
  29444. "CECILL-B": [
  29445. "CeCILL-B Free Software License Agreement",
  29446. false,
  29447. false
  29448. ],
  29449. "CECILL-C": [
  29450. "CeCILL-C Free Software License Agreement",
  29451. false,
  29452. false
  29453. ],
  29454. "ClArtistic": [
  29455. "Clarified Artistic License",
  29456. false,
  29457. false
  29458. ],
  29459. "CNRI-Jython": [
  29460. "CNRI Jython License",
  29461. false,
  29462. false
  29463. ],
  29464. "CNRI-Python": [
  29465. "CNRI Python License",
  29466. true,
  29467. false
  29468. ],
  29469. "CNRI-Python-GPL-Compatible": [
  29470. "CNRI Python Open Source GPL Compatible License Agreement",
  29471. false,
  29472. false
  29473. ],
  29474. "Condor-1.1": [
  29475. "Condor Public License v1.1",
  29476. false,
  29477. false
  29478. ],
  29479. "CPAL-1.0": [
  29480. "Common Public Attribution License 1.0",
  29481. true,
  29482. false
  29483. ],
  29484. "CPL-1.0": [
  29485. "Common Public License 1.0",
  29486. true,
  29487. false
  29488. ],
  29489. "CPOL-1.02": [
  29490. "Code Project Open License 1.02",
  29491. false,
  29492. false
  29493. ],
  29494. "Crossword": [
  29495. "Crossword License",
  29496. false,
  29497. false
  29498. ],
  29499. "CrystalStacker": [
  29500. "CrystalStacker License",
  29501. false,
  29502. false
  29503. ],
  29504. "CUA-OPL-1.0": [
  29505. "CUA Office Public License v1.0",
  29506. true,
  29507. false
  29508. ],
  29509. "Cube": [
  29510. "Cube License",
  29511. false,
  29512. false
  29513. ],
  29514. "curl": [
  29515. "curl License",
  29516. false,
  29517. false
  29518. ],
  29519. "D-FSL-1.0": [
  29520. "Deutsche Freie Software Lizenz",
  29521. false,
  29522. false
  29523. ],
  29524. "diffmark": [
  29525. "diffmark license",
  29526. false,
  29527. false
  29528. ],
  29529. "DOC": [
  29530. "DOC License",
  29531. false,
  29532. false
  29533. ],
  29534. "Dotseqn": [
  29535. "Dotseqn License",
  29536. false,
  29537. false
  29538. ],
  29539. "DSDP": [
  29540. "DSDP License",
  29541. false,
  29542. false
  29543. ],
  29544. "dvipdfm": [
  29545. "dvipdfm License",
  29546. false,
  29547. false
  29548. ],
  29549. "ECL-1.0": [
  29550. "Educational Community License v1.0",
  29551. true,
  29552. false
  29553. ],
  29554. "ECL-2.0": [
  29555. "Educational Community License v2.0",
  29556. true,
  29557. false
  29558. ],
  29559. "eCos-2.0": [
  29560. "eCos license version 2.0",
  29561. false,
  29562. true
  29563. ],
  29564. "EFL-1.0": [
  29565. "Eiffel Forum License v1.0",
  29566. true,
  29567. false
  29568. ],
  29569. "EFL-2.0": [
  29570. "Eiffel Forum License v2.0",
  29571. true,
  29572. false
  29573. ],
  29574. "eGenix": [
  29575. "eGenix.com Public License 1.1.0",
  29576. false,
  29577. false
  29578. ],
  29579. "Entessa": [
  29580. "Entessa Public License v1.0",
  29581. true,
  29582. false
  29583. ],
  29584. "EPL-1.0": [
  29585. "Eclipse Public License 1.0",
  29586. true,
  29587. false
  29588. ],
  29589. "EPL-2.0": [
  29590. "Eclipse Public License 2.0",
  29591. true,
  29592. false
  29593. ],
  29594. "ErlPL-1.1": [
  29595. "Erlang Public License v1.1",
  29596. false,
  29597. false
  29598. ],
  29599. "EUDatagrid": [
  29600. "EU DataGrid Software License",
  29601. true,
  29602. false
  29603. ],
  29604. "EUPL-1.0": [
  29605. "European Union Public License 1.0",
  29606. false,
  29607. false
  29608. ],
  29609. "EUPL-1.1": [
  29610. "European Union Public License 1.1",
  29611. true,
  29612. false
  29613. ],
  29614. "EUPL-1.2": [
  29615. "European Union Public License 1.2",
  29616. true,
  29617. false
  29618. ],
  29619. "Eurosym": [
  29620. "Eurosym License",
  29621. false,
  29622. false
  29623. ],
  29624. "Fair": [
  29625. "Fair License",
  29626. true,
  29627. false
  29628. ],
  29629. "Frameworx-1.0": [
  29630. "Frameworx Open License 1.0",
  29631. true,
  29632. false
  29633. ],
  29634. "FreeImage": [
  29635. "FreeImage Public License v1.0",
  29636. false,
  29637. false
  29638. ],
  29639. "FSFAP": [
  29640. "FSF All Permissive License",
  29641. false,
  29642. false
  29643. ],
  29644. "FSFUL": [
  29645. "FSF Unlimited License",
  29646. false,
  29647. false
  29648. ],
  29649. "FSFULLR": [
  29650. "FSF Unlimited License (with License Retention)",
  29651. false,
  29652. false
  29653. ],
  29654. "FTL": [
  29655. "Freetype Project License",
  29656. false,
  29657. false
  29658. ],
  29659. "GFDL-1.1": [
  29660. "GNU Free Documentation License v1.1",
  29661. false,
  29662. true
  29663. ],
  29664. "GFDL-1.1-only": [
  29665. "GNU Free Documentation License v1.1 only",
  29666. false,
  29667. false
  29668. ],
  29669. "GFDL-1.1-or-later": [
  29670. "GNU Free Documentation License v1.1 or later",
  29671. false,
  29672. false
  29673. ],
  29674. "GFDL-1.2": [
  29675. "GNU Free Documentation License v1.2",
  29676. false,
  29677. true
  29678. ],
  29679. "GFDL-1.2-only": [
  29680. "GNU Free Documentation License v1.2 only",
  29681. false,
  29682. false
  29683. ],
  29684. "GFDL-1.2-or-later": [
  29685. "GNU Free Documentation License v1.2 or later",
  29686. false,
  29687. false
  29688. ],
  29689. "GFDL-1.3": [
  29690. "GNU Free Documentation License v1.3",
  29691. false,
  29692. true
  29693. ],
  29694. "GFDL-1.3-only": [
  29695. "GNU Free Documentation License v1.3 only",
  29696. false,
  29697. false
  29698. ],
  29699. "GFDL-1.3-or-later": [
  29700. "GNU Free Documentation License v1.3 or later",
  29701. false,
  29702. false
  29703. ],
  29704. "Giftware": [
  29705. "Giftware License",
  29706. false,
  29707. false
  29708. ],
  29709. "GL2PS": [
  29710. "GL2PS License",
  29711. false,
  29712. false
  29713. ],
  29714. "Glide": [
  29715. "3dfx Glide License",
  29716. false,
  29717. false
  29718. ],
  29719. "Glulxe": [
  29720. "Glulxe License",
  29721. false,
  29722. false
  29723. ],
  29724. "gnuplot": [
  29725. "gnuplot License",
  29726. false,
  29727. false
  29728. ],
  29729. "GPL-1.0": [
  29730. "GNU General Public License v1.0 only",
  29731. false,
  29732. true
  29733. ],
  29734. "GPL-1.0+": [
  29735. "GNU General Public License v1.0 or later",
  29736. false,
  29737. true
  29738. ],
  29739. "GPL-1.0-only": [
  29740. "GNU General Public License v1.0 only",
  29741. false,
  29742. false
  29743. ],
  29744. "GPL-1.0-or-later": [
  29745. "GNU General Public License v1.0 or later",
  29746. false,
  29747. false
  29748. ],
  29749. "GPL-2.0": [
  29750. "GNU General Public License v2.0 only",
  29751. true,
  29752. true
  29753. ],
  29754. "GPL-2.0+": [
  29755. "GNU General Public License v2.0 or later",
  29756. true,
  29757. true
  29758. ],
  29759. "GPL-2.0-only": [
  29760. "GNU General Public License v2.0 only",
  29761. true,
  29762. false
  29763. ],
  29764. "GPL-2.0-or-later": [
  29765. "GNU General Public License v2.0 or later",
  29766. true,
  29767. false
  29768. ],
  29769. "GPL-2.0-with-autoconf-exception": [
  29770. "GNU General Public License v2.0 w/Autoconf exception",
  29771. false,
  29772. true
  29773. ],
  29774. "GPL-2.0-with-bison-exception": [
  29775. "GNU General Public License v2.0 w/Bison exception",
  29776. false,
  29777. true
  29778. ],
  29779. "GPL-2.0-with-classpath-exception": [
  29780. "GNU General Public License v2.0 w/Classpath exception",
  29781. false,
  29782. true
  29783. ],
  29784. "GPL-2.0-with-font-exception": [
  29785. "GNU General Public License v2.0 w/Font exception",
  29786. false,
  29787. true
  29788. ],
  29789. "GPL-2.0-with-GCC-exception": [
  29790. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  29791. false,
  29792. true
  29793. ],
  29794. "GPL-3.0": [
  29795. "GNU General Public License v3.0 only",
  29796. true,
  29797. true
  29798. ],
  29799. "GPL-3.0+": [
  29800. "GNU General Public License v3.0 or later",
  29801. true,
  29802. true
  29803. ],
  29804. "GPL-3.0-only": [
  29805. "GNU General Public License v3.0 only",
  29806. true,
  29807. false
  29808. ],
  29809. "GPL-3.0-or-later": [
  29810. "GNU General Public License v3.0 or later",
  29811. true,
  29812. false
  29813. ],
  29814. "GPL-3.0-with-autoconf-exception": [
  29815. "GNU General Public License v3.0 w/Autoconf exception",
  29816. false,
  29817. true
  29818. ],
  29819. "GPL-3.0-with-GCC-exception": [
  29820. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  29821. true,
  29822. true
  29823. ],
  29824. "gSOAP-1.3b": [
  29825. "gSOAP Public License v1.3b",
  29826. false,
  29827. false
  29828. ],
  29829. "HaskellReport": [
  29830. "Haskell Language Report License",
  29831. false,
  29832. false
  29833. ],
  29834. "HPND": [
  29835. "Historical Permission Notice and Disclaimer",
  29836. true,
  29837. false
  29838. ],
  29839. "IBM-pibs": [
  29840. "IBM PowerPC Initialization and Boot Software",
  29841. false,
  29842. false
  29843. ],
  29844. "ICU": [
  29845. "ICU License",
  29846. false,
  29847. false
  29848. ],
  29849. "IJG": [
  29850. "Independent JPEG Group License",
  29851. false,
  29852. false
  29853. ],
  29854. "ImageMagick": [
  29855. "ImageMagick License",
  29856. false,
  29857. false
  29858. ],
  29859. "iMatix": [
  29860. "iMatix Standard Function Library Agreement",
  29861. false,
  29862. false
  29863. ],
  29864. "Imlib2": [
  29865. "Imlib2 License",
  29866. false,
  29867. false
  29868. ],
  29869. "Info-ZIP": [
  29870. "Info-ZIP License",
  29871. false,
  29872. false
  29873. ],
  29874. "Intel": [
  29875. "Intel Open Source License",
  29876. true,
  29877. false
  29878. ],
  29879. "Intel-ACPI": [
  29880. "Intel ACPI Software License Agreement",
  29881. false,
  29882. false
  29883. ],
  29884. "Interbase-1.0": [
  29885. "Interbase Public License v1.0",
  29886. false,
  29887. false
  29888. ],
  29889. "IPA": [
  29890. "IPA Font License",
  29891. true,
  29892. false
  29893. ],
  29894. "IPL-1.0": [
  29895. "IBM Public License v1.0",
  29896. true,
  29897. false
  29898. ],
  29899. "ISC": [
  29900. "ISC License",
  29901. true,
  29902. false
  29903. ],
  29904. "JasPer-2.0": [
  29905. "JasPer License",
  29906. false,
  29907. false
  29908. ],
  29909. "JSON": [
  29910. "JSON License",
  29911. false,
  29912. false
  29913. ],
  29914. "LAL-1.2": [
  29915. "Licence Art Libre 1.2",
  29916. false,
  29917. false
  29918. ],
  29919. "LAL-1.3": [
  29920. "Licence Art Libre 1.3",
  29921. false,
  29922. false
  29923. ],
  29924. "Latex2e": [
  29925. "Latex2e License",
  29926. false,
  29927. false
  29928. ],
  29929. "Leptonica": [
  29930. "Leptonica License",
  29931. false,
  29932. false
  29933. ],
  29934. "LGPL-2.0": [
  29935. "GNU Library General Public License v2 only",
  29936. true,
  29937. true
  29938. ],
  29939. "LGPL-2.0+": [
  29940. "GNU Library General Public License v2 or later",
  29941. true,
  29942. true
  29943. ],
  29944. "LGPL-2.0-only": [
  29945. "GNU Library General Public License v2 only",
  29946. true,
  29947. false
  29948. ],
  29949. "LGPL-2.0-or-later": [
  29950. "GNU Library General Public License v2 or later",
  29951. true,
  29952. false
  29953. ],
  29954. "LGPL-2.1": [
  29955. "GNU Lesser General Public License v2.1 only",
  29956. true,
  29957. true
  29958. ],
  29959. "LGPL-2.1+": [
  29960. "GNU Library General Public License v2.1 or later",
  29961. true,
  29962. true
  29963. ],
  29964. "LGPL-2.1-only": [
  29965. "GNU Lesser General Public License v2.1 only",
  29966. true,
  29967. false
  29968. ],
  29969. "LGPL-2.1-or-later": [
  29970. "GNU Lesser General Public License v2.1 or later",
  29971. true,
  29972. false
  29973. ],
  29974. "LGPL-3.0": [
  29975. "GNU Lesser General Public License v3.0 only",
  29976. true,
  29977. true
  29978. ],
  29979. "LGPL-3.0+": [
  29980. "GNU Lesser General Public License v3.0 or later",
  29981. true,
  29982. true
  29983. ],
  29984. "LGPL-3.0-only": [
  29985. "GNU Lesser General Public License v3.0 only",
  29986. true,
  29987. false
  29988. ],
  29989. "LGPL-3.0-or-later": [
  29990. "GNU Lesser General Public License v3.0 or later",
  29991. true,
  29992. false
  29993. ],
  29994. "LGPLLR": [
  29995. "Lesser General Public License For Linguistic Resources",
  29996. false,
  29997. false
  29998. ],
  29999. "Libpng": [
  30000. "libpng License",
  30001. false,
  30002. false
  30003. ],
  30004. "libtiff": [
  30005. "libtiff License",
  30006. false,
  30007. false
  30008. ],
  30009. "LiLiQ-P-1.1": [
  30010. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  30011. true,
  30012. false
  30013. ],
  30014. "LiLiQ-R-1.1": [
  30015. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  30016. true,
  30017. false
  30018. ],
  30019. "LiLiQ-Rplus-1.1": [
  30020. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  30021. true,
  30022. false
  30023. ],
  30024. "Linux-OpenIB": [
  30025. "Linux Kernel Variant of OpenIB.org license",
  30026. false,
  30027. false
  30028. ],
  30029. "LPL-1.0": [
  30030. "Lucent Public License Version 1.0",
  30031. true,
  30032. false
  30033. ],
  30034. "LPL-1.02": [
  30035. "Lucent Public License v1.02",
  30036. true,
  30037. false
  30038. ],
  30039. "LPPL-1.0": [
  30040. "LaTeX Project Public License v1.0",
  30041. false,
  30042. false
  30043. ],
  30044. "LPPL-1.1": [
  30045. "LaTeX Project Public License v1.1",
  30046. false,
  30047. false
  30048. ],
  30049. "LPPL-1.2": [
  30050. "LaTeX Project Public License v1.2",
  30051. false,
  30052. false
  30053. ],
  30054. "LPPL-1.3a": [
  30055. "LaTeX Project Public License v1.3a",
  30056. false,
  30057. false
  30058. ],
  30059. "LPPL-1.3c": [
  30060. "LaTeX Project Public License v1.3c",
  30061. true,
  30062. false
  30063. ],
  30064. "MakeIndex": [
  30065. "MakeIndex License",
  30066. false,
  30067. false
  30068. ],
  30069. "MirOS": [
  30070. "MirOS License",
  30071. true,
  30072. false
  30073. ],
  30074. "MIT": [
  30075. "MIT License",
  30076. true,
  30077. false
  30078. ],
  30079. "MIT-0": [
  30080. "MIT No Attribution",
  30081. true,
  30082. false
  30083. ],
  30084. "MIT-advertising": [
  30085. "Enlightenment License (e16)",
  30086. false,
  30087. false
  30088. ],
  30089. "MIT-CMU": [
  30090. "CMU License",
  30091. false,
  30092. false
  30093. ],
  30094. "MIT-enna": [
  30095. "enna License",
  30096. false,
  30097. false
  30098. ],
  30099. "MIT-feh": [
  30100. "feh License",
  30101. false,
  30102. false
  30103. ],
  30104. "MITNFA": [
  30105. "MIT +no-false-attribs license",
  30106. false,
  30107. false
  30108. ],
  30109. "Motosoto": [
  30110. "Motosoto License",
  30111. true,
  30112. false
  30113. ],
  30114. "mpich2": [
  30115. "mpich2 License",
  30116. false,
  30117. false
  30118. ],
  30119. "MPL-1.0": [
  30120. "Mozilla Public License 1.0",
  30121. true,
  30122. false
  30123. ],
  30124. "MPL-1.1": [
  30125. "Mozilla Public License 1.1",
  30126. true,
  30127. false
  30128. ],
  30129. "MPL-2.0": [
  30130. "Mozilla Public License 2.0",
  30131. true,
  30132. false
  30133. ],
  30134. "MPL-2.0-no-copyleft-exception": [
  30135. "Mozilla Public License 2.0 (no copyleft exception)",
  30136. true,
  30137. false
  30138. ],
  30139. "MS-PL": [
  30140. "Microsoft Public License",
  30141. true,
  30142. false
  30143. ],
  30144. "MS-RL": [
  30145. "Microsoft Reciprocal License",
  30146. true,
  30147. false
  30148. ],
  30149. "MTLL": [
  30150. "Matrix Template Library License",
  30151. false,
  30152. false
  30153. ],
  30154. "Multics": [
  30155. "Multics License",
  30156. true,
  30157. false
  30158. ],
  30159. "Mup": [
  30160. "Mup License",
  30161. false,
  30162. false
  30163. ],
  30164. "NASA-1.3": [
  30165. "NASA Open Source Agreement 1.3",
  30166. true,
  30167. false
  30168. ],
  30169. "Naumen": [
  30170. "Naumen Public License",
  30171. true,
  30172. false
  30173. ],
  30174. "NBPL-1.0": [
  30175. "Net Boolean Public License v1",
  30176. false,
  30177. false
  30178. ],
  30179. "NCSA": [
  30180. "University of Illinois/NCSA Open Source License",
  30181. true,
  30182. false
  30183. ],
  30184. "Net-SNMP": [
  30185. "Net-SNMP License",
  30186. false,
  30187. false
  30188. ],
  30189. "NetCDF": [
  30190. "NetCDF license",
  30191. false,
  30192. false
  30193. ],
  30194. "Newsletr": [
  30195. "Newsletr License",
  30196. false,
  30197. false
  30198. ],
  30199. "NGPL": [
  30200. "Nethack General Public License",
  30201. true,
  30202. false
  30203. ],
  30204. "NLOD-1.0": [
  30205. "Norwegian Licence for Open Government Data",
  30206. false,
  30207. false
  30208. ],
  30209. "NLPL": [
  30210. "No Limit Public License",
  30211. false,
  30212. false
  30213. ],
  30214. "Nokia": [
  30215. "Nokia Open Source License",
  30216. true,
  30217. false
  30218. ],
  30219. "NOSL": [
  30220. "Netizen Open Source License",
  30221. false,
  30222. false
  30223. ],
  30224. "Noweb": [
  30225. "Noweb License",
  30226. false,
  30227. false
  30228. ],
  30229. "NPL-1.0": [
  30230. "Netscape Public License v1.0",
  30231. false,
  30232. false
  30233. ],
  30234. "NPL-1.1": [
  30235. "Netscape Public License v1.1",
  30236. false,
  30237. false
  30238. ],
  30239. "NPOSL-3.0": [
  30240. "Non-Profit Open Software License 3.0",
  30241. true,
  30242. false
  30243. ],
  30244. "NRL": [
  30245. "NRL License",
  30246. false,
  30247. false
  30248. ],
  30249. "NTP": [
  30250. "NTP License",
  30251. true,
  30252. false
  30253. ],
  30254. "Nunit": [
  30255. "Nunit License",
  30256. false,
  30257. true
  30258. ],
  30259. "OCCT-PL": [
  30260. "Open CASCADE Technology Public License",
  30261. false,
  30262. false
  30263. ],
  30264. "OCLC-2.0": [
  30265. "OCLC Research Public License 2.0",
  30266. true,
  30267. false
  30268. ],
  30269. "ODbL-1.0": [
  30270. "ODC Open Database License v1.0",
  30271. false,
  30272. false
  30273. ],
  30274. "OFL-1.0": [
  30275. "SIL Open Font License 1.0",
  30276. false,
  30277. false
  30278. ],
  30279. "OFL-1.1": [
  30280. "SIL Open Font License 1.1",
  30281. true,
  30282. false
  30283. ],
  30284. "OGTSL": [
  30285. "Open Group Test Suite License",
  30286. true,
  30287. false
  30288. ],
  30289. "OLDAP-1.1": [
  30290. "Open LDAP Public License v1.1",
  30291. false,
  30292. false
  30293. ],
  30294. "OLDAP-1.2": [
  30295. "Open LDAP Public License v1.2",
  30296. false,
  30297. false
  30298. ],
  30299. "OLDAP-1.3": [
  30300. "Open LDAP Public License v1.3",
  30301. false,
  30302. false
  30303. ],
  30304. "OLDAP-1.4": [
  30305. "Open LDAP Public License v1.4",
  30306. false,
  30307. false
  30308. ],
  30309. "OLDAP-2.0": [
  30310. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  30311. false,
  30312. false
  30313. ],
  30314. "OLDAP-2.0.1": [
  30315. "Open LDAP Public License v2.0.1",
  30316. false,
  30317. false
  30318. ],
  30319. "OLDAP-2.1": [
  30320. "Open LDAP Public License v2.1",
  30321. false,
  30322. false
  30323. ],
  30324. "OLDAP-2.2": [
  30325. "Open LDAP Public License v2.2",
  30326. false,
  30327. false
  30328. ],
  30329. "OLDAP-2.2.1": [
  30330. "Open LDAP Public License v2.2.1",
  30331. false,
  30332. false
  30333. ],
  30334. "OLDAP-2.2.2": [
  30335. "Open LDAP Public License 2.2.2",
  30336. false,
  30337. false
  30338. ],
  30339. "OLDAP-2.3": [
  30340. "Open LDAP Public License v2.3",
  30341. false,
  30342. false
  30343. ],
  30344. "OLDAP-2.4": [
  30345. "Open LDAP Public License v2.4",
  30346. false,
  30347. false
  30348. ],
  30349. "OLDAP-2.5": [
  30350. "Open LDAP Public License v2.5",
  30351. false,
  30352. false
  30353. ],
  30354. "OLDAP-2.6": [
  30355. "Open LDAP Public License v2.6",
  30356. false,
  30357. false
  30358. ],
  30359. "OLDAP-2.7": [
  30360. "Open LDAP Public License v2.7",
  30361. false,
  30362. false
  30363. ],
  30364. "OLDAP-2.8": [
  30365. "Open LDAP Public License v2.8",
  30366. false,
  30367. false
  30368. ],
  30369. "OML": [
  30370. "Open Market License",
  30371. false,
  30372. false
  30373. ],
  30374. "OpenSSL": [
  30375. "OpenSSL License",
  30376. false,
  30377. false
  30378. ],
  30379. "OPL-1.0": [
  30380. "Open Public License v1.0",
  30381. false,
  30382. false
  30383. ],
  30384. "OSET-PL-2.1": [
  30385. "OSET Public License version 2.1",
  30386. true,
  30387. false
  30388. ],
  30389. "OSL-1.0": [
  30390. "Open Software License 1.0",
  30391. true,
  30392. false
  30393. ],
  30394. "OSL-1.1": [
  30395. "Open Software License 1.1",
  30396. false,
  30397. false
  30398. ],
  30399. "OSL-2.0": [
  30400. "Open Software License 2.0",
  30401. true,
  30402. false
  30403. ],
  30404. "OSL-2.1": [
  30405. "Open Software License 2.1",
  30406. true,
  30407. false
  30408. ],
  30409. "OSL-3.0": [
  30410. "Open Software License 3.0",
  30411. true,
  30412. false
  30413. ],
  30414. "PDDL-1.0": [
  30415. "ODC Public Domain Dedication & License 1.0",
  30416. false,
  30417. false
  30418. ],
  30419. "PHP-3.0": [
  30420. "PHP License v3.0",
  30421. true,
  30422. false
  30423. ],
  30424. "PHP-3.01": [
  30425. "PHP License v3.01",
  30426. false,
  30427. false
  30428. ],
  30429. "Plexus": [
  30430. "Plexus Classworlds License",
  30431. false,
  30432. false
  30433. ],
  30434. "PostgreSQL": [
  30435. "PostgreSQL License",
  30436. true,
  30437. false
  30438. ],
  30439. "psfrag": [
  30440. "psfrag License",
  30441. false,
  30442. false
  30443. ],
  30444. "psutils": [
  30445. "psutils License",
  30446. false,
  30447. false
  30448. ],
  30449. "Python-2.0": [
  30450. "Python License 2.0",
  30451. true,
  30452. false
  30453. ],
  30454. "Qhull": [
  30455. "Qhull License",
  30456. false,
  30457. false
  30458. ],
  30459. "QPL-1.0": [
  30460. "Q Public License 1.0",
  30461. true,
  30462. false
  30463. ],
  30464. "Rdisc": [
  30465. "Rdisc License",
  30466. false,
  30467. false
  30468. ],
  30469. "RHeCos-1.1": [
  30470. "Red Hat eCos Public License v1.1",
  30471. false,
  30472. false
  30473. ],
  30474. "RPL-1.1": [
  30475. "Reciprocal Public License 1.1",
  30476. true,
  30477. false
  30478. ],
  30479. "RPL-1.5": [
  30480. "Reciprocal Public License 1.5",
  30481. true,
  30482. false
  30483. ],
  30484. "RPSL-1.0": [
  30485. "RealNetworks Public Source License v1.0",
  30486. true,
  30487. false
  30488. ],
  30489. "RSA-MD": [
  30490. "RSA Message-Digest License",
  30491. false,
  30492. false
  30493. ],
  30494. "RSCPL": [
  30495. "Ricoh Source Code Public License",
  30496. true,
  30497. false
  30498. ],
  30499. "Ruby": [
  30500. "Ruby License",
  30501. false,
  30502. false
  30503. ],
  30504. "SAX-PD": [
  30505. "Sax Public Domain Notice",
  30506. false,
  30507. false
  30508. ],
  30509. "Saxpath": [
  30510. "Saxpath License",
  30511. false,
  30512. false
  30513. ],
  30514. "SCEA": [
  30515. "SCEA Shared Source License",
  30516. false,
  30517. false
  30518. ],
  30519. "Sendmail": [
  30520. "Sendmail License",
  30521. false,
  30522. false
  30523. ],
  30524. "SGI-B-1.0": [
  30525. "SGI Free Software License B v1.0",
  30526. false,
  30527. false
  30528. ],
  30529. "SGI-B-1.1": [
  30530. "SGI Free Software License B v1.1",
  30531. false,
  30532. false
  30533. ],
  30534. "SGI-B-2.0": [
  30535. "SGI Free Software License B v2.0",
  30536. false,
  30537. false
  30538. ],
  30539. "SimPL-2.0": [
  30540. "Simple Public License 2.0",
  30541. true,
  30542. false
  30543. ],
  30544. "SISSL": [
  30545. "Sun Industry Standards Source License v1.1",
  30546. true,
  30547. false
  30548. ],
  30549. "SISSL-1.2": [
  30550. "Sun Industry Standards Source License v1.2",
  30551. false,
  30552. false
  30553. ],
  30554. "Sleepycat": [
  30555. "Sleepycat License",
  30556. true,
  30557. false
  30558. ],
  30559. "SMLNJ": [
  30560. "Standard ML of New Jersey License",
  30561. false,
  30562. false
  30563. ],
  30564. "SMPPL": [
  30565. "Secure Messaging Protocol Public License",
  30566. false,
  30567. false
  30568. ],
  30569. "SNIA": [
  30570. "SNIA Public License 1.1",
  30571. false,
  30572. false
  30573. ],
  30574. "Spencer-86": [
  30575. "Spencer License 86",
  30576. false,
  30577. false
  30578. ],
  30579. "Spencer-94": [
  30580. "Spencer License 94",
  30581. false,
  30582. false
  30583. ],
  30584. "Spencer-99": [
  30585. "Spencer License 99",
  30586. false,
  30587. false
  30588. ],
  30589. "SPL-1.0": [
  30590. "Sun Public License v1.0",
  30591. true,
  30592. false
  30593. ],
  30594. "StandardML-NJ": [
  30595. "Standard ML of New Jersey License",
  30596. false,
  30597. true
  30598. ],
  30599. "SugarCRM-1.1.3": [
  30600. "SugarCRM Public License v1.1.3",
  30601. false,
  30602. false
  30603. ],
  30604. "SWL": [
  30605. "Scheme Widget Library (SWL) Software License Agreement",
  30606. false,
  30607. false
  30608. ],
  30609. "TCL": [
  30610. "TCL/TK License",
  30611. false,
  30612. false
  30613. ],
  30614. "TCP-wrappers": [
  30615. "TCP Wrappers License",
  30616. false,
  30617. false
  30618. ],
  30619. "TMate": [
  30620. "TMate Open Source License",
  30621. false,
  30622. false
  30623. ],
  30624. "TORQUE-1.1": [
  30625. "TORQUE v2.5+ Software License v1.1",
  30626. false,
  30627. false
  30628. ],
  30629. "TOSL": [
  30630. "Trusster Open Source License",
  30631. false,
  30632. false
  30633. ],
  30634. "Unicode-DFS-2015": [
  30635. "Unicode License Agreement - Data Files and Software (2015)",
  30636. false,
  30637. false
  30638. ],
  30639. "Unicode-DFS-2016": [
  30640. "Unicode License Agreement - Data Files and Software (2016)",
  30641. false,
  30642. false
  30643. ],
  30644. "Unicode-TOU": [
  30645. "Unicode Terms of Use",
  30646. false,
  30647. false
  30648. ],
  30649. "Unlicense": [
  30650. "The Unlicense",
  30651. false,
  30652. false
  30653. ],
  30654. "UPL-1.0": [
  30655. "Universal Permissive License v1.0",
  30656. true,
  30657. false
  30658. ],
  30659. "Vim": [
  30660. "Vim License",
  30661. false,
  30662. false
  30663. ],
  30664. "VOSTROM": [
  30665. "VOSTROM Public License for Open Source",
  30666. false,
  30667. false
  30668. ],
  30669. "VSL-1.0": [
  30670. "Vovida Software License v1.0",
  30671. true,
  30672. false
  30673. ],
  30674. "W3C": [
  30675. "W3C Software Notice and License (2002-12-31)",
  30676. true,
  30677. false
  30678. ],
  30679. "W3C-19980720": [
  30680. "W3C Software Notice and License (1998-07-20)",
  30681. false,
  30682. false
  30683. ],
  30684. "W3C-20150513": [
  30685. "W3C Software Notice and Document License (2015-05-13)",
  30686. false,
  30687. false
  30688. ],
  30689. "Watcom-1.0": [
  30690. "Sybase Open Watcom Public License 1.0",
  30691. true,
  30692. false
  30693. ],
  30694. "Wsuipa": [
  30695. "Wsuipa License",
  30696. false,
  30697. false
  30698. ],
  30699. "WTFPL": [
  30700. "Do What The F*ck You Want To Public License",
  30701. false,
  30702. false
  30703. ],
  30704. "wxWindows": [
  30705. "wxWindows Library License",
  30706. false,
  30707. true
  30708. ],
  30709. "X11": [
  30710. "X11 License",
  30711. false,
  30712. false
  30713. ],
  30714. "Xerox": [
  30715. "Xerox License",
  30716. false,
  30717. false
  30718. ],
  30719. "XFree86-1.1": [
  30720. "XFree86 License 1.1",
  30721. false,
  30722. false
  30723. ],
  30724. "xinetd": [
  30725. "xinetd License",
  30726. false,
  30727. false
  30728. ],
  30729. "Xnet": [
  30730. "X.Net License",
  30731. true,
  30732. false
  30733. ],
  30734. "xpp": [
  30735. "XPP License",
  30736. false,
  30737. false
  30738. ],
  30739. "XSkat": [
  30740. "XSkat License",
  30741. false,
  30742. false
  30743. ],
  30744. "YPL-1.0": [
  30745. "Yahoo! Public License v1.0",
  30746. false,
  30747. false
  30748. ],
  30749. "YPL-1.1": [
  30750. "Yahoo! Public License v1.1",
  30751. false,
  30752. false
  30753. ],
  30754. "Zed": [
  30755. "Zed License",
  30756. false,
  30757. false
  30758. ],
  30759. "Zend-2.0": [
  30760. "Zend License v2.0",
  30761. false,
  30762. false
  30763. ],
  30764. "Zimbra-1.3": [
  30765. "Zimbra Public License v1.3",
  30766. false,
  30767. false
  30768. ],
  30769. "Zimbra-1.4": [
  30770. "Zimbra Public License v1.4",
  30771. false,
  30772. false
  30773. ],
  30774. "Zlib": [
  30775. "zlib License",
  30776. true,
  30777. false
  30778. ],
  30779. "zlib-acknowledgement": [
  30780. "zlib/libpng License with Acknowledgement",
  30781. false,
  30782. false
  30783. ],
  30784. "ZPL-1.1": [
  30785. "Zope Public License 1.1",
  30786. false,
  30787. false
  30788. ],
  30789. "ZPL-2.0": [
  30790. "Zope Public License 2.0",
  30791. true,
  30792. false
  30793. ],
  30794. "ZPL-2.1": [
  30795. "Zope Public License 2.1",
  30796. false,
  30797. false
  30798. ]
  30799. }MZ�ÿÿ¸@躴 Í!¸LÍ!This program cannot be run in DOS mode.
  30800. $Æ,Í;§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žPEL¬MoOà 
  30801. 8 @`?œ@��"P@ Pp!8!@ Ø.text 
  30802.  `.rdataÎ
  30803. @@.data�0@À.rsrc @@@.relocÌP"@Bj$¸æ@èxjöÿ @ƒ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
  30804. jè\Yë;¡|3@…Àu,‰5|3@hð @hä @è§YY…ÀtÇEüþÿÿÿ¸ÿé݉5<0@¡|3@;Æuhà @hØ @èlYYÇ|3@9]äuSWÿ8 @9Œ3@thŒ3@èƒY…Àt
  30805. 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@èûøMZf9@t3ÀëM¡<@�€@�8PEué·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¸MZf9t3À]ËA<Á�8PEuï3Ò¹ f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  30806. 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‡@h0@èçƒÄ]ËÿVhh3ö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‹ÆÁà ð‰50@÷Ö‰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@Š@¬MoOl€!€@0@˜0@bad allocationH0@ð!@RSDSÑŒ³´�J¨!öÌëLZc:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdbeæþÿÿÿÐÿÿÿþÿÿÿ@@þÿÿÿÌÿÿÿþÿÿÿ:@þÿÿÿØÿÿÿþÿÿÿË@ß@ÿÿÿÿÝ@"“d"@à"ì# $#ô&D H#(h ¸#Ê#Ü#ˆ)r)b)H)4))ú(æ(Ò(´(¬(–(ž)ú#à$%Ê%&d&®&¤$('Ä'Ö'è'þ'(((6(¦'H(Z(t(†('''–'‚'l'^'R'F'>'>(0'¶'¸)•GetConsoleMode·SetConsoleMode;GetStdHandleKERNEL32.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@AJ?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@@ZMSVCP90.dll_amsg_exitŸ__getmainargs,_cexit|_exitf_XcptFilterÌexit __initenv_initterm_initterm_e<_configthreadlocaleã__setusermatherr _adjust_fdivË__p__commodeÏ__p__fmodej_encode_pointerà__set_app_typeK_crt_debugger_hookC?terminate@@YAXXZMSVCR90.dllæ_unlock–__dllonexitv_lock_onexit`_decode_pointers_except_handler4_common _invoke_watson?_controlfp_s½InterlockedExchange!SleepºInterlockedCompareExchange-TerminateProcess©GetCurrentProcess>UnhandledExceptionFilterSetUnhandledExceptionFilterÑIsDebuggerPresentTQueryPerformanceCounterfGetTickCount­GetCurrentThreadIdªGetCurrentProcessIdOGetSystemTimeAsFileTimes__CxxFrameHandler3Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ$!@ €8€P€h€ € � @(äÈCVä(4VS_VERSION_INFO½ïþ†StringFileInfob040904b0ÊQFileDescriptionReads from stdin without leaking info to the terminal and outputs back to stdout6 FileVersion1, 0, 0, 08 InternalNamehiddeninputPLegalCopyrightJordi Boggiano - 2012HOriginalFilenamehiddeninput.exe: ProductNameHidden Input: ProductVersion1, 0, 0, 0DVarFileInfo$Translation °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  30807. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  30808. <security>
  30809. <requestedPrivileges>
  30810. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  30811. </requestedPrivileges>
  30812. </security>
  30813. </trustInfo>
  30814. <dependency>
  30815. <dependentAssembly>
  30816. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  30817. </dependentAssembly>
  30818. </dependency>
  30819. </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—677 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89 $Ü0è0ì01 1t1x12 2@2\2`2h2t20 0<?php
  30820. namespace Symfony\Component\Console;
  30821. use Symfony\Component\Console\Descriptor\TextDescriptor;
  30822. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  30823. use Symfony\Component\Console\Exception\ExceptionInterface;
  30824. use Symfony\Component\Console\Formatter\OutputFormatter;
  30825. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  30826. use Symfony\Component\Console\Helper\Helper;
  30827. use Symfony\Component\Console\Helper\ProcessHelper;
  30828. use Symfony\Component\Console\Helper\QuestionHelper;
  30829. use Symfony\Component\Console\Input\InputInterface;
  30830. use Symfony\Component\Console\Input\ArgvInput;
  30831. use Symfony\Component\Console\Input\ArrayInput;
  30832. use Symfony\Component\Console\Input\InputDefinition;
  30833. use Symfony\Component\Console\Input\InputOption;
  30834. use Symfony\Component\Console\Input\InputArgument;
  30835. use Symfony\Component\Console\Input\InputAwareInterface;
  30836. use Symfony\Component\Console\Output\BufferedOutput;
  30837. use Symfony\Component\Console\Output\OutputInterface;
  30838. use Symfony\Component\Console\Output\ConsoleOutput;
  30839. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  30840. use Symfony\Component\Console\Command\Command;
  30841. use Symfony\Component\Console\Command\HelpCommand;
  30842. use Symfony\Component\Console\Command\ListCommand;
  30843. use Symfony\Component\Console\Helper\HelperSet;
  30844. use Symfony\Component\Console\Helper\FormatterHelper;
  30845. use Symfony\Component\Console\Helper\DialogHelper;
  30846. use Symfony\Component\Console\Helper\ProgressHelper;
  30847. use Symfony\Component\Console\Helper\TableHelper;
  30848. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  30849. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  30850. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  30851. use Symfony\Component\Console\Exception\CommandNotFoundException;
  30852. use Symfony\Component\Console\Exception\LogicException;
  30853. use Symfony\Component\Debug\Exception\FatalThrowableError;
  30854. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  30855. class Application
  30856. {
  30857. private $commands = array();
  30858. private $wantHelps = false;
  30859. private $runningCommand;
  30860. private $name;
  30861. private $version;
  30862. private $catchExceptions = true;
  30863. private $autoExit = true;
  30864. private $definition;
  30865. private $helperSet;
  30866. private $dispatcher;
  30867. private $terminalDimensions;
  30868. private $defaultCommand;
  30869. private $initialized;
  30870. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  30871. {
  30872. $this->name = $name;
  30873. $this->version = $version;
  30874. $this->defaultCommand = 'list';
  30875. }
  30876. public function setDispatcher(EventDispatcherInterface $dispatcher)
  30877. {
  30878. $this->dispatcher = $dispatcher;
  30879. }
  30880. public function run(InputInterface $input = null, OutputInterface $output = null)
  30881. {
  30882. if (null === $input) {
  30883. $input = new ArgvInput();
  30884. }
  30885. if (null === $output) {
  30886. $output = new ConsoleOutput();
  30887. }
  30888. $this->configureIO($input, $output);
  30889. try {
  30890. $e = null;
  30891. $exitCode = $this->doRun($input, $output);
  30892. } catch (\Exception $e) {
  30893. }
  30894. if (null !== $e) {
  30895. if (!$this->catchExceptions) {
  30896. throw $e;
  30897. }
  30898. if ($output instanceof ConsoleOutputInterface) {
  30899. $this->renderException($e, $output->getErrorOutput());
  30900. } else {
  30901. $this->renderException($e, $output);
  30902. }
  30903. $exitCode = $e->getCode();
  30904. if (is_numeric($exitCode)) {
  30905. $exitCode = (int) $exitCode;
  30906. if (0 === $exitCode) {
  30907. $exitCode = 1;
  30908. }
  30909. } else {
  30910. $exitCode = 1;
  30911. }
  30912. }
  30913. if ($this->autoExit) {
  30914. if ($exitCode > 255) {
  30915. $exitCode = 255;
  30916. }
  30917. exit($exitCode);
  30918. }
  30919. return $exitCode;
  30920. }
  30921. public function doRun(InputInterface $input, OutputInterface $output)
  30922. {
  30923. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  30924. $output->writeln($this->getLongVersion());
  30925. return 0;
  30926. }
  30927. $name = $this->getCommandName($input);
  30928. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  30929. if (!$name) {
  30930. $name = 'help';
  30931. $input = new ArrayInput(array('command' => 'help'));
  30932. } else {
  30933. $this->wantHelps = true;
  30934. }
  30935. }
  30936. if (!$name) {
  30937. $name = $this->defaultCommand;
  30938. $definition = $this->getDefinition();
  30939. $definition->setArguments(array_merge(
  30940. $definition->getArguments(),
  30941. array(
  30942. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  30943. )
  30944. ));
  30945. }
  30946. $this->runningCommand = null;
  30947. $command = $this->find($name);
  30948. $this->runningCommand = $command;
  30949. $exitCode = $this->doRunCommand($command, $input, $output);
  30950. $this->runningCommand = null;
  30951. return $exitCode;
  30952. }
  30953. public function setHelperSet(HelperSet $helperSet)
  30954. {
  30955. $this->helperSet = $helperSet;
  30956. }
  30957. public function getHelperSet()
  30958. {
  30959. if (!$this->helperSet) {
  30960. $this->helperSet = $this->getDefaultHelperSet();
  30961. }
  30962. return $this->helperSet;
  30963. }
  30964. public function setDefinition(InputDefinition $definition)
  30965. {
  30966. $this->definition = $definition;
  30967. }
  30968. public function getDefinition()
  30969. {
  30970. if (!$this->definition) {
  30971. $this->definition = $this->getDefaultInputDefinition();
  30972. }
  30973. return $this->definition;
  30974. }
  30975. public function getHelp()
  30976. {
  30977. return $this->getLongVersion();
  30978. }
  30979. public function setCatchExceptions($boolean)
  30980. {
  30981. $this->catchExceptions = (bool) $boolean;
  30982. }
  30983. public function setAutoExit($boolean)
  30984. {
  30985. $this->autoExit = (bool) $boolean;
  30986. }
  30987. public function getName()
  30988. {
  30989. return $this->name;
  30990. }
  30991. public function setName($name)
  30992. {
  30993. $this->name = $name;
  30994. }
  30995. public function getVersion()
  30996. {
  30997. return $this->version;
  30998. }
  30999. public function setVersion($version)
  31000. {
  31001. $this->version = $version;
  31002. }
  31003. public function getLongVersion()
  31004. {
  31005. if ('UNKNOWN' !== $this->getName()) {
  31006. if ('UNKNOWN' !== $this->getVersion()) {
  31007. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  31008. }
  31009. return sprintf('<info>%s</info>', $this->getName());
  31010. }
  31011. return '<info>Console Tool</info>';
  31012. }
  31013. public function register($name)
  31014. {
  31015. return $this->add(new Command($name));
  31016. }
  31017. public function addCommands(array $commands)
  31018. {
  31019. foreach ($commands as $command) {
  31020. $this->add($command);
  31021. }
  31022. }
  31023. public function add(Command $command)
  31024. {
  31025. $this->init();
  31026. $command->setApplication($this);
  31027. if (!$command->isEnabled()) {
  31028. $command->setApplication(null);
  31029. return;
  31030. }
  31031. if (null === $command->getDefinition()) {
  31032. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
  31033. }
  31034. $this->commands[$command->getName()] = $command;
  31035. foreach ($command->getAliases() as $alias) {
  31036. $this->commands[$alias] = $command;
  31037. }
  31038. return $command;
  31039. }
  31040. public function get($name)
  31041. {
  31042. $this->init();
  31043. if (!isset($this->commands[$name])) {
  31044. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  31045. }
  31046. $command = $this->commands[$name];
  31047. if ($this->wantHelps) {
  31048. $this->wantHelps = false;
  31049. $helpCommand = $this->get('help');
  31050. $helpCommand->setCommand($command);
  31051. return $helpCommand;
  31052. }
  31053. return $command;
  31054. }
  31055. public function has($name)
  31056. {
  31057. $this->init();
  31058. return isset($this->commands[$name]);
  31059. }
  31060. public function getNamespaces()
  31061. {
  31062. $namespaces = array();
  31063. foreach ($this->all() as $command) {
  31064. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  31065. foreach ($command->getAliases() as $alias) {
  31066. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  31067. }
  31068. }
  31069. return array_values(array_unique(array_filter($namespaces)));
  31070. }
  31071. public function findNamespace($namespace)
  31072. {
  31073. $allNamespaces = $this->getNamespaces();
  31074. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  31075. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  31076. if (empty($namespaces)) {
  31077. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  31078. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  31079. if (1 == count($alternatives)) {
  31080. $message .= "\n\nDid you mean this?\n ";
  31081. } else {
  31082. $message .= "\n\nDid you mean one of these?\n ";
  31083. }
  31084. $message .= implode("\n ", $alternatives);
  31085. }
  31086. throw new CommandNotFoundException($message, $alternatives);
  31087. }
  31088. $exact = in_array($namespace, $namespaces, true);
  31089. if (count($namespaces) > 1 && !$exact) {
  31090. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  31091. }
  31092. return $exact ? $namespace : reset($namespaces);
  31093. }
  31094. public function find($name)
  31095. {
  31096. $this->init();
  31097. $aliases = array();
  31098. $allCommands = array_keys($this->commands);
  31099. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  31100. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  31101. if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  31102. if (false !== $pos = strrpos($name, ':')) {
  31103. $this->findNamespace(substr($name, 0, $pos));
  31104. }
  31105. $message = sprintf('Command "%s" is not defined.', $name);
  31106. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  31107. if (1 == count($alternatives)) {
  31108. $message .= "\n\nDid you mean this?\n ";
  31109. } else {
  31110. $message .= "\n\nDid you mean one of these?\n ";
  31111. }
  31112. $message .= implode("\n ", $alternatives);
  31113. }
  31114. throw new CommandNotFoundException($message, $alternatives);
  31115. }
  31116. if (count($commands) > 1) {
  31117. $commandList = $this->commands;
  31118. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
  31119. $commandName = $commandList[$nameOrAlias]->getName();
  31120. $aliases[$nameOrAlias] = $commandName;
  31121. return $commandName === $nameOrAlias || !in_array($commandName, $commands);
  31122. });
  31123. }
  31124. $exact = in_array($name, $commands, true) || isset($aliases[$name]);
  31125. if (!$exact && count($commands) > 1) {
  31126. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  31127. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  31128. }
  31129. return $this->get($exact ? $name : reset($commands));
  31130. }
  31131. public function all($namespace = null)
  31132. {
  31133. $this->init();
  31134. if (null === $namespace) {
  31135. return $this->commands;
  31136. }
  31137. $commands = array();
  31138. foreach ($this->commands as $name => $command) {
  31139. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  31140. $commands[$name] = $command;
  31141. }
  31142. }
  31143. return $commands;
  31144. }
  31145. public static function getAbbreviations($names)
  31146. {
  31147. $abbrevs = array();
  31148. foreach ($names as $name) {
  31149. for ($len = strlen($name); $len > 0; --$len) {
  31150. $abbrev = substr($name, 0, $len);
  31151. $abbrevs[$abbrev][] = $name;
  31152. }
  31153. }
  31154. return $abbrevs;
  31155. }
  31156. public function asText($namespace = null, $raw = false)
  31157. {
  31158. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31159. $descriptor = new TextDescriptor();
  31160. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  31161. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  31162. return $output->fetch();
  31163. }
  31164. public function asXml($namespace = null, $asDom = false)
  31165. {
  31166. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31167. $descriptor = new XmlDescriptor();
  31168. if ($asDom) {
  31169. return $descriptor->getApplicationDocument($this, $namespace);
  31170. }
  31171. $output = new BufferedOutput();
  31172. $descriptor->describe($output, $this, array('namespace' => $namespace));
  31173. return $output->fetch();
  31174. }
  31175. public function renderException($e, $output)
  31176. {
  31177. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  31178. do {
  31179. $title = sprintf(' [%s] ', get_class($e));
  31180. $len = Helper::strlen($title);
  31181. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  31182. if (defined('HHVM_VERSION') && $width > 1 << 31) {
  31183. $width = 1 << 31;
  31184. }
  31185. $lines = array();
  31186. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  31187. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  31188. $lineLength = Helper::strlen($line) + 4;
  31189. $lines[] = array($line, $lineLength);
  31190. $len = max($lineLength, $len);
  31191. }
  31192. }
  31193. $messages = array();
  31194. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  31195. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  31196. foreach ($lines as $line) {
  31197. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  31198. }
  31199. $messages[] = $emptyLine;
  31200. $messages[] = '';
  31201. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  31202. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  31203. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  31204. $trace = $e->getTrace();
  31205. array_unshift($trace, array(
  31206. 'function' => '',
  31207. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  31208. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  31209. 'args' => array(),
  31210. ));
  31211. for ($i = 0, $count = count($trace); $i < $count; ++$i) {
  31212. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  31213. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  31214. $function = $trace[$i]['function'];
  31215. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  31216. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  31217. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  31218. }
  31219. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  31220. }
  31221. } while ($e = $e->getPrevious());
  31222. if (null !== $this->runningCommand) {
  31223. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  31224. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  31225. }
  31226. }
  31227. protected function getTerminalWidth()
  31228. {
  31229. $dimensions = $this->getTerminalDimensions();
  31230. return $dimensions[0];
  31231. }
  31232. protected function getTerminalHeight()
  31233. {
  31234. $dimensions = $this->getTerminalDimensions();
  31235. return $dimensions[1];
  31236. }
  31237. public function getTerminalDimensions()
  31238. {
  31239. if ($this->terminalDimensions) {
  31240. return $this->terminalDimensions;
  31241. }
  31242. if ('\\' === DIRECTORY_SEPARATOR) {
  31243. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  31244. return array((int) $matches[1], (int) $matches[2]);
  31245. }
  31246. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  31247. return array((int) $matches[1], (int) $matches[2]);
  31248. }
  31249. }
  31250. if ($sttyString = $this->getSttyColumns()) {
  31251. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  31252. return array((int) $matches[2], (int) $matches[1]);
  31253. }
  31254. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  31255. return array((int) $matches[2], (int) $matches[1]);
  31256. }
  31257. }
  31258. return array(null, null);
  31259. }
  31260. public function setTerminalDimensions($width, $height)
  31261. {
  31262. $this->terminalDimensions = array($width, $height);
  31263. return $this;
  31264. }
  31265. protected function configureIO(InputInterface $input, OutputInterface $output)
  31266. {
  31267. if (true === $input->hasParameterOption(array('--ansi'))) {
  31268. $output->setDecorated(true);
  31269. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  31270. $output->setDecorated(false);
  31271. }
  31272. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  31273. $input->setInteractive(false);
  31274. } elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  31275. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  31276. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  31277. $input->setInteractive(false);
  31278. }
  31279. }
  31280. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  31281. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  31282. $input->setInteractive(false);
  31283. } else {
  31284. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  31285. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  31286. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  31287. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  31288. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  31289. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  31290. }
  31291. }
  31292. }
  31293. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  31294. {
  31295. foreach ($command->getHelperSet() as $helper) {
  31296. if ($helper instanceof InputAwareInterface) {
  31297. $helper->setInput($input);
  31298. }
  31299. }
  31300. if (null === $this->dispatcher) {
  31301. return $command->run($input, $output);
  31302. }
  31303. try {
  31304. $command->mergeApplicationDefinition();
  31305. $input->bind($command->getDefinition());
  31306. } catch (ExceptionInterface $e) {
  31307. }
  31308. $event = new ConsoleCommandEvent($command, $input, $output);
  31309. $e = null;
  31310. try {
  31311. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  31312. if ($event->commandShouldRun()) {
  31313. $exitCode = $command->run($input, $output);
  31314. } else {
  31315. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  31316. }
  31317. } catch (\Exception $e) {
  31318. } catch (\Throwable $e) {
  31319. }
  31320. if (null !== $e) {
  31321. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  31322. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  31323. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  31324. if ($x !== $event->getException()) {
  31325. $e = $event->getException();
  31326. }
  31327. $exitCode = $e->getCode();
  31328. }
  31329. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  31330. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  31331. if (null !== $e) {
  31332. throw $e;
  31333. }
  31334. return $event->getExitCode();
  31335. }
  31336. protected function getCommandName(InputInterface $input)
  31337. {
  31338. return $input->getFirstArgument();
  31339. }
  31340. protected function getDefaultInputDefinition()
  31341. {
  31342. return new InputDefinition(array(
  31343. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  31344. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  31345. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  31346. 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'),
  31347. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  31348. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  31349. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  31350. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  31351. ));
  31352. }
  31353. protected function getDefaultCommands()
  31354. {
  31355. return array(new HelpCommand(), new ListCommand());
  31356. }
  31357. protected function getDefaultHelperSet()
  31358. {
  31359. return new HelperSet(array(
  31360. new FormatterHelper(),
  31361. new DialogHelper(false),
  31362. new ProgressHelper(false),
  31363. new TableHelper(false),
  31364. new DebugFormatterHelper(),
  31365. new ProcessHelper(),
  31366. new QuestionHelper(),
  31367. ));
  31368. }
  31369. private function getSttyColumns()
  31370. {
  31371. if (!function_exists('proc_open')) {
  31372. return;
  31373. }
  31374. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  31375. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  31376. if (is_resource($process)) {
  31377. $info = stream_get_contents($pipes[1]);
  31378. fclose($pipes[1]);
  31379. fclose($pipes[2]);
  31380. proc_close($process);
  31381. return $info;
  31382. }
  31383. }
  31384. private function getConsoleMode()
  31385. {
  31386. if (!function_exists('proc_open')) {
  31387. return;
  31388. }
  31389. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  31390. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  31391. if (is_resource($process)) {
  31392. $info = stream_get_contents($pipes[1]);
  31393. fclose($pipes[1]);
  31394. fclose($pipes[2]);
  31395. proc_close($process);
  31396. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  31397. return $matches[2].'x'.$matches[1];
  31398. }
  31399. }
  31400. }
  31401. private function getAbbreviationSuggestions($abbrevs)
  31402. {
  31403. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
  31404. }
  31405. public function extractNamespace($name, $limit = null)
  31406. {
  31407. $parts = explode(':', $name);
  31408. array_pop($parts);
  31409. return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit));
  31410. }
  31411. private function findAlternatives($name, $collection)
  31412. {
  31413. $threshold = 1e3;
  31414. $alternatives = array();
  31415. $collectionParts = array();
  31416. foreach ($collection as $item) {
  31417. $collectionParts[$item] = explode(':', $item);
  31418. }
  31419. foreach (explode(':', $name) as $i => $subname) {
  31420. foreach ($collectionParts as $collectionName => $parts) {
  31421. $exists = isset($alternatives[$collectionName]);
  31422. if (!isset($parts[$i]) && $exists) {
  31423. $alternatives[$collectionName] += $threshold;
  31424. continue;
  31425. } elseif (!isset($parts[$i])) {
  31426. continue;
  31427. }
  31428. $lev = levenshtein($subname, $parts[$i]);
  31429. if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  31430. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  31431. } elseif ($exists) {
  31432. $alternatives[$collectionName] += $threshold;
  31433. }
  31434. }
  31435. }
  31436. foreach ($collection as $item) {
  31437. $lev = levenshtein($name, $item);
  31438. if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
  31439. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  31440. }
  31441. }
  31442. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  31443. asort($alternatives);
  31444. return array_keys($alternatives);
  31445. }
  31446. public function setDefaultCommand($commandName)
  31447. {
  31448. $this->defaultCommand = $commandName;
  31449. }
  31450. private function splitStringByWidth($string, $width)
  31451. {
  31452. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  31453. return str_split($string, $width);
  31454. }
  31455. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  31456. $lines = array();
  31457. $line = '';
  31458. foreach (preg_split('//u', $utf8String) as $char) {
  31459. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  31460. $line .= $char;
  31461. continue;
  31462. }
  31463. $lines[] = str_pad($line, $width);
  31464. $line = $char;
  31465. }
  31466. $lines[] = count($lines) ? str_pad($line, $width) : $line;
  31467. mb_convert_variables($encoding, 'utf8', $lines);
  31468. return $lines;
  31469. }
  31470. private function extractAllNamespaces($name)
  31471. {
  31472. $parts = explode(':', $name, -1);
  31473. $namespaces = array();
  31474. foreach ($parts as $part) {
  31475. if (count($namespaces)) {
  31476. $namespaces[] = end($namespaces).':'.$part;
  31477. } else {
  31478. $namespaces[] = $part;
  31479. }
  31480. }
  31481. return $namespaces;
  31482. }
  31483. private function init()
  31484. {
  31485. if ($this->initialized) {
  31486. return;
  31487. }
  31488. $this->initialized = true;
  31489. foreach ($this->getDefaultCommands() as $command) {
  31490. $this->add($command);
  31491. }
  31492. }
  31493. }
  31494. <?php
  31495. namespace Symfony\Component\Console\Command;
  31496. use Symfony\Component\Console\Descriptor\TextDescriptor;
  31497. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  31498. use Symfony\Component\Console\Exception\ExceptionInterface;
  31499. use Symfony\Component\Console\Input\InputDefinition;
  31500. use Symfony\Component\Console\Input\InputOption;
  31501. use Symfony\Component\Console\Input\InputArgument;
  31502. use Symfony\Component\Console\Input\InputInterface;
  31503. use Symfony\Component\Console\Output\BufferedOutput;
  31504. use Symfony\Component\Console\Output\OutputInterface;
  31505. use Symfony\Component\Console\Application;
  31506. use Symfony\Component\Console\Helper\HelperSet;
  31507. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31508. use Symfony\Component\Console\Exception\LogicException;
  31509. class Command
  31510. {
  31511. private $application;
  31512. private $name;
  31513. private $processTitle;
  31514. private $aliases = array();
  31515. private $definition;
  31516. private $help;
  31517. private $description;
  31518. private $ignoreValidationErrors = false;
  31519. private $applicationDefinitionMerged = false;
  31520. private $applicationDefinitionMergedWithArgs = false;
  31521. private $code;
  31522. private $synopsis = array();
  31523. private $usages = array();
  31524. private $helperSet;
  31525. public function __construct($name = null)
  31526. {
  31527. $this->definition = new InputDefinition();
  31528. if (null !== $name) {
  31529. $this->setName($name);
  31530. }
  31531. $this->configure();
  31532. if (!$this->name) {
  31533. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this)));
  31534. }
  31535. }
  31536. public function ignoreValidationErrors()
  31537. {
  31538. $this->ignoreValidationErrors = true;
  31539. }
  31540. public function setApplication(Application $application = null)
  31541. {
  31542. $this->application = $application;
  31543. if ($application) {
  31544. $this->setHelperSet($application->getHelperSet());
  31545. } else {
  31546. $this->helperSet = null;
  31547. }
  31548. }
  31549. public function setHelperSet(HelperSet $helperSet)
  31550. {
  31551. $this->helperSet = $helperSet;
  31552. }
  31553. public function getHelperSet()
  31554. {
  31555. return $this->helperSet;
  31556. }
  31557. public function getApplication()
  31558. {
  31559. return $this->application;
  31560. }
  31561. public function isEnabled()
  31562. {
  31563. return true;
  31564. }
  31565. protected function configure()
  31566. {
  31567. }
  31568. protected function execute(InputInterface $input, OutputInterface $output)
  31569. {
  31570. throw new LogicException('You must override the execute() method in the concrete command class.');
  31571. }
  31572. protected function interact(InputInterface $input, OutputInterface $output)
  31573. {
  31574. }
  31575. protected function initialize(InputInterface $input, OutputInterface $output)
  31576. {
  31577. }
  31578. public function run(InputInterface $input, OutputInterface $output)
  31579. {
  31580. $this->getSynopsis(true);
  31581. $this->getSynopsis(false);
  31582. $this->mergeApplicationDefinition();
  31583. try {
  31584. $input->bind($this->definition);
  31585. } catch (ExceptionInterface $e) {
  31586. if (!$this->ignoreValidationErrors) {
  31587. throw $e;
  31588. }
  31589. }
  31590. $this->initialize($input, $output);
  31591. if (null !== $this->processTitle) {
  31592. if (function_exists('cli_set_process_title')) {
  31593. if (!@cli_set_process_title($this->processTitle)) {
  31594. if ('Darwin' === PHP_OS) {
  31595. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  31596. } else {
  31597. cli_set_process_title($this->processTitle);
  31598. }
  31599. }
  31600. } elseif (function_exists('setproctitle')) {
  31601. setproctitle($this->processTitle);
  31602. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  31603. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  31604. }
  31605. }
  31606. if ($input->isInteractive()) {
  31607. $this->interact($input, $output);
  31608. }
  31609. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  31610. $input->setArgument('command', $this->getName());
  31611. }
  31612. $input->validate();
  31613. if ($this->code) {
  31614. $statusCode = call_user_func($this->code, $input, $output);
  31615. } else {
  31616. $statusCode = $this->execute($input, $output);
  31617. }
  31618. return is_numeric($statusCode) ? (int) $statusCode : 0;
  31619. }
  31620. public function setCode($code)
  31621. {
  31622. if (!is_callable($code)) {
  31623. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  31624. }
  31625. if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  31626. $r = new \ReflectionFunction($code);
  31627. if (null === $r->getClosureThis()) {
  31628. if (PHP_VERSION_ID < 70000) {
  31629. $code = @\Closure::bind($code, $this);
  31630. } else {
  31631. $code = \Closure::bind($code, $this);
  31632. }
  31633. }
  31634. }
  31635. $this->code = $code;
  31636. return $this;
  31637. }
  31638. public function mergeApplicationDefinition($mergeArgs = true)
  31639. {
  31640. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  31641. return;
  31642. }
  31643. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  31644. if ($mergeArgs) {
  31645. $currentArguments = $this->definition->getArguments();
  31646. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  31647. $this->definition->addArguments($currentArguments);
  31648. }
  31649. $this->applicationDefinitionMerged = true;
  31650. if ($mergeArgs) {
  31651. $this->applicationDefinitionMergedWithArgs = true;
  31652. }
  31653. }
  31654. public function setDefinition($definition)
  31655. {
  31656. if ($definition instanceof InputDefinition) {
  31657. $this->definition = $definition;
  31658. } else {
  31659. $this->definition->setDefinition($definition);
  31660. }
  31661. $this->applicationDefinitionMerged = false;
  31662. return $this;
  31663. }
  31664. public function getDefinition()
  31665. {
  31666. return $this->definition;
  31667. }
  31668. public function getNativeDefinition()
  31669. {
  31670. return $this->getDefinition();
  31671. }
  31672. public function addArgument($name, $mode = null, $description = '', $default = null)
  31673. {
  31674. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  31675. return $this;
  31676. }
  31677. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  31678. {
  31679. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  31680. return $this;
  31681. }
  31682. public function setName($name)
  31683. {
  31684. $this->validateName($name);
  31685. $this->name = $name;
  31686. return $this;
  31687. }
  31688. public function setProcessTitle($title)
  31689. {
  31690. $this->processTitle = $title;
  31691. return $this;
  31692. }
  31693. public function getName()
  31694. {
  31695. return $this->name;
  31696. }
  31697. public function setDescription($description)
  31698. {
  31699. $this->description = $description;
  31700. return $this;
  31701. }
  31702. public function getDescription()
  31703. {
  31704. return $this->description;
  31705. }
  31706. public function setHelp($help)
  31707. {
  31708. $this->help = $help;
  31709. return $this;
  31710. }
  31711. public function getHelp()
  31712. {
  31713. return $this->help;
  31714. }
  31715. public function getProcessedHelp()
  31716. {
  31717. $name = $this->name;
  31718. $placeholders = array(
  31719. '%command.name%',
  31720. '%command.full_name%',
  31721. );
  31722. $replacements = array(
  31723. $name,
  31724. $_SERVER['PHP_SELF'].' '.$name,
  31725. );
  31726. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  31727. }
  31728. public function setAliases($aliases)
  31729. {
  31730. if (!is_array($aliases) && !$aliases instanceof \Traversable) {
  31731. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  31732. }
  31733. foreach ($aliases as $alias) {
  31734. $this->validateName($alias);
  31735. }
  31736. $this->aliases = $aliases;
  31737. return $this;
  31738. }
  31739. public function getAliases()
  31740. {
  31741. return $this->aliases;
  31742. }
  31743. public function getSynopsis($short = false)
  31744. {
  31745. $key = $short ? 'short' : 'long';
  31746. if (!isset($this->synopsis[$key])) {
  31747. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  31748. }
  31749. return $this->synopsis[$key];
  31750. }
  31751. public function addUsage($usage)
  31752. {
  31753. if (0 !== strpos($usage, $this->name)) {
  31754. $usage = sprintf('%s %s', $this->name, $usage);
  31755. }
  31756. $this->usages[] = $usage;
  31757. return $this;
  31758. }
  31759. public function getUsages()
  31760. {
  31761. return $this->usages;
  31762. }
  31763. public function getHelper($name)
  31764. {
  31765. if (null === $this->helperSet) {
  31766. 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));
  31767. }
  31768. return $this->helperSet->get($name);
  31769. }
  31770. public function asText()
  31771. {
  31772. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31773. $descriptor = new TextDescriptor();
  31774. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  31775. $descriptor->describe($output, $this, array('raw_output' => true));
  31776. return $output->fetch();
  31777. }
  31778. public function asXml($asDom = false)
  31779. {
  31780. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31781. $descriptor = new XmlDescriptor();
  31782. if ($asDom) {
  31783. return $descriptor->getCommandDocument($this);
  31784. }
  31785. $output = new BufferedOutput();
  31786. $descriptor->describe($output, $this);
  31787. return $output->fetch();
  31788. }
  31789. private function validateName($name)
  31790. {
  31791. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  31792. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  31793. }
  31794. }
  31795. }
  31796. <?php
  31797. namespace Symfony\Component\Console\Command;
  31798. use Symfony\Component\Console\Helper\DescriptorHelper;
  31799. use Symfony\Component\Console\Input\InputArgument;
  31800. use Symfony\Component\Console\Input\InputOption;
  31801. use Symfony\Component\Console\Input\InputInterface;
  31802. use Symfony\Component\Console\Output\OutputInterface;
  31803. class HelpCommand extends Command
  31804. {
  31805. private $command;
  31806. protected function configure()
  31807. {
  31808. $this->ignoreValidationErrors();
  31809. $this
  31810. ->setName('help')
  31811. ->setDefinition(array(
  31812. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  31813. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  31814. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  31815. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  31816. ))
  31817. ->setDescription('Displays help for a command')
  31818. ->setHelp(<<<'EOF'
  31819. The <info>%command.name%</info> command displays help for a given command:
  31820. <info>php %command.full_name% list</info>
  31821. You can also output the help in other formats by using the <comment>--format</comment> option:
  31822. <info>php %command.full_name% --format=xml list</info>
  31823. To display the list of available commands, please use the <info>list</info> command.
  31824. EOF
  31825. )
  31826. ;
  31827. }
  31828. public function setCommand(Command $command)
  31829. {
  31830. $this->command = $command;
  31831. }
  31832. protected function execute(InputInterface $input, OutputInterface $output)
  31833. {
  31834. if (null === $this->command) {
  31835. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  31836. }
  31837. if ($input->getOption('xml')) {
  31838. @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);
  31839. $input->setOption('format', 'xml');
  31840. }
  31841. $helper = new DescriptorHelper();
  31842. $helper->describe($output, $this->command, array(
  31843. 'format' => $input->getOption('format'),
  31844. 'raw_text' => $input->getOption('raw'),
  31845. ));
  31846. $this->command = null;
  31847. }
  31848. }
  31849. <?php
  31850. namespace Symfony\Component\Console\Command;
  31851. use Symfony\Component\Console\Helper\DescriptorHelper;
  31852. use Symfony\Component\Console\Input\InputArgument;
  31853. use Symfony\Component\Console\Input\InputOption;
  31854. use Symfony\Component\Console\Input\InputInterface;
  31855. use Symfony\Component\Console\Output\OutputInterface;
  31856. use Symfony\Component\Console\Input\InputDefinition;
  31857. class ListCommand extends Command
  31858. {
  31859. protected function configure()
  31860. {
  31861. $this
  31862. ->setName('list')
  31863. ->setDefinition($this->createDefinition())
  31864. ->setDescription('Lists commands')
  31865. ->setHelp(<<<'EOF'
  31866. The <info>%command.name%</info> command lists all commands:
  31867. <info>php %command.full_name%</info>
  31868. You can also display the commands for a specific namespace:
  31869. <info>php %command.full_name% test</info>
  31870. You can also output the information in other formats by using the <comment>--format</comment> option:
  31871. <info>php %command.full_name% --format=xml</info>
  31872. It's also possible to get raw list of commands (useful for embedding command runner):
  31873. <info>php %command.full_name% --raw</info>
  31874. EOF
  31875. )
  31876. ;
  31877. }
  31878. public function getNativeDefinition()
  31879. {
  31880. return $this->createDefinition();
  31881. }
  31882. protected function execute(InputInterface $input, OutputInterface $output)
  31883. {
  31884. if ($input->getOption('xml')) {
  31885. @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);
  31886. $input->setOption('format', 'xml');
  31887. }
  31888. $helper = new DescriptorHelper();
  31889. $helper->describe($output, $this->getApplication(), array(
  31890. 'format' => $input->getOption('format'),
  31891. 'raw_text' => $input->getOption('raw'),
  31892. 'namespace' => $input->getArgument('namespace'),
  31893. ));
  31894. }
  31895. private function createDefinition()
  31896. {
  31897. return new InputDefinition(array(
  31898. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  31899. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  31900. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  31901. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  31902. ));
  31903. }
  31904. }
  31905. <?php
  31906. namespace Symfony\Component\Console;
  31907. final class ConsoleEvents
  31908. {
  31909. const COMMAND = 'console.command';
  31910. const TERMINATE = 'console.terminate';
  31911. const EXCEPTION = 'console.exception';
  31912. }
  31913. <?php
  31914. namespace Symfony\Component\Console\Descriptor;
  31915. use Symfony\Component\Console\Application;
  31916. use Symfony\Component\Console\Command\Command;
  31917. use Symfony\Component\Console\Exception\CommandNotFoundException;
  31918. class ApplicationDescription
  31919. {
  31920. const GLOBAL_NAMESPACE = '_global';
  31921. private $application;
  31922. private $namespace;
  31923. private $namespaces;
  31924. private $commands;
  31925. private $aliases;
  31926. public function __construct(Application $application, $namespace = null)
  31927. {
  31928. $this->application = $application;
  31929. $this->namespace = $namespace;
  31930. }
  31931. public function getNamespaces()
  31932. {
  31933. if (null === $this->namespaces) {
  31934. $this->inspectApplication();
  31935. }
  31936. return $this->namespaces;
  31937. }
  31938. public function getCommands()
  31939. {
  31940. if (null === $this->commands) {
  31941. $this->inspectApplication();
  31942. }
  31943. return $this->commands;
  31944. }
  31945. public function getCommand($name)
  31946. {
  31947. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  31948. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  31949. }
  31950. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  31951. }
  31952. private function inspectApplication()
  31953. {
  31954. $this->commands = array();
  31955. $this->namespaces = array();
  31956. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  31957. foreach ($this->sortCommands($all) as $namespace => $commands) {
  31958. $names = array();
  31959. foreach ($commands as $name => $command) {
  31960. if (!$command->getName()) {
  31961. continue;
  31962. }
  31963. if ($command->getName() === $name) {
  31964. $this->commands[$name] = $command;
  31965. } else {
  31966. $this->aliases[$name] = $command;
  31967. }
  31968. $names[] = $name;
  31969. }
  31970. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  31971. }
  31972. }
  31973. private function sortCommands(array $commands)
  31974. {
  31975. $namespacedCommands = array();
  31976. $globalCommands = array();
  31977. foreach ($commands as $name => $command) {
  31978. $key = $this->application->extractNamespace($name, 1);
  31979. if (!$key) {
  31980. $globalCommands['_global'][$name] = $command;
  31981. } else {
  31982. $namespacedCommands[$key][$name] = $command;
  31983. }
  31984. }
  31985. ksort($namespacedCommands);
  31986. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  31987. foreach ($namespacedCommands as &$commandsSet) {
  31988. ksort($commandsSet);
  31989. }
  31990. unset($commandsSet);
  31991. return $namespacedCommands;
  31992. }
  31993. }
  31994. <?php
  31995. namespace Symfony\Component\Console\Descriptor;
  31996. use Symfony\Component\Console\Application;
  31997. use Symfony\Component\Console\Command\Command;
  31998. use Symfony\Component\Console\Input\InputArgument;
  31999. use Symfony\Component\Console\Input\InputDefinition;
  32000. use Symfony\Component\Console\Input\InputOption;
  32001. use Symfony\Component\Console\Output\OutputInterface;
  32002. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32003. abstract class Descriptor implements DescriptorInterface
  32004. {
  32005. private $output;
  32006. public function describe(OutputInterface $output, $object, array $options = array())
  32007. {
  32008. $this->output = $output;
  32009. switch (true) {
  32010. case $object instanceof InputArgument:
  32011. $this->describeInputArgument($object, $options);
  32012. break;
  32013. case $object instanceof InputOption:
  32014. $this->describeInputOption($object, $options);
  32015. break;
  32016. case $object instanceof InputDefinition:
  32017. $this->describeInputDefinition($object, $options);
  32018. break;
  32019. case $object instanceof Command:
  32020. $this->describeCommand($object, $options);
  32021. break;
  32022. case $object instanceof Application:
  32023. $this->describeApplication($object, $options);
  32024. break;
  32025. default:
  32026. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object)));
  32027. }
  32028. }
  32029. protected function write($content, $decorated = false)
  32030. {
  32031. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  32032. }
  32033. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  32034. abstract protected function describeInputOption(InputOption $option, array $options = array());
  32035. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  32036. abstract protected function describeCommand(Command $command, array $options = array());
  32037. abstract protected function describeApplication(Application $application, array $options = array());
  32038. }
  32039. <?php
  32040. namespace Symfony\Component\Console\Descriptor;
  32041. use Symfony\Component\Console\Output\OutputInterface;
  32042. interface DescriptorInterface
  32043. {
  32044. public function describe(OutputInterface $output, $object, array $options = array());
  32045. }
  32046. <?php
  32047. namespace Symfony\Component\Console\Descriptor;
  32048. use Symfony\Component\Console\Application;
  32049. use Symfony\Component\Console\Command\Command;
  32050. use Symfony\Component\Console\Input\InputArgument;
  32051. use Symfony\Component\Console\Input\InputDefinition;
  32052. use Symfony\Component\Console\Input\InputOption;
  32053. class JsonDescriptor extends Descriptor
  32054. {
  32055. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32056. {
  32057. $this->writeData($this->getInputArgumentData($argument), $options);
  32058. }
  32059. protected function describeInputOption(InputOption $option, array $options = array())
  32060. {
  32061. $this->writeData($this->getInputOptionData($option), $options);
  32062. }
  32063. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32064. {
  32065. $this->writeData($this->getInputDefinitionData($definition), $options);
  32066. }
  32067. protected function describeCommand(Command $command, array $options = array())
  32068. {
  32069. $this->writeData($this->getCommandData($command), $options);
  32070. }
  32071. protected function describeApplication(Application $application, array $options = array())
  32072. {
  32073. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32074. $description = new ApplicationDescription($application, $describedNamespace);
  32075. $commands = array();
  32076. foreach ($description->getCommands() as $command) {
  32077. $commands[] = $this->getCommandData($command);
  32078. }
  32079. $data = $describedNamespace
  32080. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  32081. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  32082. $this->writeData($data, $options);
  32083. }
  32084. private function writeData(array $data, array $options)
  32085. {
  32086. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  32087. }
  32088. private function getInputArgumentData(InputArgument $argument)
  32089. {
  32090. return array(
  32091. 'name' => $argument->getName(),
  32092. 'is_required' => $argument->isRequired(),
  32093. 'is_array' => $argument->isArray(),
  32094. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  32095. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  32096. );
  32097. }
  32098. private function getInputOptionData(InputOption $option)
  32099. {
  32100. return array(
  32101. 'name' => '--'.$option->getName(),
  32102. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  32103. 'accept_value' => $option->acceptValue(),
  32104. 'is_value_required' => $option->isValueRequired(),
  32105. 'is_multiple' => $option->isArray(),
  32106. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  32107. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  32108. );
  32109. }
  32110. private function getInputDefinitionData(InputDefinition $definition)
  32111. {
  32112. $inputArguments = array();
  32113. foreach ($definition->getArguments() as $name => $argument) {
  32114. $inputArguments[$name] = $this->getInputArgumentData($argument);
  32115. }
  32116. $inputOptions = array();
  32117. foreach ($definition->getOptions() as $name => $option) {
  32118. $inputOptions[$name] = $this->getInputOptionData($option);
  32119. }
  32120. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  32121. }
  32122. private function getCommandData(Command $command)
  32123. {
  32124. $command->getSynopsis();
  32125. $command->mergeApplicationDefinition(false);
  32126. return array(
  32127. 'name' => $command->getName(),
  32128. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  32129. 'description' => $command->getDescription(),
  32130. 'help' => $command->getProcessedHelp(),
  32131. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  32132. );
  32133. }
  32134. }
  32135. <?php
  32136. namespace Symfony\Component\Console\Descriptor;
  32137. use Symfony\Component\Console\Application;
  32138. use Symfony\Component\Console\Command\Command;
  32139. use Symfony\Component\Console\Helper\Helper;
  32140. use Symfony\Component\Console\Input\InputArgument;
  32141. use Symfony\Component\Console\Input\InputDefinition;
  32142. use Symfony\Component\Console\Input\InputOption;
  32143. class MarkdownDescriptor extends Descriptor
  32144. {
  32145. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32146. {
  32147. $this->write(
  32148. '**'.$argument->getName().':**'."\n\n"
  32149. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  32150. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  32151. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  32152. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  32153. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  32154. );
  32155. }
  32156. protected function describeInputOption(InputOption $option, array $options = array())
  32157. {
  32158. $this->write(
  32159. '**'.$option->getName().':**'."\n\n"
  32160. .'* Name: `--'.$option->getName().'`'."\n"
  32161. .'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '<none>')."\n"
  32162. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  32163. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  32164. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  32165. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  32166. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  32167. );
  32168. }
  32169. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32170. {
  32171. if ($showArguments = count($definition->getArguments()) > 0) {
  32172. $this->write('### Arguments:');
  32173. foreach ($definition->getArguments() as $argument) {
  32174. $this->write("\n\n");
  32175. $this->write($this->describeInputArgument($argument));
  32176. }
  32177. }
  32178. if (count($definition->getOptions()) > 0) {
  32179. if ($showArguments) {
  32180. $this->write("\n\n");
  32181. }
  32182. $this->write('### Options:');
  32183. foreach ($definition->getOptions() as $option) {
  32184. $this->write("\n\n");
  32185. $this->write($this->describeInputOption($option));
  32186. }
  32187. }
  32188. }
  32189. protected function describeCommand(Command $command, array $options = array())
  32190. {
  32191. $command->getSynopsis();
  32192. $command->mergeApplicationDefinition(false);
  32193. $this->write(
  32194. $command->getName()."\n"
  32195. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  32196. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  32197. .'* Usage:'."\n\n"
  32198. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  32199. return $carry.' * `'.$usage.'`'."\n";
  32200. })
  32201. );
  32202. if ($help = $command->getProcessedHelp()) {
  32203. $this->write("\n");
  32204. $this->write($help);
  32205. }
  32206. if ($command->getNativeDefinition()) {
  32207. $this->write("\n\n");
  32208. $this->describeInputDefinition($command->getNativeDefinition());
  32209. }
  32210. }
  32211. protected function describeApplication(Application $application, array $options = array())
  32212. {
  32213. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32214. $description = new ApplicationDescription($application, $describedNamespace);
  32215. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  32216. foreach ($description->getNamespaces() as $namespace) {
  32217. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  32218. $this->write("\n\n");
  32219. $this->write('**'.$namespace['id'].':**');
  32220. }
  32221. $this->write("\n\n");
  32222. $this->write(implode("\n", array_map(function ($commandName) {
  32223. return '* '.$commandName;
  32224. }, $namespace['commands'])));
  32225. }
  32226. foreach ($description->getCommands() as $command) {
  32227. $this->write("\n\n");
  32228. $this->write($this->describeCommand($command));
  32229. }
  32230. }
  32231. }
  32232. <?php
  32233. namespace Symfony\Component\Console\Descriptor;
  32234. use Symfony\Component\Console\Application;
  32235. use Symfony\Component\Console\Command\Command;
  32236. use Symfony\Component\Console\Formatter\OutputFormatter;
  32237. use Symfony\Component\Console\Helper\Helper;
  32238. use Symfony\Component\Console\Input\InputArgument;
  32239. use Symfony\Component\Console\Input\InputDefinition;
  32240. use Symfony\Component\Console\Input\InputOption;
  32241. class TextDescriptor extends Descriptor
  32242. {
  32243. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32244. {
  32245. if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) {
  32246. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  32247. } else {
  32248. $default = '';
  32249. }
  32250. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  32251. $spacingWidth = $totalWidth - strlen($argument->getName());
  32252. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  32253. $argument->getName(),
  32254. str_repeat(' ', $spacingWidth),
  32255. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  32256. $default
  32257. ), $options);
  32258. }
  32259. protected function describeInputOption(InputOption $option, array $options = array())
  32260. {
  32261. if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) {
  32262. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  32263. } else {
  32264. $default = '';
  32265. }
  32266. $value = '';
  32267. if ($option->acceptValue()) {
  32268. $value = '='.strtoupper($option->getName());
  32269. if ($option->isValueOptional()) {
  32270. $value = '['.$value.']';
  32271. }
  32272. }
  32273. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  32274. $synopsis = sprintf('%s%s',
  32275. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  32276. sprintf('--%s%s', $option->getName(), $value)
  32277. );
  32278. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  32279. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  32280. $synopsis,
  32281. str_repeat(' ', $spacingWidth),
  32282. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  32283. $default,
  32284. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  32285. ), $options);
  32286. }
  32287. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32288. {
  32289. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  32290. foreach ($definition->getArguments() as $argument) {
  32291. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  32292. }
  32293. if ($definition->getArguments()) {
  32294. $this->writeText('<comment>Arguments:</comment>', $options);
  32295. $this->writeText("\n");
  32296. foreach ($definition->getArguments() as $argument) {
  32297. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  32298. $this->writeText("\n");
  32299. }
  32300. }
  32301. if ($definition->getArguments() && $definition->getOptions()) {
  32302. $this->writeText("\n");
  32303. }
  32304. if ($definition->getOptions()) {
  32305. $laterOptions = array();
  32306. $this->writeText('<comment>Options:</comment>', $options);
  32307. foreach ($definition->getOptions() as $option) {
  32308. if (strlen($option->getShortcut()) > 1) {
  32309. $laterOptions[] = $option;
  32310. continue;
  32311. }
  32312. $this->writeText("\n");
  32313. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  32314. }
  32315. foreach ($laterOptions as $option) {
  32316. $this->writeText("\n");
  32317. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  32318. }
  32319. }
  32320. }
  32321. protected function describeCommand(Command $command, array $options = array())
  32322. {
  32323. $command->getSynopsis(true);
  32324. $command->getSynopsis(false);
  32325. $command->mergeApplicationDefinition(false);
  32326. $this->writeText('<comment>Usage:</comment>', $options);
  32327. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  32328. $this->writeText("\n");
  32329. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  32330. }
  32331. $this->writeText("\n");
  32332. $definition = $command->getNativeDefinition();
  32333. if ($definition->getOptions() || $definition->getArguments()) {
  32334. $this->writeText("\n");
  32335. $this->describeInputDefinition($definition, $options);
  32336. $this->writeText("\n");
  32337. }
  32338. if ($help = $command->getProcessedHelp()) {
  32339. $this->writeText("\n");
  32340. $this->writeText('<comment>Help:</comment>', $options);
  32341. $this->writeText("\n");
  32342. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  32343. $this->writeText("\n");
  32344. }
  32345. }
  32346. protected function describeApplication(Application $application, array $options = array())
  32347. {
  32348. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  32349. $description = new ApplicationDescription($application, $describedNamespace);
  32350. if (isset($options['raw_text']) && $options['raw_text']) {
  32351. $width = $this->getColumnWidth($description->getCommands());
  32352. foreach ($description->getCommands() as $command) {
  32353. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  32354. $this->writeText("\n");
  32355. }
  32356. } else {
  32357. if ('' != $help = $application->getHelp()) {
  32358. $this->writeText("$help\n\n", $options);
  32359. }
  32360. $this->writeText("<comment>Usage:</comment>\n", $options);
  32361. $this->writeText(" command [options] [arguments]\n\n", $options);
  32362. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  32363. $this->writeText("\n");
  32364. $this->writeText("\n");
  32365. $width = $this->getColumnWidth($description->getCommands());
  32366. if ($describedNamespace) {
  32367. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  32368. } else {
  32369. $this->writeText('<comment>Available commands:</comment>', $options);
  32370. }
  32371. foreach ($description->getNamespaces() as $namespace) {
  32372. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  32373. $this->writeText("\n");
  32374. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  32375. }
  32376. foreach ($namespace['commands'] as $name) {
  32377. $this->writeText("\n");
  32378. $spacingWidth = $width - Helper::strlen($name);
  32379. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  32380. }
  32381. }
  32382. $this->writeText("\n");
  32383. }
  32384. }
  32385. private function writeText($content, array $options = array())
  32386. {
  32387. $this->write(
  32388. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  32389. isset($options['raw_output']) ? !$options['raw_output'] : true
  32390. );
  32391. }
  32392. private function formatDefaultValue($default)
  32393. {
  32394. if (INF === $default) {
  32395. return 'INF';
  32396. }
  32397. if (is_string($default)) {
  32398. $default = OutputFormatter::escape($default);
  32399. } elseif (is_array($default)) {
  32400. foreach ($default as $key => $value) {
  32401. if (is_string($value)) {
  32402. $default[$key] = OutputFormatter::escape($value);
  32403. }
  32404. }
  32405. }
  32406. if (\PHP_VERSION_ID < 50400) {
  32407. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  32408. }
  32409. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  32410. }
  32411. private function getColumnWidth(array $commands)
  32412. {
  32413. $widths = array();
  32414. foreach ($commands as $command) {
  32415. $widths[] = Helper::strlen($command->getName());
  32416. foreach ($command->getAliases() as $alias) {
  32417. $widths[] = Helper::strlen($alias);
  32418. }
  32419. }
  32420. return max($widths) + 2;
  32421. }
  32422. private function calculateTotalWidthForOptions(array $options)
  32423. {
  32424. $totalWidth = 0;
  32425. foreach ($options as $option) {
  32426. $nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  32427. if ($option->acceptValue()) {
  32428. $valueLength = 1 + Helper::strlen($option->getName());
  32429. $valueLength += $option->isValueOptional() ? 2 : 0;
  32430. $nameLength += $valueLength;
  32431. }
  32432. $totalWidth = max($totalWidth, $nameLength);
  32433. }
  32434. return $totalWidth;
  32435. }
  32436. }
  32437. <?php
  32438. namespace Symfony\Component\Console\Descriptor;
  32439. use Symfony\Component\Console\Application;
  32440. use Symfony\Component\Console\Command\Command;
  32441. use Symfony\Component\Console\Input\InputArgument;
  32442. use Symfony\Component\Console\Input\InputDefinition;
  32443. use Symfony\Component\Console\Input\InputOption;
  32444. class XmlDescriptor extends Descriptor
  32445. {
  32446. public function getInputDefinitionDocument(InputDefinition $definition)
  32447. {
  32448. $dom = new \DOMDocument('1.0', 'UTF-8');
  32449. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  32450. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  32451. foreach ($definition->getArguments() as $argument) {
  32452. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  32453. }
  32454. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  32455. foreach ($definition->getOptions() as $option) {
  32456. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  32457. }
  32458. return $dom;
  32459. }
  32460. public function getCommandDocument(Command $command)
  32461. {
  32462. $dom = new \DOMDocument('1.0', 'UTF-8');
  32463. $dom->appendChild($commandXML = $dom->createElement('command'));
  32464. $command->getSynopsis();
  32465. $command->mergeApplicationDefinition(false);
  32466. $commandXML->setAttribute('id', $command->getName());
  32467. $commandXML->setAttribute('name', $command->getName());
  32468. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  32469. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  32470. $usagesXML->appendChild($dom->createElement('usage', $usage));
  32471. }
  32472. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  32473. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  32474. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  32475. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  32476. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  32477. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  32478. return $dom;
  32479. }
  32480. public function getApplicationDocument(Application $application, $namespace = null)
  32481. {
  32482. $dom = new \DOMDocument('1.0', 'UTF-8');
  32483. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  32484. if ('UNKNOWN' !== $application->getName()) {
  32485. $rootXml->setAttribute('name', $application->getName());
  32486. if ('UNKNOWN' !== $application->getVersion()) {
  32487. $rootXml->setAttribute('version', $application->getVersion());
  32488. }
  32489. }
  32490. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  32491. $description = new ApplicationDescription($application, $namespace);
  32492. if ($namespace) {
  32493. $commandsXML->setAttribute('namespace', $namespace);
  32494. }
  32495. foreach ($description->getCommands() as $command) {
  32496. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  32497. }
  32498. if (!$namespace) {
  32499. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  32500. foreach ($description->getNamespaces() as $namespaceDescription) {
  32501. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  32502. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  32503. foreach ($namespaceDescription['commands'] as $name) {
  32504. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  32505. $commandXML->appendChild($dom->createTextNode($name));
  32506. }
  32507. }
  32508. }
  32509. return $dom;
  32510. }
  32511. protected function describeInputArgument(InputArgument $argument, array $options = array())
  32512. {
  32513. $this->writeDocument($this->getInputArgumentDocument($argument));
  32514. }
  32515. protected function describeInputOption(InputOption $option, array $options = array())
  32516. {
  32517. $this->writeDocument($this->getInputOptionDocument($option));
  32518. }
  32519. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  32520. {
  32521. $this->writeDocument($this->getInputDefinitionDocument($definition));
  32522. }
  32523. protected function describeCommand(Command $command, array $options = array())
  32524. {
  32525. $this->writeDocument($this->getCommandDocument($command));
  32526. }
  32527. protected function describeApplication(Application $application, array $options = array())
  32528. {
  32529. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  32530. }
  32531. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  32532. {
  32533. foreach ($importedParent->childNodes as $childNode) {
  32534. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  32535. }
  32536. }
  32537. private function writeDocument(\DOMDocument $dom)
  32538. {
  32539. $dom->formatOutput = true;
  32540. $this->write($dom->saveXML());
  32541. }
  32542. private function getInputArgumentDocument(InputArgument $argument)
  32543. {
  32544. $dom = new \DOMDocument('1.0', 'UTF-8');
  32545. $dom->appendChild($objectXML = $dom->createElement('argument'));
  32546. $objectXML->setAttribute('name', $argument->getName());
  32547. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  32548. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  32549. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  32550. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  32551. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  32552. $defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  32553. foreach ($defaults as $default) {
  32554. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  32555. $defaultXML->appendChild($dom->createTextNode($default));
  32556. }
  32557. return $dom;
  32558. }
  32559. private function getInputOptionDocument(InputOption $option)
  32560. {
  32561. $dom = new \DOMDocument('1.0', 'UTF-8');
  32562. $dom->appendChild($objectXML = $dom->createElement('option'));
  32563. $objectXML->setAttribute('name', '--'.$option->getName());
  32564. $pos = strpos($option->getShortcut(), '|');
  32565. if (false !== $pos) {
  32566. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  32567. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  32568. } else {
  32569. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  32570. }
  32571. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  32572. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  32573. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  32574. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  32575. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  32576. if ($option->acceptValue()) {
  32577. $defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  32578. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  32579. if (!empty($defaults)) {
  32580. foreach ($defaults as $default) {
  32581. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  32582. $defaultXML->appendChild($dom->createTextNode($default));
  32583. }
  32584. }
  32585. }
  32586. return $dom;
  32587. }
  32588. }
  32589. <?php
  32590. namespace Symfony\Component\Console\Event;
  32591. class ConsoleCommandEvent extends ConsoleEvent
  32592. {
  32593. const RETURN_CODE_DISABLED = 113;
  32594. private $commandShouldRun = true;
  32595. public function disableCommand()
  32596. {
  32597. return $this->commandShouldRun = false;
  32598. }
  32599. public function enableCommand()
  32600. {
  32601. return $this->commandShouldRun = true;
  32602. }
  32603. public function commandShouldRun()
  32604. {
  32605. return $this->commandShouldRun;
  32606. }
  32607. }
  32608. <?php
  32609. namespace Symfony\Component\Console\Event;
  32610. use Symfony\Component\Console\Command\Command;
  32611. use Symfony\Component\Console\Input\InputInterface;
  32612. use Symfony\Component\Console\Output\OutputInterface;
  32613. use Symfony\Component\EventDispatcher\Event;
  32614. class ConsoleEvent extends Event
  32615. {
  32616. protected $command;
  32617. private $input;
  32618. private $output;
  32619. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  32620. {
  32621. $this->command = $command;
  32622. $this->input = $input;
  32623. $this->output = $output;
  32624. }
  32625. public function getCommand()
  32626. {
  32627. return $this->command;
  32628. }
  32629. public function getInput()
  32630. {
  32631. return $this->input;
  32632. }
  32633. public function getOutput()
  32634. {
  32635. return $this->output;
  32636. }
  32637. }
  32638. <?php
  32639. namespace Symfony\Component\Console\Event;
  32640. use Symfony\Component\Console\Command\Command;
  32641. use Symfony\Component\Console\Input\InputInterface;
  32642. use Symfony\Component\Console\Output\OutputInterface;
  32643. class ConsoleExceptionEvent extends ConsoleEvent
  32644. {
  32645. private $exception;
  32646. private $exitCode;
  32647. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  32648. {
  32649. parent::__construct($command, $input, $output);
  32650. $this->setException($exception);
  32651. $this->exitCode = (int) $exitCode;
  32652. }
  32653. public function getException()
  32654. {
  32655. return $this->exception;
  32656. }
  32657. public function setException(\Exception $exception)
  32658. {
  32659. $this->exception = $exception;
  32660. }
  32661. public function getExitCode()
  32662. {
  32663. return $this->exitCode;
  32664. }
  32665. }
  32666. <?php
  32667. namespace Symfony\Component\Console\Event;
  32668. use Symfony\Component\Console\Command\Command;
  32669. use Symfony\Component\Console\Input\InputInterface;
  32670. use Symfony\Component\Console\Output\OutputInterface;
  32671. class ConsoleTerminateEvent extends ConsoleEvent
  32672. {
  32673. private $exitCode;
  32674. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  32675. {
  32676. parent::__construct($command, $input, $output);
  32677. $this->setExitCode($exitCode);
  32678. }
  32679. public function setExitCode($exitCode)
  32680. {
  32681. $this->exitCode = (int) $exitCode;
  32682. }
  32683. public function getExitCode()
  32684. {
  32685. return $this->exitCode;
  32686. }
  32687. }
  32688. <?php
  32689. namespace Symfony\Component\Console\Exception;
  32690. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  32691. {
  32692. private $alternatives;
  32693. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  32694. {
  32695. parent::__construct($message, $code, $previous);
  32696. $this->alternatives = $alternatives;
  32697. }
  32698. public function getAlternatives()
  32699. {
  32700. return $this->alternatives;
  32701. }
  32702. }
  32703. <?php
  32704. namespace Symfony\Component\Console\Exception;
  32705. interface ExceptionInterface
  32706. {
  32707. }
  32708. <?php
  32709. namespace Symfony\Component\Console\Exception;
  32710. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  32711. {
  32712. }
  32713. <?php
  32714. namespace Symfony\Component\Console\Exception;
  32715. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  32716. {
  32717. }
  32718. <?php
  32719. namespace Symfony\Component\Console\Exception;
  32720. class LogicException extends \LogicException implements ExceptionInterface
  32721. {
  32722. }
  32723. <?php
  32724. namespace Symfony\Component\Console\Exception;
  32725. class RuntimeException extends \RuntimeException implements ExceptionInterface
  32726. {
  32727. }
  32728. <?php
  32729. namespace Symfony\Component\Console\Formatter;
  32730. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32731. class OutputFormatter implements OutputFormatterInterface
  32732. {
  32733. private $decorated;
  32734. private $styles = array();
  32735. private $styleStack;
  32736. public static function escape($text)
  32737. {
  32738. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  32739. return self::escapeTrailingBackslash($text);
  32740. }
  32741. public static function escapeTrailingBackslash($text)
  32742. {
  32743. if ('\\' === substr($text, -1)) {
  32744. $len = strlen($text);
  32745. $text = rtrim($text, '\\');
  32746. $text = str_replace("\0", '', $text);
  32747. $text .= str_repeat("\0", $len - strlen($text));
  32748. }
  32749. return $text;
  32750. }
  32751. public function __construct($decorated = false, array $styles = array())
  32752. {
  32753. $this->decorated = (bool) $decorated;
  32754. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  32755. $this->setStyle('info', new OutputFormatterStyle('green'));
  32756. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  32757. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  32758. foreach ($styles as $name => $style) {
  32759. $this->setStyle($name, $style);
  32760. }
  32761. $this->styleStack = new OutputFormatterStyleStack();
  32762. }
  32763. public function setDecorated($decorated)
  32764. {
  32765. $this->decorated = (bool) $decorated;
  32766. }
  32767. public function isDecorated()
  32768. {
  32769. return $this->decorated;
  32770. }
  32771. public function setStyle($name, OutputFormatterStyleInterface $style)
  32772. {
  32773. $this->styles[strtolower($name)] = $style;
  32774. }
  32775. public function hasStyle($name)
  32776. {
  32777. return isset($this->styles[strtolower($name)]);
  32778. }
  32779. public function getStyle($name)
  32780. {
  32781. if (!$this->hasStyle($name)) {
  32782. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  32783. }
  32784. return $this->styles[strtolower($name)];
  32785. }
  32786. public function format($message)
  32787. {
  32788. $message = (string) $message;
  32789. $offset = 0;
  32790. $output = '';
  32791. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  32792. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  32793. foreach ($matches[0] as $i => $match) {
  32794. $pos = $match[1];
  32795. $text = $match[0];
  32796. if (0 != $pos && '\\' == $message[$pos - 1]) {
  32797. continue;
  32798. }
  32799. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  32800. $offset = $pos + strlen($text);
  32801. if ($open = '/' != $text[1]) {
  32802. $tag = $matches[1][$i][0];
  32803. } else {
  32804. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  32805. }
  32806. if (!$open && !$tag) {
  32807. $this->styleStack->pop();
  32808. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  32809. $output .= $this->applyCurrentStyle($text);
  32810. } elseif ($open) {
  32811. $this->styleStack->push($style);
  32812. } else {
  32813. $this->styleStack->pop($style);
  32814. }
  32815. }
  32816. $output .= $this->applyCurrentStyle(substr($message, $offset));
  32817. if (false !== strpos($output, "\0")) {
  32818. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  32819. }
  32820. return str_replace('\\<', '<', $output);
  32821. }
  32822. public function getStyleStack()
  32823. {
  32824. return $this->styleStack;
  32825. }
  32826. private function createStyleFromString($string)
  32827. {
  32828. if (isset($this->styles[$string])) {
  32829. return $this->styles[$string];
  32830. }
  32831. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  32832. return false;
  32833. }
  32834. $style = new OutputFormatterStyle();
  32835. foreach ($matches as $match) {
  32836. array_shift($match);
  32837. if ('fg' == $match[0]) {
  32838. $style->setForeground($match[1]);
  32839. } elseif ('bg' == $match[0]) {
  32840. $style->setBackground($match[1]);
  32841. } else {
  32842. try {
  32843. $style->setOption($match[1]);
  32844. } catch (\InvalidArgumentException $e) {
  32845. return false;
  32846. }
  32847. }
  32848. }
  32849. return $style;
  32850. }
  32851. private function applyCurrentStyle($text)
  32852. {
  32853. return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  32854. }
  32855. }
  32856. <?php
  32857. namespace Symfony\Component\Console\Formatter;
  32858. interface OutputFormatterInterface
  32859. {
  32860. public function setDecorated($decorated);
  32861. public function isDecorated();
  32862. public function setStyle($name, OutputFormatterStyleInterface $style);
  32863. public function hasStyle($name);
  32864. public function getStyle($name);
  32865. public function format($message);
  32866. }
  32867. <?php
  32868. namespace Symfony\Component\Console\Formatter;
  32869. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32870. class OutputFormatterStyle implements OutputFormatterStyleInterface
  32871. {
  32872. private static $availableForegroundColors = array(
  32873. 'black' => array('set' => 30, 'unset' => 39),
  32874. 'red' => array('set' => 31, 'unset' => 39),
  32875. 'green' => array('set' => 32, 'unset' => 39),
  32876. 'yellow' => array('set' => 33, 'unset' => 39),
  32877. 'blue' => array('set' => 34, 'unset' => 39),
  32878. 'magenta' => array('set' => 35, 'unset' => 39),
  32879. 'cyan' => array('set' => 36, 'unset' => 39),
  32880. 'white' => array('set' => 37, 'unset' => 39),
  32881. 'default' => array('set' => 39, 'unset' => 39),
  32882. );
  32883. private static $availableBackgroundColors = array(
  32884. 'black' => array('set' => 40, 'unset' => 49),
  32885. 'red' => array('set' => 41, 'unset' => 49),
  32886. 'green' => array('set' => 42, 'unset' => 49),
  32887. 'yellow' => array('set' => 43, 'unset' => 49),
  32888. 'blue' => array('set' => 44, 'unset' => 49),
  32889. 'magenta' => array('set' => 45, 'unset' => 49),
  32890. 'cyan' => array('set' => 46, 'unset' => 49),
  32891. 'white' => array('set' => 47, 'unset' => 49),
  32892. 'default' => array('set' => 49, 'unset' => 49),
  32893. );
  32894. private static $availableOptions = array(
  32895. 'bold' => array('set' => 1, 'unset' => 22),
  32896. 'underscore' => array('set' => 4, 'unset' => 24),
  32897. 'blink' => array('set' => 5, 'unset' => 25),
  32898. 'reverse' => array('set' => 7, 'unset' => 27),
  32899. 'conceal' => array('set' => 8, 'unset' => 28),
  32900. );
  32901. private $foreground;
  32902. private $background;
  32903. private $options = array();
  32904. public function __construct($foreground = null, $background = null, array $options = array())
  32905. {
  32906. if (null !== $foreground) {
  32907. $this->setForeground($foreground);
  32908. }
  32909. if (null !== $background) {
  32910. $this->setBackground($background);
  32911. }
  32912. if (count($options)) {
  32913. $this->setOptions($options);
  32914. }
  32915. }
  32916. public function setForeground($color = null)
  32917. {
  32918. if (null === $color) {
  32919. $this->foreground = null;
  32920. return;
  32921. }
  32922. if (!isset(static::$availableForegroundColors[$color])) {
  32923. throw new InvalidArgumentException(sprintf(
  32924. 'Invalid foreground color specified: "%s". Expected one of (%s)',
  32925. $color,
  32926. implode(', ', array_keys(static::$availableForegroundColors))
  32927. ));
  32928. }
  32929. $this->foreground = static::$availableForegroundColors[$color];
  32930. }
  32931. public function setBackground($color = null)
  32932. {
  32933. if (null === $color) {
  32934. $this->background = null;
  32935. return;
  32936. }
  32937. if (!isset(static::$availableBackgroundColors[$color])) {
  32938. throw new InvalidArgumentException(sprintf(
  32939. 'Invalid background color specified: "%s". Expected one of (%s)',
  32940. $color,
  32941. implode(', ', array_keys(static::$availableBackgroundColors))
  32942. ));
  32943. }
  32944. $this->background = static::$availableBackgroundColors[$color];
  32945. }
  32946. public function setOption($option)
  32947. {
  32948. if (!isset(static::$availableOptions[$option])) {
  32949. throw new InvalidArgumentException(sprintf(
  32950. 'Invalid option specified: "%s". Expected one of (%s)',
  32951. $option,
  32952. implode(', ', array_keys(static::$availableOptions))
  32953. ));
  32954. }
  32955. if (!in_array(static::$availableOptions[$option], $this->options)) {
  32956. $this->options[] = static::$availableOptions[$option];
  32957. }
  32958. }
  32959. public function unsetOption($option)
  32960. {
  32961. if (!isset(static::$availableOptions[$option])) {
  32962. throw new InvalidArgumentException(sprintf(
  32963. 'Invalid option specified: "%s". Expected one of (%s)',
  32964. $option,
  32965. implode(', ', array_keys(static::$availableOptions))
  32966. ));
  32967. }
  32968. $pos = array_search(static::$availableOptions[$option], $this->options);
  32969. if (false !== $pos) {
  32970. unset($this->options[$pos]);
  32971. }
  32972. }
  32973. public function setOptions(array $options)
  32974. {
  32975. $this->options = array();
  32976. foreach ($options as $option) {
  32977. $this->setOption($option);
  32978. }
  32979. }
  32980. public function apply($text)
  32981. {
  32982. $setCodes = array();
  32983. $unsetCodes = array();
  32984. if (null !== $this->foreground) {
  32985. $setCodes[] = $this->foreground['set'];
  32986. $unsetCodes[] = $this->foreground['unset'];
  32987. }
  32988. if (null !== $this->background) {
  32989. $setCodes[] = $this->background['set'];
  32990. $unsetCodes[] = $this->background['unset'];
  32991. }
  32992. if (count($this->options)) {
  32993. foreach ($this->options as $option) {
  32994. $setCodes[] = $option['set'];
  32995. $unsetCodes[] = $option['unset'];
  32996. }
  32997. }
  32998. if (0 === count($setCodes)) {
  32999. return $text;
  33000. }
  33001. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  33002. }
  33003. }
  33004. <?php
  33005. namespace Symfony\Component\Console\Formatter;
  33006. interface OutputFormatterStyleInterface
  33007. {
  33008. public function setForeground($color = null);
  33009. public function setBackground($color = null);
  33010. public function setOption($option);
  33011. public function unsetOption($option);
  33012. public function setOptions(array $options);
  33013. public function apply($text);
  33014. }
  33015. <?php
  33016. namespace Symfony\Component\Console\Formatter;
  33017. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33018. class OutputFormatterStyleStack
  33019. {
  33020. private $styles;
  33021. private $emptyStyle;
  33022. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  33023. {
  33024. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  33025. $this->reset();
  33026. }
  33027. public function reset()
  33028. {
  33029. $this->styles = array();
  33030. }
  33031. public function push(OutputFormatterStyleInterface $style)
  33032. {
  33033. $this->styles[] = $style;
  33034. }
  33035. public function pop(OutputFormatterStyleInterface $style = null)
  33036. {
  33037. if (empty($this->styles)) {
  33038. return $this->emptyStyle;
  33039. }
  33040. if (null === $style) {
  33041. return array_pop($this->styles);
  33042. }
  33043. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  33044. if ($style->apply('') === $stackedStyle->apply('')) {
  33045. $this->styles = array_slice($this->styles, 0, $index);
  33046. return $stackedStyle;
  33047. }
  33048. }
  33049. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  33050. }
  33051. public function getCurrent()
  33052. {
  33053. if (empty($this->styles)) {
  33054. return $this->emptyStyle;
  33055. }
  33056. return $this->styles[count($this->styles) - 1];
  33057. }
  33058. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  33059. {
  33060. $this->emptyStyle = $emptyStyle;
  33061. return $this;
  33062. }
  33063. public function getEmptyStyle()
  33064. {
  33065. return $this->emptyStyle;
  33066. }
  33067. }
  33068. <?php
  33069. namespace Symfony\Component\Console\Helper;
  33070. class DebugFormatterHelper extends Helper
  33071. {
  33072. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  33073. private $started = array();
  33074. private $count = -1;
  33075. public function start($id, $message, $prefix = 'RUN')
  33076. {
  33077. $this->started[$id] = array('border' => ++$this->count % count($this->colors));
  33078. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  33079. }
  33080. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  33081. {
  33082. $message = '';
  33083. if ($error) {
  33084. if (isset($this->started[$id]['out'])) {
  33085. $message .= "\n";
  33086. unset($this->started[$id]['out']);
  33087. }
  33088. if (!isset($this->started[$id]['err'])) {
  33089. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  33090. $this->started[$id]['err'] = true;
  33091. }
  33092. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  33093. } else {
  33094. if (isset($this->started[$id]['err'])) {
  33095. $message .= "\n";
  33096. unset($this->started[$id]['err']);
  33097. }
  33098. if (!isset($this->started[$id]['out'])) {
  33099. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  33100. $this->started[$id]['out'] = true;
  33101. }
  33102. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  33103. }
  33104. return $message;
  33105. }
  33106. public function stop($id, $message, $successful, $prefix = 'RES')
  33107. {
  33108. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  33109. if ($successful) {
  33110. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  33111. }
  33112. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  33113. unset($this->started[$id]['out'], $this->started[$id]['err']);
  33114. return $message;
  33115. }
  33116. private function getBorder($id)
  33117. {
  33118. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  33119. }
  33120. public function getName()
  33121. {
  33122. return 'debug_formatter';
  33123. }
  33124. }
  33125. <?php
  33126. namespace Symfony\Component\Console\Helper;
  33127. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  33128. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  33129. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  33130. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33131. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33132. use Symfony\Component\Console\Output\OutputInterface;
  33133. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33134. class DescriptorHelper extends Helper
  33135. {
  33136. private $descriptors = array();
  33137. public function __construct()
  33138. {
  33139. $this
  33140. ->register('txt', new TextDescriptor())
  33141. ->register('xml', new XmlDescriptor())
  33142. ->register('json', new JsonDescriptor())
  33143. ->register('md', new MarkdownDescriptor())
  33144. ;
  33145. }
  33146. public function describe(OutputInterface $output, $object, array $options = array())
  33147. {
  33148. $options = array_merge(array(
  33149. 'raw_text' => false,
  33150. 'format' => 'txt',
  33151. ), $options);
  33152. if (!isset($this->descriptors[$options['format']])) {
  33153. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  33154. }
  33155. $descriptor = $this->descriptors[$options['format']];
  33156. $descriptor->describe($output, $object, $options);
  33157. }
  33158. public function register($format, DescriptorInterface $descriptor)
  33159. {
  33160. $this->descriptors[$format] = $descriptor;
  33161. return $this;
  33162. }
  33163. public function getName()
  33164. {
  33165. return 'descriptor';
  33166. }
  33167. }
  33168. <?php
  33169. namespace Symfony\Component\Console\Helper;
  33170. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33171. use Symfony\Component\Console\Exception\RuntimeException;
  33172. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33173. use Symfony\Component\Console\Output\OutputInterface;
  33174. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  33175. class DialogHelper extends InputAwareHelper
  33176. {
  33177. private $inputStream;
  33178. private static $shell;
  33179. private static $stty;
  33180. public function __construct($triggerDeprecationError = true)
  33181. {
  33182. if ($triggerDeprecationError) {
  33183. @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);
  33184. }
  33185. }
  33186. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  33187. {
  33188. if ($output instanceof ConsoleOutputInterface) {
  33189. $output = $output->getErrorOutput();
  33190. }
  33191. $width = max(array_map('strlen', array_keys($choices)));
  33192. $messages = (array) $question;
  33193. foreach ($choices as $key => $value) {
  33194. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  33195. }
  33196. $output->writeln($messages);
  33197. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  33198. $selectedChoices = str_replace(' ', '', $picked);
  33199. if ($multiselect) {
  33200. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  33201. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  33202. }
  33203. $selectedChoices = explode(',', $selectedChoices);
  33204. } else {
  33205. $selectedChoices = array($picked);
  33206. }
  33207. $multiselectChoices = array();
  33208. foreach ($selectedChoices as $value) {
  33209. if (empty($choices[$value])) {
  33210. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  33211. }
  33212. $multiselectChoices[] = $value;
  33213. }
  33214. if ($multiselect) {
  33215. return $multiselectChoices;
  33216. }
  33217. return $picked;
  33218. }, $attempts, $default);
  33219. return $result;
  33220. }
  33221. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  33222. {
  33223. if ($this->input && !$this->input->isInteractive()) {
  33224. return $default;
  33225. }
  33226. if ($output instanceof ConsoleOutputInterface) {
  33227. $output = $output->getErrorOutput();
  33228. }
  33229. $output->write($question);
  33230. $inputStream = $this->inputStream ?: STDIN;
  33231. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  33232. $ret = fgets($inputStream, 4096);
  33233. if (false === $ret) {
  33234. throw new RuntimeException('Aborted');
  33235. }
  33236. $ret = trim($ret);
  33237. } else {
  33238. $ret = '';
  33239. $i = 0;
  33240. $ofs = -1;
  33241. $matches = $autocomplete;
  33242. $numMatches = count($matches);
  33243. $sttyMode = shell_exec('stty -g');
  33244. shell_exec('stty -icanon -echo');
  33245. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  33246. while (!feof($inputStream)) {
  33247. $c = fread($inputStream, 1);
  33248. if ("\177" === $c) {
  33249. if (0 === $numMatches && 0 !== $i) {
  33250. --$i;
  33251. $output->write("\033[1D");
  33252. }
  33253. if (0 === $i) {
  33254. $ofs = -1;
  33255. $matches = $autocomplete;
  33256. $numMatches = count($matches);
  33257. } else {
  33258. $numMatches = 0;
  33259. }
  33260. $ret = substr($ret, 0, $i);
  33261. } elseif ("\033" === $c) {
  33262. $c .= fread($inputStream, 2);
  33263. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  33264. if ('A' === $c[2] && -1 === $ofs) {
  33265. $ofs = 0;
  33266. }
  33267. if (0 === $numMatches) {
  33268. continue;
  33269. }
  33270. $ofs += ('A' === $c[2]) ? -1 : 1;
  33271. $ofs = ($numMatches + $ofs) % $numMatches;
  33272. }
  33273. } elseif (ord($c) < 32) {
  33274. if ("\t" === $c || "\n" === $c) {
  33275. if ($numMatches > 0 && -1 !== $ofs) {
  33276. $ret = $matches[$ofs];
  33277. $output->write(substr($ret, $i));
  33278. $i = strlen($ret);
  33279. }
  33280. if ("\n" === $c) {
  33281. $output->write($c);
  33282. break;
  33283. }
  33284. $numMatches = 0;
  33285. }
  33286. continue;
  33287. } else {
  33288. $output->write($c);
  33289. $ret .= $c;
  33290. ++$i;
  33291. $numMatches = 0;
  33292. $ofs = 0;
  33293. foreach ($autocomplete as $value) {
  33294. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  33295. $matches[$numMatches++] = $value;
  33296. }
  33297. }
  33298. }
  33299. $output->write("\033[K");
  33300. if ($numMatches > 0 && -1 !== $ofs) {
  33301. $output->write("\0337");
  33302. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  33303. $output->write("\0338");
  33304. }
  33305. }
  33306. shell_exec(sprintf('stty %s', $sttyMode));
  33307. }
  33308. return strlen($ret) > 0 ? $ret : $default;
  33309. }
  33310. public function askConfirmation(OutputInterface $output, $question, $default = true)
  33311. {
  33312. $answer = 'z';
  33313. while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) {
  33314. $answer = $this->ask($output, $question);
  33315. }
  33316. if (false === $default) {
  33317. return $answer && 'y' == strtolower($answer[0]);
  33318. }
  33319. return !$answer || 'y' == strtolower($answer[0]);
  33320. }
  33321. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  33322. {
  33323. if ($output instanceof ConsoleOutputInterface) {
  33324. $output = $output->getErrorOutput();
  33325. }
  33326. if ('\\' === DIRECTORY_SEPARATOR) {
  33327. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  33328. if ('phar:' === substr(__FILE__, 0, 5)) {
  33329. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  33330. copy($exe, $tmpExe);
  33331. $exe = $tmpExe;
  33332. }
  33333. $output->write($question);
  33334. $value = rtrim(shell_exec($exe));
  33335. $output->writeln('');
  33336. if (isset($tmpExe)) {
  33337. unlink($tmpExe);
  33338. }
  33339. return $value;
  33340. }
  33341. if ($this->hasSttyAvailable()) {
  33342. $output->write($question);
  33343. $sttyMode = shell_exec('stty -g');
  33344. shell_exec('stty -echo');
  33345. $value = fgets($this->inputStream ?: STDIN, 4096);
  33346. shell_exec(sprintf('stty %s', $sttyMode));
  33347. if (false === $value) {
  33348. throw new RuntimeException('Aborted');
  33349. }
  33350. $value = trim($value);
  33351. $output->writeln('');
  33352. return $value;
  33353. }
  33354. if (false !== $shell = $this->getShell()) {
  33355. $output->write($question);
  33356. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  33357. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  33358. $value = rtrim(shell_exec($command));
  33359. $output->writeln('');
  33360. return $value;
  33361. }
  33362. if ($fallback) {
  33363. return $this->ask($output, $question);
  33364. }
  33365. throw new RuntimeException('Unable to hide the response');
  33366. }
  33367. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  33368. {
  33369. $that = $this;
  33370. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  33371. return $that->ask($output, $question, $default, $autocomplete);
  33372. };
  33373. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  33374. }
  33375. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  33376. {
  33377. $that = $this;
  33378. $interviewer = function () use ($output, $question, $fallback, $that) {
  33379. return $that->askHiddenResponse($output, $question, $fallback);
  33380. };
  33381. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  33382. }
  33383. public function setInputStream($stream)
  33384. {
  33385. $this->inputStream = $stream;
  33386. }
  33387. public function getInputStream()
  33388. {
  33389. return $this->inputStream;
  33390. }
  33391. public function getName()
  33392. {
  33393. return 'dialog';
  33394. }
  33395. private function getShell()
  33396. {
  33397. if (null !== self::$shell) {
  33398. return self::$shell;
  33399. }
  33400. self::$shell = false;
  33401. if (file_exists('/usr/bin/env')) {
  33402. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  33403. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  33404. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  33405. self::$shell = $sh;
  33406. break;
  33407. }
  33408. }
  33409. }
  33410. return self::$shell;
  33411. }
  33412. private function hasSttyAvailable()
  33413. {
  33414. if (null !== self::$stty) {
  33415. return self::$stty;
  33416. }
  33417. exec('stty 2>&1', $output, $exitcode);
  33418. return self::$stty = 0 === $exitcode;
  33419. }
  33420. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  33421. {
  33422. if ($output instanceof ConsoleOutputInterface) {
  33423. $output = $output->getErrorOutput();
  33424. }
  33425. $e = null;
  33426. while (false === $attempts || $attempts--) {
  33427. if (null !== $e) {
  33428. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  33429. }
  33430. try {
  33431. return call_user_func($validator, $interviewer());
  33432. } catch (\Exception $e) {
  33433. }
  33434. }
  33435. throw $e;
  33436. }
  33437. }
  33438. <?php
  33439. namespace Symfony\Component\Console\Helper;
  33440. use Symfony\Component\Console\Formatter\OutputFormatter;
  33441. class FormatterHelper extends Helper
  33442. {
  33443. public function formatSection($section, $message, $style = 'info')
  33444. {
  33445. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  33446. }
  33447. public function formatBlock($messages, $style, $large = false)
  33448. {
  33449. if (!is_array($messages)) {
  33450. $messages = array($messages);
  33451. }
  33452. $len = 0;
  33453. $lines = array();
  33454. foreach ($messages as $message) {
  33455. $message = OutputFormatter::escape($message);
  33456. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  33457. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  33458. }
  33459. $messages = $large ? array(str_repeat(' ', $len)) : array();
  33460. for ($i = 0; isset($lines[$i]); ++$i) {
  33461. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  33462. }
  33463. if ($large) {
  33464. $messages[] = str_repeat(' ', $len);
  33465. }
  33466. for ($i = 0; isset($messages[$i]); ++$i) {
  33467. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  33468. }
  33469. return implode("\n", $messages);
  33470. }
  33471. public function getName()
  33472. {
  33473. return 'formatter';
  33474. }
  33475. }
  33476. <?php
  33477. namespace Symfony\Component\Console\Helper;
  33478. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  33479. abstract class Helper implements HelperInterface
  33480. {
  33481. protected $helperSet = null;
  33482. public function setHelperSet(HelperSet $helperSet = null)
  33483. {
  33484. $this->helperSet = $helperSet;
  33485. }
  33486. public function getHelperSet()
  33487. {
  33488. return $this->helperSet;
  33489. }
  33490. public static function strlen($string)
  33491. {
  33492. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  33493. return strlen($string);
  33494. }
  33495. return mb_strwidth($string, $encoding);
  33496. }
  33497. public static function formatTime($secs)
  33498. {
  33499. static $timeFormats = array(
  33500. array(0, '< 1 sec'),
  33501. array(1, '1 sec'),
  33502. array(2, 'secs', 1),
  33503. array(60, '1 min'),
  33504. array(120, 'mins', 60),
  33505. array(3600, '1 hr'),
  33506. array(7200, 'hrs', 3600),
  33507. array(86400, '1 day'),
  33508. array(172800, 'days', 86400),
  33509. );
  33510. foreach ($timeFormats as $index => $format) {
  33511. if ($secs >= $format[0]) {
  33512. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  33513. || $index == count($timeFormats) - 1
  33514. ) {
  33515. if (2 == count($format)) {
  33516. return $format[1];
  33517. }
  33518. return floor($secs / $format[2]).' '.$format[1];
  33519. }
  33520. }
  33521. }
  33522. }
  33523. public static function formatMemory($memory)
  33524. {
  33525. if ($memory >= 1024 * 1024 * 1024) {
  33526. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  33527. }
  33528. if ($memory >= 1024 * 1024) {
  33529. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  33530. }
  33531. if ($memory >= 1024) {
  33532. return sprintf('%d KiB', $memory / 1024);
  33533. }
  33534. return sprintf('%d B', $memory);
  33535. }
  33536. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  33537. {
  33538. return self::strlen(self::removeDecoration($formatter, $string));
  33539. }
  33540. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  33541. {
  33542. $isDecorated = $formatter->isDecorated();
  33543. $formatter->setDecorated(false);
  33544. $string = $formatter->format($string);
  33545. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  33546. $formatter->setDecorated($isDecorated);
  33547. return $string;
  33548. }
  33549. }
  33550. <?php
  33551. namespace Symfony\Component\Console\Helper;
  33552. interface HelperInterface
  33553. {
  33554. public function setHelperSet(HelperSet $helperSet = null);
  33555. public function getHelperSet();
  33556. public function getName();
  33557. }
  33558. <?php
  33559. namespace Symfony\Component\Console\Helper;
  33560. use Symfony\Component\Console\Command\Command;
  33561. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33562. class HelperSet implements \IteratorAggregate
  33563. {
  33564. private $helpers = array();
  33565. private $command;
  33566. public function __construct(array $helpers = array())
  33567. {
  33568. foreach ($helpers as $alias => $helper) {
  33569. $this->set($helper, is_int($alias) ? null : $alias);
  33570. }
  33571. }
  33572. public function set(HelperInterface $helper, $alias = null)
  33573. {
  33574. $this->helpers[$helper->getName()] = $helper;
  33575. if (null !== $alias) {
  33576. $this->helpers[$alias] = $helper;
  33577. }
  33578. $helper->setHelperSet($this);
  33579. }
  33580. public function has($name)
  33581. {
  33582. return isset($this->helpers[$name]);
  33583. }
  33584. public function get($name)
  33585. {
  33586. if (!$this->has($name)) {
  33587. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  33588. }
  33589. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  33590. @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);
  33591. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  33592. @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);
  33593. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  33594. @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);
  33595. }
  33596. return $this->helpers[$name];
  33597. }
  33598. public function setCommand(Command $command = null)
  33599. {
  33600. $this->command = $command;
  33601. }
  33602. public function getCommand()
  33603. {
  33604. return $this->command;
  33605. }
  33606. public function getIterator()
  33607. {
  33608. return new \ArrayIterator($this->helpers);
  33609. }
  33610. }
  33611. <?php
  33612. namespace Symfony\Component\Console\Helper;
  33613. use Symfony\Component\Console\Input\InputInterface;
  33614. use Symfony\Component\Console\Input\InputAwareInterface;
  33615. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  33616. {
  33617. protected $input;
  33618. public function setInput(InputInterface $input)
  33619. {
  33620. $this->input = $input;
  33621. }
  33622. }
  33623. <?php
  33624. namespace Symfony\Component\Console\Helper;
  33625. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33626. use Symfony\Component\Console\Output\OutputInterface;
  33627. use Symfony\Component\Process\Exception\ProcessFailedException;
  33628. use Symfony\Component\Process\Process;
  33629. use Symfony\Component\Process\ProcessBuilder;
  33630. class ProcessHelper extends Helper
  33631. {
  33632. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  33633. {
  33634. if ($output instanceof ConsoleOutputInterface) {
  33635. $output = $output->getErrorOutput();
  33636. }
  33637. $formatter = $this->getHelperSet()->get('debug_formatter');
  33638. if (is_array($cmd)) {
  33639. $process = ProcessBuilder::create($cmd)->getProcess();
  33640. } elseif ($cmd instanceof Process) {
  33641. $process = $cmd;
  33642. } else {
  33643. $process = new Process($cmd);
  33644. }
  33645. if ($verbosity <= $output->getVerbosity()) {
  33646. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  33647. }
  33648. if ($output->isDebug()) {
  33649. $callback = $this->wrapCallback($output, $process, $callback);
  33650. }
  33651. $process->run($callback);
  33652. if ($verbosity <= $output->getVerbosity()) {
  33653. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  33654. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  33655. }
  33656. if (!$process->isSuccessful() && null !== $error) {
  33657. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  33658. }
  33659. return $process;
  33660. }
  33661. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  33662. {
  33663. $process = $this->run($output, $cmd, $error, $callback);
  33664. if (!$process->isSuccessful()) {
  33665. throw new ProcessFailedException($process);
  33666. }
  33667. return $process;
  33668. }
  33669. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  33670. {
  33671. if ($output instanceof ConsoleOutputInterface) {
  33672. $output = $output->getErrorOutput();
  33673. }
  33674. $formatter = $this->getHelperSet()->get('debug_formatter');
  33675. $that = $this;
  33676. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  33677. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  33678. if (null !== $callback) {
  33679. call_user_func($callback, $type, $buffer);
  33680. }
  33681. };
  33682. }
  33683. public function escapeString($str)
  33684. {
  33685. return str_replace('<', '\\<', $str);
  33686. }
  33687. public function getName()
  33688. {
  33689. return 'process';
  33690. }
  33691. }
  33692. <?php
  33693. namespace Symfony\Component\Console\Helper;
  33694. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33695. use Symfony\Component\Console\Output\OutputInterface;
  33696. use Symfony\Component\Console\Exception\LogicException;
  33697. class ProgressBar
  33698. {
  33699. private $barWidth = 28;
  33700. private $barChar;
  33701. private $emptyBarChar = '-';
  33702. private $progressChar = '>';
  33703. private $format;
  33704. private $internalFormat;
  33705. private $redrawFreq = 1;
  33706. private $output;
  33707. private $step = 0;
  33708. private $max;
  33709. private $startTime;
  33710. private $stepWidth;
  33711. private $percent = 0.0;
  33712. private $formatLineCount;
  33713. private $messages = array();
  33714. private $overwrite = true;
  33715. private $firstRun = true;
  33716. private static $formatters;
  33717. private static $formats;
  33718. public function __construct(OutputInterface $output, $max = 0)
  33719. {
  33720. if ($output instanceof ConsoleOutputInterface) {
  33721. $output = $output->getErrorOutput();
  33722. }
  33723. $this->output = $output;
  33724. $this->setMaxSteps($max);
  33725. if (!$this->output->isDecorated()) {
  33726. $this->overwrite = false;
  33727. $this->setRedrawFrequency($max / 10);
  33728. }
  33729. $this->startTime = time();
  33730. }
  33731. public static function setPlaceholderFormatterDefinition($name, $callable)
  33732. {
  33733. if (!self::$formatters) {
  33734. self::$formatters = self::initPlaceholderFormatters();
  33735. }
  33736. self::$formatters[$name] = $callable;
  33737. }
  33738. public static function getPlaceholderFormatterDefinition($name)
  33739. {
  33740. if (!self::$formatters) {
  33741. self::$formatters = self::initPlaceholderFormatters();
  33742. }
  33743. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  33744. }
  33745. public static function setFormatDefinition($name, $format)
  33746. {
  33747. if (!self::$formats) {
  33748. self::$formats = self::initFormats();
  33749. }
  33750. self::$formats[$name] = $format;
  33751. }
  33752. public static function getFormatDefinition($name)
  33753. {
  33754. if (!self::$formats) {
  33755. self::$formats = self::initFormats();
  33756. }
  33757. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  33758. }
  33759. public function setMessage($message, $name = 'message')
  33760. {
  33761. $this->messages[$name] = $message;
  33762. }
  33763. public function getMessage($name = 'message')
  33764. {
  33765. return $this->messages[$name];
  33766. }
  33767. public function getStartTime()
  33768. {
  33769. return $this->startTime;
  33770. }
  33771. public function getMaxSteps()
  33772. {
  33773. return $this->max;
  33774. }
  33775. public function getStep()
  33776. {
  33777. @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);
  33778. return $this->getProgress();
  33779. }
  33780. public function getProgress()
  33781. {
  33782. return $this->step;
  33783. }
  33784. public function getStepWidth()
  33785. {
  33786. return $this->stepWidth;
  33787. }
  33788. public function getProgressPercent()
  33789. {
  33790. return $this->percent;
  33791. }
  33792. public function setBarWidth($size)
  33793. {
  33794. $this->barWidth = (int) $size;
  33795. }
  33796. public function getBarWidth()
  33797. {
  33798. return $this->barWidth;
  33799. }
  33800. public function setBarCharacter($char)
  33801. {
  33802. $this->barChar = $char;
  33803. }
  33804. public function getBarCharacter()
  33805. {
  33806. if (null === $this->barChar) {
  33807. return $this->max ? '=' : $this->emptyBarChar;
  33808. }
  33809. return $this->barChar;
  33810. }
  33811. public function setEmptyBarCharacter($char)
  33812. {
  33813. $this->emptyBarChar = $char;
  33814. }
  33815. public function getEmptyBarCharacter()
  33816. {
  33817. return $this->emptyBarChar;
  33818. }
  33819. public function setProgressCharacter($char)
  33820. {
  33821. $this->progressChar = $char;
  33822. }
  33823. public function getProgressCharacter()
  33824. {
  33825. return $this->progressChar;
  33826. }
  33827. public function setFormat($format)
  33828. {
  33829. $this->format = null;
  33830. $this->internalFormat = $format;
  33831. }
  33832. public function setRedrawFrequency($freq)
  33833. {
  33834. $this->redrawFreq = max((int) $freq, 1);
  33835. }
  33836. public function start($max = null)
  33837. {
  33838. $this->startTime = time();
  33839. $this->step = 0;
  33840. $this->percent = 0.0;
  33841. if (null !== $max) {
  33842. $this->setMaxSteps($max);
  33843. }
  33844. $this->display();
  33845. }
  33846. public function advance($step = 1)
  33847. {
  33848. $this->setProgress($this->step + $step);
  33849. }
  33850. public function setCurrent($step)
  33851. {
  33852. @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);
  33853. $this->setProgress($step);
  33854. }
  33855. public function setOverwrite($overwrite)
  33856. {
  33857. $this->overwrite = (bool) $overwrite;
  33858. }
  33859. public function setProgress($step)
  33860. {
  33861. $step = (int) $step;
  33862. if ($step < $this->step) {
  33863. throw new LogicException('You can\'t regress the progress bar.');
  33864. }
  33865. if ($this->max && $step > $this->max) {
  33866. $this->max = $step;
  33867. }
  33868. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  33869. $currPeriod = (int) ($step / $this->redrawFreq);
  33870. $this->step = $step;
  33871. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  33872. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  33873. $this->display();
  33874. }
  33875. }
  33876. public function finish()
  33877. {
  33878. if (!$this->max) {
  33879. $this->max = $this->step;
  33880. }
  33881. if ($this->step === $this->max && !$this->overwrite) {
  33882. return;
  33883. }
  33884. $this->setProgress($this->max);
  33885. }
  33886. public function display()
  33887. {
  33888. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  33889. return;
  33890. }
  33891. if (null === $this->format) {
  33892. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  33893. }
  33894. $self = $this;
  33895. $output = $this->output;
  33896. $messages = $this->messages;
  33897. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  33898. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  33899. $text = call_user_func($formatter, $self, $output);
  33900. } elseif (isset($messages[$matches[1]])) {
  33901. $text = $messages[$matches[1]];
  33902. } else {
  33903. return $matches[0];
  33904. }
  33905. if (isset($matches[2])) {
  33906. $text = sprintf('%'.$matches[2], $text);
  33907. }
  33908. return $text;
  33909. }, $this->format));
  33910. }
  33911. public function clear()
  33912. {
  33913. if (!$this->overwrite) {
  33914. return;
  33915. }
  33916. if (null === $this->format) {
  33917. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  33918. }
  33919. $this->overwrite('');
  33920. }
  33921. private function setRealFormat($format)
  33922. {
  33923. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  33924. $this->format = self::getFormatDefinition($format.'_nomax');
  33925. } elseif (null !== self::getFormatDefinition($format)) {
  33926. $this->format = self::getFormatDefinition($format);
  33927. } else {
  33928. $this->format = $format;
  33929. }
  33930. $this->formatLineCount = substr_count($this->format, "\n");
  33931. }
  33932. private function setMaxSteps($max)
  33933. {
  33934. $this->max = max(0, (int) $max);
  33935. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  33936. }
  33937. private function overwrite($message)
  33938. {
  33939. if ($this->overwrite) {
  33940. if (!$this->firstRun) {
  33941. $this->output->write("\x0D");
  33942. $this->output->write("\x1B[2K");
  33943. if ($this->formatLineCount > 0) {
  33944. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  33945. }
  33946. }
  33947. } elseif ($this->step > 0) {
  33948. $this->output->writeln('');
  33949. }
  33950. $this->firstRun = false;
  33951. $this->output->write($message);
  33952. }
  33953. private function determineBestFormat()
  33954. {
  33955. switch ($this->output->getVerbosity()) {
  33956. case OutputInterface::VERBOSITY_VERBOSE:
  33957. return $this->max ? 'verbose' : 'verbose_nomax';
  33958. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  33959. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  33960. case OutputInterface::VERBOSITY_DEBUG:
  33961. return $this->max ? 'debug' : 'debug_nomax';
  33962. default:
  33963. return $this->max ? 'normal' : 'normal_nomax';
  33964. }
  33965. }
  33966. private static function initPlaceholderFormatters()
  33967. {
  33968. return array(
  33969. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  33970. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  33971. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  33972. if ($completeBars < $bar->getBarWidth()) {
  33973. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  33974. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  33975. }
  33976. return $display;
  33977. },
  33978. 'elapsed' => function (ProgressBar $bar) {
  33979. return Helper::formatTime(time() - $bar->getStartTime());
  33980. },
  33981. 'remaining' => function (ProgressBar $bar) {
  33982. if (!$bar->getMaxSteps()) {
  33983. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  33984. }
  33985. if (!$bar->getProgress()) {
  33986. $remaining = 0;
  33987. } else {
  33988. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  33989. }
  33990. return Helper::formatTime($remaining);
  33991. },
  33992. 'estimated' => function (ProgressBar $bar) {
  33993. if (!$bar->getMaxSteps()) {
  33994. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  33995. }
  33996. if (!$bar->getProgress()) {
  33997. $estimated = 0;
  33998. } else {
  33999. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  34000. }
  34001. return Helper::formatTime($estimated);
  34002. },
  34003. 'memory' => function (ProgressBar $bar) {
  34004. return Helper::formatMemory(memory_get_usage(true));
  34005. },
  34006. 'current' => function (ProgressBar $bar) {
  34007. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  34008. },
  34009. 'max' => function (ProgressBar $bar) {
  34010. return $bar->getMaxSteps();
  34011. },
  34012. 'percent' => function (ProgressBar $bar) {
  34013. return floor($bar->getProgressPercent() * 100);
  34014. },
  34015. );
  34016. }
  34017. private static function initFormats()
  34018. {
  34019. return array(
  34020. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  34021. 'normal_nomax' => ' %current% [%bar%]',
  34022. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  34023. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  34024. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  34025. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  34026. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  34027. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  34028. );
  34029. }
  34030. }
  34031. <?php
  34032. namespace Symfony\Component\Console\Helper;
  34033. use Symfony\Component\Console\Output\NullOutput;
  34034. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34035. use Symfony\Component\Console\Output\OutputInterface;
  34036. use Symfony\Component\Console\Exception\LogicException;
  34037. class ProgressHelper extends Helper
  34038. {
  34039. const FORMAT_QUIET = ' %percent%%';
  34040. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  34041. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  34042. const FORMAT_QUIET_NOMAX = ' %current%';
  34043. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  34044. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  34045. private $barWidth = 28;
  34046. private $barChar = '=';
  34047. private $emptyBarChar = '-';
  34048. private $progressChar = '>';
  34049. private $format = null;
  34050. private $redrawFreq = 1;
  34051. private $lastMessagesLength;
  34052. private $barCharOriginal;
  34053. private $output;
  34054. private $current;
  34055. private $max;
  34056. private $startTime;
  34057. private $defaultFormatVars = array(
  34058. 'current',
  34059. 'max',
  34060. 'bar',
  34061. 'percent',
  34062. 'elapsed',
  34063. );
  34064. private $formatVars;
  34065. private $widths = array(
  34066. 'current' => 4,
  34067. 'max' => 4,
  34068. 'percent' => 3,
  34069. 'elapsed' => 6,
  34070. );
  34071. private $timeFormats = array(
  34072. array(0, '???'),
  34073. array(2, '1 sec'),
  34074. array(59, 'secs', 1),
  34075. array(60, '1 min'),
  34076. array(3600, 'mins', 60),
  34077. array(5400, '1 hr'),
  34078. array(86400, 'hrs', 3600),
  34079. array(129600, '1 day'),
  34080. array(604800, 'days', 86400),
  34081. );
  34082. public function __construct($triggerDeprecationError = true)
  34083. {
  34084. if ($triggerDeprecationError) {
  34085. @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);
  34086. }
  34087. }
  34088. public function setBarWidth($size)
  34089. {
  34090. $this->barWidth = (int) $size;
  34091. }
  34092. public function setBarCharacter($char)
  34093. {
  34094. $this->barChar = $char;
  34095. }
  34096. public function setEmptyBarCharacter($char)
  34097. {
  34098. $this->emptyBarChar = $char;
  34099. }
  34100. public function setProgressCharacter($char)
  34101. {
  34102. $this->progressChar = $char;
  34103. }
  34104. public function setFormat($format)
  34105. {
  34106. $this->format = $format;
  34107. }
  34108. public function setRedrawFrequency($freq)
  34109. {
  34110. $this->redrawFreq = (int) $freq;
  34111. }
  34112. public function start(OutputInterface $output, $max = null)
  34113. {
  34114. if ($output instanceof ConsoleOutputInterface) {
  34115. $output = $output->getErrorOutput();
  34116. }
  34117. $this->startTime = time();
  34118. $this->current = 0;
  34119. $this->max = (int) $max;
  34120. $this->output = $output->isDecorated() ? $output : new NullOutput();
  34121. $this->lastMessagesLength = 0;
  34122. $this->barCharOriginal = '';
  34123. if (null === $this->format) {
  34124. switch ($output->getVerbosity()) {
  34125. case OutputInterface::VERBOSITY_QUIET:
  34126. $this->format = self::FORMAT_QUIET_NOMAX;
  34127. if ($this->max > 0) {
  34128. $this->format = self::FORMAT_QUIET;
  34129. }
  34130. break;
  34131. case OutputInterface::VERBOSITY_VERBOSE:
  34132. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34133. case OutputInterface::VERBOSITY_DEBUG:
  34134. $this->format = self::FORMAT_VERBOSE_NOMAX;
  34135. if ($this->max > 0) {
  34136. $this->format = self::FORMAT_VERBOSE;
  34137. }
  34138. break;
  34139. default:
  34140. $this->format = self::FORMAT_NORMAL_NOMAX;
  34141. if ($this->max > 0) {
  34142. $this->format = self::FORMAT_NORMAL;
  34143. }
  34144. break;
  34145. }
  34146. }
  34147. $this->initialize();
  34148. }
  34149. public function advance($step = 1, $redraw = false)
  34150. {
  34151. $this->setCurrent($this->current + $step, $redraw);
  34152. }
  34153. public function setCurrent($current, $redraw = false)
  34154. {
  34155. if (null === $this->startTime) {
  34156. throw new LogicException('You must start the progress bar before calling setCurrent().');
  34157. }
  34158. $current = (int) $current;
  34159. if ($current < $this->current) {
  34160. throw new LogicException('You can\'t regress the progress bar');
  34161. }
  34162. if (0 === $this->current) {
  34163. $redraw = true;
  34164. }
  34165. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  34166. $this->current = $current;
  34167. $currPeriod = (int) ($this->current / $this->redrawFreq);
  34168. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  34169. $this->display();
  34170. }
  34171. }
  34172. public function display($finish = false)
  34173. {
  34174. if (null === $this->startTime) {
  34175. throw new LogicException('You must start the progress bar before calling display().');
  34176. }
  34177. $message = $this->format;
  34178. foreach ($this->generate($finish) as $name => $value) {
  34179. $message = str_replace("%{$name}%", $value, $message);
  34180. }
  34181. $this->overwrite($this->output, $message);
  34182. }
  34183. public function clear()
  34184. {
  34185. $this->overwrite($this->output, '');
  34186. }
  34187. public function finish()
  34188. {
  34189. if (null === $this->startTime) {
  34190. throw new LogicException('You must start the progress bar before calling finish().');
  34191. }
  34192. if (null !== $this->startTime) {
  34193. if (!$this->max) {
  34194. $this->barChar = $this->barCharOriginal;
  34195. $this->display(true);
  34196. }
  34197. $this->startTime = null;
  34198. $this->output->writeln('');
  34199. $this->output = null;
  34200. }
  34201. }
  34202. private function initialize()
  34203. {
  34204. $this->formatVars = array();
  34205. foreach ($this->defaultFormatVars as $var) {
  34206. if (false !== strpos($this->format, "%{$var}%")) {
  34207. $this->formatVars[$var] = true;
  34208. }
  34209. }
  34210. if ($this->max > 0) {
  34211. $this->widths['max'] = $this->strlen($this->max);
  34212. $this->widths['current'] = $this->widths['max'];
  34213. } else {
  34214. $this->barCharOriginal = $this->barChar;
  34215. $this->barChar = $this->emptyBarChar;
  34216. }
  34217. }
  34218. private function generate($finish = false)
  34219. {
  34220. $vars = array();
  34221. $percent = 0;
  34222. if ($this->max > 0) {
  34223. $percent = (float) $this->current / $this->max;
  34224. }
  34225. if (isset($this->formatVars['bar'])) {
  34226. if ($this->max > 0) {
  34227. $completeBars = floor($percent * $this->barWidth);
  34228. } else {
  34229. if (!$finish) {
  34230. $completeBars = floor($this->current % $this->barWidth);
  34231. } else {
  34232. $completeBars = $this->barWidth;
  34233. }
  34234. }
  34235. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  34236. $bar = str_repeat($this->barChar, $completeBars);
  34237. if ($completeBars < $this->barWidth) {
  34238. $bar .= $this->progressChar;
  34239. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  34240. }
  34241. $vars['bar'] = $bar;
  34242. }
  34243. if (isset($this->formatVars['elapsed'])) {
  34244. $elapsed = time() - $this->startTime;
  34245. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  34246. }
  34247. if (isset($this->formatVars['current'])) {
  34248. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  34249. }
  34250. if (isset($this->formatVars['max'])) {
  34251. $vars['max'] = $this->max;
  34252. }
  34253. if (isset($this->formatVars['percent'])) {
  34254. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  34255. }
  34256. return $vars;
  34257. }
  34258. private function humaneTime($secs)
  34259. {
  34260. $text = '';
  34261. foreach ($this->timeFormats as $format) {
  34262. if ($secs < $format[0]) {
  34263. if (2 == count($format)) {
  34264. $text = $format[1];
  34265. break;
  34266. } else {
  34267. $text = ceil($secs / $format[2]).' '.$format[1];
  34268. break;
  34269. }
  34270. }
  34271. }
  34272. return $text;
  34273. }
  34274. private function overwrite(OutputInterface $output, $message)
  34275. {
  34276. $length = $this->strlen($message);
  34277. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  34278. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  34279. }
  34280. $output->write("\x0D");
  34281. $output->write($message);
  34282. $this->lastMessagesLength = $this->strlen($message);
  34283. }
  34284. public function getName()
  34285. {
  34286. return 'progress';
  34287. }
  34288. }
  34289. <?php
  34290. namespace Symfony\Component\Console\Helper;
  34291. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34292. use Symfony\Component\Console\Exception\LogicException;
  34293. use Symfony\Component\Console\Output\OutputInterface;
  34294. class ProgressIndicator
  34295. {
  34296. private $output;
  34297. private $startTime;
  34298. private $format;
  34299. private $message;
  34300. private $indicatorValues;
  34301. private $indicatorCurrent;
  34302. private $indicatorChangeInterval;
  34303. private $indicatorUpdateTime;
  34304. private $started = false;
  34305. private static $formatters;
  34306. private static $formats;
  34307. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  34308. {
  34309. $this->output = $output;
  34310. if (null === $format) {
  34311. $format = $this->determineBestFormat();
  34312. }
  34313. if (null === $indicatorValues) {
  34314. $indicatorValues = array('-', '\\', '|', '/');
  34315. }
  34316. $indicatorValues = array_values($indicatorValues);
  34317. if (2 > count($indicatorValues)) {
  34318. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  34319. }
  34320. $this->format = self::getFormatDefinition($format);
  34321. $this->indicatorChangeInterval = $indicatorChangeInterval;
  34322. $this->indicatorValues = $indicatorValues;
  34323. $this->startTime = time();
  34324. }
  34325. public function setMessage($message)
  34326. {
  34327. $this->message = $message;
  34328. $this->display();
  34329. }
  34330. public function getMessage()
  34331. {
  34332. return $this->message;
  34333. }
  34334. public function getStartTime()
  34335. {
  34336. return $this->startTime;
  34337. }
  34338. public function getCurrentValue()
  34339. {
  34340. return $this->indicatorValues[$this->indicatorCurrent % count($this->indicatorValues)];
  34341. }
  34342. public function start($message)
  34343. {
  34344. if ($this->started) {
  34345. throw new LogicException('Progress indicator already started.');
  34346. }
  34347. $this->message = $message;
  34348. $this->started = true;
  34349. $this->startTime = time();
  34350. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  34351. $this->indicatorCurrent = 0;
  34352. $this->display();
  34353. }
  34354. public function advance()
  34355. {
  34356. if (!$this->started) {
  34357. throw new LogicException('Progress indicator has not yet been started.');
  34358. }
  34359. if (!$this->output->isDecorated()) {
  34360. return;
  34361. }
  34362. $currentTime = $this->getCurrentTimeInMilliseconds();
  34363. if ($currentTime < $this->indicatorUpdateTime) {
  34364. return;
  34365. }
  34366. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  34367. ++$this->indicatorCurrent;
  34368. $this->display();
  34369. }
  34370. public function finish($message)
  34371. {
  34372. if (!$this->started) {
  34373. throw new LogicException('Progress indicator has not yet been started.');
  34374. }
  34375. $this->message = $message;
  34376. $this->display();
  34377. $this->output->writeln('');
  34378. $this->started = false;
  34379. }
  34380. public static function getFormatDefinition($name)
  34381. {
  34382. if (!self::$formats) {
  34383. self::$formats = self::initFormats();
  34384. }
  34385. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  34386. }
  34387. public static function setPlaceholderFormatterDefinition($name, $callable)
  34388. {
  34389. if (!self::$formatters) {
  34390. self::$formatters = self::initPlaceholderFormatters();
  34391. }
  34392. self::$formatters[$name] = $callable;
  34393. }
  34394. public static function getPlaceholderFormatterDefinition($name)
  34395. {
  34396. if (!self::$formatters) {
  34397. self::$formatters = self::initPlaceholderFormatters();
  34398. }
  34399. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  34400. }
  34401. private function display()
  34402. {
  34403. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  34404. return;
  34405. }
  34406. $self = $this;
  34407. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  34408. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  34409. return call_user_func($formatter, $self);
  34410. }
  34411. return $matches[0];
  34412. }, $this->format));
  34413. }
  34414. private function determineBestFormat()
  34415. {
  34416. switch ($this->output->getVerbosity()) {
  34417. case OutputInterface::VERBOSITY_VERBOSE:
  34418. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  34419. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34420. case OutputInterface::VERBOSITY_DEBUG:
  34421. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  34422. default:
  34423. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  34424. }
  34425. }
  34426. private function overwrite($message)
  34427. {
  34428. if ($this->output->isDecorated()) {
  34429. $this->output->write("\x0D\x1B[2K");
  34430. $this->output->write($message);
  34431. } else {
  34432. $this->output->writeln($message);
  34433. }
  34434. }
  34435. private function getCurrentTimeInMilliseconds()
  34436. {
  34437. return round(microtime(true) * 1000);
  34438. }
  34439. private static function initPlaceholderFormatters()
  34440. {
  34441. return array(
  34442. 'indicator' => function (ProgressIndicator $indicator) {
  34443. return $indicator->getCurrentValue();
  34444. },
  34445. 'message' => function (ProgressIndicator $indicator) {
  34446. return $indicator->getMessage();
  34447. },
  34448. 'elapsed' => function (ProgressIndicator $indicator) {
  34449. return Helper::formatTime(time() - $indicator->getStartTime());
  34450. },
  34451. 'memory' => function () {
  34452. return Helper::formatMemory(memory_get_usage(true));
  34453. },
  34454. );
  34455. }
  34456. private static function initFormats()
  34457. {
  34458. return array(
  34459. 'normal' => ' %indicator% %message%',
  34460. 'normal_no_ansi' => ' %message%',
  34461. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  34462. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  34463. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  34464. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  34465. );
  34466. }
  34467. }
  34468. <?php
  34469. namespace Symfony\Component\Console\Helper;
  34470. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34471. use Symfony\Component\Console\Exception\RuntimeException;
  34472. use Symfony\Component\Console\Formatter\OutputFormatter;
  34473. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  34474. use Symfony\Component\Console\Input\InputInterface;
  34475. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34476. use Symfony\Component\Console\Output\OutputInterface;
  34477. use Symfony\Component\Console\Question\Question;
  34478. use Symfony\Component\Console\Question\ChoiceQuestion;
  34479. class QuestionHelper extends Helper
  34480. {
  34481. private $inputStream;
  34482. private static $shell;
  34483. private static $stty;
  34484. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  34485. {
  34486. if ($output instanceof ConsoleOutputInterface) {
  34487. $output = $output->getErrorOutput();
  34488. }
  34489. if (!$input->isInteractive()) {
  34490. if ($question instanceof ChoiceQuestion) {
  34491. $choices = $question->getChoices();
  34492. return $choices[$question->getDefault()];
  34493. }
  34494. return $question->getDefault();
  34495. }
  34496. if (!$question->getValidator()) {
  34497. return $this->doAsk($output, $question);
  34498. }
  34499. $that = $this;
  34500. $interviewer = function () use ($output, $question, $that) {
  34501. return $that->doAsk($output, $question);
  34502. };
  34503. return $this->validateAttempts($interviewer, $output, $question);
  34504. }
  34505. public function setInputStream($stream)
  34506. {
  34507. if (!is_resource($stream)) {
  34508. throw new InvalidArgumentException('Input stream must be a valid resource.');
  34509. }
  34510. $this->inputStream = $stream;
  34511. }
  34512. public function getInputStream()
  34513. {
  34514. return $this->inputStream;
  34515. }
  34516. public function getName()
  34517. {
  34518. return 'question';
  34519. }
  34520. public function doAsk(OutputInterface $output, Question $question)
  34521. {
  34522. $this->writePrompt($output, $question);
  34523. $inputStream = $this->inputStream ?: STDIN;
  34524. $autocomplete = $question->getAutocompleterValues();
  34525. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  34526. $ret = false;
  34527. if ($question->isHidden()) {
  34528. try {
  34529. $ret = trim($this->getHiddenResponse($output, $inputStream));
  34530. } catch (RuntimeException $e) {
  34531. if (!$question->isHiddenFallback()) {
  34532. throw $e;
  34533. }
  34534. }
  34535. }
  34536. if (false === $ret) {
  34537. $ret = fgets($inputStream, 4096);
  34538. if (false === $ret) {
  34539. throw new RuntimeException('Aborted');
  34540. }
  34541. $ret = trim($ret);
  34542. }
  34543. } else {
  34544. $ret = trim($this->autocomplete($output, $question, $inputStream, is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  34545. }
  34546. $ret = strlen($ret) > 0 ? $ret : $question->getDefault();
  34547. if ($normalizer = $question->getNormalizer()) {
  34548. return $normalizer($ret);
  34549. }
  34550. return $ret;
  34551. }
  34552. protected function writePrompt(OutputInterface $output, Question $question)
  34553. {
  34554. $message = $question->getQuestion();
  34555. if ($question instanceof ChoiceQuestion) {
  34556. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  34557. $messages = (array) $question->getQuestion();
  34558. foreach ($question->getChoices() as $key => $value) {
  34559. $width = $maxWidth - $this->strlen($key);
  34560. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  34561. }
  34562. $output->writeln($messages);
  34563. $message = $question->getPrompt();
  34564. }
  34565. $output->write($message);
  34566. }
  34567. protected function writeError(OutputInterface $output, \Exception $error)
  34568. {
  34569. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  34570. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  34571. } else {
  34572. $message = '<error>'.$error->getMessage().'</error>';
  34573. }
  34574. $output->writeln($message);
  34575. }
  34576. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  34577. {
  34578. $ret = '';
  34579. $i = 0;
  34580. $ofs = -1;
  34581. $matches = $autocomplete;
  34582. $numMatches = count($matches);
  34583. $sttyMode = shell_exec('stty -g');
  34584. shell_exec('stty -icanon -echo');
  34585. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  34586. while (!feof($inputStream)) {
  34587. $c = fread($inputStream, 1);
  34588. if ("\177" === $c) {
  34589. if (0 === $numMatches && 0 !== $i) {
  34590. --$i;
  34591. $output->write("\033[1D");
  34592. }
  34593. if (0 === $i) {
  34594. $ofs = -1;
  34595. $matches = $autocomplete;
  34596. $numMatches = count($matches);
  34597. } else {
  34598. $numMatches = 0;
  34599. }
  34600. $ret = substr($ret, 0, $i);
  34601. } elseif ("\033" === $c) {
  34602. $c .= fread($inputStream, 2);
  34603. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  34604. if ('A' === $c[2] && -1 === $ofs) {
  34605. $ofs = 0;
  34606. }
  34607. if (0 === $numMatches) {
  34608. continue;
  34609. }
  34610. $ofs += ('A' === $c[2]) ? -1 : 1;
  34611. $ofs = ($numMatches + $ofs) % $numMatches;
  34612. }
  34613. } elseif (ord($c) < 32) {
  34614. if ("\t" === $c || "\n" === $c) {
  34615. if ($numMatches > 0 && -1 !== $ofs) {
  34616. $ret = $matches[$ofs];
  34617. $output->write(substr($ret, $i));
  34618. $i = strlen($ret);
  34619. }
  34620. if ("\n" === $c) {
  34621. $output->write($c);
  34622. break;
  34623. }
  34624. $numMatches = 0;
  34625. }
  34626. continue;
  34627. } else {
  34628. $output->write($c);
  34629. $ret .= $c;
  34630. ++$i;
  34631. $numMatches = 0;
  34632. $ofs = 0;
  34633. foreach ($autocomplete as $value) {
  34634. if (0 === strpos($value, $ret)) {
  34635. $matches[$numMatches++] = $value;
  34636. }
  34637. }
  34638. }
  34639. $output->write("\033[K");
  34640. if ($numMatches > 0 && -1 !== $ofs) {
  34641. $output->write("\0337");
  34642. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  34643. $output->write("\0338");
  34644. }
  34645. }
  34646. shell_exec(sprintf('stty %s', $sttyMode));
  34647. return $ret;
  34648. }
  34649. private function getHiddenResponse(OutputInterface $output, $inputStream)
  34650. {
  34651. if ('\\' === DIRECTORY_SEPARATOR) {
  34652. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  34653. if ('phar:' === substr(__FILE__, 0, 5)) {
  34654. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  34655. copy($exe, $tmpExe);
  34656. $exe = $tmpExe;
  34657. }
  34658. $value = rtrim(shell_exec($exe));
  34659. $output->writeln('');
  34660. if (isset($tmpExe)) {
  34661. unlink($tmpExe);
  34662. }
  34663. return $value;
  34664. }
  34665. if ($this->hasSttyAvailable()) {
  34666. $sttyMode = shell_exec('stty -g');
  34667. shell_exec('stty -echo');
  34668. $value = fgets($inputStream, 4096);
  34669. shell_exec(sprintf('stty %s', $sttyMode));
  34670. if (false === $value) {
  34671. throw new RuntimeException('Aborted');
  34672. }
  34673. $value = trim($value);
  34674. $output->writeln('');
  34675. return $value;
  34676. }
  34677. if (false !== $shell = $this->getShell()) {
  34678. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  34679. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  34680. $value = rtrim(shell_exec($command));
  34681. $output->writeln('');
  34682. return $value;
  34683. }
  34684. throw new RuntimeException('Unable to hide the response.');
  34685. }
  34686. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  34687. {
  34688. $error = null;
  34689. $attempts = $question->getMaxAttempts();
  34690. while (null === $attempts || $attempts--) {
  34691. if (null !== $error) {
  34692. $this->writeError($output, $error);
  34693. }
  34694. try {
  34695. return call_user_func($question->getValidator(), $interviewer());
  34696. } catch (RuntimeException $e) {
  34697. throw $e;
  34698. } catch (\Exception $error) {
  34699. }
  34700. }
  34701. throw $error;
  34702. }
  34703. private function getShell()
  34704. {
  34705. if (null !== self::$shell) {
  34706. return self::$shell;
  34707. }
  34708. self::$shell = false;
  34709. if (file_exists('/usr/bin/env')) {
  34710. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  34711. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  34712. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  34713. self::$shell = $sh;
  34714. break;
  34715. }
  34716. }
  34717. }
  34718. return self::$shell;
  34719. }
  34720. private function hasSttyAvailable()
  34721. {
  34722. if (null !== self::$stty) {
  34723. return self::$stty;
  34724. }
  34725. exec('stty 2>&1', $output, $exitcode);
  34726. return self::$stty = 0 === $exitcode;
  34727. }
  34728. }
  34729. <?php
  34730. namespace Symfony\Component\Console\Helper;
  34731. use Symfony\Component\Console\Exception\LogicException;
  34732. use Symfony\Component\Console\Input\InputInterface;
  34733. use Symfony\Component\Console\Output\OutputInterface;
  34734. use Symfony\Component\Console\Question\ChoiceQuestion;
  34735. use Symfony\Component\Console\Question\ConfirmationQuestion;
  34736. use Symfony\Component\Console\Question\Question;
  34737. use Symfony\Component\Console\Style\SymfonyStyle;
  34738. use Symfony\Component\Console\Formatter\OutputFormatter;
  34739. class SymfonyQuestionHelper extends QuestionHelper
  34740. {
  34741. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  34742. {
  34743. $validator = $question->getValidator();
  34744. $question->setValidator(function ($value) use ($validator) {
  34745. if (null !== $validator) {
  34746. $value = $validator($value);
  34747. } else {
  34748. if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
  34749. throw new LogicException('A value is required.');
  34750. }
  34751. }
  34752. return $value;
  34753. });
  34754. return parent::ask($input, $output, $question);
  34755. }
  34756. protected function writePrompt(OutputInterface $output, Question $question)
  34757. {
  34758. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  34759. $default = $question->getDefault();
  34760. switch (true) {
  34761. case null === $default:
  34762. $text = sprintf(' <info>%s</info>:', $text);
  34763. break;
  34764. case $question instanceof ConfirmationQuestion:
  34765. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  34766. break;
  34767. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  34768. $choices = $question->getChoices();
  34769. $default = explode(',', $default);
  34770. foreach ($default as $key => $value) {
  34771. $default[$key] = $choices[trim($value)];
  34772. }
  34773. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  34774. break;
  34775. case $question instanceof ChoiceQuestion:
  34776. $choices = $question->getChoices();
  34777. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default]));
  34778. break;
  34779. default:
  34780. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  34781. }
  34782. $output->writeln($text);
  34783. if ($question instanceof ChoiceQuestion) {
  34784. $width = max(array_map('strlen', array_keys($question->getChoices())));
  34785. foreach ($question->getChoices() as $key => $value) {
  34786. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  34787. }
  34788. }
  34789. $output->write(' > ');
  34790. }
  34791. protected function writeError(OutputInterface $output, \Exception $error)
  34792. {
  34793. if ($output instanceof SymfonyStyle) {
  34794. $output->newLine();
  34795. $output->error($error->getMessage());
  34796. return;
  34797. }
  34798. parent::writeError($output, $error);
  34799. }
  34800. }
  34801. <?php
  34802. namespace Symfony\Component\Console\Helper;
  34803. use Symfony\Component\Console\Output\OutputInterface;
  34804. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34805. class Table
  34806. {
  34807. private $headers = array();
  34808. private $rows = array();
  34809. private $columnWidths = array();
  34810. private $numberOfColumns;
  34811. private $output;
  34812. private $style;
  34813. private $columnStyles = array();
  34814. private static $styles;
  34815. public function __construct(OutputInterface $output)
  34816. {
  34817. $this->output = $output;
  34818. if (!self::$styles) {
  34819. self::$styles = self::initStyles();
  34820. }
  34821. $this->setStyle('default');
  34822. }
  34823. public static function setStyleDefinition($name, TableStyle $style)
  34824. {
  34825. if (!self::$styles) {
  34826. self::$styles = self::initStyles();
  34827. }
  34828. self::$styles[$name] = $style;
  34829. }
  34830. public static function getStyleDefinition($name)
  34831. {
  34832. if (!self::$styles) {
  34833. self::$styles = self::initStyles();
  34834. }
  34835. if (isset(self::$styles[$name])) {
  34836. return self::$styles[$name];
  34837. }
  34838. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  34839. }
  34840. public function setStyle($name)
  34841. {
  34842. $this->style = $this->resolveStyle($name);
  34843. return $this;
  34844. }
  34845. public function getStyle()
  34846. {
  34847. return $this->style;
  34848. }
  34849. public function setColumnStyle($columnIndex, $name)
  34850. {
  34851. $columnIndex = (int) $columnIndex;
  34852. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  34853. return $this;
  34854. }
  34855. public function getColumnStyle($columnIndex)
  34856. {
  34857. if (isset($this->columnStyles[$columnIndex])) {
  34858. return $this->columnStyles[$columnIndex];
  34859. }
  34860. return $this->getStyle();
  34861. }
  34862. public function setHeaders(array $headers)
  34863. {
  34864. $headers = array_values($headers);
  34865. if (!empty($headers) && !is_array($headers[0])) {
  34866. $headers = array($headers);
  34867. }
  34868. $this->headers = $headers;
  34869. return $this;
  34870. }
  34871. public function setRows(array $rows)
  34872. {
  34873. $this->rows = array();
  34874. return $this->addRows($rows);
  34875. }
  34876. public function addRows(array $rows)
  34877. {
  34878. foreach ($rows as $row) {
  34879. $this->addRow($row);
  34880. }
  34881. return $this;
  34882. }
  34883. public function addRow($row)
  34884. {
  34885. if ($row instanceof TableSeparator) {
  34886. $this->rows[] = $row;
  34887. return $this;
  34888. }
  34889. if (!is_array($row)) {
  34890. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  34891. }
  34892. $this->rows[] = array_values($row);
  34893. return $this;
  34894. }
  34895. public function setRow($column, array $row)
  34896. {
  34897. $this->rows[$column] = $row;
  34898. return $this;
  34899. }
  34900. public function render()
  34901. {
  34902. $this->calculateNumberOfColumns();
  34903. $rows = $this->buildTableRows($this->rows);
  34904. $headers = $this->buildTableRows($this->headers);
  34905. $this->calculateColumnsWidth(array_merge($headers, $rows));
  34906. $this->renderRowSeparator();
  34907. if (!empty($headers)) {
  34908. foreach ($headers as $header) {
  34909. $this->renderRow($header, $this->style->getCellHeaderFormat());
  34910. $this->renderRowSeparator();
  34911. }
  34912. }
  34913. foreach ($rows as $row) {
  34914. if ($row instanceof TableSeparator) {
  34915. $this->renderRowSeparator();
  34916. } else {
  34917. $this->renderRow($row, $this->style->getCellRowFormat());
  34918. }
  34919. }
  34920. if (!empty($rows)) {
  34921. $this->renderRowSeparator();
  34922. }
  34923. $this->cleanup();
  34924. }
  34925. private function renderRowSeparator()
  34926. {
  34927. if (0 === $count = $this->numberOfColumns) {
  34928. return;
  34929. }
  34930. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  34931. return;
  34932. }
  34933. $markup = $this->style->getCrossingChar();
  34934. for ($column = 0; $column < $count; ++$column) {
  34935. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  34936. }
  34937. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  34938. }
  34939. private function renderColumnSeparator()
  34940. {
  34941. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  34942. }
  34943. private function renderRow(array $row, $cellFormat)
  34944. {
  34945. if (empty($row)) {
  34946. return;
  34947. }
  34948. $rowContent = $this->renderColumnSeparator();
  34949. foreach ($this->getRowColumns($row) as $column) {
  34950. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  34951. $rowContent .= $this->renderColumnSeparator();
  34952. }
  34953. $this->output->writeln($rowContent);
  34954. }
  34955. private function renderCell(array $row, $column, $cellFormat)
  34956. {
  34957. $cell = isset($row[$column]) ? $row[$column] : '';
  34958. $width = $this->columnWidths[$column];
  34959. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  34960. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  34961. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  34962. }
  34963. }
  34964. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  34965. $width += strlen($cell) - mb_strwidth($cell, $encoding);
  34966. }
  34967. $style = $this->getColumnStyle($column);
  34968. if ($cell instanceof TableSeparator) {
  34969. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  34970. }
  34971. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  34972. $content = sprintf($style->getCellRowContentFormat(), $cell);
  34973. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  34974. }
  34975. private function calculateNumberOfColumns()
  34976. {
  34977. if (null !== $this->numberOfColumns) {
  34978. return;
  34979. }
  34980. $columns = array(0);
  34981. foreach (array_merge($this->headers, $this->rows) as $row) {
  34982. if ($row instanceof TableSeparator) {
  34983. continue;
  34984. }
  34985. $columns[] = $this->getNumberOfColumns($row);
  34986. }
  34987. $this->numberOfColumns = max($columns);
  34988. }
  34989. private function buildTableRows($rows)
  34990. {
  34991. $unmergedRows = array();
  34992. for ($rowKey = 0; $rowKey < count($rows); ++$rowKey) {
  34993. $rows = $this->fillNextRows($rows, $rowKey);
  34994. foreach ($rows[$rowKey] as $column => $cell) {
  34995. if (!strstr($cell, "\n")) {
  34996. continue;
  34997. }
  34998. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  34999. foreach ($lines as $lineKey => $line) {
  35000. if ($cell instanceof TableCell) {
  35001. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  35002. }
  35003. if (0 === $lineKey) {
  35004. $rows[$rowKey][$column] = $line;
  35005. } else {
  35006. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  35007. }
  35008. }
  35009. }
  35010. }
  35011. $tableRows = array();
  35012. foreach ($rows as $rowKey => $row) {
  35013. $tableRows[] = $this->fillCells($row);
  35014. if (isset($unmergedRows[$rowKey])) {
  35015. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  35016. }
  35017. }
  35018. return $tableRows;
  35019. }
  35020. private function fillNextRows(array $rows, $line)
  35021. {
  35022. $unmergedRows = array();
  35023. foreach ($rows[$line] as $column => $cell) {
  35024. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  35025. $nbLines = $cell->getRowspan() - 1;
  35026. $lines = array($cell);
  35027. if (strstr($cell, "\n")) {
  35028. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  35029. $nbLines = count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  35030. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  35031. unset($lines[0]);
  35032. }
  35033. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  35034. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  35035. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  35036. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  35037. if ($nbLines === $unmergedRowKey - $line) {
  35038. break;
  35039. }
  35040. }
  35041. }
  35042. }
  35043. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  35044. if (isset($rows[$unmergedRowKey]) && is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  35045. foreach ($unmergedRow as $cellKey => $cell) {
  35046. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  35047. }
  35048. } else {
  35049. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  35050. foreach ($unmergedRow as $column => $cell) {
  35051. if (!empty($cell)) {
  35052. $row[$column] = $unmergedRow[$column];
  35053. }
  35054. }
  35055. array_splice($rows, $unmergedRowKey, 0, array($row));
  35056. }
  35057. }
  35058. return $rows;
  35059. }
  35060. private function fillCells($row)
  35061. {
  35062. $newRow = array();
  35063. foreach ($row as $column => $cell) {
  35064. $newRow[] = $cell;
  35065. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35066. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  35067. $newRow[] = '';
  35068. }
  35069. }
  35070. }
  35071. return $newRow ?: $row;
  35072. }
  35073. private function copyRow(array $rows, $line)
  35074. {
  35075. $row = $rows[$line];
  35076. foreach ($row as $cellKey => $cellValue) {
  35077. $row[$cellKey] = '';
  35078. if ($cellValue instanceof TableCell) {
  35079. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  35080. }
  35081. }
  35082. return $row;
  35083. }
  35084. private function getNumberOfColumns(array $row)
  35085. {
  35086. $columns = count($row);
  35087. foreach ($row as $column) {
  35088. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  35089. }
  35090. return $columns;
  35091. }
  35092. private function getRowColumns(array $row)
  35093. {
  35094. $columns = range(0, $this->numberOfColumns - 1);
  35095. foreach ($row as $cellKey => $cell) {
  35096. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35097. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  35098. }
  35099. }
  35100. return $columns;
  35101. }
  35102. private function calculateColumnsWidth($rows)
  35103. {
  35104. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  35105. $lengths = array();
  35106. foreach ($rows as $row) {
  35107. if ($row instanceof TableSeparator) {
  35108. continue;
  35109. }
  35110. foreach ($row as $i => $cell) {
  35111. if ($cell instanceof TableCell) {
  35112. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  35113. $textLength = Helper::strlen($textContent);
  35114. if ($textLength > 0) {
  35115. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  35116. foreach ($contentColumns as $position => $content) {
  35117. $row[$i + $position] = $content;
  35118. }
  35119. }
  35120. }
  35121. }
  35122. $lengths[] = $this->getCellWidth($row, $column);
  35123. }
  35124. $this->columnWidths[$column] = max($lengths) + strlen($this->style->getCellRowContentFormat()) - 2;
  35125. }
  35126. }
  35127. private function getColumnSeparatorWidth()
  35128. {
  35129. return strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  35130. }
  35131. private function getCellWidth(array $row, $column)
  35132. {
  35133. if (isset($row[$column])) {
  35134. $cell = $row[$column];
  35135. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  35136. return $cellWidth;
  35137. }
  35138. return 0;
  35139. }
  35140. private function cleanup()
  35141. {
  35142. $this->columnWidths = array();
  35143. $this->numberOfColumns = null;
  35144. }
  35145. private static function initStyles()
  35146. {
  35147. $borderless = new TableStyle();
  35148. $borderless
  35149. ->setHorizontalBorderChar('=')
  35150. ->setVerticalBorderChar(' ')
  35151. ->setCrossingChar(' ')
  35152. ;
  35153. $compact = new TableStyle();
  35154. $compact
  35155. ->setHorizontalBorderChar('')
  35156. ->setVerticalBorderChar(' ')
  35157. ->setCrossingChar('')
  35158. ->setCellRowContentFormat('%s')
  35159. ;
  35160. $styleGuide = new TableStyle();
  35161. $styleGuide
  35162. ->setHorizontalBorderChar('-')
  35163. ->setVerticalBorderChar(' ')
  35164. ->setCrossingChar(' ')
  35165. ->setCellHeaderFormat('%s')
  35166. ;
  35167. return array(
  35168. 'default' => new TableStyle(),
  35169. 'borderless' => $borderless,
  35170. 'compact' => $compact,
  35171. 'symfony-style-guide' => $styleGuide,
  35172. );
  35173. }
  35174. private function resolveStyle($name)
  35175. {
  35176. if ($name instanceof TableStyle) {
  35177. return $name;
  35178. }
  35179. if (isset(self::$styles[$name])) {
  35180. return self::$styles[$name];
  35181. }
  35182. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  35183. }
  35184. }
  35185. <?php
  35186. namespace Symfony\Component\Console\Helper;
  35187. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35188. class TableCell
  35189. {
  35190. private $value;
  35191. private $options = array(
  35192. 'rowspan' => 1,
  35193. 'colspan' => 1,
  35194. );
  35195. public function __construct($value = '', array $options = array())
  35196. {
  35197. if (is_numeric($value) && !is_string($value)) {
  35198. $value = (string) $value;
  35199. }
  35200. $this->value = $value;
  35201. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  35202. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  35203. }
  35204. $this->options = array_merge($this->options, $options);
  35205. }
  35206. public function __toString()
  35207. {
  35208. return $this->value;
  35209. }
  35210. public function getColspan()
  35211. {
  35212. return (int) $this->options['colspan'];
  35213. }
  35214. public function getRowspan()
  35215. {
  35216. return (int) $this->options['rowspan'];
  35217. }
  35218. }
  35219. <?php
  35220. namespace Symfony\Component\Console\Helper;
  35221. use Symfony\Component\Console\Output\OutputInterface;
  35222. use Symfony\Component\Console\Output\NullOutput;
  35223. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35224. class TableHelper extends Helper
  35225. {
  35226. const LAYOUT_DEFAULT = 0;
  35227. const LAYOUT_BORDERLESS = 1;
  35228. const LAYOUT_COMPACT = 2;
  35229. private $table;
  35230. public function __construct($triggerDeprecationError = true)
  35231. {
  35232. if ($triggerDeprecationError) {
  35233. @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);
  35234. }
  35235. $this->table = new Table(new NullOutput());
  35236. }
  35237. public function setLayout($layout)
  35238. {
  35239. switch ($layout) {
  35240. case self::LAYOUT_BORDERLESS:
  35241. $this->table->setStyle('borderless');
  35242. break;
  35243. case self::LAYOUT_COMPACT:
  35244. $this->table->setStyle('compact');
  35245. break;
  35246. case self::LAYOUT_DEFAULT:
  35247. $this->table->setStyle('default');
  35248. break;
  35249. default:
  35250. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  35251. }
  35252. return $this;
  35253. }
  35254. public function setHeaders(array $headers)
  35255. {
  35256. $this->table->setHeaders($headers);
  35257. return $this;
  35258. }
  35259. public function setRows(array $rows)
  35260. {
  35261. $this->table->setRows($rows);
  35262. return $this;
  35263. }
  35264. public function addRows(array $rows)
  35265. {
  35266. $this->table->addRows($rows);
  35267. return $this;
  35268. }
  35269. public function addRow(array $row)
  35270. {
  35271. $this->table->addRow($row);
  35272. return $this;
  35273. }
  35274. public function setRow($column, array $row)
  35275. {
  35276. $this->table->setRow($column, $row);
  35277. return $this;
  35278. }
  35279. public function setPaddingChar($paddingChar)
  35280. {
  35281. $this->table->getStyle()->setPaddingChar($paddingChar);
  35282. return $this;
  35283. }
  35284. public function setHorizontalBorderChar($horizontalBorderChar)
  35285. {
  35286. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  35287. return $this;
  35288. }
  35289. public function setVerticalBorderChar($verticalBorderChar)
  35290. {
  35291. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  35292. return $this;
  35293. }
  35294. public function setCrossingChar($crossingChar)
  35295. {
  35296. $this->table->getStyle()->setCrossingChar($crossingChar);
  35297. return $this;
  35298. }
  35299. public function setCellHeaderFormat($cellHeaderFormat)
  35300. {
  35301. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  35302. return $this;
  35303. }
  35304. public function setCellRowFormat($cellRowFormat)
  35305. {
  35306. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  35307. return $this;
  35308. }
  35309. public function setCellRowContentFormat($cellRowContentFormat)
  35310. {
  35311. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  35312. return $this;
  35313. }
  35314. public function setBorderFormat($borderFormat)
  35315. {
  35316. $this->table->getStyle()->setBorderFormat($borderFormat);
  35317. return $this;
  35318. }
  35319. public function setPadType($padType)
  35320. {
  35321. $this->table->getStyle()->setPadType($padType);
  35322. return $this;
  35323. }
  35324. public function render(OutputInterface $output)
  35325. {
  35326. $p = new \ReflectionProperty($this->table, 'output');
  35327. $p->setAccessible(true);
  35328. $p->setValue($this->table, $output);
  35329. $this->table->render();
  35330. }
  35331. public function getName()
  35332. {
  35333. return 'table';
  35334. }
  35335. }
  35336. <?php
  35337. namespace Symfony\Component\Console\Helper;
  35338. class TableSeparator extends TableCell
  35339. {
  35340. public function __construct(array $options = array())
  35341. {
  35342. parent::__construct('', $options);
  35343. }
  35344. }
  35345. <?php
  35346. namespace Symfony\Component\Console\Helper;
  35347. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35348. use Symfony\Component\Console\Exception\LogicException;
  35349. class TableStyle
  35350. {
  35351. private $paddingChar = ' ';
  35352. private $horizontalBorderChar = '-';
  35353. private $verticalBorderChar = '|';
  35354. private $crossingChar = '+';
  35355. private $cellHeaderFormat = '<info>%s</info>';
  35356. private $cellRowFormat = '%s';
  35357. private $cellRowContentFormat = ' %s ';
  35358. private $borderFormat = '%s';
  35359. private $padType = STR_PAD_RIGHT;
  35360. public function setPaddingChar($paddingChar)
  35361. {
  35362. if (!$paddingChar) {
  35363. throw new LogicException('The padding char must not be empty');
  35364. }
  35365. $this->paddingChar = $paddingChar;
  35366. return $this;
  35367. }
  35368. public function getPaddingChar()
  35369. {
  35370. return $this->paddingChar;
  35371. }
  35372. public function setHorizontalBorderChar($horizontalBorderChar)
  35373. {
  35374. $this->horizontalBorderChar = $horizontalBorderChar;
  35375. return $this;
  35376. }
  35377. public function getHorizontalBorderChar()
  35378. {
  35379. return $this->horizontalBorderChar;
  35380. }
  35381. public function setVerticalBorderChar($verticalBorderChar)
  35382. {
  35383. $this->verticalBorderChar = $verticalBorderChar;
  35384. return $this;
  35385. }
  35386. public function getVerticalBorderChar()
  35387. {
  35388. return $this->verticalBorderChar;
  35389. }
  35390. public function setCrossingChar($crossingChar)
  35391. {
  35392. $this->crossingChar = $crossingChar;
  35393. return $this;
  35394. }
  35395. public function getCrossingChar()
  35396. {
  35397. return $this->crossingChar;
  35398. }
  35399. public function setCellHeaderFormat($cellHeaderFormat)
  35400. {
  35401. $this->cellHeaderFormat = $cellHeaderFormat;
  35402. return $this;
  35403. }
  35404. public function getCellHeaderFormat()
  35405. {
  35406. return $this->cellHeaderFormat;
  35407. }
  35408. public function setCellRowFormat($cellRowFormat)
  35409. {
  35410. $this->cellRowFormat = $cellRowFormat;
  35411. return $this;
  35412. }
  35413. public function getCellRowFormat()
  35414. {
  35415. return $this->cellRowFormat;
  35416. }
  35417. public function setCellRowContentFormat($cellRowContentFormat)
  35418. {
  35419. $this->cellRowContentFormat = $cellRowContentFormat;
  35420. return $this;
  35421. }
  35422. public function getCellRowContentFormat()
  35423. {
  35424. return $this->cellRowContentFormat;
  35425. }
  35426. public function setBorderFormat($borderFormat)
  35427. {
  35428. $this->borderFormat = $borderFormat;
  35429. return $this;
  35430. }
  35431. public function getBorderFormat()
  35432. {
  35433. return $this->borderFormat;
  35434. }
  35435. public function setPadType($padType)
  35436. {
  35437. if (!in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  35438. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  35439. }
  35440. $this->padType = $padType;
  35441. return $this;
  35442. }
  35443. public function getPadType()
  35444. {
  35445. return $this->padType;
  35446. }
  35447. }
  35448. <?php
  35449. namespace Symfony\Component\Console\Input;
  35450. use Symfony\Component\Console\Exception\RuntimeException;
  35451. class ArgvInput extends Input
  35452. {
  35453. private $tokens;
  35454. private $parsed;
  35455. public function __construct(array $argv = null, InputDefinition $definition = null)
  35456. {
  35457. if (null === $argv) {
  35458. $argv = $_SERVER['argv'];
  35459. }
  35460. array_shift($argv);
  35461. $this->tokens = $argv;
  35462. parent::__construct($definition);
  35463. }
  35464. protected function setTokens(array $tokens)
  35465. {
  35466. $this->tokens = $tokens;
  35467. }
  35468. protected function parse()
  35469. {
  35470. $parseOptions = true;
  35471. $this->parsed = $this->tokens;
  35472. while (null !== $token = array_shift($this->parsed)) {
  35473. if ($parseOptions && '' == $token) {
  35474. $this->parseArgument($token);
  35475. } elseif ($parseOptions && '--' == $token) {
  35476. $parseOptions = false;
  35477. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  35478. $this->parseLongOption($token);
  35479. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  35480. $this->parseShortOption($token);
  35481. } else {
  35482. $this->parseArgument($token);
  35483. }
  35484. }
  35485. }
  35486. private function parseShortOption($token)
  35487. {
  35488. $name = substr($token, 1);
  35489. if (strlen($name) > 1) {
  35490. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  35491. $this->addShortOption($name[0], substr($name, 1));
  35492. } else {
  35493. $this->parseShortOptionSet($name);
  35494. }
  35495. } else {
  35496. $this->addShortOption($name, null);
  35497. }
  35498. }
  35499. private function parseShortOptionSet($name)
  35500. {
  35501. $len = strlen($name);
  35502. for ($i = 0; $i < $len; ++$i) {
  35503. if (!$this->definition->hasShortcut($name[$i])) {
  35504. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
  35505. }
  35506. $option = $this->definition->getOptionForShortcut($name[$i]);
  35507. if ($option->acceptValue()) {
  35508. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  35509. break;
  35510. } else {
  35511. $this->addLongOption($option->getName(), null);
  35512. }
  35513. }
  35514. }
  35515. private function parseLongOption($token)
  35516. {
  35517. $name = substr($token, 2);
  35518. if (false !== $pos = strpos($name, '=')) {
  35519. if (0 === strlen($value = substr($name, $pos + 1))) {
  35520. array_unshift($this->parsed, null);
  35521. }
  35522. $this->addLongOption(substr($name, 0, $pos), $value);
  35523. } else {
  35524. $this->addLongOption($name, null);
  35525. }
  35526. }
  35527. private function parseArgument($token)
  35528. {
  35529. $c = count($this->arguments);
  35530. if ($this->definition->hasArgument($c)) {
  35531. $arg = $this->definition->getArgument($c);
  35532. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  35533. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  35534. $arg = $this->definition->getArgument($c - 1);
  35535. $this->arguments[$arg->getName()][] = $token;
  35536. } else {
  35537. $all = $this->definition->getArguments();
  35538. if (count($all)) {
  35539. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  35540. }
  35541. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  35542. }
  35543. }
  35544. private function addShortOption($shortcut, $value)
  35545. {
  35546. if (!$this->definition->hasShortcut($shortcut)) {
  35547. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  35548. }
  35549. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  35550. }
  35551. private function addLongOption($name, $value)
  35552. {
  35553. if (!$this->definition->hasOption($name)) {
  35554. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  35555. }
  35556. $option = $this->definition->getOption($name);
  35557. if (!isset($value[0])) {
  35558. $value = null;
  35559. }
  35560. if (null !== $value && !$option->acceptValue()) {
  35561. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  35562. }
  35563. if (null === $value && $option->acceptValue() && count($this->parsed)) {
  35564. $next = array_shift($this->parsed);
  35565. if (isset($next[0]) && '-' !== $next[0]) {
  35566. $value = $next;
  35567. } elseif (empty($next)) {
  35568. $value = null;
  35569. } else {
  35570. array_unshift($this->parsed, $next);
  35571. }
  35572. }
  35573. if (null === $value) {
  35574. if ($option->isValueRequired()) {
  35575. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  35576. }
  35577. if (!$option->isArray()) {
  35578. $value = $option->isValueOptional() ? $option->getDefault() : true;
  35579. }
  35580. }
  35581. if ($option->isArray()) {
  35582. $this->options[$name][] = $value;
  35583. } else {
  35584. $this->options[$name] = $value;
  35585. }
  35586. }
  35587. public function getFirstArgument()
  35588. {
  35589. foreach ($this->tokens as $token) {
  35590. if ($token && '-' === $token[0]) {
  35591. continue;
  35592. }
  35593. return $token;
  35594. }
  35595. }
  35596. public function hasParameterOption($values)
  35597. {
  35598. $values = (array) $values;
  35599. foreach ($this->tokens as $token) {
  35600. foreach ($values as $value) {
  35601. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  35602. if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
  35603. return true;
  35604. }
  35605. }
  35606. }
  35607. return false;
  35608. }
  35609. public function getParameterOption($values, $default = false)
  35610. {
  35611. $values = (array) $values;
  35612. $tokens = $this->tokens;
  35613. while (0 < count($tokens)) {
  35614. $token = array_shift($tokens);
  35615. foreach ($values as $value) {
  35616. if ($token === $value) {
  35617. return array_shift($tokens);
  35618. }
  35619. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  35620. if ('' !== $leading && 0 === strpos($token, $leading)) {
  35621. return substr($token, strlen($leading));
  35622. }
  35623. }
  35624. }
  35625. return $default;
  35626. }
  35627. public function __toString()
  35628. {
  35629. $self = $this;
  35630. $tokens = array_map(function ($token) use ($self) {
  35631. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  35632. return $match[1].$self->escapeToken($match[2]);
  35633. }
  35634. if ($token && '-' !== $token[0]) {
  35635. return $self->escapeToken($token);
  35636. }
  35637. return $token;
  35638. }, $this->tokens);
  35639. return implode(' ', $tokens);
  35640. }
  35641. }
  35642. <?php
  35643. namespace Symfony\Component\Console\Input;
  35644. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35645. use Symfony\Component\Console\Exception\InvalidOptionException;
  35646. class ArrayInput extends Input
  35647. {
  35648. private $parameters;
  35649. public function __construct(array $parameters, InputDefinition $definition = null)
  35650. {
  35651. $this->parameters = $parameters;
  35652. parent::__construct($definition);
  35653. }
  35654. public function getFirstArgument()
  35655. {
  35656. foreach ($this->parameters as $key => $value) {
  35657. if ($key && '-' === $key[0]) {
  35658. continue;
  35659. }
  35660. return $value;
  35661. }
  35662. }
  35663. public function hasParameterOption($values)
  35664. {
  35665. $values = (array) $values;
  35666. foreach ($this->parameters as $k => $v) {
  35667. if (!is_int($k)) {
  35668. $v = $k;
  35669. }
  35670. if (in_array($v, $values)) {
  35671. return true;
  35672. }
  35673. }
  35674. return false;
  35675. }
  35676. public function getParameterOption($values, $default = false)
  35677. {
  35678. $values = (array) $values;
  35679. foreach ($this->parameters as $k => $v) {
  35680. if (is_int($k)) {
  35681. if (in_array($v, $values)) {
  35682. return true;
  35683. }
  35684. } elseif (in_array($k, $values)) {
  35685. return $v;
  35686. }
  35687. }
  35688. return $default;
  35689. }
  35690. public function __toString()
  35691. {
  35692. $params = array();
  35693. foreach ($this->parameters as $param => $val) {
  35694. if ($param && '-' === $param[0]) {
  35695. if (is_array($val)) {
  35696. foreach ($val as $v) {
  35697. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  35698. }
  35699. } else {
  35700. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  35701. }
  35702. } else {
  35703. $params[] = is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
  35704. }
  35705. }
  35706. return implode(' ', $params);
  35707. }
  35708. protected function parse()
  35709. {
  35710. foreach ($this->parameters as $key => $value) {
  35711. if (0 === strpos($key, '--')) {
  35712. $this->addLongOption(substr($key, 2), $value);
  35713. } elseif ('-' === $key[0]) {
  35714. $this->addShortOption(substr($key, 1), $value);
  35715. } else {
  35716. $this->addArgument($key, $value);
  35717. }
  35718. }
  35719. }
  35720. private function addShortOption($shortcut, $value)
  35721. {
  35722. if (!$this->definition->hasShortcut($shortcut)) {
  35723. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  35724. }
  35725. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  35726. }
  35727. private function addLongOption($name, $value)
  35728. {
  35729. if (!$this->definition->hasOption($name)) {
  35730. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  35731. }
  35732. $option = $this->definition->getOption($name);
  35733. if (null === $value) {
  35734. if ($option->isValueRequired()) {
  35735. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  35736. }
  35737. $value = $option->isValueOptional() ? $option->getDefault() : true;
  35738. }
  35739. $this->options[$name] = $value;
  35740. }
  35741. private function addArgument($name, $value)
  35742. {
  35743. if (!$this->definition->hasArgument($name)) {
  35744. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35745. }
  35746. $this->arguments[$name] = $value;
  35747. }
  35748. }
  35749. <?php
  35750. namespace Symfony\Component\Console\Input;
  35751. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35752. use Symfony\Component\Console\Exception\RuntimeException;
  35753. abstract class Input implements InputInterface
  35754. {
  35755. protected $definition;
  35756. protected $options = array();
  35757. protected $arguments = array();
  35758. protected $interactive = true;
  35759. public function __construct(InputDefinition $definition = null)
  35760. {
  35761. if (null === $definition) {
  35762. $this->definition = new InputDefinition();
  35763. } else {
  35764. $this->bind($definition);
  35765. $this->validate();
  35766. }
  35767. }
  35768. public function bind(InputDefinition $definition)
  35769. {
  35770. $this->arguments = array();
  35771. $this->options = array();
  35772. $this->definition = $definition;
  35773. $this->parse();
  35774. }
  35775. abstract protected function parse();
  35776. public function validate()
  35777. {
  35778. $definition = $this->definition;
  35779. $givenArguments = $this->arguments;
  35780. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  35781. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  35782. });
  35783. if (count($missingArguments) > 0) {
  35784. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  35785. }
  35786. }
  35787. public function isInteractive()
  35788. {
  35789. return $this->interactive;
  35790. }
  35791. public function setInteractive($interactive)
  35792. {
  35793. $this->interactive = (bool) $interactive;
  35794. }
  35795. public function getArguments()
  35796. {
  35797. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  35798. }
  35799. public function getArgument($name)
  35800. {
  35801. if (!$this->definition->hasArgument($name)) {
  35802. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35803. }
  35804. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  35805. }
  35806. public function setArgument($name, $value)
  35807. {
  35808. if (!$this->definition->hasArgument($name)) {
  35809. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35810. }
  35811. $this->arguments[$name] = $value;
  35812. }
  35813. public function hasArgument($name)
  35814. {
  35815. return $this->definition->hasArgument($name);
  35816. }
  35817. public function getOptions()
  35818. {
  35819. return array_merge($this->definition->getOptionDefaults(), $this->options);
  35820. }
  35821. public function getOption($name)
  35822. {
  35823. if (!$this->definition->hasOption($name)) {
  35824. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  35825. }
  35826. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  35827. }
  35828. public function setOption($name, $value)
  35829. {
  35830. if (!$this->definition->hasOption($name)) {
  35831. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  35832. }
  35833. $this->options[$name] = $value;
  35834. }
  35835. public function hasOption($name)
  35836. {
  35837. return $this->definition->hasOption($name);
  35838. }
  35839. public function escapeToken($token)
  35840. {
  35841. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  35842. }
  35843. }
  35844. <?php
  35845. namespace Symfony\Component\Console\Input;
  35846. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35847. use Symfony\Component\Console\Exception\LogicException;
  35848. class InputArgument
  35849. {
  35850. const REQUIRED = 1;
  35851. const OPTIONAL = 2;
  35852. const IS_ARRAY = 4;
  35853. private $name;
  35854. private $mode;
  35855. private $default;
  35856. private $description;
  35857. public function __construct($name, $mode = null, $description = '', $default = null)
  35858. {
  35859. if (null === $mode) {
  35860. $mode = self::OPTIONAL;
  35861. } elseif (!is_int($mode) || $mode > 7 || $mode < 1) {
  35862. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  35863. }
  35864. $this->name = $name;
  35865. $this->mode = $mode;
  35866. $this->description = $description;
  35867. $this->setDefault($default);
  35868. }
  35869. public function getName()
  35870. {
  35871. return $this->name;
  35872. }
  35873. public function isRequired()
  35874. {
  35875. return self::REQUIRED === (self::REQUIRED & $this->mode);
  35876. }
  35877. public function isArray()
  35878. {
  35879. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  35880. }
  35881. public function setDefault($default = null)
  35882. {
  35883. if (self::REQUIRED === $this->mode && null !== $default) {
  35884. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  35885. }
  35886. if ($this->isArray()) {
  35887. if (null === $default) {
  35888. $default = array();
  35889. } elseif (!is_array($default)) {
  35890. throw new LogicException('A default value for an array argument must be an array.');
  35891. }
  35892. }
  35893. $this->default = $default;
  35894. }
  35895. public function getDefault()
  35896. {
  35897. return $this->default;
  35898. }
  35899. public function getDescription()
  35900. {
  35901. return $this->description;
  35902. }
  35903. }
  35904. <?php
  35905. namespace Symfony\Component\Console\Input;
  35906. interface InputAwareInterface
  35907. {
  35908. public function setInput(InputInterface $input);
  35909. }
  35910. <?php
  35911. namespace Symfony\Component\Console\Input;
  35912. use Symfony\Component\Console\Descriptor\TextDescriptor;
  35913. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  35914. use Symfony\Component\Console\Output\BufferedOutput;
  35915. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35916. use Symfony\Component\Console\Exception\LogicException;
  35917. class InputDefinition
  35918. {
  35919. private $arguments;
  35920. private $requiredCount;
  35921. private $hasAnArrayArgument = false;
  35922. private $hasOptional;
  35923. private $options;
  35924. private $shortcuts;
  35925. public function __construct(array $definition = array())
  35926. {
  35927. $this->setDefinition($definition);
  35928. }
  35929. public function setDefinition(array $definition)
  35930. {
  35931. $arguments = array();
  35932. $options = array();
  35933. foreach ($definition as $item) {
  35934. if ($item instanceof InputOption) {
  35935. $options[] = $item;
  35936. } else {
  35937. $arguments[] = $item;
  35938. }
  35939. }
  35940. $this->setArguments($arguments);
  35941. $this->setOptions($options);
  35942. }
  35943. public function setArguments($arguments = array())
  35944. {
  35945. $this->arguments = array();
  35946. $this->requiredCount = 0;
  35947. $this->hasOptional = false;
  35948. $this->hasAnArrayArgument = false;
  35949. $this->addArguments($arguments);
  35950. }
  35951. public function addArguments($arguments = array())
  35952. {
  35953. if (null !== $arguments) {
  35954. foreach ($arguments as $argument) {
  35955. $this->addArgument($argument);
  35956. }
  35957. }
  35958. }
  35959. public function addArgument(InputArgument $argument)
  35960. {
  35961. if (isset($this->arguments[$argument->getName()])) {
  35962. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  35963. }
  35964. if ($this->hasAnArrayArgument) {
  35965. throw new LogicException('Cannot add an argument after an array argument.');
  35966. }
  35967. if ($argument->isRequired() && $this->hasOptional) {
  35968. throw new LogicException('Cannot add a required argument after an optional one.');
  35969. }
  35970. if ($argument->isArray()) {
  35971. $this->hasAnArrayArgument = true;
  35972. }
  35973. if ($argument->isRequired()) {
  35974. ++$this->requiredCount;
  35975. } else {
  35976. $this->hasOptional = true;
  35977. }
  35978. $this->arguments[$argument->getName()] = $argument;
  35979. }
  35980. public function getArgument($name)
  35981. {
  35982. if (!$this->hasArgument($name)) {
  35983. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35984. }
  35985. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  35986. return $arguments[$name];
  35987. }
  35988. public function hasArgument($name)
  35989. {
  35990. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  35991. return isset($arguments[$name]);
  35992. }
  35993. public function getArguments()
  35994. {
  35995. return $this->arguments;
  35996. }
  35997. public function getArgumentCount()
  35998. {
  35999. return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments);
  36000. }
  36001. public function getArgumentRequiredCount()
  36002. {
  36003. return $this->requiredCount;
  36004. }
  36005. public function getArgumentDefaults()
  36006. {
  36007. $values = array();
  36008. foreach ($this->arguments as $argument) {
  36009. $values[$argument->getName()] = $argument->getDefault();
  36010. }
  36011. return $values;
  36012. }
  36013. public function setOptions($options = array())
  36014. {
  36015. $this->options = array();
  36016. $this->shortcuts = array();
  36017. $this->addOptions($options);
  36018. }
  36019. public function addOptions($options = array())
  36020. {
  36021. foreach ($options as $option) {
  36022. $this->addOption($option);
  36023. }
  36024. }
  36025. public function addOption(InputOption $option)
  36026. {
  36027. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  36028. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  36029. }
  36030. if ($option->getShortcut()) {
  36031. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  36032. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  36033. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  36034. }
  36035. }
  36036. }
  36037. $this->options[$option->getName()] = $option;
  36038. if ($option->getShortcut()) {
  36039. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  36040. $this->shortcuts[$shortcut] = $option->getName();
  36041. }
  36042. }
  36043. }
  36044. public function getOption($name)
  36045. {
  36046. if (!$this->hasOption($name)) {
  36047. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  36048. }
  36049. return $this->options[$name];
  36050. }
  36051. public function hasOption($name)
  36052. {
  36053. return isset($this->options[$name]);
  36054. }
  36055. public function getOptions()
  36056. {
  36057. return $this->options;
  36058. }
  36059. public function hasShortcut($name)
  36060. {
  36061. return isset($this->shortcuts[$name]);
  36062. }
  36063. public function getOptionForShortcut($shortcut)
  36064. {
  36065. return $this->getOption($this->shortcutToName($shortcut));
  36066. }
  36067. public function getOptionDefaults()
  36068. {
  36069. $values = array();
  36070. foreach ($this->options as $option) {
  36071. $values[$option->getName()] = $option->getDefault();
  36072. }
  36073. return $values;
  36074. }
  36075. private function shortcutToName($shortcut)
  36076. {
  36077. if (!isset($this->shortcuts[$shortcut])) {
  36078. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  36079. }
  36080. return $this->shortcuts[$shortcut];
  36081. }
  36082. public function getSynopsis($short = false)
  36083. {
  36084. $elements = array();
  36085. if ($short && $this->getOptions()) {
  36086. $elements[] = '[options]';
  36087. } elseif (!$short) {
  36088. foreach ($this->getOptions() as $option) {
  36089. $value = '';
  36090. if ($option->acceptValue()) {
  36091. $value = sprintf(
  36092. ' %s%s%s',
  36093. $option->isValueOptional() ? '[' : '',
  36094. strtoupper($option->getName()),
  36095. $option->isValueOptional() ? ']' : ''
  36096. );
  36097. }
  36098. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  36099. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  36100. }
  36101. }
  36102. if (count($elements) && $this->getArguments()) {
  36103. $elements[] = '[--]';
  36104. }
  36105. foreach ($this->getArguments() as $argument) {
  36106. $element = '<'.$argument->getName().'>';
  36107. if (!$argument->isRequired()) {
  36108. $element = '['.$element.']';
  36109. } elseif ($argument->isArray()) {
  36110. $element = $element.' ('.$element.')';
  36111. }
  36112. if ($argument->isArray()) {
  36113. $element .= '...';
  36114. }
  36115. $elements[] = $element;
  36116. }
  36117. return implode(' ', $elements);
  36118. }
  36119. public function asText()
  36120. {
  36121. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  36122. $descriptor = new TextDescriptor();
  36123. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  36124. $descriptor->describe($output, $this, array('raw_output' => true));
  36125. return $output->fetch();
  36126. }
  36127. public function asXml($asDom = false)
  36128. {
  36129. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  36130. $descriptor = new XmlDescriptor();
  36131. if ($asDom) {
  36132. return $descriptor->getInputDefinitionDocument($this);
  36133. }
  36134. $output = new BufferedOutput();
  36135. $descriptor->describe($output, $this);
  36136. return $output->fetch();
  36137. }
  36138. }
  36139. <?php
  36140. namespace Symfony\Component\Console\Input;
  36141. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36142. use Symfony\Component\Console\Exception\RuntimeException;
  36143. interface InputInterface
  36144. {
  36145. public function getFirstArgument();
  36146. public function hasParameterOption($values);
  36147. public function getParameterOption($values, $default = false);
  36148. public function bind(InputDefinition $definition);
  36149. public function validate();
  36150. public function getArguments();
  36151. public function getArgument($name);
  36152. public function setArgument($name, $value);
  36153. public function hasArgument($name);
  36154. public function getOptions();
  36155. public function getOption($name);
  36156. public function setOption($name, $value);
  36157. public function hasOption($name);
  36158. public function isInteractive();
  36159. public function setInteractive($interactive);
  36160. }
  36161. <?php
  36162. namespace Symfony\Component\Console\Input;
  36163. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36164. use Symfony\Component\Console\Exception\LogicException;
  36165. class InputOption
  36166. {
  36167. const VALUE_NONE = 1;
  36168. const VALUE_REQUIRED = 2;
  36169. const VALUE_OPTIONAL = 4;
  36170. const VALUE_IS_ARRAY = 8;
  36171. private $name;
  36172. private $shortcut;
  36173. private $mode;
  36174. private $default;
  36175. private $description;
  36176. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  36177. {
  36178. if (0 === strpos($name, '--')) {
  36179. $name = substr($name, 2);
  36180. }
  36181. if (empty($name)) {
  36182. throw new InvalidArgumentException('An option name cannot be empty.');
  36183. }
  36184. if (empty($shortcut)) {
  36185. $shortcut = null;
  36186. }
  36187. if (null !== $shortcut) {
  36188. if (is_array($shortcut)) {
  36189. $shortcut = implode('|', $shortcut);
  36190. }
  36191. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  36192. $shortcuts = array_filter($shortcuts);
  36193. $shortcut = implode('|', $shortcuts);
  36194. if (empty($shortcut)) {
  36195. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  36196. }
  36197. }
  36198. if (null === $mode) {
  36199. $mode = self::VALUE_NONE;
  36200. } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
  36201. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  36202. }
  36203. $this->name = $name;
  36204. $this->shortcut = $shortcut;
  36205. $this->mode = $mode;
  36206. $this->description = $description;
  36207. if ($this->isArray() && !$this->acceptValue()) {
  36208. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  36209. }
  36210. $this->setDefault($default);
  36211. }
  36212. public function getShortcut()
  36213. {
  36214. return $this->shortcut;
  36215. }
  36216. public function getName()
  36217. {
  36218. return $this->name;
  36219. }
  36220. public function acceptValue()
  36221. {
  36222. return $this->isValueRequired() || $this->isValueOptional();
  36223. }
  36224. public function isValueRequired()
  36225. {
  36226. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  36227. }
  36228. public function isValueOptional()
  36229. {
  36230. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  36231. }
  36232. public function isArray()
  36233. {
  36234. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  36235. }
  36236. public function setDefault($default = null)
  36237. {
  36238. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  36239. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  36240. }
  36241. if ($this->isArray()) {
  36242. if (null === $default) {
  36243. $default = array();
  36244. } elseif (!is_array($default)) {
  36245. throw new LogicException('A default value for an array option must be an array.');
  36246. }
  36247. }
  36248. $this->default = $this->acceptValue() ? $default : false;
  36249. }
  36250. public function getDefault()
  36251. {
  36252. return $this->default;
  36253. }
  36254. public function getDescription()
  36255. {
  36256. return $this->description;
  36257. }
  36258. public function equals(self $option)
  36259. {
  36260. return $option->getName() === $this->getName()
  36261. && $option->getShortcut() === $this->getShortcut()
  36262. && $option->getDefault() === $this->getDefault()
  36263. && $option->isArray() === $this->isArray()
  36264. && $option->isValueRequired() === $this->isValueRequired()
  36265. && $option->isValueOptional() === $this->isValueOptional()
  36266. ;
  36267. }
  36268. }
  36269. <?php
  36270. namespace Symfony\Component\Console\Input;
  36271. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36272. class StringInput extends ArgvInput
  36273. {
  36274. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  36275. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  36276. public function __construct($input, InputDefinition $definition = null)
  36277. {
  36278. if ($definition) {
  36279. @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);
  36280. }
  36281. parent::__construct(array(), null);
  36282. $this->setTokens($this->tokenize($input));
  36283. if (null !== $definition) {
  36284. $this->bind($definition);
  36285. }
  36286. }
  36287. private function tokenize($input)
  36288. {
  36289. $tokens = array();
  36290. $length = strlen($input);
  36291. $cursor = 0;
  36292. while ($cursor < $length) {
  36293. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  36294. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  36295. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
  36296. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  36297. $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
  36298. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  36299. $tokens[] = stripcslashes($match[1]);
  36300. } else {
  36301. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  36302. }
  36303. $cursor += strlen($match[0]);
  36304. }
  36305. return $tokens;
  36306. }
  36307. }
  36308. Copyright (c) 2004-2018 Fabien Potencier
  36309. Permission is hereby granted, free of charge, to any person obtaining a copy
  36310. of this software and associated documentation files (the "Software"), to deal
  36311. in the Software without restriction, including without limitation the rights
  36312. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  36313. copies of the Software, and to permit persons to whom the Software is furnished
  36314. to do so, subject to the following conditions:
  36315. The above copyright notice and this permission notice shall be included in all
  36316. copies or substantial portions of the Software.
  36317. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  36318. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  36319. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  36320. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  36321. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  36322. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  36323. THE SOFTWARE.
  36324. <?php
  36325. namespace Symfony\Component\Console\Logger;
  36326. use Psr\Log\AbstractLogger;
  36327. use Psr\Log\InvalidArgumentException;
  36328. use Psr\Log\LogLevel;
  36329. use Symfony\Component\Console\Output\OutputInterface;
  36330. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36331. class ConsoleLogger extends AbstractLogger
  36332. {
  36333. const INFO = 'info';
  36334. const ERROR = 'error';
  36335. private $output;
  36336. private $verbosityLevelMap = array(
  36337. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  36338. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  36339. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  36340. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  36341. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  36342. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  36343. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  36344. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  36345. );
  36346. private $formatLevelMap = array(
  36347. LogLevel::EMERGENCY => self::ERROR,
  36348. LogLevel::ALERT => self::ERROR,
  36349. LogLevel::CRITICAL => self::ERROR,
  36350. LogLevel::ERROR => self::ERROR,
  36351. LogLevel::WARNING => self::INFO,
  36352. LogLevel::NOTICE => self::INFO,
  36353. LogLevel::INFO => self::INFO,
  36354. LogLevel::DEBUG => self::INFO,
  36355. );
  36356. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  36357. {
  36358. $this->output = $output;
  36359. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  36360. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  36361. }
  36362. public function log($level, $message, array $context = array())
  36363. {
  36364. if (!isset($this->verbosityLevelMap[$level])) {
  36365. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  36366. }
  36367. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  36368. $output = $this->output->getErrorOutput();
  36369. } else {
  36370. $output = $this->output;
  36371. }
  36372. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  36373. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  36374. }
  36375. }
  36376. private function interpolate($message, array $context)
  36377. {
  36378. $replace = array();
  36379. foreach ($context as $key => $val) {
  36380. if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
  36381. $replace[sprintf('{%s}', $key)] = $val;
  36382. }
  36383. }
  36384. return strtr($message, $replace);
  36385. }
  36386. }
  36387. <?php
  36388. namespace Symfony\Component\Console\Output;
  36389. class BufferedOutput extends Output
  36390. {
  36391. private $buffer = '';
  36392. public function fetch()
  36393. {
  36394. $content = $this->buffer;
  36395. $this->buffer = '';
  36396. return $content;
  36397. }
  36398. protected function doWrite($message, $newline)
  36399. {
  36400. $this->buffer .= $message;
  36401. if ($newline) {
  36402. $this->buffer .= PHP_EOL;
  36403. }
  36404. }
  36405. }
  36406. <?php
  36407. namespace Symfony\Component\Console\Output;
  36408. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36409. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  36410. {
  36411. private $stderr;
  36412. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  36413. {
  36414. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  36415. $actualDecorated = $this->isDecorated();
  36416. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  36417. if (null === $decorated) {
  36418. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  36419. }
  36420. }
  36421. public function setDecorated($decorated)
  36422. {
  36423. parent::setDecorated($decorated);
  36424. $this->stderr->setDecorated($decorated);
  36425. }
  36426. public function setFormatter(OutputFormatterInterface $formatter)
  36427. {
  36428. parent::setFormatter($formatter);
  36429. $this->stderr->setFormatter($formatter);
  36430. }
  36431. public function setVerbosity($level)
  36432. {
  36433. parent::setVerbosity($level);
  36434. $this->stderr->setVerbosity($level);
  36435. }
  36436. public function getErrorOutput()
  36437. {
  36438. return $this->stderr;
  36439. }
  36440. public function setErrorOutput(OutputInterface $error)
  36441. {
  36442. $this->stderr = $error;
  36443. }
  36444. protected function hasStdoutSupport()
  36445. {
  36446. return false === $this->isRunningOS400();
  36447. }
  36448. protected function hasStderrSupport()
  36449. {
  36450. return false === $this->isRunningOS400();
  36451. }
  36452. private function isRunningOS400()
  36453. {
  36454. $checks = array(
  36455. function_exists('php_uname') ? php_uname('s') : '',
  36456. getenv('OSTYPE'),
  36457. PHP_OS,
  36458. );
  36459. return false !== stripos(implode(';', $checks), 'OS400');
  36460. }
  36461. private function openOutputStream()
  36462. {
  36463. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  36464. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  36465. }
  36466. private function openErrorStream()
  36467. {
  36468. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  36469. return fopen($errorStream, 'w');
  36470. }
  36471. }
  36472. <?php
  36473. namespace Symfony\Component\Console\Output;
  36474. interface ConsoleOutputInterface extends OutputInterface
  36475. {
  36476. public function getErrorOutput();
  36477. public function setErrorOutput(OutputInterface $error);
  36478. }
  36479. <?php
  36480. namespace Symfony\Component\Console\Output;
  36481. use Symfony\Component\Console\Formatter\OutputFormatter;
  36482. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36483. class NullOutput implements OutputInterface
  36484. {
  36485. public function setFormatter(OutputFormatterInterface $formatter)
  36486. {
  36487. }
  36488. public function getFormatter()
  36489. {
  36490. return new OutputFormatter();
  36491. }
  36492. public function setDecorated($decorated)
  36493. {
  36494. }
  36495. public function isDecorated()
  36496. {
  36497. return false;
  36498. }
  36499. public function setVerbosity($level)
  36500. {
  36501. }
  36502. public function getVerbosity()
  36503. {
  36504. return self::VERBOSITY_QUIET;
  36505. }
  36506. public function isQuiet()
  36507. {
  36508. return true;
  36509. }
  36510. public function isVerbose()
  36511. {
  36512. return false;
  36513. }
  36514. public function isVeryVerbose()
  36515. {
  36516. return false;
  36517. }
  36518. public function isDebug()
  36519. {
  36520. return false;
  36521. }
  36522. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  36523. {
  36524. }
  36525. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  36526. {
  36527. }
  36528. }
  36529. <?php
  36530. namespace Symfony\Component\Console\Output;
  36531. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36532. use Symfony\Component\Console\Formatter\OutputFormatter;
  36533. abstract class Output implements OutputInterface
  36534. {
  36535. private $verbosity;
  36536. private $formatter;
  36537. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  36538. {
  36539. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  36540. $this->formatter = $formatter ?: new OutputFormatter();
  36541. $this->formatter->setDecorated($decorated);
  36542. }
  36543. public function setFormatter(OutputFormatterInterface $formatter)
  36544. {
  36545. $this->formatter = $formatter;
  36546. }
  36547. public function getFormatter()
  36548. {
  36549. return $this->formatter;
  36550. }
  36551. public function setDecorated($decorated)
  36552. {
  36553. $this->formatter->setDecorated($decorated);
  36554. }
  36555. public function isDecorated()
  36556. {
  36557. return $this->formatter->isDecorated();
  36558. }
  36559. public function setVerbosity($level)
  36560. {
  36561. $this->verbosity = (int) $level;
  36562. }
  36563. public function getVerbosity()
  36564. {
  36565. return $this->verbosity;
  36566. }
  36567. public function isQuiet()
  36568. {
  36569. return self::VERBOSITY_QUIET === $this->verbosity;
  36570. }
  36571. public function isVerbose()
  36572. {
  36573. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  36574. }
  36575. public function isVeryVerbose()
  36576. {
  36577. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  36578. }
  36579. public function isDebug()
  36580. {
  36581. return self::VERBOSITY_DEBUG <= $this->verbosity;
  36582. }
  36583. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  36584. {
  36585. $this->write($messages, true, $options);
  36586. }
  36587. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  36588. {
  36589. $messages = (array) $messages;
  36590. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  36591. $type = $types & $options ?: self::OUTPUT_NORMAL;
  36592. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  36593. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  36594. if ($verbosity > $this->getVerbosity()) {
  36595. return;
  36596. }
  36597. foreach ($messages as $message) {
  36598. switch ($type) {
  36599. case OutputInterface::OUTPUT_NORMAL:
  36600. $message = $this->formatter->format($message);
  36601. break;
  36602. case OutputInterface::OUTPUT_RAW:
  36603. break;
  36604. case OutputInterface::OUTPUT_PLAIN:
  36605. $message = strip_tags($this->formatter->format($message));
  36606. break;
  36607. }
  36608. $this->doWrite($message, $newline);
  36609. }
  36610. }
  36611. abstract protected function doWrite($message, $newline);
  36612. }
  36613. <?php
  36614. namespace Symfony\Component\Console\Output;
  36615. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36616. interface OutputInterface
  36617. {
  36618. const VERBOSITY_QUIET = 16;
  36619. const VERBOSITY_NORMAL = 32;
  36620. const VERBOSITY_VERBOSE = 64;
  36621. const VERBOSITY_VERY_VERBOSE = 128;
  36622. const VERBOSITY_DEBUG = 256;
  36623. const OUTPUT_NORMAL = 1;
  36624. const OUTPUT_RAW = 2;
  36625. const OUTPUT_PLAIN = 4;
  36626. public function write($messages, $newline = false, $options = 0);
  36627. public function writeln($messages, $options = 0);
  36628. public function setVerbosity($level);
  36629. public function getVerbosity();
  36630. public function setDecorated($decorated);
  36631. public function isDecorated();
  36632. public function setFormatter(OutputFormatterInterface $formatter);
  36633. public function getFormatter();
  36634. }
  36635. <?php
  36636. namespace Symfony\Component\Console\Output;
  36637. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36638. use Symfony\Component\Console\Exception\RuntimeException;
  36639. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36640. class StreamOutput extends Output
  36641. {
  36642. private $stream;
  36643. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  36644. {
  36645. if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  36646. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  36647. }
  36648. $this->stream = $stream;
  36649. if (null === $decorated) {
  36650. $decorated = $this->hasColorSupport();
  36651. }
  36652. parent::__construct($verbosity, $decorated, $formatter);
  36653. }
  36654. public function getStream()
  36655. {
  36656. return $this->stream;
  36657. }
  36658. protected function doWrite($message, $newline)
  36659. {
  36660. if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) {
  36661. throw new RuntimeException('Unable to write output.');
  36662. }
  36663. fflush($this->stream);
  36664. }
  36665. protected function hasColorSupport()
  36666. {
  36667. if ('Hyper' === getenv('TERM_PROGRAM')) {
  36668. return true;
  36669. }
  36670. if (DIRECTORY_SEPARATOR === '\\') {
  36671. return (function_exists('sapi_windows_vt100_support')
  36672. && @sapi_windows_vt100_support($this->stream))
  36673. || false !== getenv('ANSICON')
  36674. || 'ON' === getenv('ConEmuANSI')
  36675. || 'xterm' === getenv('TERM');
  36676. }
  36677. if (function_exists('stream_isatty')) {
  36678. return @stream_isatty($this->stream);
  36679. }
  36680. if (function_exists('posix_isatty')) {
  36681. return @posix_isatty($this->stream);
  36682. }
  36683. $stat = @fstat($this->stream);
  36684. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  36685. }
  36686. }
  36687. <?php
  36688. namespace Symfony\Component\Console\Question;
  36689. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36690. class ChoiceQuestion extends Question
  36691. {
  36692. private $choices;
  36693. private $multiselect = false;
  36694. private $prompt = ' > ';
  36695. private $errorMessage = 'Value "%s" is invalid';
  36696. public function __construct($question, array $choices, $default = null)
  36697. {
  36698. if (!$choices) {
  36699. throw new \LogicException('Choice question must have at least 1 choice available.');
  36700. }
  36701. parent::__construct($question, $default);
  36702. $this->choices = $choices;
  36703. $this->setValidator($this->getDefaultValidator());
  36704. $this->setAutocompleterValues($choices);
  36705. }
  36706. public function getChoices()
  36707. {
  36708. return $this->choices;
  36709. }
  36710. public function setMultiselect($multiselect)
  36711. {
  36712. $this->multiselect = $multiselect;
  36713. $this->setValidator($this->getDefaultValidator());
  36714. return $this;
  36715. }
  36716. public function isMultiselect()
  36717. {
  36718. return $this->multiselect;
  36719. }
  36720. public function getPrompt()
  36721. {
  36722. return $this->prompt;
  36723. }
  36724. public function setPrompt($prompt)
  36725. {
  36726. $this->prompt = $prompt;
  36727. return $this;
  36728. }
  36729. public function setErrorMessage($errorMessage)
  36730. {
  36731. $this->errorMessage = $errorMessage;
  36732. $this->setValidator($this->getDefaultValidator());
  36733. return $this;
  36734. }
  36735. private function getDefaultValidator()
  36736. {
  36737. $choices = $this->choices;
  36738. $errorMessage = $this->errorMessage;
  36739. $multiselect = $this->multiselect;
  36740. $isAssoc = $this->isAssoc($choices);
  36741. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  36742. $selectedChoices = str_replace(' ', '', $selected);
  36743. if ($multiselect) {
  36744. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  36745. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  36746. }
  36747. $selectedChoices = explode(',', $selectedChoices);
  36748. } else {
  36749. $selectedChoices = array($selected);
  36750. }
  36751. $multiselectChoices = array();
  36752. foreach ($selectedChoices as $value) {
  36753. $results = array();
  36754. foreach ($choices as $key => $choice) {
  36755. if ($choice === $value) {
  36756. $results[] = $key;
  36757. }
  36758. }
  36759. if (count($results) > 1) {
  36760. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  36761. }
  36762. $result = array_search($value, $choices);
  36763. if (!$isAssoc) {
  36764. if (false !== $result) {
  36765. $result = $choices[$result];
  36766. } elseif (isset($choices[$value])) {
  36767. $result = $choices[$value];
  36768. }
  36769. } elseif (false === $result && isset($choices[$value])) {
  36770. $result = $value;
  36771. }
  36772. if (false === $result) {
  36773. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  36774. }
  36775. $multiselectChoices[] = (string) $result;
  36776. }
  36777. if ($multiselect) {
  36778. return $multiselectChoices;
  36779. }
  36780. return current($multiselectChoices);
  36781. };
  36782. }
  36783. }
  36784. <?php
  36785. namespace Symfony\Component\Console\Question;
  36786. class ConfirmationQuestion extends Question
  36787. {
  36788. private $trueAnswerRegex;
  36789. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  36790. {
  36791. parent::__construct($question, (bool) $default);
  36792. $this->trueAnswerRegex = $trueAnswerRegex;
  36793. $this->setNormalizer($this->getDefaultNormalizer());
  36794. }
  36795. private function getDefaultNormalizer()
  36796. {
  36797. $default = $this->getDefault();
  36798. $regex = $this->trueAnswerRegex;
  36799. return function ($answer) use ($default, $regex) {
  36800. if (is_bool($answer)) {
  36801. return $answer;
  36802. }
  36803. $answerIsTrue = (bool) preg_match($regex, $answer);
  36804. if (false === $default) {
  36805. return $answer && $answerIsTrue;
  36806. }
  36807. return !$answer || $answerIsTrue;
  36808. };
  36809. }
  36810. }
  36811. <?php
  36812. namespace Symfony\Component\Console\Question;
  36813. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36814. use Symfony\Component\Console\Exception\LogicException;
  36815. class Question
  36816. {
  36817. private $question;
  36818. private $attempts;
  36819. private $hidden = false;
  36820. private $hiddenFallback = true;
  36821. private $autocompleterValues;
  36822. private $validator;
  36823. private $default;
  36824. private $normalizer;
  36825. public function __construct($question, $default = null)
  36826. {
  36827. $this->question = $question;
  36828. $this->default = $default;
  36829. }
  36830. public function getQuestion()
  36831. {
  36832. return $this->question;
  36833. }
  36834. public function getDefault()
  36835. {
  36836. return $this->default;
  36837. }
  36838. public function isHidden()
  36839. {
  36840. return $this->hidden;
  36841. }
  36842. public function setHidden($hidden)
  36843. {
  36844. if ($this->autocompleterValues) {
  36845. throw new LogicException('A hidden question cannot use the autocompleter.');
  36846. }
  36847. $this->hidden = (bool) $hidden;
  36848. return $this;
  36849. }
  36850. public function isHiddenFallback()
  36851. {
  36852. return $this->hiddenFallback;
  36853. }
  36854. public function setHiddenFallback($fallback)
  36855. {
  36856. $this->hiddenFallback = (bool) $fallback;
  36857. return $this;
  36858. }
  36859. public function getAutocompleterValues()
  36860. {
  36861. return $this->autocompleterValues;
  36862. }
  36863. public function setAutocompleterValues($values)
  36864. {
  36865. if (is_array($values)) {
  36866. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  36867. }
  36868. if (null !== $values && !is_array($values) && !$values instanceof \Traversable) {
  36869. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  36870. }
  36871. if ($this->hidden) {
  36872. throw new LogicException('A hidden question cannot use the autocompleter.');
  36873. }
  36874. $this->autocompleterValues = $values;
  36875. return $this;
  36876. }
  36877. public function setValidator($validator)
  36878. {
  36879. $this->validator = $validator;
  36880. return $this;
  36881. }
  36882. public function getValidator()
  36883. {
  36884. return $this->validator;
  36885. }
  36886. public function setMaxAttempts($attempts)
  36887. {
  36888. if (null !== $attempts && $attempts < 1) {
  36889. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  36890. }
  36891. $this->attempts = $attempts;
  36892. return $this;
  36893. }
  36894. public function getMaxAttempts()
  36895. {
  36896. return $this->attempts;
  36897. }
  36898. public function setNormalizer($normalizer)
  36899. {
  36900. $this->normalizer = $normalizer;
  36901. return $this;
  36902. }
  36903. public function getNormalizer()
  36904. {
  36905. return $this->normalizer;
  36906. }
  36907. protected function isAssoc($array)
  36908. {
  36909. return (bool) count(array_filter(array_keys($array), 'is_string'));
  36910. }
  36911. }
  36912. <?php
  36913. namespace Symfony\Component\Console;
  36914. use Symfony\Component\Console\Exception\RuntimeException;
  36915. use Symfony\Component\Console\Input\StringInput;
  36916. use Symfony\Component\Console\Output\ConsoleOutput;
  36917. use Symfony\Component\Process\ProcessBuilder;
  36918. use Symfony\Component\Process\PhpExecutableFinder;
  36919. class Shell
  36920. {
  36921. private $application;
  36922. private $history;
  36923. private $output;
  36924. private $hasReadline;
  36925. private $processIsolation = false;
  36926. public function __construct(Application $application)
  36927. {
  36928. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  36929. $this->hasReadline = function_exists('readline');
  36930. $this->application = $application;
  36931. $this->history = getenv('HOME').'/.history_'.$application->getName();
  36932. $this->output = new ConsoleOutput();
  36933. }
  36934. public function run()
  36935. {
  36936. $this->application->setAutoExit(false);
  36937. $this->application->setCatchExceptions(true);
  36938. if ($this->hasReadline) {
  36939. readline_read_history($this->history);
  36940. readline_completion_function(array($this, 'autocompleter'));
  36941. }
  36942. $this->output->writeln($this->getHeader());
  36943. $php = null;
  36944. if ($this->processIsolation) {
  36945. $finder = new PhpExecutableFinder();
  36946. $php = $finder->find();
  36947. $this->output->writeln(<<<'EOF'
  36948. <info>Running with process isolation, you should consider this:</info>
  36949. * each command is executed as separate process,
  36950. * commands don't support interactivity, all params must be passed explicitly,
  36951. * commands output is not colorized.
  36952. EOF
  36953. );
  36954. }
  36955. while (true) {
  36956. $command = $this->readline();
  36957. if (false === $command) {
  36958. $this->output->writeln("\n");
  36959. break;
  36960. }
  36961. if ($this->hasReadline) {
  36962. readline_add_history($command);
  36963. readline_write_history($this->history);
  36964. }
  36965. if ($this->processIsolation) {
  36966. $pb = new ProcessBuilder();
  36967. $process = $pb
  36968. ->add($php)
  36969. ->add($_SERVER['argv'][0])
  36970. ->add($command)
  36971. ->inheritEnvironmentVariables(true)
  36972. ->getProcess()
  36973. ;
  36974. $output = $this->output;
  36975. $process->run(function ($type, $data) use ($output) {
  36976. $output->writeln($data);
  36977. });
  36978. $ret = $process->getExitCode();
  36979. } else {
  36980. $ret = $this->application->run(new StringInput($command), $this->output);
  36981. }
  36982. if (0 !== $ret) {
  36983. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  36984. }
  36985. }
  36986. }
  36987. protected function getHeader()
  36988. {
  36989. return <<<EOF
  36990. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  36991. At the prompt, type <comment>help</comment> for some help,
  36992. or <comment>list</comment> to get a list of available commands.
  36993. To exit the shell, type <comment>^D</comment>.
  36994. EOF;
  36995. }
  36996. protected function getPrompt()
  36997. {
  36998. return $this->output->getFormatter()->format($this->application->getName().' > ');
  36999. }
  37000. protected function getOutput()
  37001. {
  37002. return $this->output;
  37003. }
  37004. protected function getApplication()
  37005. {
  37006. return $this->application;
  37007. }
  37008. private function autocompleter($text)
  37009. {
  37010. $info = readline_info();
  37011. $text = substr($info['line_buffer'], 0, $info['end']);
  37012. if ($info['point'] !== $info['end']) {
  37013. return true;
  37014. }
  37015. if (false === strpos($text, ' ') || !$text) {
  37016. return array_keys($this->application->all());
  37017. }
  37018. try {
  37019. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  37020. } catch (\Exception $e) {
  37021. return true;
  37022. }
  37023. $list = array('--help');
  37024. foreach ($command->getDefinition()->getOptions() as $option) {
  37025. $list[] = '--'.$option->getName();
  37026. }
  37027. return $list;
  37028. }
  37029. private function readline()
  37030. {
  37031. if ($this->hasReadline) {
  37032. $line = readline($this->getPrompt());
  37033. } else {
  37034. $this->output->write($this->getPrompt());
  37035. $line = fgets(STDIN, 1024);
  37036. $line = (false === $line || '' === $line) ? false : rtrim($line);
  37037. }
  37038. return $line;
  37039. }
  37040. public function getProcessIsolation()
  37041. {
  37042. return $this->processIsolation;
  37043. }
  37044. public function setProcessIsolation($processIsolation)
  37045. {
  37046. $this->processIsolation = (bool) $processIsolation;
  37047. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  37048. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  37049. }
  37050. }
  37051. }
  37052. <?php
  37053. namespace Symfony\Component\Console\Style;
  37054. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37055. use Symfony\Component\Console\Helper\ProgressBar;
  37056. use Symfony\Component\Console\Output\OutputInterface;
  37057. abstract class OutputStyle implements OutputInterface, StyleInterface
  37058. {
  37059. private $output;
  37060. public function __construct(OutputInterface $output)
  37061. {
  37062. $this->output = $output;
  37063. }
  37064. public function newLine($count = 1)
  37065. {
  37066. $this->output->write(str_repeat(PHP_EOL, $count));
  37067. }
  37068. public function createProgressBar($max = 0)
  37069. {
  37070. return new ProgressBar($this->output, $max);
  37071. }
  37072. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  37073. {
  37074. $this->output->write($messages, $newline, $type);
  37075. }
  37076. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  37077. {
  37078. $this->output->writeln($messages, $type);
  37079. }
  37080. public function setVerbosity($level)
  37081. {
  37082. $this->output->setVerbosity($level);
  37083. }
  37084. public function getVerbosity()
  37085. {
  37086. return $this->output->getVerbosity();
  37087. }
  37088. public function setDecorated($decorated)
  37089. {
  37090. $this->output->setDecorated($decorated);
  37091. }
  37092. public function isDecorated()
  37093. {
  37094. return $this->output->isDecorated();
  37095. }
  37096. public function setFormatter(OutputFormatterInterface $formatter)
  37097. {
  37098. $this->output->setFormatter($formatter);
  37099. }
  37100. public function getFormatter()
  37101. {
  37102. return $this->output->getFormatter();
  37103. }
  37104. }
  37105. <?php
  37106. namespace Symfony\Component\Console\Style;
  37107. interface StyleInterface
  37108. {
  37109. public function title($message);
  37110. public function section($message);
  37111. public function listing(array $elements);
  37112. public function text($message);
  37113. public function success($message);
  37114. public function error($message);
  37115. public function warning($message);
  37116. public function note($message);
  37117. public function caution($message);
  37118. public function table(array $headers, array $rows);
  37119. public function ask($question, $default = null, $validator = null);
  37120. public function askHidden($question, $validator = null);
  37121. public function confirm($question, $default = true);
  37122. public function choice($question, array $choices, $default = null);
  37123. public function newLine($count = 1);
  37124. public function progressStart($max = 0);
  37125. public function progressAdvance($step = 1);
  37126. public function progressFinish();
  37127. }
  37128. <?php
  37129. namespace Symfony\Component\Console\Style;
  37130. use Symfony\Component\Console\Application;
  37131. use Symfony\Component\Console\Exception\RuntimeException;
  37132. use Symfony\Component\Console\Formatter\OutputFormatter;
  37133. use Symfony\Component\Console\Helper\Helper;
  37134. use Symfony\Component\Console\Helper\ProgressBar;
  37135. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  37136. use Symfony\Component\Console\Helper\Table;
  37137. use Symfony\Component\Console\Input\InputInterface;
  37138. use Symfony\Component\Console\Output\BufferedOutput;
  37139. use Symfony\Component\Console\Output\OutputInterface;
  37140. use Symfony\Component\Console\Question\ChoiceQuestion;
  37141. use Symfony\Component\Console\Question\ConfirmationQuestion;
  37142. use Symfony\Component\Console\Question\Question;
  37143. class SymfonyStyle extends OutputStyle
  37144. {
  37145. const MAX_LINE_LENGTH = 120;
  37146. private $input;
  37147. private $questionHelper;
  37148. private $progressBar;
  37149. private $lineLength;
  37150. private $bufferedOutput;
  37151. public function __construct(InputInterface $input, OutputInterface $output)
  37152. {
  37153. $this->input = $input;
  37154. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  37155. $this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  37156. parent::__construct($output);
  37157. }
  37158. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  37159. {
  37160. $messages = is_array($messages) ? array_values($messages) : array($messages);
  37161. $this->autoPrependBlock();
  37162. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  37163. $this->newLine();
  37164. }
  37165. public function title($message)
  37166. {
  37167. $this->autoPrependBlock();
  37168. $this->writeln(array(
  37169. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  37170. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  37171. ));
  37172. $this->newLine();
  37173. }
  37174. public function section($message)
  37175. {
  37176. $this->autoPrependBlock();
  37177. $this->writeln(array(
  37178. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  37179. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  37180. ));
  37181. $this->newLine();
  37182. }
  37183. public function listing(array $elements)
  37184. {
  37185. $this->autoPrependText();
  37186. $elements = array_map(function ($element) {
  37187. return sprintf(' * %s', $element);
  37188. }, $elements);
  37189. $this->writeln($elements);
  37190. $this->newLine();
  37191. }
  37192. public function text($message)
  37193. {
  37194. $this->autoPrependText();
  37195. $messages = is_array($message) ? array_values($message) : array($message);
  37196. foreach ($messages as $message) {
  37197. $this->writeln(sprintf(' %s', $message));
  37198. }
  37199. }
  37200. public function comment($message)
  37201. {
  37202. $messages = is_array($message) ? array_values($message) : array($message);
  37203. $this->autoPrependBlock();
  37204. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  37205. $this->newLine();
  37206. }
  37207. public function success($message)
  37208. {
  37209. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  37210. }
  37211. public function error($message)
  37212. {
  37213. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  37214. }
  37215. public function warning($message)
  37216. {
  37217. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  37218. }
  37219. public function note($message)
  37220. {
  37221. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  37222. }
  37223. public function caution($message)
  37224. {
  37225. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  37226. }
  37227. public function table(array $headers, array $rows)
  37228. {
  37229. $style = clone Table::getStyleDefinition('symfony-style-guide');
  37230. $style->setCellHeaderFormat('<info>%s</info>');
  37231. $table = new Table($this);
  37232. $table->setHeaders($headers);
  37233. $table->setRows($rows);
  37234. $table->setStyle($style);
  37235. $table->render();
  37236. $this->newLine();
  37237. }
  37238. public function ask($question, $default = null, $validator = null)
  37239. {
  37240. $question = new Question($question, $default);
  37241. $question->setValidator($validator);
  37242. return $this->askQuestion($question);
  37243. }
  37244. public function askHidden($question, $validator = null)
  37245. {
  37246. $question = new Question($question);
  37247. $question->setHidden(true);
  37248. $question->setValidator($validator);
  37249. return $this->askQuestion($question);
  37250. }
  37251. public function confirm($question, $default = true)
  37252. {
  37253. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  37254. }
  37255. public function choice($question, array $choices, $default = null)
  37256. {
  37257. if (null !== $default) {
  37258. $values = array_flip($choices);
  37259. $default = $values[$default];
  37260. }
  37261. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  37262. }
  37263. public function progressStart($max = 0)
  37264. {
  37265. $this->progressBar = $this->createProgressBar($max);
  37266. $this->progressBar->start();
  37267. }
  37268. public function progressAdvance($step = 1)
  37269. {
  37270. $this->getProgressBar()->advance($step);
  37271. }
  37272. public function progressFinish()
  37273. {
  37274. $this->getProgressBar()->finish();
  37275. $this->newLine(2);
  37276. $this->progressBar = null;
  37277. }
  37278. public function createProgressBar($max = 0)
  37279. {
  37280. $progressBar = parent::createProgressBar($max);
  37281. if ('\\' !== DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  37282. $progressBar->setEmptyBarCharacter('â–‘');
  37283. $progressBar->setProgressCharacter('');
  37284. $progressBar->setBarCharacter('â–“');
  37285. }
  37286. return $progressBar;
  37287. }
  37288. public function askQuestion(Question $question)
  37289. {
  37290. if ($this->input->isInteractive()) {
  37291. $this->autoPrependBlock();
  37292. }
  37293. if (!$this->questionHelper) {
  37294. $this->questionHelper = new SymfonyQuestionHelper();
  37295. }
  37296. $answer = $this->questionHelper->ask($this->input, $this, $question);
  37297. if ($this->input->isInteractive()) {
  37298. $this->newLine();
  37299. $this->bufferedOutput->write("\n");
  37300. }
  37301. return $answer;
  37302. }
  37303. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  37304. {
  37305. parent::writeln($messages, $type);
  37306. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  37307. }
  37308. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  37309. {
  37310. parent::write($messages, $newline, $type);
  37311. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  37312. }
  37313. public function newLine($count = 1)
  37314. {
  37315. parent::newLine($count);
  37316. $this->bufferedOutput->write(str_repeat("\n", $count));
  37317. }
  37318. private function getProgressBar()
  37319. {
  37320. if (!$this->progressBar) {
  37321. throw new RuntimeException('The ProgressBar is not started.');
  37322. }
  37323. return $this->progressBar;
  37324. }
  37325. private function getTerminalWidth()
  37326. {
  37327. $application = new Application();
  37328. $dimensions = $application->getTerminalDimensions();
  37329. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  37330. }
  37331. private function autoPrependBlock()
  37332. {
  37333. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  37334. if (!isset($chars[0])) {
  37335. return $this->newLine();
  37336. }
  37337. $this->newLine(2 - substr_count($chars, "\n"));
  37338. }
  37339. private function autoPrependText()
  37340. {
  37341. $fetched = $this->bufferedOutput->fetch();
  37342. if ("\n" !== substr($fetched, -1)) {
  37343. $this->newLine();
  37344. }
  37345. }
  37346. private function reduceBuffer($messages)
  37347. {
  37348. return array_map(function ($value) {
  37349. return substr($value, -4);
  37350. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  37351. }
  37352. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  37353. {
  37354. $indentLength = 0;
  37355. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  37356. $lines = array();
  37357. if (null !== $type) {
  37358. $type = sprintf('[%s] ', $type);
  37359. $indentLength = strlen($type);
  37360. $lineIndentation = str_repeat(' ', $indentLength);
  37361. }
  37362. foreach ($messages as $key => $message) {
  37363. if ($escape) {
  37364. $message = OutputFormatter::escape($message);
  37365. }
  37366. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  37367. if (count($messages) > 1 && $key < count($messages) - 1) {
  37368. $lines[] = '';
  37369. }
  37370. }
  37371. $firstLineIndex = 0;
  37372. if ($padding && $this->isDecorated()) {
  37373. $firstLineIndex = 1;
  37374. array_unshift($lines, '');
  37375. $lines[] = '';
  37376. }
  37377. foreach ($lines as $i => &$line) {
  37378. if (null !== $type) {
  37379. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  37380. }
  37381. $line = $prefix.$line;
  37382. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  37383. if ($style) {
  37384. $line = sprintf('<%s>%s</>', $style, $line);
  37385. }
  37386. }
  37387. return $lines;
  37388. }
  37389. }
  37390. <?php
  37391. namespace Symfony\Component\Console\Tester;
  37392. use Symfony\Component\Console\Application;
  37393. use Symfony\Component\Console\Input\ArrayInput;
  37394. use Symfony\Component\Console\Input\InputInterface;
  37395. use Symfony\Component\Console\Output\OutputInterface;
  37396. use Symfony\Component\Console\Output\StreamOutput;
  37397. class ApplicationTester
  37398. {
  37399. private $application;
  37400. private $input;
  37401. private $output;
  37402. private $statusCode;
  37403. public function __construct(Application $application)
  37404. {
  37405. $this->application = $application;
  37406. }
  37407. public function run(array $input, $options = array())
  37408. {
  37409. $this->input = new ArrayInput($input);
  37410. if (isset($options['interactive'])) {
  37411. $this->input->setInteractive($options['interactive']);
  37412. }
  37413. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  37414. if (isset($options['decorated'])) {
  37415. $this->output->setDecorated($options['decorated']);
  37416. }
  37417. if (isset($options['verbosity'])) {
  37418. $this->output->setVerbosity($options['verbosity']);
  37419. }
  37420. return $this->statusCode = $this->application->run($this->input, $this->output);
  37421. }
  37422. public function getDisplay($normalize = false)
  37423. {
  37424. rewind($this->output->getStream());
  37425. $display = stream_get_contents($this->output->getStream());
  37426. if ($normalize) {
  37427. $display = str_replace(PHP_EOL, "\n", $display);
  37428. }
  37429. return $display;
  37430. }
  37431. public function getInput()
  37432. {
  37433. return $this->input;
  37434. }
  37435. public function getOutput()
  37436. {
  37437. return $this->output;
  37438. }
  37439. public function getStatusCode()
  37440. {
  37441. return $this->statusCode;
  37442. }
  37443. }
  37444. <?php
  37445. namespace Symfony\Component\Console\Tester;
  37446. use Symfony\Component\Console\Command\Command;
  37447. use Symfony\Component\Console\Input\ArrayInput;
  37448. use Symfony\Component\Console\Output\StreamOutput;
  37449. use Symfony\Component\Console\Input\InputInterface;
  37450. use Symfony\Component\Console\Output\OutputInterface;
  37451. class CommandTester
  37452. {
  37453. private $command;
  37454. private $input;
  37455. private $output;
  37456. private $statusCode;
  37457. public function __construct(Command $command)
  37458. {
  37459. $this->command = $command;
  37460. }
  37461. public function execute(array $input, array $options = array())
  37462. {
  37463. if (!isset($input['command'])
  37464. && (null !== $application = $this->command->getApplication())
  37465. && $application->getDefinition()->hasArgument('command')
  37466. ) {
  37467. $input = array_merge(array('command' => $this->command->getName()), $input);
  37468. }
  37469. $this->input = new ArrayInput($input);
  37470. if (isset($options['interactive'])) {
  37471. $this->input->setInteractive($options['interactive']);
  37472. }
  37473. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  37474. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  37475. if (isset($options['verbosity'])) {
  37476. $this->output->setVerbosity($options['verbosity']);
  37477. }
  37478. return $this->statusCode = $this->command->run($this->input, $this->output);
  37479. }
  37480. public function getDisplay($normalize = false)
  37481. {
  37482. rewind($this->output->getStream());
  37483. $display = stream_get_contents($this->output->getStream());
  37484. if ($normalize) {
  37485. $display = str_replace(PHP_EOL, "\n", $display);
  37486. }
  37487. return $display;
  37488. }
  37489. public function getInput()
  37490. {
  37491. return $this->input;
  37492. }
  37493. public function getOutput()
  37494. {
  37495. return $this->output;
  37496. }
  37497. public function getStatusCode()
  37498. {
  37499. return $this->statusCode;
  37500. }
  37501. }
  37502. <?php
  37503. namespace Symfony\Component\Debug;
  37504. use Psr\Log\AbstractLogger;
  37505. class BufferingLogger extends AbstractLogger
  37506. {
  37507. private $logs = array();
  37508. public function log($level, $message, array $context = array())
  37509. {
  37510. $this->logs[] = array($level, $message, $context);
  37511. }
  37512. public function cleanLogs()
  37513. {
  37514. $logs = $this->logs;
  37515. $this->logs = array();
  37516. return $logs;
  37517. }
  37518. }
  37519. <?php
  37520. namespace Symfony\Component\Debug;
  37521. class Debug
  37522. {
  37523. private static $enabled = false;
  37524. public static function enable($errorReportingLevel = null, $displayErrors = true)
  37525. {
  37526. if (static::$enabled) {
  37527. return;
  37528. }
  37529. static::$enabled = true;
  37530. if (null !== $errorReportingLevel) {
  37531. error_reporting($errorReportingLevel);
  37532. } else {
  37533. error_reporting(-1);
  37534. }
  37535. if (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true)) {
  37536. ini_set('display_errors', 0);
  37537. ExceptionHandler::register();
  37538. } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
  37539. ini_set('display_errors', 1);
  37540. }
  37541. if ($displayErrors) {
  37542. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  37543. } else {
  37544. ErrorHandler::register()->throwAt(0, true);
  37545. }
  37546. DebugClassLoader::enable();
  37547. }
  37548. }
  37549. <?php
  37550. namespace Symfony\Component\Debug;
  37551. class DebugClassLoader
  37552. {
  37553. private $classLoader;
  37554. private $isFinder;
  37555. private $loaded = array();
  37556. private $wasFinder;
  37557. private static $caseCheck;
  37558. private static $deprecated = array();
  37559. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  37560. private static $darwinCache = array('/' => array('/', array()));
  37561. public function __construct($classLoader)
  37562. {
  37563. $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
  37564. if ($this->wasFinder) {
  37565. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  37566. $this->classLoader = array($classLoader, 'loadClass');
  37567. $this->isFinder = true;
  37568. } else {
  37569. $this->classLoader = $classLoader;
  37570. $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  37571. }
  37572. if (!isset(self::$caseCheck)) {
  37573. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
  37574. $i = strrpos($file, DIRECTORY_SEPARATOR);
  37575. $dir = substr($file, 0, 1 + $i);
  37576. $file = substr($file, 1 + $i);
  37577. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  37578. $test = realpath($dir.$test);
  37579. if (false === $test || false === $i) {
  37580. self::$caseCheck = 0;
  37581. } elseif (substr($test, -strlen($file)) === $file) {
  37582. self::$caseCheck = 1;
  37583. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  37584. self::$caseCheck = 2;
  37585. } else {
  37586. self::$caseCheck = 0;
  37587. }
  37588. }
  37589. }
  37590. public function getClassLoader()
  37591. {
  37592. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  37593. }
  37594. public static function enable()
  37595. {
  37596. class_exists('Symfony\Component\Debug\ErrorHandler');
  37597. class_exists('Psr\Log\LogLevel');
  37598. if (!is_array($functions = spl_autoload_functions())) {
  37599. return;
  37600. }
  37601. foreach ($functions as $function) {
  37602. spl_autoload_unregister($function);
  37603. }
  37604. foreach ($functions as $function) {
  37605. if (!is_array($function) || !$function[0] instanceof self) {
  37606. $function = array(new static($function), 'loadClass');
  37607. }
  37608. spl_autoload_register($function);
  37609. }
  37610. }
  37611. public static function disable()
  37612. {
  37613. if (!is_array($functions = spl_autoload_functions())) {
  37614. return;
  37615. }
  37616. foreach ($functions as $function) {
  37617. spl_autoload_unregister($function);
  37618. }
  37619. foreach ($functions as $function) {
  37620. if (is_array($function) && $function[0] instanceof self) {
  37621. $function = $function[0]->getClassLoader();
  37622. }
  37623. spl_autoload_register($function);
  37624. }
  37625. }
  37626. public function findFile($class)
  37627. {
  37628. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  37629. if ($this->wasFinder) {
  37630. return $this->classLoader[0]->findFile($class);
  37631. }
  37632. }
  37633. public function loadClass($class)
  37634. {
  37635. ErrorHandler::stackErrors();
  37636. try {
  37637. if ($this->isFinder && !isset($this->loaded[$class])) {
  37638. $this->loaded[$class] = true;
  37639. if ($file = $this->classLoader[0]->findFile($class)) {
  37640. require $file;
  37641. }
  37642. } else {
  37643. call_user_func($this->classLoader, $class);
  37644. $file = false;
  37645. }
  37646. } catch (\Exception $e) {
  37647. ErrorHandler::unstackErrors();
  37648. throw $e;
  37649. } catch (\Throwable $e) {
  37650. ErrorHandler::unstackErrors();
  37651. throw $e;
  37652. }
  37653. ErrorHandler::unstackErrors();
  37654. $exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  37655. if ($class && '\\' === $class[0]) {
  37656. $class = substr($class, 1);
  37657. }
  37658. if ($exists) {
  37659. $refl = new \ReflectionClass($class);
  37660. $name = $refl->getName();
  37661. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  37662. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  37663. }
  37664. if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  37665. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  37666. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  37667. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  37668. } else {
  37669. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  37670. $len = 0;
  37671. $ns = '';
  37672. } else {
  37673. $ns = substr($name, 0, $len);
  37674. }
  37675. $parent = get_parent_class($class);
  37676. if (!$parent || strncmp($ns, $parent, $len)) {
  37677. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  37678. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  37679. }
  37680. $parentInterfaces = array();
  37681. $deprecatedInterfaces = array();
  37682. if ($parent) {
  37683. foreach (class_implements($parent) as $interface) {
  37684. $parentInterfaces[$interface] = 1;
  37685. }
  37686. }
  37687. foreach ($refl->getInterfaceNames() as $interface) {
  37688. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  37689. $deprecatedInterfaces[] = $interface;
  37690. }
  37691. foreach (class_implements($interface) as $interface) {
  37692. $parentInterfaces[$interface] = 1;
  37693. }
  37694. }
  37695. foreach ($deprecatedInterfaces as $interface) {
  37696. if (!isset($parentInterfaces[$interface])) {
  37697. @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);
  37698. }
  37699. }
  37700. }
  37701. }
  37702. }
  37703. if ($file) {
  37704. if (!$exists) {
  37705. if (false !== strpos($class, '/')) {
  37706. 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));
  37707. }
  37708. 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));
  37709. }
  37710. if (self::$caseCheck) {
  37711. $real = explode('\\', $class.strrchr($file, '.'));
  37712. $tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file));
  37713. $i = count($tail) - 1;
  37714. $j = count($real) - 1;
  37715. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  37716. --$i;
  37717. --$j;
  37718. }
  37719. array_splice($tail, 0, $i + 1);
  37720. }
  37721. if (self::$caseCheck && $tail) {
  37722. $tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail);
  37723. $tailLen = strlen($tail);
  37724. $real = $refl->getFileName();
  37725. if (2 === self::$caseCheck) {
  37726. $i = 1 + strrpos($real, '/');
  37727. $file = substr($real, $i);
  37728. $real = substr($real, 0, $i);
  37729. if (isset(self::$darwinCache[$real])) {
  37730. $kDir = $real;
  37731. } else {
  37732. $kDir = strtolower($real);
  37733. if (isset(self::$darwinCache[$kDir])) {
  37734. $real = self::$darwinCache[$kDir][0];
  37735. } else {
  37736. $dir = getcwd();
  37737. chdir($real);
  37738. $real = getcwd().'/';
  37739. chdir($dir);
  37740. $dir = $real;
  37741. $k = $kDir;
  37742. $i = strlen($dir) - 1;
  37743. while (!isset(self::$darwinCache[$k])) {
  37744. self::$darwinCache[$k] = array($dir, array());
  37745. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  37746. while ('/' !== $dir[--$i]) {
  37747. }
  37748. $k = substr($k, 0, ++$i);
  37749. $dir = substr($dir, 0, $i--);
  37750. }
  37751. }
  37752. }
  37753. $dirFiles = self::$darwinCache[$kDir][1];
  37754. if (isset($dirFiles[$file])) {
  37755. $kFile = $file;
  37756. } else {
  37757. $kFile = strtolower($file);
  37758. if (!isset($dirFiles[$kFile])) {
  37759. foreach (scandir($real, 2) as $f) {
  37760. if ('.' !== $f[0]) {
  37761. $dirFiles[$f] = $f;
  37762. if ($f === $file) {
  37763. $kFile = $k = $file;
  37764. } elseif ($f !== $k = strtolower($f)) {
  37765. $dirFiles[$k] = $f;
  37766. }
  37767. }
  37768. }
  37769. self::$darwinCache[$kDir][1] = $dirFiles;
  37770. }
  37771. }
  37772. $real .= $dirFiles[$kFile];
  37773. }
  37774. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  37775. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  37776. ) {
  37777. 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)));
  37778. }
  37779. }
  37780. return true;
  37781. }
  37782. }
  37783. }
  37784. <?php
  37785. namespace Symfony\Component\Debug;
  37786. use Psr\Log\LogLevel;
  37787. use Psr\Log\LoggerInterface;
  37788. use Symfony\Component\Debug\Exception\ContextErrorException;
  37789. use Symfony\Component\Debug\Exception\FatalErrorException;
  37790. use Symfony\Component\Debug\Exception\FatalThrowableError;
  37791. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  37792. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  37793. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  37794. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  37795. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  37796. class ErrorHandler
  37797. {
  37798. const TYPE_DEPRECATION = -100;
  37799. private $levels = array(
  37800. E_DEPRECATED => 'Deprecated',
  37801. E_USER_DEPRECATED => 'User Deprecated',
  37802. E_NOTICE => 'Notice',
  37803. E_USER_NOTICE => 'User Notice',
  37804. E_STRICT => 'Runtime Notice',
  37805. E_WARNING => 'Warning',
  37806. E_USER_WARNING => 'User Warning',
  37807. E_COMPILE_WARNING => 'Compile Warning',
  37808. E_CORE_WARNING => 'Core Warning',
  37809. E_USER_ERROR => 'User Error',
  37810. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  37811. E_COMPILE_ERROR => 'Compile Error',
  37812. E_PARSE => 'Parse Error',
  37813. E_ERROR => 'Error',
  37814. E_CORE_ERROR => 'Core Error',
  37815. );
  37816. private $loggers = array(
  37817. E_DEPRECATED => array(null, LogLevel::INFO),
  37818. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  37819. E_NOTICE => array(null, LogLevel::WARNING),
  37820. E_USER_NOTICE => array(null, LogLevel::WARNING),
  37821. E_STRICT => array(null, LogLevel::WARNING),
  37822. E_WARNING => array(null, LogLevel::WARNING),
  37823. E_USER_WARNING => array(null, LogLevel::WARNING),
  37824. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  37825. E_CORE_WARNING => array(null, LogLevel::WARNING),
  37826. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  37827. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  37828. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  37829. E_PARSE => array(null, LogLevel::CRITICAL),
  37830. E_ERROR => array(null, LogLevel::CRITICAL),
  37831. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  37832. );
  37833. private $thrownErrors = 0x1FFF;
  37834. private $scopedErrors = 0x1FFF;
  37835. private $tracedErrors = 0x77FB;
  37836. private $screamedErrors = 0x55;
  37837. private $loggedErrors = 0;
  37838. private $loggedTraces = array();
  37839. private $isRecursive = 0;
  37840. private $isRoot = false;
  37841. private $exceptionHandler;
  37842. private $bootstrappingLogger;
  37843. private static $reservedMemory;
  37844. private static $stackedErrors = array();
  37845. private static $stackedErrorLevels = array();
  37846. private static $toStringException = null;
  37847. private static $exitCode = 0;
  37848. private $displayErrors = 0x1FFF;
  37849. public static function register($handler = null, $replace = true)
  37850. {
  37851. if (null === self::$reservedMemory) {
  37852. self::$reservedMemory = str_repeat('x', 10240);
  37853. register_shutdown_function(__CLASS__.'::handleFatalError');
  37854. }
  37855. $levels = -1;
  37856. if ($handlerIsNew = !$handler instanceof self) {
  37857. if (null !== $handler) {
  37858. $levels = $replace ? $handler : 0;
  37859. $replace = true;
  37860. }
  37861. $handler = new static();
  37862. }
  37863. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  37864. restore_error_handler();
  37865. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  37866. $handler->isRoot = true;
  37867. }
  37868. if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) {
  37869. $handler = $prev[0];
  37870. $replace = false;
  37871. }
  37872. if (!$replace && $prev) {
  37873. restore_error_handler();
  37874. $handlerIsRegistered = is_array($prev) && $handler === $prev[0];
  37875. } else {
  37876. $handlerIsRegistered = true;
  37877. }
  37878. if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
  37879. restore_exception_handler();
  37880. if (!$handlerIsRegistered) {
  37881. $handler = $prev[0];
  37882. } elseif ($handler !== $prev[0] && $replace) {
  37883. set_exception_handler(array($handler, 'handleException'));
  37884. $p = $prev[0]->setExceptionHandler(null);
  37885. $handler->setExceptionHandler($p);
  37886. $prev[0]->setExceptionHandler($p);
  37887. }
  37888. } else {
  37889. $handler->setExceptionHandler($prev);
  37890. }
  37891. $handler->throwAt($levels & $handler->thrownErrors, true);
  37892. return $handler;
  37893. }
  37894. public function __construct(BufferingLogger $bootstrappingLogger = null)
  37895. {
  37896. if ($bootstrappingLogger) {
  37897. $this->bootstrappingLogger = $bootstrappingLogger;
  37898. $this->setDefaultLogger($bootstrappingLogger);
  37899. }
  37900. }
  37901. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  37902. {
  37903. $loggers = array();
  37904. if (is_array($levels)) {
  37905. foreach ($levels as $type => $logLevel) {
  37906. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  37907. $loggers[$type] = array($logger, $logLevel);
  37908. }
  37909. }
  37910. } else {
  37911. if (null === $levels) {
  37912. $levels = E_ALL | E_STRICT;
  37913. }
  37914. foreach ($this->loggers as $type => $log) {
  37915. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  37916. $log[0] = $logger;
  37917. $loggers[$type] = $log;
  37918. }
  37919. }
  37920. }
  37921. $this->setLoggers($loggers);
  37922. }
  37923. public function setLoggers(array $loggers)
  37924. {
  37925. $prevLogged = $this->loggedErrors;
  37926. $prev = $this->loggers;
  37927. $flush = array();
  37928. foreach ($loggers as $type => $log) {
  37929. if (!isset($prev[$type])) {
  37930. throw new \InvalidArgumentException('Unknown error type: '.$type);
  37931. }
  37932. if (!is_array($log)) {
  37933. $log = array($log);
  37934. } elseif (!array_key_exists(0, $log)) {
  37935. throw new \InvalidArgumentException('No logger provided');
  37936. }
  37937. if (null === $log[0]) {
  37938. $this->loggedErrors &= ~$type;
  37939. } elseif ($log[0] instanceof LoggerInterface) {
  37940. $this->loggedErrors |= $type;
  37941. } else {
  37942. throw new \InvalidArgumentException('Invalid logger provided');
  37943. }
  37944. $this->loggers[$type] = $log + $prev[$type];
  37945. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  37946. $flush[$type] = $type;
  37947. }
  37948. }
  37949. $this->reRegister($prevLogged | $this->thrownErrors);
  37950. if ($flush) {
  37951. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  37952. $type = $log[2]['type'];
  37953. if (!isset($flush[$type])) {
  37954. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  37955. } elseif ($this->loggers[$type][0]) {
  37956. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  37957. }
  37958. }
  37959. }
  37960. return $prev;
  37961. }
  37962. public function setExceptionHandler($handler)
  37963. {
  37964. if (null !== $handler && !is_callable($handler)) {
  37965. throw new \LogicException('The exception handler must be a valid PHP callable.');
  37966. }
  37967. $prev = $this->exceptionHandler;
  37968. $this->exceptionHandler = $handler;
  37969. return $prev;
  37970. }
  37971. public function throwAt($levels, $replace = false)
  37972. {
  37973. $prev = $this->thrownErrors;
  37974. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  37975. if (!$replace) {
  37976. $this->thrownErrors |= $prev;
  37977. }
  37978. $this->reRegister($prev | $this->loggedErrors);
  37979. $this->displayErrors = $this->thrownErrors;
  37980. return $prev;
  37981. }
  37982. public function scopeAt($levels, $replace = false)
  37983. {
  37984. $prev = $this->scopedErrors;
  37985. $this->scopedErrors = (int) $levels;
  37986. if (!$replace) {
  37987. $this->scopedErrors |= $prev;
  37988. }
  37989. return $prev;
  37990. }
  37991. public function traceAt($levels, $replace = false)
  37992. {
  37993. $prev = $this->tracedErrors;
  37994. $this->tracedErrors = (int) $levels;
  37995. if (!$replace) {
  37996. $this->tracedErrors |= $prev;
  37997. }
  37998. return $prev;
  37999. }
  38000. public function screamAt($levels, $replace = false)
  38001. {
  38002. $prev = $this->screamedErrors;
  38003. $this->screamedErrors = (int) $levels;
  38004. if (!$replace) {
  38005. $this->screamedErrors |= $prev;
  38006. }
  38007. return $prev;
  38008. }
  38009. private function reRegister($prev)
  38010. {
  38011. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  38012. $handler = set_error_handler('var_dump');
  38013. $handler = is_array($handler) ? $handler[0] : null;
  38014. restore_error_handler();
  38015. if ($handler === $this) {
  38016. restore_error_handler();
  38017. if ($this->isRoot) {
  38018. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  38019. } else {
  38020. set_error_handler(array($this, 'handleError'));
  38021. }
  38022. }
  38023. }
  38024. }
  38025. public function handleError($type, $message, $file, $line)
  38026. {
  38027. $level = error_reporting();
  38028. $silenced = 0 === ($level & $type);
  38029. $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  38030. $log = $this->loggedErrors & $type;
  38031. $throw = $this->thrownErrors & $type & $level;
  38032. $type &= $level | $this->screamedErrors;
  38033. if (!$type || (!$log && !$throw)) {
  38034. return !$silenced && $type && $log;
  38035. }
  38036. $scope = $this->scopedErrors & $type;
  38037. if (4 < $numArgs = func_num_args()) {
  38038. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  38039. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  38040. } else {
  38041. $context = array();
  38042. $backtrace = null;
  38043. }
  38044. if (isset($context['GLOBALS']) && $scope) {
  38045. $e = $context;
  38046. unset($e['GLOBALS'], $context);
  38047. $context = $e;
  38048. }
  38049. if (null !== $backtrace && $type & E_ERROR) {
  38050. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  38051. return true;
  38052. }
  38053. if ($throw) {
  38054. if (null !== self::$toStringException) {
  38055. $throw = self::$toStringException;
  38056. self::$toStringException = null;
  38057. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  38058. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  38059. } else {
  38060. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  38061. }
  38062. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  38063. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  38064. }
  38065. if (E_USER_ERROR & $type) {
  38066. $backtrace = $backtrace ?: $throw->getTrace();
  38067. for ($i = 1; isset($backtrace[$i]); ++$i) {
  38068. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  38069. && '__toString' === $backtrace[$i]['function']
  38070. && '->' === $backtrace[$i]['type']
  38071. && !isset($backtrace[$i - 1]['class'])
  38072. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  38073. ) {
  38074. foreach ($context as $e) {
  38075. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  38076. if (1 === $i) {
  38077. $throw = $e;
  38078. break;
  38079. }
  38080. self::$toStringException = $e;
  38081. return true;
  38082. }
  38083. }
  38084. if (1 < $i) {
  38085. $this->handleException($throw);
  38086. return false;
  38087. }
  38088. }
  38089. }
  38090. }
  38091. throw $throw;
  38092. }
  38093. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  38094. $trace = true;
  38095. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  38096. $trace = false;
  38097. } else {
  38098. $this->loggedTraces[$e] = 1;
  38099. }
  38100. $e = compact('type', 'file', 'line', 'level');
  38101. if ($type & $level) {
  38102. if ($scope) {
  38103. $e['scope_vars'] = $context;
  38104. if ($trace) {
  38105. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  38106. }
  38107. } elseif ($trace) {
  38108. if (null === $backtrace) {
  38109. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  38110. } else {
  38111. foreach ($backtrace as &$frame) {
  38112. unset($frame['args'], $frame);
  38113. }
  38114. $e['stack'] = $backtrace;
  38115. }
  38116. }
  38117. }
  38118. if ($this->isRecursive) {
  38119. $log = 0;
  38120. } elseif (self::$stackedErrorLevels) {
  38121. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  38122. } else {
  38123. try {
  38124. $this->isRecursive = true;
  38125. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  38126. $this->isRecursive = false;
  38127. } catch (\Exception $e) {
  38128. $this->isRecursive = false;
  38129. throw $e;
  38130. } catch (\Throwable $e) {
  38131. $this->isRecursive = false;
  38132. throw $e;
  38133. }
  38134. }
  38135. return !$silenced && $type && $log;
  38136. }
  38137. public function handleException($exception, array $error = null)
  38138. {
  38139. if (null === $error) {
  38140. self::$exitCode = 255;
  38141. }
  38142. if (!$exception instanceof \Exception) {
  38143. $exception = new FatalThrowableError($exception);
  38144. }
  38145. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  38146. $handlerException = null;
  38147. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  38148. $e = array(
  38149. 'type' => $type,
  38150. 'file' => $exception->getFile(),
  38151. 'line' => $exception->getLine(),
  38152. 'level' => error_reporting(),
  38153. 'stack' => $exception->getTrace(),
  38154. );
  38155. if ($exception instanceof FatalErrorException) {
  38156. if ($exception instanceof FatalThrowableError) {
  38157. $error = array(
  38158. 'type' => $type,
  38159. 'message' => $message = $exception->getMessage(),
  38160. 'file' => $e['file'],
  38161. 'line' => $e['line'],
  38162. );
  38163. } else {
  38164. $message = 'Fatal '.$exception->getMessage();
  38165. }
  38166. } elseif ($exception instanceof \ErrorException) {
  38167. $message = 'Uncaught '.$exception->getMessage();
  38168. if ($exception instanceof ContextErrorException) {
  38169. $e['context'] = $exception->getContext();
  38170. }
  38171. } else {
  38172. $message = 'Uncaught Exception: '.$exception->getMessage();
  38173. }
  38174. }
  38175. if ($this->loggedErrors & $type) {
  38176. try {
  38177. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  38178. } catch (\Exception $handlerException) {
  38179. } catch (\Throwable $handlerException) {
  38180. }
  38181. }
  38182. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  38183. foreach ($this->getFatalErrorHandlers() as $handler) {
  38184. if ($e = $handler->handleError($error, $exception)) {
  38185. $exception = $e;
  38186. break;
  38187. }
  38188. }
  38189. }
  38190. $exceptionHandler = $this->exceptionHandler;
  38191. $this->exceptionHandler = null;
  38192. try {
  38193. if (null !== $exceptionHandler) {
  38194. return \call_user_func($exceptionHandler, $exception);
  38195. }
  38196. $handlerException = $handlerException ?: $exception;
  38197. } catch (\Exception $handlerException) {
  38198. } catch (\Throwable $handlerException) {
  38199. }
  38200. if ($exception === $handlerException) {
  38201. self::$reservedMemory = null;
  38202. throw $exception;
  38203. }
  38204. $this->handleException($handlerException);
  38205. }
  38206. public static function handleFatalError(array $error = null)
  38207. {
  38208. if (null === self::$reservedMemory) {
  38209. return;
  38210. }
  38211. $handler = self::$reservedMemory = null;
  38212. $handlers = array();
  38213. $previousHandler = null;
  38214. $sameHandlerLimit = 10;
  38215. while (!is_array($handler) || !$handler[0] instanceof self) {
  38216. $handler = set_exception_handler('var_dump');
  38217. restore_exception_handler();
  38218. if (!$handler) {
  38219. break;
  38220. }
  38221. restore_exception_handler();
  38222. if ($handler !== $previousHandler) {
  38223. array_unshift($handlers, $handler);
  38224. $previousHandler = $handler;
  38225. } elseif (0 === --$sameHandlerLimit) {
  38226. $handler = null;
  38227. break;
  38228. }
  38229. }
  38230. foreach ($handlers as $h) {
  38231. set_exception_handler($h);
  38232. }
  38233. if (!$handler) {
  38234. return;
  38235. }
  38236. if ($handler !== $h) {
  38237. $handler[0]->setExceptionHandler($h);
  38238. }
  38239. $handler = $handler[0];
  38240. $handlers = array();
  38241. if ($exit = null === $error) {
  38242. $error = error_get_last();
  38243. }
  38244. try {
  38245. while (self::$stackedErrorLevels) {
  38246. static::unstackErrors();
  38247. }
  38248. } catch (\Exception $exception) {
  38249. } catch (\Throwable $exception) {
  38250. }
  38251. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  38252. $handler->throwAt(0, true);
  38253. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  38254. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  38255. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  38256. } else {
  38257. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  38258. }
  38259. }
  38260. try {
  38261. if (isset($exception)) {
  38262. self::$exitCode = 255;
  38263. $handler->handleException($exception, $error);
  38264. }
  38265. } catch (FatalErrorException $e) {
  38266. }
  38267. if ($exit && self::$exitCode) {
  38268. $exitCode = self::$exitCode;
  38269. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  38270. }
  38271. }
  38272. public static function stackErrors()
  38273. {
  38274. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  38275. }
  38276. public static function unstackErrors()
  38277. {
  38278. $level = array_pop(self::$stackedErrorLevels);
  38279. if (null !== $level) {
  38280. $e = error_reporting($level);
  38281. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  38282. error_reporting($e);
  38283. }
  38284. }
  38285. if (empty(self::$stackedErrorLevels)) {
  38286. $errors = self::$stackedErrors;
  38287. self::$stackedErrors = array();
  38288. foreach ($errors as $e) {
  38289. $e[0]->log($e[1], $e[2], $e[3]);
  38290. }
  38291. }
  38292. }
  38293. protected function getFatalErrorHandlers()
  38294. {
  38295. return array(
  38296. new UndefinedFunctionFatalErrorHandler(),
  38297. new UndefinedMethodFatalErrorHandler(),
  38298. new ClassNotFoundFatalErrorHandler(),
  38299. );
  38300. }
  38301. public function setLevel($level)
  38302. {
  38303. @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);
  38304. $level = null === $level ? error_reporting() : $level;
  38305. $this->throwAt($level, true);
  38306. }
  38307. public function setDisplayErrors($displayErrors)
  38308. {
  38309. @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);
  38310. if ($displayErrors) {
  38311. $this->throwAt($this->displayErrors, true);
  38312. } else {
  38313. $displayErrors = $this->displayErrors;
  38314. $this->throwAt(0, true);
  38315. $this->displayErrors = $displayErrors;
  38316. }
  38317. }
  38318. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  38319. {
  38320. @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);
  38321. $handler = set_error_handler('var_dump');
  38322. $handler = is_array($handler) ? $handler[0] : null;
  38323. restore_error_handler();
  38324. if (!$handler instanceof self) {
  38325. return;
  38326. }
  38327. if ('deprecation' === $channel) {
  38328. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  38329. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  38330. } elseif ('scream' === $channel) {
  38331. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  38332. $handler->screamAt(E_ALL | E_STRICT);
  38333. } elseif ('emergency' === $channel) {
  38334. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  38335. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  38336. }
  38337. }
  38338. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  38339. {
  38340. $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());
  38341. return $this->handleError($level, $message, $file, $line, (array) $context);
  38342. }
  38343. public function handleFatal()
  38344. {
  38345. @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);
  38346. static::handleFatalError();
  38347. }
  38348. }
  38349. class ErrorHandlerCanary
  38350. {
  38351. private static $displayErrors = null;
  38352. public function __construct()
  38353. {
  38354. if (null === self::$displayErrors) {
  38355. self::$displayErrors = ini_set('display_errors', 1);
  38356. }
  38357. }
  38358. public function __destruct()
  38359. {
  38360. if (null !== self::$displayErrors) {
  38361. ini_set('display_errors', self::$displayErrors);
  38362. self::$displayErrors = null;
  38363. }
  38364. }
  38365. }
  38366. <?php
  38367. namespace Symfony\Component\Debug\Exception;
  38368. class ClassNotFoundException extends FatalErrorException
  38369. {
  38370. public function __construct($message, \ErrorException $previous)
  38371. {
  38372. parent::__construct(
  38373. $message,
  38374. $previous->getCode(),
  38375. $previous->getSeverity(),
  38376. $previous->getFile(),
  38377. $previous->getLine(),
  38378. null,
  38379. true,
  38380. null,
  38381. $previous->getPrevious()
  38382. );
  38383. $this->setTrace($previous->getTrace());
  38384. }
  38385. }
  38386. <?php
  38387. namespace Symfony\Component\Debug\Exception;
  38388. class ContextErrorException extends \ErrorException
  38389. {
  38390. private $context = array();
  38391. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  38392. {
  38393. parent::__construct($message, $code, $severity, $filename, $lineno);
  38394. $this->context = $context;
  38395. }
  38396. public function getContext()
  38397. {
  38398. return $this->context;
  38399. }
  38400. }
  38401. <?php
  38402. namespace Symfony\Component\Debug\Exception;
  38403. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  38404. class DummyException extends \ErrorException
  38405. {
  38406. }
  38407. <?php
  38408. namespace Symfony\Component\HttpKernel\Exception;
  38409. class FatalErrorException extends \ErrorException
  38410. {
  38411. }
  38412. namespace Symfony\Component\Debug\Exception;
  38413. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  38414. class FatalErrorException extends LegacyFatalErrorException
  38415. {
  38416. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
  38417. {
  38418. parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
  38419. if (null !== $trace) {
  38420. if (!$traceArgs) {
  38421. foreach ($trace as &$frame) {
  38422. unset($frame['args'], $frame['this'], $frame);
  38423. }
  38424. }
  38425. $this->setTrace($trace);
  38426. } elseif (null !== $traceOffset) {
  38427. if (function_exists('xdebug_get_function_stack')) {
  38428. $trace = xdebug_get_function_stack();
  38429. if (0 < $traceOffset) {
  38430. array_splice($trace, -$traceOffset);
  38431. }
  38432. foreach ($trace as &$frame) {
  38433. if (!isset($frame['type'])) {
  38434. if (isset($frame['class'])) {
  38435. $frame['type'] = '::';
  38436. }
  38437. } elseif ('dynamic' === $frame['type']) {
  38438. $frame['type'] = '->';
  38439. } elseif ('static' === $frame['type']) {
  38440. $frame['type'] = '::';
  38441. }
  38442. if (!$traceArgs) {
  38443. unset($frame['params'], $frame['args']);
  38444. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  38445. $frame['args'] = $frame['params'];
  38446. unset($frame['params']);
  38447. }
  38448. }
  38449. unset($frame);
  38450. $trace = array_reverse($trace);
  38451. } elseif (function_exists('symfony_debug_backtrace')) {
  38452. $trace = symfony_debug_backtrace();
  38453. if (0 < $traceOffset) {
  38454. array_splice($trace, 0, $traceOffset);
  38455. }
  38456. } else {
  38457. $trace = array();
  38458. }
  38459. $this->setTrace($trace);
  38460. }
  38461. }
  38462. protected function setTrace($trace)
  38463. {
  38464. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  38465. $traceReflector->setAccessible(true);
  38466. $traceReflector->setValue($this, $trace);
  38467. }
  38468. }
  38469. <?php
  38470. namespace Symfony\Component\Debug\Exception;
  38471. class FatalThrowableError extends FatalErrorException
  38472. {
  38473. public function __construct(\Throwable $e)
  38474. {
  38475. if ($e instanceof \ParseError) {
  38476. $message = 'Parse error: '.$e->getMessage();
  38477. $severity = E_PARSE;
  38478. } elseif ($e instanceof \TypeError) {
  38479. $message = 'Type error: '.$e->getMessage();
  38480. $severity = E_RECOVERABLE_ERROR;
  38481. } else {
  38482. $message = $e->getMessage();
  38483. $severity = E_ERROR;
  38484. }
  38485. \ErrorException::__construct(
  38486. $message,
  38487. $e->getCode(),
  38488. $severity,
  38489. $e->getFile(),
  38490. $e->getLine(),
  38491. $e->getPrevious()
  38492. );
  38493. $this->setTrace($e->getTrace());
  38494. }
  38495. }
  38496. <?php
  38497. namespace Symfony\Component\HttpKernel\Exception;
  38498. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  38499. class FlattenException
  38500. {
  38501. private $handler;
  38502. public static function __callStatic($method, $args)
  38503. {
  38504. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  38505. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method));
  38506. }
  38507. return call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  38508. }
  38509. public function __call($method, $args)
  38510. {
  38511. if (!isset($this->handler)) {
  38512. $this->handler = new DebugFlattenException();
  38513. }
  38514. if (!method_exists($this->handler, $method)) {
  38515. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method));
  38516. }
  38517. return call_user_func_array(array($this->handler, $method), $args);
  38518. }
  38519. }
  38520. namespace Symfony\Component\Debug\Exception;
  38521. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  38522. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  38523. class FlattenException extends LegacyFlattenException
  38524. {
  38525. private $message;
  38526. private $code;
  38527. private $previous;
  38528. private $trace;
  38529. private $class;
  38530. private $statusCode;
  38531. private $headers;
  38532. private $file;
  38533. private $line;
  38534. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  38535. {
  38536. $e = new static();
  38537. $e->setMessage($exception->getMessage());
  38538. $e->setCode($exception->getCode());
  38539. if ($exception instanceof HttpExceptionInterface) {
  38540. $statusCode = $exception->getStatusCode();
  38541. $headers = array_merge($headers, $exception->getHeaders());
  38542. }
  38543. if (null === $statusCode) {
  38544. $statusCode = 500;
  38545. }
  38546. $e->setStatusCode($statusCode);
  38547. $e->setHeaders($headers);
  38548. $e->setTraceFromException($exception);
  38549. $e->setClass(get_class($exception));
  38550. $e->setFile($exception->getFile());
  38551. $e->setLine($exception->getLine());
  38552. $previous = $exception->getPrevious();
  38553. if ($previous instanceof \Exception) {
  38554. $e->setPrevious(static::create($previous));
  38555. } elseif ($previous instanceof \Throwable) {
  38556. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  38557. }
  38558. return $e;
  38559. }
  38560. public function toArray()
  38561. {
  38562. $exceptions = array();
  38563. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  38564. $exceptions[] = array(
  38565. 'message' => $exception->getMessage(),
  38566. 'class' => $exception->getClass(),
  38567. 'trace' => $exception->getTrace(),
  38568. );
  38569. }
  38570. return $exceptions;
  38571. }
  38572. public function getStatusCode()
  38573. {
  38574. return $this->statusCode;
  38575. }
  38576. public function setStatusCode($code)
  38577. {
  38578. $this->statusCode = $code;
  38579. }
  38580. public function getHeaders()
  38581. {
  38582. return $this->headers;
  38583. }
  38584. public function setHeaders(array $headers)
  38585. {
  38586. $this->headers = $headers;
  38587. }
  38588. public function getClass()
  38589. {
  38590. return $this->class;
  38591. }
  38592. public function setClass($class)
  38593. {
  38594. $this->class = $class;
  38595. }
  38596. public function getFile()
  38597. {
  38598. return $this->file;
  38599. }
  38600. public function setFile($file)
  38601. {
  38602. $this->file = $file;
  38603. }
  38604. public function getLine()
  38605. {
  38606. return $this->line;
  38607. }
  38608. public function setLine($line)
  38609. {
  38610. $this->line = $line;
  38611. }
  38612. public function getMessage()
  38613. {
  38614. return $this->message;
  38615. }
  38616. public function setMessage($message)
  38617. {
  38618. $this->message = $message;
  38619. }
  38620. public function getCode()
  38621. {
  38622. return $this->code;
  38623. }
  38624. public function setCode($code)
  38625. {
  38626. $this->code = $code;
  38627. }
  38628. public function getPrevious()
  38629. {
  38630. return $this->previous;
  38631. }
  38632. public function setPrevious(FlattenException $previous)
  38633. {
  38634. $this->previous = $previous;
  38635. }
  38636. public function getAllPrevious()
  38637. {
  38638. $exceptions = array();
  38639. $e = $this;
  38640. while ($e = $e->getPrevious()) {
  38641. $exceptions[] = $e;
  38642. }
  38643. return $exceptions;
  38644. }
  38645. public function getTrace()
  38646. {
  38647. return $this->trace;
  38648. }
  38649. public function setTraceFromException(\Exception $exception)
  38650. {
  38651. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  38652. }
  38653. public function setTrace($trace, $file, $line)
  38654. {
  38655. $this->trace = array();
  38656. $this->trace[] = array(
  38657. 'namespace' => '',
  38658. 'short_class' => '',
  38659. 'class' => '',
  38660. 'type' => '',
  38661. 'function' => '',
  38662. 'file' => $file,
  38663. 'line' => $line,
  38664. 'args' => array(),
  38665. );
  38666. foreach ($trace as $entry) {
  38667. $class = '';
  38668. $namespace = '';
  38669. if (isset($entry['class'])) {
  38670. $parts = explode('\\', $entry['class']);
  38671. $class = array_pop($parts);
  38672. $namespace = implode('\\', $parts);
  38673. }
  38674. $this->trace[] = array(
  38675. 'namespace' => $namespace,
  38676. 'short_class' => $class,
  38677. 'class' => isset($entry['class']) ? $entry['class'] : '',
  38678. 'type' => isset($entry['type']) ? $entry['type'] : '',
  38679. 'function' => isset($entry['function']) ? $entry['function'] : null,
  38680. 'file' => isset($entry['file']) ? $entry['file'] : null,
  38681. 'line' => isset($entry['line']) ? $entry['line'] : null,
  38682. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  38683. );
  38684. }
  38685. }
  38686. private function flattenArgs($args, $level = 0, &$count = 0)
  38687. {
  38688. $result = array();
  38689. foreach ($args as $key => $value) {
  38690. if (++$count > 1e4) {
  38691. return array('array', '*SKIPPED over 10000 entries*');
  38692. }
  38693. if ($value instanceof \__PHP_Incomplete_Class) {
  38694. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  38695. } elseif (is_object($value)) {
  38696. $result[$key] = array('object', get_class($value));
  38697. } elseif (is_array($value)) {
  38698. if ($level > 10) {
  38699. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  38700. } else {
  38701. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  38702. }
  38703. } elseif (null === $value) {
  38704. $result[$key] = array('null', null);
  38705. } elseif (is_bool($value)) {
  38706. $result[$key] = array('boolean', $value);
  38707. } elseif (is_resource($value)) {
  38708. $result[$key] = array('resource', get_resource_type($value));
  38709. } else {
  38710. $result[$key] = array('string', (string) $value);
  38711. }
  38712. }
  38713. return $result;
  38714. }
  38715. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  38716. {
  38717. $array = new \ArrayObject($value);
  38718. return $array['__PHP_Incomplete_Class_Name'];
  38719. }
  38720. }
  38721. <?php
  38722. namespace Symfony\Component\Debug\Exception;
  38723. class OutOfMemoryException extends FatalErrorException
  38724. {
  38725. }
  38726. <?php
  38727. namespace Symfony\Component\Debug\Exception;
  38728. class UndefinedFunctionException extends FatalErrorException
  38729. {
  38730. public function __construct($message, \ErrorException $previous)
  38731. {
  38732. parent::__construct(
  38733. $message,
  38734. $previous->getCode(),
  38735. $previous->getSeverity(),
  38736. $previous->getFile(),
  38737. $previous->getLine(),
  38738. null,
  38739. true,
  38740. null,
  38741. $previous->getPrevious()
  38742. );
  38743. $this->setTrace($previous->getTrace());
  38744. }
  38745. }
  38746. <?php
  38747. namespace Symfony\Component\Debug\Exception;
  38748. class UndefinedMethodException extends FatalErrorException
  38749. {
  38750. public function __construct($message, \ErrorException $previous)
  38751. {
  38752. parent::__construct(
  38753. $message,
  38754. $previous->getCode(),
  38755. $previous->getSeverity(),
  38756. $previous->getFile(),
  38757. $previous->getLine(),
  38758. null,
  38759. true,
  38760. null,
  38761. $previous->getPrevious()
  38762. );
  38763. $this->setTrace($previous->getTrace());
  38764. }
  38765. }
  38766. <?php
  38767. namespace Symfony\Component\Debug;
  38768. use Symfony\Component\HttpFoundation\Response;
  38769. use Symfony\Component\Debug\Exception\FlattenException;
  38770. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  38771. class ExceptionHandler
  38772. {
  38773. private $debug;
  38774. private $charset;
  38775. private $handler;
  38776. private $caughtBuffer;
  38777. private $caughtLength;
  38778. private $fileLinkFormat;
  38779. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  38780. {
  38781. if (false !== strpos($charset, '%')) {
  38782. @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);
  38783. $pivot = $fileLinkFormat;
  38784. $fileLinkFormat = $charset;
  38785. $charset = $pivot;
  38786. }
  38787. $this->debug = $debug;
  38788. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  38789. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  38790. }
  38791. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  38792. {
  38793. $handler = new static($debug, $charset, $fileLinkFormat);
  38794. $prev = set_exception_handler(array($handler, 'handle'));
  38795. if (is_array($prev) && $prev[0] instanceof ErrorHandler) {
  38796. restore_exception_handler();
  38797. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  38798. }
  38799. return $handler;
  38800. }
  38801. public function setHandler($handler)
  38802. {
  38803. if (null !== $handler && !is_callable($handler)) {
  38804. throw new \LogicException('The exception handler must be a valid PHP callable.');
  38805. }
  38806. $old = $this->handler;
  38807. $this->handler = $handler;
  38808. return $old;
  38809. }
  38810. public function setFileLinkFormat($format)
  38811. {
  38812. $old = $this->fileLinkFormat;
  38813. $this->fileLinkFormat = $format;
  38814. return $old;
  38815. }
  38816. public function handle(\Exception $exception)
  38817. {
  38818. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  38819. $this->failSafeHandle($exception);
  38820. return;
  38821. }
  38822. $caughtLength = $this->caughtLength = 0;
  38823. ob_start(array($this, 'catchOutput'));
  38824. $this->failSafeHandle($exception);
  38825. while (null === $this->caughtBuffer && ob_end_flush()) {
  38826. }
  38827. if (isset($this->caughtBuffer[0])) {
  38828. ob_start(array($this, 'cleanOutput'));
  38829. echo $this->caughtBuffer;
  38830. $caughtLength = ob_get_length();
  38831. }
  38832. $this->caughtBuffer = null;
  38833. try {
  38834. call_user_func($this->handler, $exception);
  38835. $this->caughtLength = $caughtLength;
  38836. } catch (\Exception $e) {
  38837. if (!$caughtLength) {
  38838. throw $exception;
  38839. }
  38840. }
  38841. }
  38842. private function failSafeHandle(\Exception $exception)
  38843. {
  38844. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  38845. && __CLASS__ !== get_class($this)
  38846. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  38847. && __CLASS__ !== $reflector->class
  38848. ) {
  38849. $response = $this->createResponse($exception);
  38850. $response->sendHeaders();
  38851. $response->sendContent();
  38852. @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);
  38853. return;
  38854. }
  38855. $this->sendPhpResponse($exception);
  38856. }
  38857. public function sendPhpResponse($exception)
  38858. {
  38859. if (!$exception instanceof FlattenException) {
  38860. $exception = FlattenException::create($exception);
  38861. }
  38862. if (!headers_sent()) {
  38863. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  38864. foreach ($exception->getHeaders() as $name => $value) {
  38865. header($name.': '.$value, false);
  38866. }
  38867. header('Content-Type: text/html; charset='.$this->charset);
  38868. }
  38869. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  38870. }
  38871. public function createResponse($exception)
  38872. {
  38873. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38874. if (!$exception instanceof FlattenException) {
  38875. $exception = FlattenException::create($exception);
  38876. }
  38877. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  38878. }
  38879. public function getHtml($exception)
  38880. {
  38881. if (!$exception instanceof FlattenException) {
  38882. $exception = FlattenException::create($exception);
  38883. }
  38884. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  38885. }
  38886. public function getContent(FlattenException $exception)
  38887. {
  38888. switch ($exception->getStatusCode()) {
  38889. case 404:
  38890. $title = 'Sorry, the page you are looking for could not be found.';
  38891. break;
  38892. default:
  38893. $title = 'Whoops, looks like something went wrong.';
  38894. }
  38895. $content = '';
  38896. if ($this->debug) {
  38897. try {
  38898. $count = count($exception->getAllPrevious());
  38899. $total = $count + 1;
  38900. foreach ($exception->toArray() as $position => $e) {
  38901. $ind = $count - $position + 1;
  38902. $class = $this->formatClass($e['class']);
  38903. $message = nl2br($this->escapeHtml($e['message']));
  38904. $content .= sprintf(<<<'EOF'
  38905. <h2 class="block_exception clear_fix">
  38906. <span class="exception_counter">%d/%d</span>
  38907. <span class="exception_title">%s%s:</span>
  38908. <span class="exception_message">%s</span>
  38909. </h2>
  38910. <div class="block">
  38911. <ol class="traces list_exception">
  38912. EOF
  38913. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  38914. foreach ($e['trace'] as $trace) {
  38915. $content .= ' <li>';
  38916. if ($trace['function']) {
  38917. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  38918. }
  38919. if (isset($trace['file']) && isset($trace['line'])) {
  38920. $content .= $this->formatPath($trace['file'], $trace['line']);
  38921. }
  38922. $content .= "</li>\n";
  38923. }
  38924. $content .= " </ol>\n</div>\n";
  38925. }
  38926. } catch (\Exception $e) {
  38927. if ($this->debug) {
  38928. $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage()));
  38929. } else {
  38930. $title = 'Whoops, looks like something went wrong.';
  38931. }
  38932. }
  38933. }
  38934. return <<<EOF
  38935. <div id="sf-resetcontent" class="sf-reset">
  38936. <h1>$title</h1>
  38937. $content
  38938. </div>
  38939. EOF;
  38940. }
  38941. public function getStylesheet(FlattenException $exception)
  38942. {
  38943. return <<<'EOF'
  38944. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  38945. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  38946. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  38947. .sf-reset .clear_fix { display:inline-block; }
  38948. .sf-reset * html .clear_fix { height:1%; }
  38949. .sf-reset .clear_fix { display:block; }
  38950. .sf-reset, .sf-reset .block { margin: auto }
  38951. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  38952. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  38953. .sf-reset strong { font-weight:bold; }
  38954. .sf-reset a { color:#6c6159; cursor: default; }
  38955. .sf-reset a img { border:none; }
  38956. .sf-reset a:hover { text-decoration:underline; }
  38957. .sf-reset em { font-style:italic; }
  38958. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  38959. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  38960. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  38961. .sf-reset .exception_message { margin-left: 3em; display: block; }
  38962. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  38963. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  38964. -webkit-border-bottom-right-radius: 16px;
  38965. -webkit-border-bottom-left-radius: 16px;
  38966. -moz-border-radius-bottomright: 16px;
  38967. -moz-border-radius-bottomleft: 16px;
  38968. border-bottom-right-radius: 16px;
  38969. border-bottom-left-radius: 16px;
  38970. border-bottom:1px solid #ccc;
  38971. border-right:1px solid #ccc;
  38972. border-left:1px solid #ccc;
  38973. word-wrap: break-word;
  38974. }
  38975. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  38976. -webkit-border-top-left-radius: 16px;
  38977. -webkit-border-top-right-radius: 16px;
  38978. -moz-border-radius-topleft: 16px;
  38979. -moz-border-radius-topright: 16px;
  38980. border-top-left-radius: 16px;
  38981. border-top-right-radius: 16px;
  38982. border-top:1px solid #ccc;
  38983. border-right:1px solid #ccc;
  38984. border-left:1px solid #ccc;
  38985. overflow: hidden;
  38986. word-wrap: break-word;
  38987. }
  38988. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  38989. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  38990. .sf-reset ol { padding: 10px 0; }
  38991. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  38992. -webkit-border-radius: 10px;
  38993. -moz-border-radius: 10px;
  38994. border-radius: 10px;
  38995. border: 1px solid #ccc;
  38996. }
  38997. EOF;
  38998. }
  38999. private function decorate($content, $css)
  39000. {
  39001. return <<<EOF
  39002. <!DOCTYPE html>
  39003. <html>
  39004. <head>
  39005. <meta charset="{$this->charset}" />
  39006. <meta name="robots" content="noindex,nofollow" />
  39007. <style>
  39008. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  39009. 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;}
  39010. html { background: #eee; padding: 10px }
  39011. img { border: 0; }
  39012. #sf-resetcontent { width:970px; margin:0 auto; }
  39013. $css
  39014. </style>
  39015. </head>
  39016. <body>
  39017. $content
  39018. </body>
  39019. </html>
  39020. EOF;
  39021. }
  39022. private function formatClass($class)
  39023. {
  39024. $parts = explode('\\', $class);
  39025. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  39026. }
  39027. private function formatPath($path, $line)
  39028. {
  39029. $path = $this->escapeHtml($path);
  39030. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  39031. if ($linkFormat = $this->fileLinkFormat) {
  39032. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  39033. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  39034. }
  39035. 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);
  39036. }
  39037. private function formatArgs(array $args)
  39038. {
  39039. $result = array();
  39040. foreach ($args as $key => $item) {
  39041. if ('object' === $item[0]) {
  39042. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  39043. } elseif ('array' === $item[0]) {
  39044. $formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  39045. } elseif ('string' === $item[0]) {
  39046. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  39047. } elseif ('null' === $item[0]) {
  39048. $formattedValue = '<em>null</em>';
  39049. } elseif ('boolean' === $item[0]) {
  39050. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  39051. } elseif ('resource' === $item[0]) {
  39052. $formattedValue = '<em>resource</em>';
  39053. } else {
  39054. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  39055. }
  39056. $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  39057. }
  39058. return implode(', ', $result);
  39059. }
  39060. protected static function utf8Htmlize($str)
  39061. {
  39062. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  39063. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  39064. }
  39065. private function escapeHtml($str)
  39066. {
  39067. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  39068. }
  39069. public function catchOutput($buffer)
  39070. {
  39071. $this->caughtBuffer = $buffer;
  39072. return '';
  39073. }
  39074. public function cleanOutput($buffer)
  39075. {
  39076. if ($this->caughtLength) {
  39077. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  39078. if (isset($cleanBuffer[0])) {
  39079. $buffer = $cleanBuffer;
  39080. }
  39081. }
  39082. return $buffer;
  39083. }
  39084. }
  39085. <?php
  39086. namespace Symfony\Component\Debug\FatalErrorHandler;
  39087. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  39088. use Symfony\Component\Debug\Exception\FatalErrorException;
  39089. use Symfony\Component\Debug\DebugClassLoader;
  39090. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  39091. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  39092. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  39093. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  39094. {
  39095. public function handleError(array $error, FatalErrorException $exception)
  39096. {
  39097. $messageLen = strlen($error['message']);
  39098. $notFoundSuffix = '\' not found';
  39099. $notFoundSuffixLen = strlen($notFoundSuffix);
  39100. if ($notFoundSuffixLen > $messageLen) {
  39101. return;
  39102. }
  39103. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  39104. return;
  39105. }
  39106. foreach (array('class', 'interface', 'trait') as $typeName) {
  39107. $prefix = ucfirst($typeName).' \'';
  39108. $prefixLen = strlen($prefix);
  39109. if (0 !== strpos($error['message'], $prefix)) {
  39110. continue;
  39111. }
  39112. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  39113. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  39114. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  39115. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  39116. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  39117. $tail = ' for another namespace?';
  39118. } else {
  39119. $className = $fullyQualifiedClassName;
  39120. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  39121. $tail = '?';
  39122. }
  39123. if ($candidates = $this->getClassCandidates($className)) {
  39124. $tail = array_pop($candidates).'"?';
  39125. if ($candidates) {
  39126. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  39127. } else {
  39128. $tail = ' for "'.$tail;
  39129. }
  39130. }
  39131. $message .= "\nDid you forget a \"use\" statement".$tail;
  39132. return new ClassNotFoundException($message, $exception);
  39133. }
  39134. }
  39135. private function getClassCandidates($class)
  39136. {
  39137. if (!is_array($functions = spl_autoload_functions())) {
  39138. return array();
  39139. }
  39140. $classes = array();
  39141. foreach ($functions as $function) {
  39142. if (!is_array($function)) {
  39143. continue;
  39144. }
  39145. if ($function[0] instanceof DebugClassLoader) {
  39146. $function = $function[0]->getClassLoader();
  39147. if (is_object($function)) {
  39148. $function = array($function);
  39149. }
  39150. if (!is_array($function)) {
  39151. continue;
  39152. }
  39153. }
  39154. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  39155. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  39156. foreach ($paths as $path) {
  39157. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  39158. }
  39159. }
  39160. }
  39161. if ($function[0] instanceof ComposerClassLoader) {
  39162. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  39163. foreach ($paths as $path) {
  39164. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  39165. }
  39166. }
  39167. }
  39168. }
  39169. return array_unique($classes);
  39170. }
  39171. private function findClassInPath($path, $class, $prefix)
  39172. {
  39173. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  39174. return array();
  39175. }
  39176. $classes = array();
  39177. $filename = $class.'.php';
  39178. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  39179. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  39180. $classes[] = $class;
  39181. }
  39182. }
  39183. return $classes;
  39184. }
  39185. private function convertFileToClass($path, $file, $prefix)
  39186. {
  39187. $candidates = array(
  39188. $namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  39189. $prefix.$namespacedClass,
  39190. $prefix.'\\'.$namespacedClass,
  39191. str_replace('\\', '_', $namespacedClass),
  39192. str_replace('\\', '_', $prefix.$namespacedClass),
  39193. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  39194. );
  39195. if ($prefix) {
  39196. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  39197. }
  39198. foreach ($candidates as $candidate) {
  39199. if ($this->classExists($candidate)) {
  39200. return $candidate;
  39201. }
  39202. }
  39203. require_once $file;
  39204. foreach ($candidates as $candidate) {
  39205. if ($this->classExists($candidate)) {
  39206. return $candidate;
  39207. }
  39208. }
  39209. }
  39210. private function classExists($class)
  39211. {
  39212. return class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  39213. }
  39214. }
  39215. <?php
  39216. namespace Symfony\Component\Debug\FatalErrorHandler;
  39217. use Symfony\Component\Debug\Exception\FatalErrorException;
  39218. interface FatalErrorHandlerInterface
  39219. {
  39220. public function handleError(array $error, FatalErrorException $exception);
  39221. }
  39222. <?php
  39223. namespace Symfony\Component\Debug\FatalErrorHandler;
  39224. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  39225. use Symfony\Component\Debug\Exception\FatalErrorException;
  39226. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  39227. {
  39228. public function handleError(array $error, FatalErrorException $exception)
  39229. {
  39230. $messageLen = strlen($error['message']);
  39231. $notFoundSuffix = '()';
  39232. $notFoundSuffixLen = strlen($notFoundSuffix);
  39233. if ($notFoundSuffixLen > $messageLen) {
  39234. return;
  39235. }
  39236. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  39237. return;
  39238. }
  39239. $prefix = 'Call to undefined function ';
  39240. $prefixLen = strlen($prefix);
  39241. if (0 !== strpos($error['message'], $prefix)) {
  39242. return;
  39243. }
  39244. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  39245. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  39246. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  39247. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  39248. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  39249. } else {
  39250. $functionName = $fullyQualifiedFunctionName;
  39251. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  39252. }
  39253. $candidates = array();
  39254. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  39255. foreach ($definedFunctionNames as $definedFunctionName) {
  39256. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  39257. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  39258. } else {
  39259. $definedFunctionNameBasename = $definedFunctionName;
  39260. }
  39261. if ($definedFunctionNameBasename === $functionName) {
  39262. $candidates[] = '\\'.$definedFunctionName;
  39263. }
  39264. }
  39265. }
  39266. if ($candidates) {
  39267. sort($candidates);
  39268. $last = array_pop($candidates).'"?';
  39269. if ($candidates) {
  39270. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  39271. } else {
  39272. $candidates = '"'.$last;
  39273. }
  39274. $message .= "\nDid you mean to call ".$candidates;
  39275. }
  39276. return new UndefinedFunctionException($message, $exception);
  39277. }
  39278. }
  39279. <?php
  39280. namespace Symfony\Component\Debug\FatalErrorHandler;
  39281. use Symfony\Component\Debug\Exception\FatalErrorException;
  39282. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  39283. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  39284. {
  39285. public function handleError(array $error, FatalErrorException $exception)
  39286. {
  39287. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  39288. if (!$matches) {
  39289. return;
  39290. }
  39291. $className = $matches[1];
  39292. $methodName = $matches[2];
  39293. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  39294. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  39295. return new UndefinedMethodException($message, $exception);
  39296. }
  39297. $candidates = array();
  39298. foreach ($methods as $definedMethodName) {
  39299. $lev = levenshtein($methodName, $definedMethodName);
  39300. if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  39301. $candidates[] = $definedMethodName;
  39302. }
  39303. }
  39304. if ($candidates) {
  39305. sort($candidates);
  39306. $last = array_pop($candidates).'"?';
  39307. if ($candidates) {
  39308. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  39309. } else {
  39310. $candidates = '"'.$last;
  39311. }
  39312. $message .= "\nDid you mean to call ".$candidates;
  39313. }
  39314. return new UndefinedMethodException($message, $exception);
  39315. }
  39316. }
  39317. Copyright (c) 2004-2018 Fabien Potencier
  39318. Permission is hereby granted, free of charge, to any person obtaining a copy
  39319. of this software and associated documentation files (the "Software"), to deal
  39320. in the Software without restriction, including without limitation the rights
  39321. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39322. copies of the Software, and to permit persons to whom the Software is furnished
  39323. to do so, subject to the following conditions:
  39324. The above copyright notice and this permission notice shall be included in all
  39325. copies or substantial portions of the Software.
  39326. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39327. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39328. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39329. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39330. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39331. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39332. THE SOFTWARE.
  39333. <?php
  39334. namespace Symfony\Component\Filesystem\Exception;
  39335. interface ExceptionInterface
  39336. {
  39337. }
  39338. <?php
  39339. namespace Symfony\Component\Filesystem\Exception;
  39340. class FileNotFoundException extends IOException
  39341. {
  39342. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  39343. {
  39344. if (null === $message) {
  39345. if (null === $path) {
  39346. $message = 'File could not be found.';
  39347. } else {
  39348. $message = sprintf('File "%s" could not be found.', $path);
  39349. }
  39350. }
  39351. parent::__construct($message, $code, $previous, $path);
  39352. }
  39353. }
  39354. <?php
  39355. namespace Symfony\Component\Filesystem\Exception;
  39356. class IOException extends \RuntimeException implements IOExceptionInterface
  39357. {
  39358. private $path;
  39359. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  39360. {
  39361. $this->path = $path;
  39362. parent::__construct($message, $code, $previous);
  39363. }
  39364. public function getPath()
  39365. {
  39366. return $this->path;
  39367. }
  39368. }
  39369. <?php
  39370. namespace Symfony\Component\Filesystem\Exception;
  39371. interface IOExceptionInterface extends ExceptionInterface
  39372. {
  39373. public function getPath();
  39374. }
  39375. <?php
  39376. namespace Symfony\Component\Filesystem;
  39377. use Symfony\Component\Filesystem\Exception\IOException;
  39378. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  39379. class Filesystem
  39380. {
  39381. private static $lastError;
  39382. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  39383. {
  39384. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  39385. if ($originIsLocal && !is_file($originFile)) {
  39386. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  39387. }
  39388. $this->mkdir(dirname($targetFile));
  39389. $doCopy = true;
  39390. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  39391. $doCopy = filemtime($originFile) > filemtime($targetFile);
  39392. }
  39393. if ($doCopy) {
  39394. if (false === $source = @fopen($originFile, 'r')) {
  39395. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  39396. }
  39397. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  39398. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  39399. }
  39400. $bytesCopied = stream_copy_to_stream($source, $target);
  39401. fclose($source);
  39402. fclose($target);
  39403. unset($source, $target);
  39404. if (!is_file($targetFile)) {
  39405. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  39406. }
  39407. if ($originIsLocal) {
  39408. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  39409. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  39410. 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);
  39411. }
  39412. }
  39413. }
  39414. }
  39415. public function mkdir($dirs, $mode = 0777)
  39416. {
  39417. foreach ($this->toIterator($dirs) as $dir) {
  39418. if (is_dir($dir)) {
  39419. continue;
  39420. }
  39421. if (!self::box('mkdir', $dir, $mode, true)) {
  39422. if (!is_dir($dir)) {
  39423. if (self::$lastError) {
  39424. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
  39425. }
  39426. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  39427. }
  39428. }
  39429. }
  39430. }
  39431. public function exists($files)
  39432. {
  39433. $maxPathLength = PHP_MAXPATHLEN - 2;
  39434. foreach ($this->toIterator($files) as $file) {
  39435. if (strlen($file) > $maxPathLength) {
  39436. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  39437. }
  39438. if (!file_exists($file)) {
  39439. return false;
  39440. }
  39441. }
  39442. return true;
  39443. }
  39444. public function touch($files, $time = null, $atime = null)
  39445. {
  39446. foreach ($this->toIterator($files) as $file) {
  39447. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  39448. if (true !== $touch) {
  39449. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  39450. }
  39451. }
  39452. }
  39453. public function remove($files)
  39454. {
  39455. if ($files instanceof \Traversable) {
  39456. $files = iterator_to_array($files, false);
  39457. } elseif (!is_array($files)) {
  39458. $files = array($files);
  39459. }
  39460. $files = array_reverse($files);
  39461. foreach ($files as $file) {
  39462. if (is_link($file)) {
  39463. if (!(self::box('unlink', $file) || '\\' !== DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  39464. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
  39465. }
  39466. } elseif (is_dir($file)) {
  39467. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  39468. if (!self::box('rmdir', $file) && file_exists($file)) {
  39469. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError));
  39470. }
  39471. } elseif (!self::box('unlink', $file) && file_exists($file)) {
  39472. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError));
  39473. }
  39474. }
  39475. }
  39476. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  39477. {
  39478. foreach ($this->toIterator($files) as $file) {
  39479. if (true !== @chmod($file, $mode & ~$umask)) {
  39480. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  39481. }
  39482. if ($recursive && is_dir($file) && !is_link($file)) {
  39483. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  39484. }
  39485. }
  39486. }
  39487. public function chown($files, $user, $recursive = false)
  39488. {
  39489. foreach ($this->toIterator($files) as $file) {
  39490. if ($recursive && is_dir($file) && !is_link($file)) {
  39491. $this->chown(new \FilesystemIterator($file), $user, true);
  39492. }
  39493. if (is_link($file) && function_exists('lchown')) {
  39494. if (true !== @lchown($file, $user)) {
  39495. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  39496. }
  39497. } else {
  39498. if (true !== @chown($file, $user)) {
  39499. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  39500. }
  39501. }
  39502. }
  39503. }
  39504. public function chgrp($files, $group, $recursive = false)
  39505. {
  39506. foreach ($this->toIterator($files) as $file) {
  39507. if ($recursive && is_dir($file) && !is_link($file)) {
  39508. $this->chgrp(new \FilesystemIterator($file), $group, true);
  39509. }
  39510. if (is_link($file) && function_exists('lchgrp')) {
  39511. if (true !== @lchgrp($file, $group) || (defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  39512. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  39513. }
  39514. } else {
  39515. if (true !== @chgrp($file, $group)) {
  39516. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  39517. }
  39518. }
  39519. }
  39520. }
  39521. public function rename($origin, $target, $overwrite = false)
  39522. {
  39523. if (!$overwrite && $this->isReadable($target)) {
  39524. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  39525. }
  39526. if (true !== @rename($origin, $target)) {
  39527. if (is_dir($origin)) {
  39528. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  39529. $this->remove($origin);
  39530. return;
  39531. }
  39532. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  39533. }
  39534. }
  39535. private function isReadable($filename)
  39536. {
  39537. $maxPathLength = PHP_MAXPATHLEN - 2;
  39538. if (strlen($filename) > $maxPathLength) {
  39539. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  39540. }
  39541. return is_readable($filename);
  39542. }
  39543. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  39544. {
  39545. if ('\\' === DIRECTORY_SEPARATOR) {
  39546. $originDir = strtr($originDir, '/', '\\');
  39547. $targetDir = strtr($targetDir, '/', '\\');
  39548. if ($copyOnWindows) {
  39549. $this->mirror($originDir, $targetDir);
  39550. return;
  39551. }
  39552. }
  39553. $this->mkdir(dirname($targetDir));
  39554. if (is_link($targetDir)) {
  39555. if (readlink($targetDir) === $originDir) {
  39556. return;
  39557. }
  39558. $this->remove($targetDir);
  39559. }
  39560. if (!self::box('symlink', $originDir, $targetDir)) {
  39561. if (null !== self::$lastError) {
  39562. if ('\\' === DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
  39563. 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);
  39564. }
  39565. }
  39566. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  39567. }
  39568. }
  39569. public function makePathRelative($endPath, $startPath)
  39570. {
  39571. if ('\\' === DIRECTORY_SEPARATOR) {
  39572. $endPath = str_replace('\\', '/', $endPath);
  39573. $startPath = str_replace('\\', '/', $startPath);
  39574. }
  39575. $stripDriveLetter = function ($path) {
  39576. if (strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  39577. return substr($path, 2);
  39578. }
  39579. return $path;
  39580. };
  39581. $endPath = $stripDriveLetter($endPath);
  39582. $startPath = $stripDriveLetter($startPath);
  39583. $startPathArr = explode('/', trim($startPath, '/'));
  39584. $endPathArr = explode('/', trim($endPath, '/'));
  39585. $normalizePathArray = function ($pathSegments, $absolute) {
  39586. $result = array();
  39587. foreach ($pathSegments as $segment) {
  39588. if ('..' === $segment && ($absolute || count($result))) {
  39589. array_pop($result);
  39590. } elseif ('.' !== $segment) {
  39591. $result[] = $segment;
  39592. }
  39593. }
  39594. return $result;
  39595. };
  39596. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  39597. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  39598. $index = 0;
  39599. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  39600. ++$index;
  39601. }
  39602. if (1 === count($startPathArr) && '' === $startPathArr[0]) {
  39603. $depth = 0;
  39604. } else {
  39605. $depth = count($startPathArr) - $index;
  39606. }
  39607. $traverser = str_repeat('../', $depth);
  39608. $endPathRemainder = implode('/', array_slice($endPathArr, $index));
  39609. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  39610. return '' === $relativePath ? './' : $relativePath;
  39611. }
  39612. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  39613. {
  39614. $targetDir = rtrim($targetDir, '/\\');
  39615. $originDir = rtrim($originDir, '/\\');
  39616. $originDirLen = strlen($originDir);
  39617. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  39618. $deleteIterator = $iterator;
  39619. if (null === $deleteIterator) {
  39620. $flags = \FilesystemIterator::SKIP_DOTS;
  39621. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  39622. }
  39623. $targetDirLen = strlen($targetDir);
  39624. foreach ($deleteIterator as $file) {
  39625. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  39626. if (!$this->exists($origin)) {
  39627. $this->remove($file);
  39628. }
  39629. }
  39630. }
  39631. $copyOnWindows = false;
  39632. if (isset($options['copy_on_windows'])) {
  39633. $copyOnWindows = $options['copy_on_windows'];
  39634. }
  39635. if (null === $iterator) {
  39636. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  39637. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  39638. }
  39639. if ($this->exists($originDir)) {
  39640. $this->mkdir($targetDir);
  39641. }
  39642. foreach ($iterator as $file) {
  39643. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  39644. if ($copyOnWindows) {
  39645. if (is_file($file)) {
  39646. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  39647. } elseif (is_dir($file)) {
  39648. $this->mkdir($target);
  39649. } else {
  39650. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  39651. }
  39652. } else {
  39653. if (is_link($file)) {
  39654. $this->symlink($file->getLinkTarget(), $target);
  39655. } elseif (is_dir($file)) {
  39656. $this->mkdir($target);
  39657. } elseif (is_file($file)) {
  39658. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  39659. } else {
  39660. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  39661. }
  39662. }
  39663. }
  39664. }
  39665. public function isAbsolutePath($file)
  39666. {
  39667. return strspn($file, '/\\', 0, 1)
  39668. || (strlen($file) > 3 && ctype_alpha($file[0])
  39669. && ':' === substr($file, 1, 1)
  39670. && strspn($file, '/\\', 2, 1)
  39671. )
  39672. || null !== parse_url($file, PHP_URL_SCHEME)
  39673. ;
  39674. }
  39675. public function tempnam($dir, $prefix)
  39676. {
  39677. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  39678. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  39679. $tmpFile = @tempnam($hierarchy, $prefix);
  39680. if (false !== $tmpFile) {
  39681. if (null !== $scheme && 'gs' !== $scheme) {
  39682. return $scheme.'://'.$tmpFile;
  39683. }
  39684. return $tmpFile;
  39685. }
  39686. throw new IOException('A temporary file could not be created.');
  39687. }
  39688. for ($i = 0; $i < 10; ++$i) {
  39689. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  39690. $handle = @fopen($tmpFile, 'x+');
  39691. if (false === $handle) {
  39692. continue;
  39693. }
  39694. @fclose($handle);
  39695. return $tmpFile;
  39696. }
  39697. throw new IOException('A temporary file could not be created.');
  39698. }
  39699. public function dumpFile($filename, $content, $mode = 0666)
  39700. {
  39701. $dir = dirname($filename);
  39702. if (!is_dir($dir)) {
  39703. $this->mkdir($dir);
  39704. }
  39705. if (!is_writable($dir)) {
  39706. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  39707. }
  39708. $tmpFile = $this->tempnam($dir, basename($filename));
  39709. if (false === @file_put_contents($tmpFile, $content)) {
  39710. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  39711. }
  39712. if (null !== $mode) {
  39713. if (func_num_args() > 2) {
  39714. @trigger_error('Support for modifying file permissions is deprecated since Symfony 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  39715. }
  39716. $this->chmod($tmpFile, $mode);
  39717. } elseif (file_exists($filename)) {
  39718. @chmod($tmpFile, fileperms($filename));
  39719. }
  39720. $this->rename($tmpFile, $filename, true);
  39721. }
  39722. private function toIterator($files)
  39723. {
  39724. if (!$files instanceof \Traversable) {
  39725. $files = new \ArrayObject(is_array($files) ? $files : array($files));
  39726. }
  39727. return $files;
  39728. }
  39729. private function getSchemeAndHierarchy($filename)
  39730. {
  39731. $components = explode('://', $filename, 2);
  39732. return 2 === count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  39733. }
  39734. private static function box($func)
  39735. {
  39736. self::$lastError = null;
  39737. \set_error_handler(__CLASS__.'::handleError');
  39738. try {
  39739. $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
  39740. \restore_error_handler();
  39741. return $result;
  39742. } catch (\Throwable $e) {
  39743. } catch (\Exception $e) {
  39744. }
  39745. \restore_error_handler();
  39746. throw $e;
  39747. }
  39748. public static function handleError($type, $msg)
  39749. {
  39750. self::$lastError = $msg;
  39751. }
  39752. }
  39753. Copyright (c) 2004-2018 Fabien Potencier
  39754. Permission is hereby granted, free of charge, to any person obtaining a copy
  39755. of this software and associated documentation files (the "Software"), to deal
  39756. in the Software without restriction, including without limitation the rights
  39757. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39758. copies of the Software, and to permit persons to whom the Software is furnished
  39759. to do so, subject to the following conditions:
  39760. The above copyright notice and this permission notice shall be included in all
  39761. copies or substantial portions of the Software.
  39762. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39763. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39764. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39765. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39766. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39767. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39768. THE SOFTWARE.
  39769. <?php
  39770. namespace Symfony\Component\Filesystem;
  39771. use Symfony\Component\Filesystem\Exception\IOException;
  39772. class LockHandler
  39773. {
  39774. private $file;
  39775. private $handle;
  39776. public function __construct($name, $lockPath = null)
  39777. {
  39778. $lockPath = $lockPath ?: sys_get_temp_dir();
  39779. if (!is_dir($lockPath)) {
  39780. $fs = new Filesystem();
  39781. $fs->mkdir($lockPath);
  39782. }
  39783. if (!is_writable($lockPath)) {
  39784. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  39785. }
  39786. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  39787. }
  39788. public function lock($blocking = false)
  39789. {
  39790. if ($this->handle) {
  39791. return true;
  39792. }
  39793. $error = null;
  39794. set_error_handler(function ($errno, $msg) use (&$error) {
  39795. $error = $msg;
  39796. });
  39797. if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  39798. if ($this->handle = fopen($this->file, 'x')) {
  39799. chmod($this->file, 0666);
  39800. } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  39801. usleep(100);
  39802. $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
  39803. }
  39804. }
  39805. restore_error_handler();
  39806. if (!$this->handle) {
  39807. throw new IOException($error, 0, null, $this->file);
  39808. }
  39809. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  39810. fclose($this->handle);
  39811. $this->handle = null;
  39812. return false;
  39813. }
  39814. return true;
  39815. }
  39816. public function release()
  39817. {
  39818. if ($this->handle) {
  39819. flock($this->handle, LOCK_UN | LOCK_NB);
  39820. fclose($this->handle);
  39821. $this->handle = null;
  39822. }
  39823. }
  39824. }
  39825. <?php
  39826. namespace Symfony\Component\Finder\Adapter;
  39827. @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);
  39828. abstract class AbstractAdapter implements AdapterInterface
  39829. {
  39830. protected $followLinks = false;
  39831. protected $mode = 0;
  39832. protected $minDepth = 0;
  39833. protected $maxDepth = PHP_INT_MAX;
  39834. protected $exclude = array();
  39835. protected $names = array();
  39836. protected $notNames = array();
  39837. protected $contains = array();
  39838. protected $notContains = array();
  39839. protected $sizes = array();
  39840. protected $dates = array();
  39841. protected $filters = array();
  39842. protected $sort = false;
  39843. protected $paths = array();
  39844. protected $notPaths = array();
  39845. protected $ignoreUnreadableDirs = false;
  39846. private static $areSupported = array();
  39847. public function isSupported()
  39848. {
  39849. $name = $this->getName();
  39850. if (!array_key_exists($name, self::$areSupported)) {
  39851. self::$areSupported[$name] = $this->canBeUsed();
  39852. }
  39853. return self::$areSupported[$name];
  39854. }
  39855. public function setFollowLinks($followLinks)
  39856. {
  39857. $this->followLinks = $followLinks;
  39858. return $this;
  39859. }
  39860. public function setMode($mode)
  39861. {
  39862. $this->mode = $mode;
  39863. return $this;
  39864. }
  39865. public function setDepths(array $depths)
  39866. {
  39867. $this->minDepth = 0;
  39868. $this->maxDepth = PHP_INT_MAX;
  39869. foreach ($depths as $comparator) {
  39870. switch ($comparator->getOperator()) {
  39871. case '>':
  39872. $this->minDepth = $comparator->getTarget() + 1;
  39873. break;
  39874. case '>=':
  39875. $this->minDepth = $comparator->getTarget();
  39876. break;
  39877. case '<':
  39878. $this->maxDepth = $comparator->getTarget() - 1;
  39879. break;
  39880. case '<=':
  39881. $this->maxDepth = $comparator->getTarget();
  39882. break;
  39883. default:
  39884. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  39885. }
  39886. }
  39887. return $this;
  39888. }
  39889. public function setExclude(array $exclude)
  39890. {
  39891. $this->exclude = $exclude;
  39892. return $this;
  39893. }
  39894. public function setNames(array $names)
  39895. {
  39896. $this->names = $names;
  39897. return $this;
  39898. }
  39899. public function setNotNames(array $notNames)
  39900. {
  39901. $this->notNames = $notNames;
  39902. return $this;
  39903. }
  39904. public function setContains(array $contains)
  39905. {
  39906. $this->contains = $contains;
  39907. return $this;
  39908. }
  39909. public function setNotContains(array $notContains)
  39910. {
  39911. $this->notContains = $notContains;
  39912. return $this;
  39913. }
  39914. public function setSizes(array $sizes)
  39915. {
  39916. $this->sizes = $sizes;
  39917. return $this;
  39918. }
  39919. public function setDates(array $dates)
  39920. {
  39921. $this->dates = $dates;
  39922. return $this;
  39923. }
  39924. public function setFilters(array $filters)
  39925. {
  39926. $this->filters = $filters;
  39927. return $this;
  39928. }
  39929. public function setSort($sort)
  39930. {
  39931. $this->sort = $sort;
  39932. return $this;
  39933. }
  39934. public function setPath(array $paths)
  39935. {
  39936. $this->paths = $paths;
  39937. return $this;
  39938. }
  39939. public function setNotPath(array $notPaths)
  39940. {
  39941. $this->notPaths = $notPaths;
  39942. return $this;
  39943. }
  39944. public function ignoreUnreadableDirs($ignore = true)
  39945. {
  39946. $this->ignoreUnreadableDirs = (bool) $ignore;
  39947. return $this;
  39948. }
  39949. abstract protected function canBeUsed();
  39950. }
  39951. <?php
  39952. namespace Symfony\Component\Finder\Adapter;
  39953. @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);
  39954. use Symfony\Component\Finder\Exception\AccessDeniedException;
  39955. use Symfony\Component\Finder\Iterator;
  39956. use Symfony\Component\Finder\Shell\Shell;
  39957. use Symfony\Component\Finder\Expression\Expression;
  39958. use Symfony\Component\Finder\Shell\Command;
  39959. use Symfony\Component\Finder\Comparator\NumberComparator;
  39960. use Symfony\Component\Finder\Comparator\DateComparator;
  39961. abstract class AbstractFindAdapter extends AbstractAdapter
  39962. {
  39963. protected $shell;
  39964. public function __construct()
  39965. {
  39966. $this->shell = new Shell();
  39967. }
  39968. public function searchInDirectory($dir)
  39969. {
  39970. $dir = realpath($dir);
  39971. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  39972. return new Iterator\FilePathsIterator(array(), $dir);
  39973. }
  39974. $command = Command::create();
  39975. $find = $this->buildFindCommand($command, $dir);
  39976. if ($this->followLinks) {
  39977. $find->add('-follow');
  39978. }
  39979. $find->add('-mindepth')->add($this->minDepth + 1);
  39980. if (PHP_INT_MAX !== $this->maxDepth) {
  39981. $find->add('-maxdepth')->add($this->maxDepth + 1);
  39982. }
  39983. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  39984. $find->add('-type d');
  39985. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  39986. $find->add('-type f');
  39987. }
  39988. $this->buildNamesFiltering($find, $this->names);
  39989. $this->buildNamesFiltering($find, $this->notNames, true);
  39990. $this->buildPathsFiltering($find, $dir, $this->paths);
  39991. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  39992. $this->buildSizesFiltering($find, $this->sizes);
  39993. $this->buildDatesFiltering($find, $this->dates);
  39994. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  39995. $useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  39996. if ($useGrep && ($this->contains || $this->notContains)) {
  39997. $grep = $command->ins('grep');
  39998. $this->buildContentFiltering($grep, $this->contains);
  39999. $this->buildContentFiltering($grep, $this->notContains, true);
  40000. }
  40001. if ($useSort) {
  40002. $this->buildSorting($command, $this->sort);
  40003. }
  40004. $command->setErrorHandler(
  40005. $this->ignoreUnreadableDirs
  40006. ? function ($stderr) { }
  40007. : function ($stderr) { throw new AccessDeniedException($stderr); }
  40008. );
  40009. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  40010. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  40011. if ($this->exclude) {
  40012. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  40013. }
  40014. if (!$useGrep && ($this->contains || $this->notContains)) {
  40015. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  40016. }
  40017. if ($this->filters) {
  40018. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  40019. }
  40020. if (!$useSort && $this->sort) {
  40021. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  40022. $iterator = $iteratorAggregate->getIterator();
  40023. }
  40024. return $iterator;
  40025. }
  40026. protected function canBeUsed()
  40027. {
  40028. return $this->shell->testCommand('find');
  40029. }
  40030. protected function buildFindCommand(Command $command, $dir)
  40031. {
  40032. return $command
  40033. ->ins('find')
  40034. ->add('find ')
  40035. ->arg($dir)
  40036. ->add('-noleaf');
  40037. }
  40038. private function buildNamesFiltering(Command $command, array $names, $not = false)
  40039. {
  40040. if (0 === count($names)) {
  40041. return;
  40042. }
  40043. $command->add($not ? '-not' : null)->cmd('(');
  40044. foreach ($names as $i => $name) {
  40045. $expr = Expression::create($name);
  40046. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  40047. $expr = Expression::create($expr->getGlob()->toRegex(false));
  40048. }
  40049. if ($expr->isRegex()) {
  40050. $regex = $expr->getRegex();
  40051. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  40052. ->setStartFlag(false)
  40053. ->setStartJoker(true)
  40054. ->replaceJokers('[^/]');
  40055. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  40056. $regex->setEndJoker(false)->append('[^/]*');
  40057. }
  40058. }
  40059. $command
  40060. ->add($i > 0 ? '-or' : null)
  40061. ->add($expr->isRegex()
  40062. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  40063. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  40064. )
  40065. ->arg($expr->renderPattern());
  40066. }
  40067. $command->cmd(')');
  40068. }
  40069. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  40070. {
  40071. if (0 === count($paths)) {
  40072. return;
  40073. }
  40074. $command->add($not ? '-not' : null)->cmd('(');
  40075. foreach ($paths as $i => $path) {
  40076. $expr = Expression::create($path);
  40077. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  40078. $expr = Expression::create($expr->getGlob()->toRegex(false));
  40079. }
  40080. if ($expr->isRegex()) {
  40081. $regex = $expr->getRegex();
  40082. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  40083. } else {
  40084. $expr->prepend('*')->append('*');
  40085. }
  40086. $command
  40087. ->add($i > 0 ? '-or' : null)
  40088. ->add($expr->isRegex()
  40089. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  40090. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  40091. )
  40092. ->arg($expr->renderPattern());
  40093. }
  40094. $command->cmd(')');
  40095. }
  40096. private function buildSizesFiltering(Command $command, array $sizes)
  40097. {
  40098. foreach ($sizes as $i => $size) {
  40099. $command->add($i > 0 ? '-and' : null);
  40100. switch ($size->getOperator()) {
  40101. case '<=':
  40102. $command->add('-size -'.($size->getTarget() + 1).'c');
  40103. break;
  40104. case '>=':
  40105. $command->add('-size +'.($size->getTarget() - 1).'c');
  40106. break;
  40107. case '>':
  40108. $command->add('-size +'.$size->getTarget().'c');
  40109. break;
  40110. case '!=':
  40111. $command->add('-size -'.$size->getTarget().'c');
  40112. $command->add('-size +'.$size->getTarget().'c');
  40113. break;
  40114. case '<':
  40115. default:
  40116. $command->add('-size -'.$size->getTarget().'c');
  40117. }
  40118. }
  40119. }
  40120. private function buildDatesFiltering(Command $command, array $dates)
  40121. {
  40122. foreach ($dates as $i => $date) {
  40123. $command->add($i > 0 ? '-and' : null);
  40124. $mins = (int) round((time() - $date->getTarget()) / 60);
  40125. if (0 > $mins) {
  40126. $command->add(' -mmin -0');
  40127. return;
  40128. }
  40129. switch ($date->getOperator()) {
  40130. case '<=':
  40131. $command->add('-mmin +'.($mins - 1));
  40132. break;
  40133. case '>=':
  40134. $command->add('-mmin -'.($mins + 1));
  40135. break;
  40136. case '>':
  40137. $command->add('-mmin -'.$mins);
  40138. break;
  40139. case '!=':
  40140. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  40141. break;
  40142. case '<':
  40143. default:
  40144. $command->add('-mmin +'.$mins);
  40145. }
  40146. }
  40147. }
  40148. private function buildSorting(Command $command, $sort)
  40149. {
  40150. $this->buildFormatSorting($command, $sort);
  40151. }
  40152. abstract protected function buildFormatSorting(Command $command, $sort);
  40153. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  40154. }
  40155. <?php
  40156. namespace Symfony\Component\Finder\Adapter;
  40157. interface AdapterInterface
  40158. {
  40159. public function setFollowLinks($followLinks);
  40160. public function setMode($mode);
  40161. public function setExclude(array $exclude);
  40162. public function setDepths(array $depths);
  40163. public function setNames(array $names);
  40164. public function setNotNames(array $notNames);
  40165. public function setContains(array $contains);
  40166. public function setNotContains(array $notContains);
  40167. public function setSizes(array $sizes);
  40168. public function setDates(array $dates);
  40169. public function setFilters(array $filters);
  40170. public function setSort($sort);
  40171. public function setPath(array $paths);
  40172. public function setNotPath(array $notPaths);
  40173. public function ignoreUnreadableDirs($ignore = true);
  40174. public function searchInDirectory($dir);
  40175. public function isSupported();
  40176. public function getName();
  40177. }
  40178. <?php
  40179. namespace Symfony\Component\Finder\Adapter;
  40180. @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);
  40181. use Symfony\Component\Finder\Shell\Shell;
  40182. use Symfony\Component\Finder\Shell\Command;
  40183. use Symfony\Component\Finder\Iterator\SortableIterator;
  40184. use Symfony\Component\Finder\Expression\Expression;
  40185. class BsdFindAdapter extends AbstractFindAdapter
  40186. {
  40187. public function getName()
  40188. {
  40189. return 'bsd_find';
  40190. }
  40191. protected function canBeUsed()
  40192. {
  40193. return in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  40194. }
  40195. protected function buildFormatSorting(Command $command, $sort)
  40196. {
  40197. switch ($sort) {
  40198. case SortableIterator::SORT_BY_NAME:
  40199. $command->ins('sort')->add('| sort');
  40200. return;
  40201. case SortableIterator::SORT_BY_TYPE:
  40202. $format = '%HT';
  40203. break;
  40204. case SortableIterator::SORT_BY_ACCESSED_TIME:
  40205. $format = '%a';
  40206. break;
  40207. case SortableIterator::SORT_BY_CHANGED_TIME:
  40208. $format = '%c';
  40209. break;
  40210. case SortableIterator::SORT_BY_MODIFIED_TIME:
  40211. $format = '%m';
  40212. break;
  40213. default:
  40214. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  40215. }
  40216. $command
  40217. ->add('-print0 | xargs -0 stat -f')
  40218. ->arg($format.'%t%N')
  40219. ->add('| sort | cut -f 2');
  40220. }
  40221. protected function buildFindCommand(Command $command, $dir)
  40222. {
  40223. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  40224. return $command;
  40225. }
  40226. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  40227. {
  40228. foreach ($contains as $contain) {
  40229. $expr = Expression::create($contain);
  40230. $command
  40231. ->add('| grep -v \'^$\'')
  40232. ->add('| xargs -I{} grep -I')
  40233. ->add($expr->isCaseSensitive() ? null : '-i')
  40234. ->add($not ? '-L' : '-l')
  40235. ->add('-Ee')->arg($expr->renderPattern())
  40236. ->add('{}')
  40237. ;
  40238. }
  40239. }
  40240. }
  40241. <?php
  40242. namespace Symfony\Component\Finder\Adapter;
  40243. @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);
  40244. use Symfony\Component\Finder\Shell\Shell;
  40245. use Symfony\Component\Finder\Shell\Command;
  40246. use Symfony\Component\Finder\Iterator\SortableIterator;
  40247. use Symfony\Component\Finder\Expression\Expression;
  40248. class GnuFindAdapter extends AbstractFindAdapter
  40249. {
  40250. public function getName()
  40251. {
  40252. return 'gnu_find';
  40253. }
  40254. protected function buildFormatSorting(Command $command, $sort)
  40255. {
  40256. switch ($sort) {
  40257. case SortableIterator::SORT_BY_NAME:
  40258. $command->ins('sort')->add('| sort');
  40259. return;
  40260. case SortableIterator::SORT_BY_TYPE:
  40261. $format = '%y';
  40262. break;
  40263. case SortableIterator::SORT_BY_ACCESSED_TIME:
  40264. $format = '%A@';
  40265. break;
  40266. case SortableIterator::SORT_BY_CHANGED_TIME:
  40267. $format = '%C@';
  40268. break;
  40269. case SortableIterator::SORT_BY_MODIFIED_TIME:
  40270. $format = '%T@';
  40271. break;
  40272. default:
  40273. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  40274. }
  40275. $command
  40276. ->get('find')
  40277. ->add('-printf')
  40278. ->arg($format.' %h/%f\\n')
  40279. ->add('| sort | cut')
  40280. ->arg('-d ')
  40281. ->arg('-f2-')
  40282. ;
  40283. }
  40284. protected function canBeUsed()
  40285. {
  40286. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  40287. }
  40288. protected function buildFindCommand(Command $command, $dir)
  40289. {
  40290. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  40291. }
  40292. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  40293. {
  40294. foreach ($contains as $contain) {
  40295. $expr = Expression::create($contain);
  40296. $command
  40297. ->add('| xargs -I{} -r grep -I')
  40298. ->add($expr->isCaseSensitive() ? null : '-i')
  40299. ->add($not ? '-L' : '-l')
  40300. ->add('-Ee')->arg($expr->renderPattern())
  40301. ->add('{}')
  40302. ;
  40303. }
  40304. }
  40305. }
  40306. <?php
  40307. namespace Symfony\Component\Finder\Adapter;
  40308. @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);
  40309. use Symfony\Component\Finder\Iterator;
  40310. class PhpAdapter extends AbstractAdapter
  40311. {
  40312. public function searchInDirectory($dir)
  40313. {
  40314. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  40315. if ($this->followLinks) {
  40316. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  40317. }
  40318. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  40319. if ($this->exclude) {
  40320. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  40321. }
  40322. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  40323. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  40324. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  40325. }
  40326. if ($this->mode) {
  40327. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  40328. }
  40329. if ($this->names || $this->notNames) {
  40330. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  40331. }
  40332. if ($this->contains || $this->notContains) {
  40333. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  40334. }
  40335. if ($this->sizes) {
  40336. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  40337. }
  40338. if ($this->dates) {
  40339. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  40340. }
  40341. if ($this->filters) {
  40342. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  40343. }
  40344. if ($this->paths || $this->notPaths) {
  40345. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  40346. }
  40347. if ($this->sort) {
  40348. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  40349. $iterator = $iteratorAggregate->getIterator();
  40350. }
  40351. return $iterator;
  40352. }
  40353. public function getName()
  40354. {
  40355. return 'php';
  40356. }
  40357. protected function canBeUsed()
  40358. {
  40359. return true;
  40360. }
  40361. }
  40362. <?php
  40363. namespace Symfony\Component\Finder\Comparator;
  40364. class Comparator
  40365. {
  40366. private $target;
  40367. private $operator = '==';
  40368. public function getTarget()
  40369. {
  40370. return $this->target;
  40371. }
  40372. public function setTarget($target)
  40373. {
  40374. $this->target = $target;
  40375. }
  40376. public function getOperator()
  40377. {
  40378. return $this->operator;
  40379. }
  40380. public function setOperator($operator)
  40381. {
  40382. if (!$operator) {
  40383. $operator = '==';
  40384. }
  40385. if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  40386. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  40387. }
  40388. $this->operator = $operator;
  40389. }
  40390. public function test($test)
  40391. {
  40392. switch ($this->operator) {
  40393. case '>':
  40394. return $test > $this->target;
  40395. case '>=':
  40396. return $test >= $this->target;
  40397. case '<':
  40398. return $test < $this->target;
  40399. case '<=':
  40400. return $test <= $this->target;
  40401. case '!=':
  40402. return $test != $this->target;
  40403. }
  40404. return $test == $this->target;
  40405. }
  40406. }
  40407. <?php
  40408. namespace Symfony\Component\Finder\Comparator;
  40409. class DateComparator extends Comparator
  40410. {
  40411. public function __construct($test)
  40412. {
  40413. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  40414. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  40415. }
  40416. try {
  40417. $date = new \DateTime($matches[2]);
  40418. $target = $date->format('U');
  40419. } catch (\Exception $e) {
  40420. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  40421. }
  40422. $operator = isset($matches[1]) ? $matches[1] : '==';
  40423. if ('since' === $operator || 'after' === $operator) {
  40424. $operator = '>';
  40425. }
  40426. if ('until' === $operator || 'before' === $operator) {
  40427. $operator = '<';
  40428. }
  40429. $this->setOperator($operator);
  40430. $this->setTarget($target);
  40431. }
  40432. }
  40433. <?php
  40434. namespace Symfony\Component\Finder\Comparator;
  40435. class NumberComparator extends Comparator
  40436. {
  40437. public function __construct($test)
  40438. {
  40439. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  40440. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  40441. }
  40442. $target = $matches[2];
  40443. if (!is_numeric($target)) {
  40444. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  40445. }
  40446. if (isset($matches[3])) {
  40447. switch (strtolower($matches[3])) {
  40448. case 'k':
  40449. $target *= 1000;
  40450. break;
  40451. case 'ki':
  40452. $target *= 1024;
  40453. break;
  40454. case 'm':
  40455. $target *= 1000000;
  40456. break;
  40457. case 'mi':
  40458. $target *= 1024 * 1024;
  40459. break;
  40460. case 'g':
  40461. $target *= 1000000000;
  40462. break;
  40463. case 'gi':
  40464. $target *= 1024 * 1024 * 1024;
  40465. break;
  40466. }
  40467. }
  40468. $this->setTarget($target);
  40469. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  40470. }
  40471. }
  40472. <?php
  40473. namespace Symfony\Component\Finder\Exception;
  40474. class AccessDeniedException extends \UnexpectedValueException
  40475. {
  40476. }
  40477. <?php
  40478. namespace Symfony\Component\Finder\Exception;
  40479. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40480. use Symfony\Component\Finder\Adapter\AdapterInterface;
  40481. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  40482. {
  40483. private $adapter;
  40484. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  40485. {
  40486. $this->adapter = $adapter;
  40487. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  40488. }
  40489. public function getAdapter()
  40490. {
  40491. return $this->adapter;
  40492. }
  40493. }
  40494. <?php
  40495. namespace Symfony\Component\Finder\Exception;
  40496. interface ExceptionInterface
  40497. {
  40498. public function getAdapter();
  40499. }
  40500. <?php
  40501. namespace Symfony\Component\Finder\Exception;
  40502. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40503. class OperationNotPermitedException extends AdapterFailureException
  40504. {
  40505. }
  40506. <?php
  40507. namespace Symfony\Component\Finder\Exception;
  40508. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40509. use Symfony\Component\Finder\Adapter\AdapterInterface;
  40510. use Symfony\Component\Finder\Shell\Command;
  40511. class ShellCommandFailureException extends AdapterFailureException
  40512. {
  40513. private $command;
  40514. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  40515. {
  40516. $this->command = $command;
  40517. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  40518. }
  40519. public function getCommand()
  40520. {
  40521. return $this->command;
  40522. }
  40523. }
  40524. <?php
  40525. namespace Symfony\Component\Finder\Expression;
  40526. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40527. class Expression implements ValueInterface
  40528. {
  40529. const TYPE_REGEX = 1;
  40530. const TYPE_GLOB = 2;
  40531. private $value;
  40532. public static function create($expr)
  40533. {
  40534. return new self($expr);
  40535. }
  40536. public function __construct($expr)
  40537. {
  40538. try {
  40539. $this->value = Regex::create($expr);
  40540. } catch (\InvalidArgumentException $e) {
  40541. $this->value = new Glob($expr);
  40542. }
  40543. }
  40544. public function __toString()
  40545. {
  40546. return $this->render();
  40547. }
  40548. public function render()
  40549. {
  40550. return $this->value->render();
  40551. }
  40552. public function renderPattern()
  40553. {
  40554. return $this->value->renderPattern();
  40555. }
  40556. public function isCaseSensitive()
  40557. {
  40558. return $this->value->isCaseSensitive();
  40559. }
  40560. public function getType()
  40561. {
  40562. return $this->value->getType();
  40563. }
  40564. public function prepend($expr)
  40565. {
  40566. $this->value->prepend($expr);
  40567. return $this;
  40568. }
  40569. public function append($expr)
  40570. {
  40571. $this->value->append($expr);
  40572. return $this;
  40573. }
  40574. public function isRegex()
  40575. {
  40576. return self::TYPE_REGEX === $this->value->getType();
  40577. }
  40578. public function isGlob()
  40579. {
  40580. return self::TYPE_GLOB === $this->value->getType();
  40581. }
  40582. public function getGlob()
  40583. {
  40584. if (self::TYPE_GLOB !== $this->value->getType()) {
  40585. throw new \LogicException('Regex can\'t be transformed to glob.');
  40586. }
  40587. return $this->value;
  40588. }
  40589. public function getRegex()
  40590. {
  40591. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  40592. }
  40593. }
  40594. <?php
  40595. namespace Symfony\Component\Finder\Expression;
  40596. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40597. use Symfony\Component\Finder\Glob as FinderGlob;
  40598. class Glob implements ValueInterface
  40599. {
  40600. private $pattern;
  40601. public function __construct($pattern)
  40602. {
  40603. $this->pattern = $pattern;
  40604. }
  40605. public function render()
  40606. {
  40607. return $this->pattern;
  40608. }
  40609. public function renderPattern()
  40610. {
  40611. return $this->pattern;
  40612. }
  40613. public function getType()
  40614. {
  40615. return Expression::TYPE_GLOB;
  40616. }
  40617. public function isCaseSensitive()
  40618. {
  40619. return true;
  40620. }
  40621. public function prepend($expr)
  40622. {
  40623. $this->pattern = $expr.$this->pattern;
  40624. return $this;
  40625. }
  40626. public function append($expr)
  40627. {
  40628. $this->pattern .= $expr;
  40629. return $this;
  40630. }
  40631. public function isExpandable()
  40632. {
  40633. return false !== strpos($this->pattern, '{')
  40634. && false !== strpos($this->pattern, '}');
  40635. }
  40636. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  40637. {
  40638. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  40639. return new Regex($regex);
  40640. }
  40641. }
  40642. <?php
  40643. namespace Symfony\Component\Finder\Expression;
  40644. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40645. class Regex implements ValueInterface
  40646. {
  40647. const START_FLAG = '^';
  40648. const END_FLAG = '$';
  40649. const BOUNDARY = '~';
  40650. const JOKER = '.*';
  40651. const ESCAPING = '\\';
  40652. private $pattern;
  40653. private $options;
  40654. private $startFlag;
  40655. private $endFlag;
  40656. private $startJoker;
  40657. private $endJoker;
  40658. public static function create($expr)
  40659. {
  40660. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  40661. $start = substr($m[1], 0, 1);
  40662. $end = substr($m[1], -1);
  40663. if (
  40664. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  40665. || ('{' === $start && '}' === $end)
  40666. || ('(' === $start && ')' === $end)
  40667. ) {
  40668. return new self(substr($m[1], 1, -1), $m[2], $end);
  40669. }
  40670. }
  40671. throw new \InvalidArgumentException('Given expression is not a regex.');
  40672. }
  40673. public function __construct($pattern, $options = '', $delimiter = null)
  40674. {
  40675. if (null !== $delimiter) {
  40676. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  40677. }
  40678. $this->parsePattern($pattern);
  40679. $this->options = $options;
  40680. }
  40681. public function __toString()
  40682. {
  40683. return $this->render();
  40684. }
  40685. public function render()
  40686. {
  40687. return self::BOUNDARY
  40688. .$this->renderPattern()
  40689. .self::BOUNDARY
  40690. .$this->options;
  40691. }
  40692. public function renderPattern()
  40693. {
  40694. return ($this->startFlag ? self::START_FLAG : '')
  40695. .($this->startJoker ? self::JOKER : '')
  40696. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  40697. .($this->endJoker ? self::JOKER : '')
  40698. .($this->endFlag ? self::END_FLAG : '');
  40699. }
  40700. public function isCaseSensitive()
  40701. {
  40702. return !$this->hasOption('i');
  40703. }
  40704. public function getType()
  40705. {
  40706. return Expression::TYPE_REGEX;
  40707. }
  40708. public function prepend($expr)
  40709. {
  40710. $this->pattern = $expr.$this->pattern;
  40711. return $this;
  40712. }
  40713. public function append($expr)
  40714. {
  40715. $this->pattern .= $expr;
  40716. return $this;
  40717. }
  40718. public function hasOption($option)
  40719. {
  40720. return false !== strpos($this->options, $option);
  40721. }
  40722. public function addOption($option)
  40723. {
  40724. if (!$this->hasOption($option)) {
  40725. $this->options .= $option;
  40726. }
  40727. return $this;
  40728. }
  40729. public function removeOption($option)
  40730. {
  40731. $this->options = str_replace($option, '', $this->options);
  40732. return $this;
  40733. }
  40734. public function setStartFlag($startFlag)
  40735. {
  40736. $this->startFlag = $startFlag;
  40737. return $this;
  40738. }
  40739. public function hasStartFlag()
  40740. {
  40741. return $this->startFlag;
  40742. }
  40743. public function setEndFlag($endFlag)
  40744. {
  40745. $this->endFlag = (bool) $endFlag;
  40746. return $this;
  40747. }
  40748. public function hasEndFlag()
  40749. {
  40750. return $this->endFlag;
  40751. }
  40752. public function setStartJoker($startJoker)
  40753. {
  40754. $this->startJoker = $startJoker;
  40755. return $this;
  40756. }
  40757. public function hasStartJoker()
  40758. {
  40759. return $this->startJoker;
  40760. }
  40761. public function setEndJoker($endJoker)
  40762. {
  40763. $this->endJoker = (bool) $endJoker;
  40764. return $this;
  40765. }
  40766. public function hasEndJoker()
  40767. {
  40768. return $this->endJoker;
  40769. }
  40770. public function replaceJokers($replacement)
  40771. {
  40772. $replace = function ($subject) use ($replacement) {
  40773. $subject = $subject[0];
  40774. $replace = 0 === substr_count($subject, '\\') % 2;
  40775. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  40776. };
  40777. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  40778. return $this;
  40779. }
  40780. private function parsePattern($pattern)
  40781. {
  40782. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  40783. $pattern = substr($pattern, 1);
  40784. }
  40785. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  40786. $pattern = substr($pattern, 2);
  40787. }
  40788. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  40789. $pattern = substr($pattern, 0, -1);
  40790. }
  40791. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  40792. $pattern = substr($pattern, 0, -2);
  40793. }
  40794. $this->pattern = $pattern;
  40795. }
  40796. }
  40797. <?php
  40798. namespace Symfony\Component\Finder\Expression;
  40799. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40800. interface ValueInterface
  40801. {
  40802. public function render();
  40803. public function renderPattern();
  40804. public function isCaseSensitive();
  40805. public function getType();
  40806. public function prepend($expr);
  40807. public function append($expr);
  40808. }
  40809. <?php
  40810. namespace Symfony\Component\Finder;
  40811. use Symfony\Component\Finder\Adapter\AdapterInterface;
  40812. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  40813. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  40814. use Symfony\Component\Finder\Adapter\PhpAdapter;
  40815. use Symfony\Component\Finder\Comparator\DateComparator;
  40816. use Symfony\Component\Finder\Comparator\NumberComparator;
  40817. use Symfony\Component\Finder\Exception\ExceptionInterface;
  40818. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  40819. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  40820. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  40821. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  40822. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  40823. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  40824. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  40825. use Symfony\Component\Finder\Iterator\SortableIterator;
  40826. class Finder implements \IteratorAggregate, \Countable
  40827. {
  40828. const IGNORE_VCS_FILES = 1;
  40829. const IGNORE_DOT_FILES = 2;
  40830. private $mode = 0;
  40831. private $names = array();
  40832. private $notNames = array();
  40833. private $exclude = array();
  40834. private $filters = array();
  40835. private $depths = array();
  40836. private $sizes = array();
  40837. private $followLinks = false;
  40838. private $sort = false;
  40839. private $ignore = 0;
  40840. private $dirs = array();
  40841. private $dates = array();
  40842. private $iterators = array();
  40843. private $contains = array();
  40844. private $notContains = array();
  40845. private $adapters = null;
  40846. private $paths = array();
  40847. private $notPaths = array();
  40848. private $ignoreUnreadableDirs = false;
  40849. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  40850. public function __construct()
  40851. {
  40852. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  40853. }
  40854. public static function create()
  40855. {
  40856. return new static();
  40857. }
  40858. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  40859. {
  40860. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40861. $this->initDefaultAdapters();
  40862. $this->adapters[$adapter->getName()] = array(
  40863. 'adapter' => $adapter,
  40864. 'priority' => $priority,
  40865. 'selected' => false,
  40866. );
  40867. return $this->sortAdapters();
  40868. }
  40869. public function useBestAdapter()
  40870. {
  40871. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40872. $this->initDefaultAdapters();
  40873. $this->resetAdapterSelection();
  40874. return $this->sortAdapters();
  40875. }
  40876. public function setAdapter($name)
  40877. {
  40878. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40879. $this->initDefaultAdapters();
  40880. if (!isset($this->adapters[$name])) {
  40881. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  40882. }
  40883. $this->resetAdapterSelection();
  40884. $this->adapters[$name]['selected'] = true;
  40885. return $this->sortAdapters();
  40886. }
  40887. public function removeAdapters()
  40888. {
  40889. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40890. $this->adapters = array();
  40891. return $this;
  40892. }
  40893. public function getAdapters()
  40894. {
  40895. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40896. $this->initDefaultAdapters();
  40897. return array_values(array_map(function (array $adapter) {
  40898. return $adapter['adapter'];
  40899. }, $this->adapters));
  40900. }
  40901. public function directories()
  40902. {
  40903. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  40904. return $this;
  40905. }
  40906. public function files()
  40907. {
  40908. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  40909. return $this;
  40910. }
  40911. public function depth($level)
  40912. {
  40913. $this->depths[] = new Comparator\NumberComparator($level);
  40914. return $this;
  40915. }
  40916. public function date($date)
  40917. {
  40918. $this->dates[] = new Comparator\DateComparator($date);
  40919. return $this;
  40920. }
  40921. public function name($pattern)
  40922. {
  40923. $this->names[] = $pattern;
  40924. return $this;
  40925. }
  40926. public function notName($pattern)
  40927. {
  40928. $this->notNames[] = $pattern;
  40929. return $this;
  40930. }
  40931. public function contains($pattern)
  40932. {
  40933. $this->contains[] = $pattern;
  40934. return $this;
  40935. }
  40936. public function notContains($pattern)
  40937. {
  40938. $this->notContains[] = $pattern;
  40939. return $this;
  40940. }
  40941. public function path($pattern)
  40942. {
  40943. $this->paths[] = $pattern;
  40944. return $this;
  40945. }
  40946. public function notPath($pattern)
  40947. {
  40948. $this->notPaths[] = $pattern;
  40949. return $this;
  40950. }
  40951. public function size($size)
  40952. {
  40953. $this->sizes[] = new Comparator\NumberComparator($size);
  40954. return $this;
  40955. }
  40956. public function exclude($dirs)
  40957. {
  40958. $this->exclude = array_merge($this->exclude, (array) $dirs);
  40959. return $this;
  40960. }
  40961. public function ignoreDotFiles($ignoreDotFiles)
  40962. {
  40963. if ($ignoreDotFiles) {
  40964. $this->ignore |= static::IGNORE_DOT_FILES;
  40965. } else {
  40966. $this->ignore &= ~static::IGNORE_DOT_FILES;
  40967. }
  40968. return $this;
  40969. }
  40970. public function ignoreVCS($ignoreVCS)
  40971. {
  40972. if ($ignoreVCS) {
  40973. $this->ignore |= static::IGNORE_VCS_FILES;
  40974. } else {
  40975. $this->ignore &= ~static::IGNORE_VCS_FILES;
  40976. }
  40977. return $this;
  40978. }
  40979. public static function addVCSPattern($pattern)
  40980. {
  40981. foreach ((array) $pattern as $p) {
  40982. self::$vcsPatterns[] = $p;
  40983. }
  40984. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  40985. }
  40986. public function sort(\Closure $closure)
  40987. {
  40988. $this->sort = $closure;
  40989. return $this;
  40990. }
  40991. public function sortByName()
  40992. {
  40993. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  40994. return $this;
  40995. }
  40996. public function sortByType()
  40997. {
  40998. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  40999. return $this;
  41000. }
  41001. public function sortByAccessedTime()
  41002. {
  41003. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  41004. return $this;
  41005. }
  41006. public function sortByChangedTime()
  41007. {
  41008. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  41009. return $this;
  41010. }
  41011. public function sortByModifiedTime()
  41012. {
  41013. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  41014. return $this;
  41015. }
  41016. public function filter(\Closure $closure)
  41017. {
  41018. $this->filters[] = $closure;
  41019. return $this;
  41020. }
  41021. public function followLinks()
  41022. {
  41023. $this->followLinks = true;
  41024. return $this;
  41025. }
  41026. public function ignoreUnreadableDirs($ignore = true)
  41027. {
  41028. $this->ignoreUnreadableDirs = (bool) $ignore;
  41029. return $this;
  41030. }
  41031. public function in($dirs)
  41032. {
  41033. $resolvedDirs = array();
  41034. foreach ((array) $dirs as $dir) {
  41035. if (is_dir($dir)) {
  41036. $resolvedDirs[] = $this->normalizeDir($dir);
  41037. } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  41038. $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
  41039. } else {
  41040. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  41041. }
  41042. }
  41043. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  41044. return $this;
  41045. }
  41046. public function getIterator()
  41047. {
  41048. if (0 === count($this->dirs) && 0 === count($this->iterators)) {
  41049. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  41050. }
  41051. if (1 === count($this->dirs) && 0 === count($this->iterators)) {
  41052. return $this->searchInDirectory($this->dirs[0]);
  41053. }
  41054. $iterator = new \AppendIterator();
  41055. foreach ($this->dirs as $dir) {
  41056. $iterator->append($this->searchInDirectory($dir));
  41057. }
  41058. foreach ($this->iterators as $it) {
  41059. $iterator->append($it);
  41060. }
  41061. return $iterator;
  41062. }
  41063. public function append($iterator)
  41064. {
  41065. if ($iterator instanceof \IteratorAggregate) {
  41066. $this->iterators[] = $iterator->getIterator();
  41067. } elseif ($iterator instanceof \Iterator) {
  41068. $this->iterators[] = $iterator;
  41069. } elseif ($iterator instanceof \Traversable || is_array($iterator)) {
  41070. $it = new \ArrayIterator();
  41071. foreach ($iterator as $file) {
  41072. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  41073. }
  41074. $this->iterators[] = $it;
  41075. } else {
  41076. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  41077. }
  41078. return $this;
  41079. }
  41080. public function count()
  41081. {
  41082. return iterator_count($this->getIterator());
  41083. }
  41084. private function sortAdapters()
  41085. {
  41086. uasort($this->adapters, function (array $a, array $b) {
  41087. if ($a['selected'] || $b['selected']) {
  41088. return $a['selected'] ? -1 : 1;
  41089. }
  41090. return $a['priority'] > $b['priority'] ? -1 : 1;
  41091. });
  41092. return $this;
  41093. }
  41094. private function searchInDirectory($dir)
  41095. {
  41096. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  41097. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  41098. }
  41099. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  41100. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  41101. }
  41102. if ($this->adapters) {
  41103. foreach ($this->adapters as $adapter) {
  41104. if ($adapter['adapter']->isSupported()) {
  41105. try {
  41106. return $this
  41107. ->buildAdapter($adapter['adapter'])
  41108. ->searchInDirectory($dir);
  41109. } catch (ExceptionInterface $e) {
  41110. }
  41111. }
  41112. }
  41113. }
  41114. $minDepth = 0;
  41115. $maxDepth = PHP_INT_MAX;
  41116. foreach ($this->depths as $comparator) {
  41117. switch ($comparator->getOperator()) {
  41118. case '>':
  41119. $minDepth = $comparator->getTarget() + 1;
  41120. break;
  41121. case '>=':
  41122. $minDepth = $comparator->getTarget();
  41123. break;
  41124. case '<':
  41125. $maxDepth = $comparator->getTarget() - 1;
  41126. break;
  41127. case '<=':
  41128. $maxDepth = $comparator->getTarget();
  41129. break;
  41130. default:
  41131. $minDepth = $maxDepth = $comparator->getTarget();
  41132. }
  41133. }
  41134. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  41135. if ($this->followLinks) {
  41136. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  41137. }
  41138. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  41139. if ($this->exclude) {
  41140. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  41141. }
  41142. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  41143. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  41144. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  41145. }
  41146. if ($this->mode) {
  41147. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  41148. }
  41149. if ($this->names || $this->notNames) {
  41150. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  41151. }
  41152. if ($this->contains || $this->notContains) {
  41153. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  41154. }
  41155. if ($this->sizes) {
  41156. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  41157. }
  41158. if ($this->dates) {
  41159. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  41160. }
  41161. if ($this->filters) {
  41162. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  41163. }
  41164. if ($this->paths || $this->notPaths) {
  41165. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  41166. }
  41167. if ($this->sort) {
  41168. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  41169. $iterator = $iteratorAggregate->getIterator();
  41170. }
  41171. return $iterator;
  41172. }
  41173. private function buildAdapter(AdapterInterface $adapter)
  41174. {
  41175. return $adapter
  41176. ->setFollowLinks($this->followLinks)
  41177. ->setDepths($this->depths)
  41178. ->setMode($this->mode)
  41179. ->setExclude($this->exclude)
  41180. ->setNames($this->names)
  41181. ->setNotNames($this->notNames)
  41182. ->setContains($this->contains)
  41183. ->setNotContains($this->notContains)
  41184. ->setSizes($this->sizes)
  41185. ->setDates($this->dates)
  41186. ->setFilters($this->filters)
  41187. ->setSort($this->sort)
  41188. ->setPath($this->paths)
  41189. ->setNotPath($this->notPaths)
  41190. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  41191. }
  41192. private function resetAdapterSelection()
  41193. {
  41194. $this->adapters = array_map(function (array $properties) {
  41195. $properties['selected'] = false;
  41196. return $properties;
  41197. }, $this->adapters);
  41198. }
  41199. private function initDefaultAdapters()
  41200. {
  41201. if (null === $this->adapters) {
  41202. $this->adapters = array();
  41203. $this
  41204. ->addAdapter(new GnuFindAdapter())
  41205. ->addAdapter(new BsdFindAdapter())
  41206. ->addAdapter(new PhpAdapter(), -50)
  41207. ->setAdapter('php')
  41208. ;
  41209. }
  41210. }
  41211. private function normalizeDir($dir)
  41212. {
  41213. return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  41214. }
  41215. }
  41216. <?php
  41217. namespace Symfony\Component\Finder;
  41218. class Glob
  41219. {
  41220. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  41221. {
  41222. $firstByte = true;
  41223. $escaping = false;
  41224. $inCurlies = 0;
  41225. $regex = '';
  41226. $sizeGlob = strlen($glob);
  41227. for ($i = 0; $i < $sizeGlob; ++$i) {
  41228. $car = $glob[$i];
  41229. if ($firstByte) {
  41230. if ($strictLeadingDot && '.' !== $car) {
  41231. $regex .= '(?=[^\.])';
  41232. }
  41233. $firstByte = false;
  41234. }
  41235. if ('/' === $car) {
  41236. $firstByte = true;
  41237. }
  41238. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  41239. $regex .= "\\$car";
  41240. } elseif ('*' === $car) {
  41241. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  41242. } elseif ('?' === $car) {
  41243. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  41244. } elseif ('{' === $car) {
  41245. $regex .= $escaping ? '\\{' : '(';
  41246. if (!$escaping) {
  41247. ++$inCurlies;
  41248. }
  41249. } elseif ('}' === $car && $inCurlies) {
  41250. $regex .= $escaping ? '}' : ')';
  41251. if (!$escaping) {
  41252. --$inCurlies;
  41253. }
  41254. } elseif (',' === $car && $inCurlies) {
  41255. $regex .= $escaping ? ',' : '|';
  41256. } elseif ('\\' === $car) {
  41257. if ($escaping) {
  41258. $regex .= '\\\\';
  41259. $escaping = false;
  41260. } else {
  41261. $escaping = true;
  41262. }
  41263. continue;
  41264. } else {
  41265. $regex .= $car;
  41266. }
  41267. $escaping = false;
  41268. }
  41269. return $delimiter.'^'.$regex.'$'.$delimiter;
  41270. }
  41271. }
  41272. <?php
  41273. namespace Symfony\Component\Finder\Iterator;
  41274. class CustomFilterIterator extends FilterIterator
  41275. {
  41276. private $filters = array();
  41277. public function __construct(\Iterator $iterator, array $filters)
  41278. {
  41279. foreach ($filters as $filter) {
  41280. if (!is_callable($filter)) {
  41281. throw new \InvalidArgumentException('Invalid PHP callback.');
  41282. }
  41283. }
  41284. $this->filters = $filters;
  41285. parent::__construct($iterator);
  41286. }
  41287. public function accept()
  41288. {
  41289. $fileinfo = $this->current();
  41290. foreach ($this->filters as $filter) {
  41291. if (false === call_user_func($filter, $fileinfo)) {
  41292. return false;
  41293. }
  41294. }
  41295. return true;
  41296. }
  41297. }
  41298. <?php
  41299. namespace Symfony\Component\Finder\Iterator;
  41300. use Symfony\Component\Finder\Comparator\DateComparator;
  41301. class DateRangeFilterIterator extends FilterIterator
  41302. {
  41303. private $comparators = array();
  41304. public function __construct(\Iterator $iterator, array $comparators)
  41305. {
  41306. $this->comparators = $comparators;
  41307. parent::__construct($iterator);
  41308. }
  41309. public function accept()
  41310. {
  41311. $fileinfo = $this->current();
  41312. if (!file_exists($fileinfo->getPathname())) {
  41313. return false;
  41314. }
  41315. $filedate = $fileinfo->getMTime();
  41316. foreach ($this->comparators as $compare) {
  41317. if (!$compare->test($filedate)) {
  41318. return false;
  41319. }
  41320. }
  41321. return true;
  41322. }
  41323. }
  41324. <?php
  41325. namespace Symfony\Component\Finder\Iterator;
  41326. class DepthRangeFilterIterator extends FilterIterator
  41327. {
  41328. private $minDepth = 0;
  41329. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  41330. {
  41331. $this->minDepth = $minDepth;
  41332. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  41333. parent::__construct($iterator);
  41334. }
  41335. public function accept()
  41336. {
  41337. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  41338. }
  41339. }
  41340. <?php
  41341. namespace Symfony\Component\Finder\Iterator;
  41342. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  41343. {
  41344. private $iterator;
  41345. private $isRecursive;
  41346. private $excludedDirs = array();
  41347. private $excludedPattern;
  41348. public function __construct(\Iterator $iterator, array $directories)
  41349. {
  41350. $this->iterator = $iterator;
  41351. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  41352. $patterns = array();
  41353. foreach ($directories as $directory) {
  41354. $directory = rtrim($directory, '/');
  41355. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  41356. $patterns[] = preg_quote($directory, '#');
  41357. } else {
  41358. $this->excludedDirs[$directory] = true;
  41359. }
  41360. }
  41361. if ($patterns) {
  41362. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  41363. }
  41364. parent::__construct($iterator);
  41365. }
  41366. public function accept()
  41367. {
  41368. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  41369. return false;
  41370. }
  41371. if ($this->excludedPattern) {
  41372. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  41373. $path = str_replace('\\', '/', $path);
  41374. return !preg_match($this->excludedPattern, $path);
  41375. }
  41376. return true;
  41377. }
  41378. public function hasChildren()
  41379. {
  41380. return $this->isRecursive && $this->iterator->hasChildren();
  41381. }
  41382. public function getChildren()
  41383. {
  41384. $children = new self($this->iterator->getChildren(), array());
  41385. $children->excludedDirs = $this->excludedDirs;
  41386. $children->excludedPattern = $this->excludedPattern;
  41387. return $children;
  41388. }
  41389. }
  41390. <?php
  41391. namespace Symfony\Component\Finder\Iterator;
  41392. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41393. use Symfony\Component\Finder\SplFileInfo;
  41394. class FilePathsIterator extends \ArrayIterator
  41395. {
  41396. private $baseDir;
  41397. private $baseDirLength;
  41398. private $subPath;
  41399. private $subPathname;
  41400. private $current;
  41401. public function __construct(array $paths, $baseDir)
  41402. {
  41403. $this->baseDir = $baseDir;
  41404. $this->baseDirLength = strlen($baseDir);
  41405. parent::__construct($paths);
  41406. }
  41407. public function __call($name, array $arguments)
  41408. {
  41409. return call_user_func_array(array($this->current(), $name), $arguments);
  41410. }
  41411. public function current()
  41412. {
  41413. return $this->current;
  41414. }
  41415. public function key()
  41416. {
  41417. return $this->current->getPathname();
  41418. }
  41419. public function next()
  41420. {
  41421. parent::next();
  41422. $this->buildProperties();
  41423. }
  41424. public function rewind()
  41425. {
  41426. parent::rewind();
  41427. $this->buildProperties();
  41428. }
  41429. public function getSubPath()
  41430. {
  41431. return $this->subPath;
  41432. }
  41433. public function getSubPathname()
  41434. {
  41435. return $this->subPathname;
  41436. }
  41437. private function buildProperties()
  41438. {
  41439. $absolutePath = parent::current();
  41440. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  41441. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  41442. $dir = dirname($this->subPathname);
  41443. $this->subPath = '.' === $dir ? '' : $dir;
  41444. } else {
  41445. $this->subPath = $this->subPathname = '';
  41446. }
  41447. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  41448. }
  41449. }
  41450. <?php
  41451. namespace Symfony\Component\Finder\Iterator;
  41452. class FileTypeFilterIterator extends FilterIterator
  41453. {
  41454. const ONLY_FILES = 1;
  41455. const ONLY_DIRECTORIES = 2;
  41456. private $mode;
  41457. public function __construct(\Iterator $iterator, $mode)
  41458. {
  41459. $this->mode = $mode;
  41460. parent::__construct($iterator);
  41461. }
  41462. public function accept()
  41463. {
  41464. $fileinfo = $this->current();
  41465. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  41466. return false;
  41467. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  41468. return false;
  41469. }
  41470. return true;
  41471. }
  41472. }
  41473. <?php
  41474. namespace Symfony\Component\Finder\Iterator;
  41475. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  41476. {
  41477. public function accept()
  41478. {
  41479. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  41480. return true;
  41481. }
  41482. $fileinfo = $this->current();
  41483. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  41484. return false;
  41485. }
  41486. $content = $fileinfo->getContents();
  41487. if (!$content) {
  41488. return false;
  41489. }
  41490. return $this->isAccepted($content);
  41491. }
  41492. protected function toRegex($str)
  41493. {
  41494. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  41495. }
  41496. }
  41497. <?php
  41498. namespace Symfony\Component\Finder\Iterator;
  41499. use Symfony\Component\Finder\Glob;
  41500. class FilenameFilterIterator extends MultiplePcreFilterIterator
  41501. {
  41502. public function accept()
  41503. {
  41504. return $this->isAccepted($this->current()->getFilename());
  41505. }
  41506. protected function toRegex($str)
  41507. {
  41508. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  41509. }
  41510. }
  41511. <?php
  41512. namespace Symfony\Component\Finder\Iterator;
  41513. abstract class FilterIterator extends \FilterIterator
  41514. {
  41515. public function rewind()
  41516. {
  41517. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  41518. parent::rewind();
  41519. return;
  41520. }
  41521. $iterator = $this;
  41522. while ($iterator instanceof \OuterIterator) {
  41523. $innerIterator = $iterator->getInnerIterator();
  41524. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  41525. if ($innerIterator->isRewindable()) {
  41526. $innerIterator->next();
  41527. $innerIterator->rewind();
  41528. }
  41529. } elseif ($innerIterator instanceof \FilesystemIterator) {
  41530. $innerIterator->next();
  41531. $innerIterator->rewind();
  41532. }
  41533. $iterator = $innerIterator;
  41534. }
  41535. parent::rewind();
  41536. }
  41537. }
  41538. <?php
  41539. namespace Symfony\Component\Finder\Iterator;
  41540. abstract class MultiplePcreFilterIterator extends FilterIterator
  41541. {
  41542. protected $matchRegexps = array();
  41543. protected $noMatchRegexps = array();
  41544. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  41545. {
  41546. foreach ($matchPatterns as $pattern) {
  41547. $this->matchRegexps[] = $this->toRegex($pattern);
  41548. }
  41549. foreach ($noMatchPatterns as $pattern) {
  41550. $this->noMatchRegexps[] = $this->toRegex($pattern);
  41551. }
  41552. parent::__construct($iterator);
  41553. }
  41554. protected function isAccepted($string)
  41555. {
  41556. foreach ($this->noMatchRegexps as $regex) {
  41557. if (preg_match($regex, $string)) {
  41558. return false;
  41559. }
  41560. }
  41561. if ($this->matchRegexps) {
  41562. foreach ($this->matchRegexps as $regex) {
  41563. if (preg_match($regex, $string)) {
  41564. return true;
  41565. }
  41566. }
  41567. return false;
  41568. }
  41569. return true;
  41570. }
  41571. protected function isRegex($str)
  41572. {
  41573. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  41574. $start = substr($m[1], 0, 1);
  41575. $end = substr($m[1], -1);
  41576. if ($start === $end) {
  41577. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  41578. }
  41579. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  41580. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  41581. return true;
  41582. }
  41583. }
  41584. }
  41585. return false;
  41586. }
  41587. abstract protected function toRegex($str);
  41588. }
  41589. <?php
  41590. namespace Symfony\Component\Finder\Iterator;
  41591. class PathFilterIterator extends MultiplePcreFilterIterator
  41592. {
  41593. public function accept()
  41594. {
  41595. $filename = $this->current()->getRelativePathname();
  41596. if ('\\' === DIRECTORY_SEPARATOR) {
  41597. $filename = str_replace('\\', '/', $filename);
  41598. }
  41599. return $this->isAccepted($filename);
  41600. }
  41601. protected function toRegex($str)
  41602. {
  41603. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  41604. }
  41605. }
  41606. <?php
  41607. namespace Symfony\Component\Finder\Iterator;
  41608. use Symfony\Component\Finder\Exception\AccessDeniedException;
  41609. use Symfony\Component\Finder\SplFileInfo;
  41610. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  41611. {
  41612. private $ignoreUnreadableDirs;
  41613. private $rewindable;
  41614. private $rootPath;
  41615. private $subPath;
  41616. private $directorySeparator = '/';
  41617. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  41618. {
  41619. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  41620. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  41621. }
  41622. parent::__construct($path, $flags);
  41623. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  41624. $this->rootPath = (string) $path;
  41625. if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  41626. $this->directorySeparator = DIRECTORY_SEPARATOR;
  41627. }
  41628. }
  41629. public function current()
  41630. {
  41631. if (null === $subPathname = $this->subPath) {
  41632. $subPathname = $this->subPath = (string) $this->getSubPath();
  41633. }
  41634. if ('' !== $subPathname) {
  41635. $subPathname .= $this->directorySeparator;
  41636. }
  41637. $subPathname .= $this->getFilename();
  41638. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  41639. }
  41640. public function getChildren()
  41641. {
  41642. try {
  41643. $children = parent::getChildren();
  41644. if ($children instanceof self) {
  41645. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  41646. $children->rewindable = &$this->rewindable;
  41647. $children->rootPath = $this->rootPath;
  41648. }
  41649. return $children;
  41650. } catch (\UnexpectedValueException $e) {
  41651. if ($this->ignoreUnreadableDirs) {
  41652. return new \RecursiveArrayIterator(array());
  41653. } else {
  41654. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  41655. }
  41656. }
  41657. }
  41658. public function rewind()
  41659. {
  41660. if (false === $this->isRewindable()) {
  41661. return;
  41662. }
  41663. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  41664. parent::next();
  41665. }
  41666. parent::rewind();
  41667. }
  41668. public function isRewindable()
  41669. {
  41670. if (null !== $this->rewindable) {
  41671. return $this->rewindable;
  41672. }
  41673. if ('' === $this->getPath()) {
  41674. return $this->rewindable = false;
  41675. }
  41676. if (false !== $stream = @opendir($this->getPath())) {
  41677. $infos = stream_get_meta_data($stream);
  41678. closedir($stream);
  41679. if ($infos['seekable']) {
  41680. return $this->rewindable = true;
  41681. }
  41682. }
  41683. return $this->rewindable = false;
  41684. }
  41685. }
  41686. <?php
  41687. namespace Symfony\Component\Finder\Iterator;
  41688. use Symfony\Component\Finder\Comparator\NumberComparator;
  41689. class SizeRangeFilterIterator extends FilterIterator
  41690. {
  41691. private $comparators = array();
  41692. public function __construct(\Iterator $iterator, array $comparators)
  41693. {
  41694. $this->comparators = $comparators;
  41695. parent::__construct($iterator);
  41696. }
  41697. public function accept()
  41698. {
  41699. $fileinfo = $this->current();
  41700. if (!$fileinfo->isFile()) {
  41701. return true;
  41702. }
  41703. $filesize = $fileinfo->getSize();
  41704. foreach ($this->comparators as $compare) {
  41705. if (!$compare->test($filesize)) {
  41706. return false;
  41707. }
  41708. }
  41709. return true;
  41710. }
  41711. }
  41712. <?php
  41713. namespace Symfony\Component\Finder\Iterator;
  41714. class SortableIterator implements \IteratorAggregate
  41715. {
  41716. const SORT_BY_NAME = 1;
  41717. const SORT_BY_TYPE = 2;
  41718. const SORT_BY_ACCESSED_TIME = 3;
  41719. const SORT_BY_CHANGED_TIME = 4;
  41720. const SORT_BY_MODIFIED_TIME = 5;
  41721. private $iterator;
  41722. private $sort;
  41723. public function __construct(\Traversable $iterator, $sort)
  41724. {
  41725. $this->iterator = $iterator;
  41726. if (self::SORT_BY_NAME === $sort) {
  41727. $this->sort = function ($a, $b) {
  41728. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  41729. };
  41730. } elseif (self::SORT_BY_TYPE === $sort) {
  41731. $this->sort = function ($a, $b) {
  41732. if ($a->isDir() && $b->isFile()) {
  41733. return -1;
  41734. } elseif ($a->isFile() && $b->isDir()) {
  41735. return 1;
  41736. }
  41737. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  41738. };
  41739. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  41740. $this->sort = function ($a, $b) {
  41741. return $a->getATime() - $b->getATime();
  41742. };
  41743. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  41744. $this->sort = function ($a, $b) {
  41745. return $a->getCTime() - $b->getCTime();
  41746. };
  41747. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  41748. $this->sort = function ($a, $b) {
  41749. return $a->getMTime() - $b->getMTime();
  41750. };
  41751. } elseif (is_callable($sort)) {
  41752. $this->sort = $sort;
  41753. } else {
  41754. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  41755. }
  41756. }
  41757. public function getIterator()
  41758. {
  41759. $array = iterator_to_array($this->iterator, true);
  41760. uasort($array, $this->sort);
  41761. return new \ArrayIterator($array);
  41762. }
  41763. }
  41764. Copyright (c) 2004-2018 Fabien Potencier
  41765. Permission is hereby granted, free of charge, to any person obtaining a copy
  41766. of this software and associated documentation files (the "Software"), to deal
  41767. in the Software without restriction, including without limitation the rights
  41768. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41769. copies of the Software, and to permit persons to whom the Software is furnished
  41770. to do so, subject to the following conditions:
  41771. The above copyright notice and this permission notice shall be included in all
  41772. copies or substantial portions of the Software.
  41773. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41774. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41775. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41776. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41777. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41778. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41779. THE SOFTWARE.
  41780. <?php
  41781. namespace Symfony\Component\Finder\Shell;
  41782. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41783. class Command
  41784. {
  41785. private $parent;
  41786. private $bits = array();
  41787. private $labels = array();
  41788. private $errorHandler;
  41789. public function __construct(Command $parent = null)
  41790. {
  41791. $this->parent = $parent;
  41792. }
  41793. public function __toString()
  41794. {
  41795. return $this->join();
  41796. }
  41797. public static function create(Command $parent = null)
  41798. {
  41799. return new self($parent);
  41800. }
  41801. public static function escape($input)
  41802. {
  41803. return escapeshellcmd($input);
  41804. }
  41805. public static function quote($input)
  41806. {
  41807. return escapeshellarg($input);
  41808. }
  41809. public function add($bit)
  41810. {
  41811. $this->bits[] = $bit;
  41812. return $this;
  41813. }
  41814. public function top($bit)
  41815. {
  41816. array_unshift($this->bits, $bit);
  41817. foreach ($this->labels as $label => $index) {
  41818. ++$this->labels[$label];
  41819. }
  41820. return $this;
  41821. }
  41822. public function arg($arg)
  41823. {
  41824. $this->bits[] = self::quote($arg);
  41825. return $this;
  41826. }
  41827. public function cmd($esc)
  41828. {
  41829. $this->bits[] = self::escape($esc);
  41830. return $this;
  41831. }
  41832. public function ins($label)
  41833. {
  41834. if (isset($this->labels[$label])) {
  41835. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  41836. }
  41837. $this->bits[] = self::create($this);
  41838. $this->labels[$label] = count($this->bits) - 1;
  41839. return $this->bits[$this->labels[$label]];
  41840. }
  41841. public function get($label)
  41842. {
  41843. if (!isset($this->labels[$label])) {
  41844. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  41845. }
  41846. return $this->bits[$this->labels[$label]];
  41847. }
  41848. public function end()
  41849. {
  41850. if (null === $this->parent) {
  41851. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  41852. }
  41853. return $this->parent;
  41854. }
  41855. public function length()
  41856. {
  41857. return count($this->bits);
  41858. }
  41859. public function setErrorHandler(\Closure $errorHandler)
  41860. {
  41861. $this->errorHandler = $errorHandler;
  41862. return $this;
  41863. }
  41864. public function getErrorHandler()
  41865. {
  41866. return $this->errorHandler;
  41867. }
  41868. public function execute()
  41869. {
  41870. if (null === $errorHandler = $this->errorHandler) {
  41871. exec($this->join(), $output);
  41872. } else {
  41873. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  41874. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  41875. if ($error = stream_get_contents($pipes[2])) {
  41876. $errorHandler($error);
  41877. }
  41878. proc_close($process);
  41879. }
  41880. return $output ?: array();
  41881. }
  41882. public function join()
  41883. {
  41884. return implode(' ', array_filter(
  41885. array_map(function ($bit) {
  41886. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  41887. }, $this->bits),
  41888. function ($bit) { return null !== $bit; }
  41889. ));
  41890. }
  41891. public function addAtIndex($bit, $index)
  41892. {
  41893. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  41894. return $this;
  41895. }
  41896. }
  41897. <?php
  41898. namespace Symfony\Component\Finder\Shell;
  41899. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41900. class Shell
  41901. {
  41902. const TYPE_UNIX = 1;
  41903. const TYPE_DARWIN = 2;
  41904. const TYPE_CYGWIN = 3;
  41905. const TYPE_WINDOWS = 4;
  41906. const TYPE_BSD = 5;
  41907. private $type;
  41908. public function getType()
  41909. {
  41910. if (null === $this->type) {
  41911. $this->type = $this->guessType();
  41912. }
  41913. return $this->type;
  41914. }
  41915. public function testCommand($command)
  41916. {
  41917. if (!function_exists('exec')) {
  41918. return false;
  41919. }
  41920. $testCommand = 'which ';
  41921. if (self::TYPE_WINDOWS === $this->type) {
  41922. $testCommand = 'where ';
  41923. }
  41924. $command = escapeshellcmd($command);
  41925. exec($testCommand.$command, $output, $code);
  41926. return 0 === $code && count($output) > 0;
  41927. }
  41928. private function guessType()
  41929. {
  41930. $os = strtolower(PHP_OS);
  41931. if (false !== strpos($os, 'cygwin')) {
  41932. return self::TYPE_CYGWIN;
  41933. }
  41934. if (false !== strpos($os, 'darwin')) {
  41935. return self::TYPE_DARWIN;
  41936. }
  41937. if (false !== strpos($os, 'bsd')) {
  41938. return self::TYPE_BSD;
  41939. }
  41940. if (0 === strpos($os, 'win')) {
  41941. return self::TYPE_WINDOWS;
  41942. }
  41943. return self::TYPE_UNIX;
  41944. }
  41945. }
  41946. <?php
  41947. namespace Symfony\Component\Finder;
  41948. class SplFileInfo extends \SplFileInfo
  41949. {
  41950. private $relativePath;
  41951. private $relativePathname;
  41952. public function __construct($file, $relativePath, $relativePathname)
  41953. {
  41954. parent::__construct($file);
  41955. $this->relativePath = $relativePath;
  41956. $this->relativePathname = $relativePathname;
  41957. }
  41958. public function getRelativePath()
  41959. {
  41960. return $this->relativePath;
  41961. }
  41962. public function getRelativePathname()
  41963. {
  41964. return $this->relativePathname;
  41965. }
  41966. public function getContents()
  41967. {
  41968. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  41969. $content = file_get_contents($this->getPathname());
  41970. restore_error_handler();
  41971. if (false === $content) {
  41972. throw new \RuntimeException($error);
  41973. }
  41974. return $content;
  41975. }
  41976. }
  41977. <?php
  41978. namespace Symfony\Polyfill\Ctype;
  41979. final class Ctype
  41980. {
  41981. public static function ctype_alnum($text)
  41982. {
  41983. $text = self::convert_int_to_char_for_ctype($text);
  41984. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  41985. }
  41986. public static function ctype_alpha($text)
  41987. {
  41988. $text = self::convert_int_to_char_for_ctype($text);
  41989. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  41990. }
  41991. public static function ctype_cntrl($text)
  41992. {
  41993. $text = self::convert_int_to_char_for_ctype($text);
  41994. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  41995. }
  41996. public static function ctype_digit($text)
  41997. {
  41998. $text = self::convert_int_to_char_for_ctype($text);
  41999. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  42000. }
  42001. public static function ctype_graph($text)
  42002. {
  42003. $text = self::convert_int_to_char_for_ctype($text);
  42004. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  42005. }
  42006. public static function ctype_lower($text)
  42007. {
  42008. $text = self::convert_int_to_char_for_ctype($text);
  42009. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  42010. }
  42011. public static function ctype_print($text)
  42012. {
  42013. $text = self::convert_int_to_char_for_ctype($text);
  42014. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  42015. }
  42016. public static function ctype_punct($text)
  42017. {
  42018. $text = self::convert_int_to_char_for_ctype($text);
  42019. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  42020. }
  42021. public static function ctype_space($text)
  42022. {
  42023. $text = self::convert_int_to_char_for_ctype($text);
  42024. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  42025. }
  42026. public static function ctype_upper($text)
  42027. {
  42028. $text = self::convert_int_to_char_for_ctype($text);
  42029. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  42030. }
  42031. public static function ctype_xdigit($text)
  42032. {
  42033. $text = self::convert_int_to_char_for_ctype($text);
  42034. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  42035. }
  42036. private static function convert_int_to_char_for_ctype($int)
  42037. {
  42038. if (!\is_int($int)) {
  42039. return $int;
  42040. }
  42041. if ($int < -128 || $int > 255) {
  42042. return (string) $int;
  42043. }
  42044. if ($int < 0) {
  42045. $int += 256;
  42046. }
  42047. return \chr($int);
  42048. }
  42049. }
  42050. Copyright (c) 2018 Fabien Potencier
  42051. Permission is hereby granted, free of charge, to any person obtaining a copy
  42052. of this software and associated documentation files (the "Software"), to deal
  42053. in the Software without restriction, including without limitation the rights
  42054. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42055. copies of the Software, and to permit persons to whom the Software is furnished
  42056. to do so, subject to the following conditions:
  42057. The above copyright notice and this permission notice shall be included in all
  42058. copies or substantial portions of the Software.
  42059. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42060. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42061. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42062. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42063. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42064. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42065. THE SOFTWARE.
  42066. <?php
  42067. use Symfony\Polyfill\Ctype as p;
  42068. if (!function_exists('ctype_alnum')) {
  42069. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  42070. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  42071. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  42072. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  42073. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  42074. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  42075. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  42076. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  42077. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  42078. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  42079. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  42080. }
  42081. Copyright (c) 2015-2018 Fabien Potencier
  42082. Permission is hereby granted, free of charge, to any person obtaining a copy
  42083. of this software and associated documentation files (the "Software"), to deal
  42084. in the Software without restriction, including without limitation the rights
  42085. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42086. copies of the Software, and to permit persons to whom the Software is furnished
  42087. to do so, subject to the following conditions:
  42088. The above copyright notice and this permission notice shall be included in all
  42089. copies or substantial portions of the Software.
  42090. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42091. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42092. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42093. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42094. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42095. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42096. THE SOFTWARE.
  42097. <?php
  42098. namespace Symfony\Polyfill\Mbstring;
  42099. final class Mbstring
  42100. {
  42101. const MB_CASE_FOLD = PHP_INT_MAX;
  42102. private static $encodingList = array('ASCII', 'UTF-8');
  42103. private static $language = 'neutral';
  42104. private static $internalEncoding = 'UTF-8';
  42105. private static $caseFold = array(
  42106. array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"),
  42107. array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1",'ι'),
  42108. );
  42109. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  42110. {
  42111. if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  42112. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  42113. } else {
  42114. $fromEncoding = self::getEncoding($fromEncoding);
  42115. }
  42116. $toEncoding = self::getEncoding($toEncoding);
  42117. if ('BASE64' === $fromEncoding) {
  42118. $s = base64_decode($s);
  42119. $fromEncoding = $toEncoding;
  42120. }
  42121. if ('BASE64' === $toEncoding) {
  42122. return base64_encode($s);
  42123. }
  42124. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  42125. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  42126. $fromEncoding = 'Windows-1252';
  42127. }
  42128. if ('UTF-8' !== $fromEncoding) {
  42129. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  42130. }
  42131. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  42132. }
  42133. if ('HTML-ENTITIES' === $fromEncoding) {
  42134. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  42135. $fromEncoding = 'UTF-8';
  42136. }
  42137. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  42138. }
  42139. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  42140. {
  42141. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  42142. $ok = true;
  42143. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  42144. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  42145. $ok = false;
  42146. }
  42147. });
  42148. return $ok ? $fromEncoding : false;
  42149. }
  42150. public static function mb_decode_mimeheader($s)
  42151. {
  42152. return iconv_mime_decode($s, 2, self::$internalEncoding);
  42153. }
  42154. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  42155. {
  42156. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  42157. }
  42158. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  42159. {
  42160. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  42161. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING);
  42162. return null;
  42163. }
  42164. if (!\is_array($convmap) || !$convmap) {
  42165. return false;
  42166. }
  42167. if (null !== $encoding && !\is_scalar($encoding)) {
  42168. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING);
  42169. return '';
  42170. }
  42171. $s = (string) $s;
  42172. if ('' === $s) {
  42173. return '';
  42174. }
  42175. $encoding = self::getEncoding($encoding);
  42176. if ('UTF-8' === $encoding) {
  42177. $encoding = null;
  42178. if (!preg_match('//u', $s)) {
  42179. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  42180. }
  42181. } else {
  42182. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42183. }
  42184. $cnt = floor(\count($convmap) / 4) * 4;
  42185. for ($i = 0; $i < $cnt; $i += 4) {
  42186. $convmap[$i] += $convmap[$i + 2];
  42187. $convmap[$i + 1] += $convmap[$i + 2];
  42188. }
  42189. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  42190. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  42191. for ($i = 0; $i < $cnt; $i += 4) {
  42192. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  42193. return Mbstring::mb_chr($c - $convmap[$i + 2]);
  42194. }
  42195. }
  42196. return $m[0];
  42197. }, $s);
  42198. if (null === $encoding) {
  42199. return $s;
  42200. }
  42201. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  42202. }
  42203. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  42204. {
  42205. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  42206. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING);
  42207. return null;
  42208. }
  42209. if (!\is_array($convmap) || !$convmap) {
  42210. return false;
  42211. }
  42212. if (null !== $encoding && !\is_scalar($encoding)) {
  42213. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING);
  42214. return null;
  42215. }
  42216. if (null !== $is_hex && !\is_scalar($is_hex)) {
  42217. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.gettype($s).' given', E_USER_WARNING);
  42218. return null;
  42219. }
  42220. $s = (string) $s;
  42221. if ('' === $s) {
  42222. return '';
  42223. }
  42224. $encoding = self::getEncoding($encoding);
  42225. if ('UTF-8' === $encoding) {
  42226. $encoding = null;
  42227. if (!preg_match('//u', $s)) {
  42228. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  42229. }
  42230. } else {
  42231. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42232. }
  42233. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  42234. $cnt = floor(\count($convmap) / 4) * 4;
  42235. $i = 0;
  42236. $len = \strlen($s);
  42237. $result = '';
  42238. while ($i < $len) {
  42239. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  42240. $uchr = substr($s, $i, $ulen);
  42241. $i += $ulen;
  42242. $c = self::mb_ord($uchr);
  42243. for ($j = 0; $j < $cnt; $j += 4) {
  42244. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  42245. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  42246. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  42247. continue 2;
  42248. }
  42249. }
  42250. $result .= $uchr;
  42251. }
  42252. if (null === $encoding) {
  42253. return $result;
  42254. }
  42255. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  42256. }
  42257. public static function mb_convert_case($s, $mode, $encoding = null)
  42258. {
  42259. $s = (string) $s;
  42260. if ('' === $s) {
  42261. return '';
  42262. }
  42263. $encoding = self::getEncoding($encoding);
  42264. if ('UTF-8' === $encoding) {
  42265. $encoding = null;
  42266. if (!preg_match('//u', $s)) {
  42267. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  42268. }
  42269. } else {
  42270. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42271. }
  42272. if (MB_CASE_TITLE == $mode) {
  42273. $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s);
  42274. $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);
  42275. } else {
  42276. if (MB_CASE_UPPER == $mode) {
  42277. static $upper = null;
  42278. if (null === $upper) {
  42279. $upper = self::getData('upperCase');
  42280. }
  42281. $map = $upper;
  42282. } else {
  42283. if (self::MB_CASE_FOLD === $mode) {
  42284. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  42285. }
  42286. static $lower = null;
  42287. if (null === $lower) {
  42288. $lower = self::getData('lowerCase');
  42289. }
  42290. $map = $lower;
  42291. }
  42292. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  42293. $i = 0;
  42294. $len = \strlen($s);
  42295. while ($i < $len) {
  42296. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  42297. $uchr = substr($s, $i, $ulen);
  42298. $i += $ulen;
  42299. if (isset($map[$uchr])) {
  42300. $uchr = $map[$uchr];
  42301. $nlen = \strlen($uchr);
  42302. if ($nlen == $ulen) {
  42303. $nlen = $i;
  42304. do {
  42305. $s[--$nlen] = $uchr[--$ulen];
  42306. } while ($ulen);
  42307. } else {
  42308. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  42309. $len += $nlen - $ulen;
  42310. $i += $nlen - $ulen;
  42311. }
  42312. }
  42313. }
  42314. }
  42315. if (null === $encoding) {
  42316. return $s;
  42317. }
  42318. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  42319. }
  42320. public static function mb_internal_encoding($encoding = null)
  42321. {
  42322. if (null === $encoding) {
  42323. return self::$internalEncoding;
  42324. }
  42325. $encoding = self::getEncoding($encoding);
  42326. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  42327. self::$internalEncoding = $encoding;
  42328. return true;
  42329. }
  42330. return false;
  42331. }
  42332. public static function mb_language($lang = null)
  42333. {
  42334. if (null === $lang) {
  42335. return self::$language;
  42336. }
  42337. switch ($lang = strtolower($lang)) {
  42338. case 'uni':
  42339. case 'neutral':
  42340. self::$language = $lang;
  42341. return true;
  42342. }
  42343. return false;
  42344. }
  42345. public static function mb_list_encodings()
  42346. {
  42347. return array('UTF-8');
  42348. }
  42349. public static function mb_encoding_aliases($encoding)
  42350. {
  42351. switch (strtoupper($encoding)) {
  42352. case 'UTF8':
  42353. case 'UTF-8':
  42354. return array('utf8');
  42355. }
  42356. return false;
  42357. }
  42358. public static function mb_check_encoding($var = null, $encoding = null)
  42359. {
  42360. if (null === $encoding) {
  42361. if (null === $var) {
  42362. return false;
  42363. }
  42364. $encoding = self::$internalEncoding;
  42365. }
  42366. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  42367. }
  42368. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  42369. {
  42370. if (null === $encodingList) {
  42371. $encodingList = self::$encodingList;
  42372. } else {
  42373. if (!\is_array($encodingList)) {
  42374. $encodingList = array_map('trim', explode(',', $encodingList));
  42375. }
  42376. $encodingList = array_map('strtoupper', $encodingList);
  42377. }
  42378. foreach ($encodingList as $enc) {
  42379. switch ($enc) {
  42380. case 'ASCII':
  42381. if (!preg_match('/[\x80-\xFF]/', $str)) {
  42382. return $enc;
  42383. }
  42384. break;
  42385. case 'UTF8':
  42386. case 'UTF-8':
  42387. if (preg_match('//u', $str)) {
  42388. return 'UTF-8';
  42389. }
  42390. break;
  42391. default:
  42392. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  42393. return $enc;
  42394. }
  42395. }
  42396. }
  42397. return false;
  42398. }
  42399. public static function mb_detect_order($encodingList = null)
  42400. {
  42401. if (null === $encodingList) {
  42402. return self::$encodingList;
  42403. }
  42404. if (!\is_array($encodingList)) {
  42405. $encodingList = array_map('trim', explode(',', $encodingList));
  42406. }
  42407. $encodingList = array_map('strtoupper', $encodingList);
  42408. foreach ($encodingList as $enc) {
  42409. switch ($enc) {
  42410. default:
  42411. if (strncmp($enc, 'ISO-8859-', 9)) {
  42412. return false;
  42413. }
  42414. case 'ASCII':
  42415. case 'UTF8':
  42416. case 'UTF-8':
  42417. }
  42418. }
  42419. self::$encodingList = $encodingList;
  42420. return true;
  42421. }
  42422. public static function mb_strlen($s, $encoding = null)
  42423. {
  42424. $encoding = self::getEncoding($encoding);
  42425. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42426. return \strlen($s);
  42427. }
  42428. return @iconv_strlen($s, $encoding);
  42429. }
  42430. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  42431. {
  42432. $encoding = self::getEncoding($encoding);
  42433. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42434. return strpos($haystack, $needle, $offset);
  42435. }
  42436. $needle = (string) $needle;
  42437. if ('' === $needle) {
  42438. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  42439. return false;
  42440. }
  42441. return iconv_strpos($haystack, $needle, $offset, $encoding);
  42442. }
  42443. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  42444. {
  42445. $encoding = self::getEncoding($encoding);
  42446. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42447. return strrpos($haystack, $needle, $offset);
  42448. }
  42449. if ($offset != (int) $offset) {
  42450. $offset = 0;
  42451. } elseif ($offset = (int) $offset) {
  42452. if ($offset < 0) {
  42453. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  42454. $offset = 0;
  42455. } else {
  42456. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  42457. }
  42458. }
  42459. $pos = iconv_strrpos($haystack, $needle, $encoding);
  42460. return false !== $pos ? $offset + $pos : false;
  42461. }
  42462. public static function mb_strtolower($s, $encoding = null)
  42463. {
  42464. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  42465. }
  42466. public static function mb_strtoupper($s, $encoding = null)
  42467. {
  42468. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  42469. }
  42470. public static function mb_substitute_character($c = null)
  42471. {
  42472. if (0 === strcasecmp($c, 'none')) {
  42473. return true;
  42474. }
  42475. return null !== $c ? false : 'none';
  42476. }
  42477. public static function mb_substr($s, $start, $length = null, $encoding = null)
  42478. {
  42479. $encoding = self::getEncoding($encoding);
  42480. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42481. return substr($s, $start, null === $length ? 2147483647 : $length);
  42482. }
  42483. if ($start < 0) {
  42484. $start = iconv_strlen($s, $encoding) + $start;
  42485. if ($start < 0) {
  42486. $start = 0;
  42487. }
  42488. }
  42489. if (null === $length) {
  42490. $length = 2147483647;
  42491. } elseif ($length < 0) {
  42492. $length = iconv_strlen($s, $encoding) + $length - $start;
  42493. if ($length < 0) {
  42494. return '';
  42495. }
  42496. }
  42497. return (string) iconv_substr($s, $start, $length, $encoding);
  42498. }
  42499. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  42500. {
  42501. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  42502. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  42503. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  42504. }
  42505. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  42506. {
  42507. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  42508. return self::getSubpart($pos, $part, $haystack, $encoding);
  42509. }
  42510. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  42511. {
  42512. $encoding = self::getEncoding($encoding);
  42513. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  42514. return strrchr($haystack, $needle, $part);
  42515. }
  42516. $needle = self::mb_substr($needle, 0, 1, $encoding);
  42517. $pos = iconv_strrpos($haystack, $needle, $encoding);
  42518. return self::getSubpart($pos, $part, $haystack, $encoding);
  42519. }
  42520. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  42521. {
  42522. $needle = self::mb_substr($needle, 0, 1, $encoding);
  42523. $pos = self::mb_strripos($haystack, $needle, $encoding);
  42524. return self::getSubpart($pos, $part, $haystack, $encoding);
  42525. }
  42526. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  42527. {
  42528. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  42529. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  42530. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  42531. }
  42532. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  42533. {
  42534. $pos = strpos($haystack, $needle);
  42535. if (false === $pos) {
  42536. return false;
  42537. }
  42538. if ($part) {
  42539. return substr($haystack, 0, $pos);
  42540. }
  42541. return substr($haystack, $pos);
  42542. }
  42543. public static function mb_get_info($type = 'all')
  42544. {
  42545. $info = array(
  42546. 'internal_encoding' => self::$internalEncoding,
  42547. 'http_output' => 'pass',
  42548. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  42549. 'func_overload' => 0,
  42550. 'func_overload_list' => 'no overload',
  42551. 'mail_charset' => 'UTF-8',
  42552. 'mail_header_encoding' => 'BASE64',
  42553. 'mail_body_encoding' => 'BASE64',
  42554. 'illegal_chars' => 0,
  42555. 'encoding_translation' => 'Off',
  42556. 'language' => self::$language,
  42557. 'detect_order' => self::$encodingList,
  42558. 'substitute_character' => 'none',
  42559. 'strict_detection' => 'Off',
  42560. );
  42561. if ('all' === $type) {
  42562. return $info;
  42563. }
  42564. if (isset($info[$type])) {
  42565. return $info[$type];
  42566. }
  42567. return false;
  42568. }
  42569. public static function mb_http_input($type = '')
  42570. {
  42571. return false;
  42572. }
  42573. public static function mb_http_output($encoding = null)
  42574. {
  42575. return null !== $encoding ? 'pass' === $encoding : 'pass';
  42576. }
  42577. public static function mb_strwidth($s, $encoding = null)
  42578. {
  42579. $encoding = self::getEncoding($encoding);
  42580. if ('UTF-8' !== $encoding) {
  42581. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  42582. }
  42583. $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);
  42584. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  42585. }
  42586. public static function mb_substr_count($haystack, $needle, $encoding = null)
  42587. {
  42588. return substr_count($haystack, $needle);
  42589. }
  42590. public static function mb_output_handler($contents, $status)
  42591. {
  42592. return $contents;
  42593. }
  42594. public static function mb_chr($code, $encoding = null)
  42595. {
  42596. if (0x80 > $code %= 0x200000) {
  42597. $s = \chr($code);
  42598. } elseif (0x800 > $code) {
  42599. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  42600. } elseif (0x10000 > $code) {
  42601. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  42602. } else {
  42603. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  42604. }
  42605. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  42606. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  42607. }
  42608. return $s;
  42609. }
  42610. public static function mb_ord($s, $encoding = null)
  42611. {
  42612. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  42613. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  42614. }
  42615. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  42616. if (0xF0 <= $code) {
  42617. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  42618. }
  42619. if (0xE0 <= $code) {
  42620. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  42621. }
  42622. if (0xC0 <= $code) {
  42623. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  42624. }
  42625. return $code;
  42626. }
  42627. private static function getSubpart($pos, $part, $haystack, $encoding)
  42628. {
  42629. if (false === $pos) {
  42630. return false;
  42631. }
  42632. if ($part) {
  42633. return self::mb_substr($haystack, 0, $pos, $encoding);
  42634. }
  42635. return self::mb_substr($haystack, $pos, null, $encoding);
  42636. }
  42637. private static function html_encoding_callback(array $m)
  42638. {
  42639. $i = 1;
  42640. $entities = '';
  42641. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  42642. while (isset($m[$i])) {
  42643. if (0x80 > $m[$i]) {
  42644. $entities .= \chr($m[$i++]);
  42645. continue;
  42646. }
  42647. if (0xF0 <= $m[$i]) {
  42648. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  42649. } elseif (0xE0 <= $m[$i]) {
  42650. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  42651. } else {
  42652. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  42653. }
  42654. $entities .= '&#'.$c.';';
  42655. }
  42656. return $entities;
  42657. }
  42658. private static function title_case_lower(array $s)
  42659. {
  42660. return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8');
  42661. }
  42662. private static function title_case_upper(array $s)
  42663. {
  42664. return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8');
  42665. }
  42666. private static function getData($file)
  42667. {
  42668. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  42669. return require $file;
  42670. }
  42671. return false;
  42672. }
  42673. private static function getEncoding($encoding)
  42674. {
  42675. if (null === $encoding) {
  42676. return self::$internalEncoding;
  42677. }
  42678. $encoding = strtoupper($encoding);
  42679. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  42680. return 'CP850';
  42681. }
  42682. if ('UTF8' === $encoding) {
  42683. return 'UTF-8';
  42684. }
  42685. return $encoding;
  42686. }
  42687. }
  42688. <?php
  42689. static $data = array (
  42690. 'A' => 'a',
  42691. 'B' => 'b',
  42692. 'C' => 'c',
  42693. 'D' => 'd',
  42694. 'E' => 'e',
  42695. 'F' => 'f',
  42696. 'G' => 'g',
  42697. 'H' => 'h',
  42698. 'I' => 'i',
  42699. 'J' => 'j',
  42700. 'K' => 'k',
  42701. 'L' => 'l',
  42702. 'M' => 'm',
  42703. 'N' => 'n',
  42704. 'O' => 'o',
  42705. 'P' => 'p',
  42706. 'Q' => 'q',
  42707. 'R' => 'r',
  42708. 'S' => 's',
  42709. 'T' => 't',
  42710. 'U' => 'u',
  42711. 'V' => 'v',
  42712. 'W' => 'w',
  42713. 'X' => 'x',
  42714. 'Y' => 'y',
  42715. 'Z' => 'z',
  42716. 'À' => 'à',
  42717. '�' => 'á',
  42718. 'Â' => 'â',
  42719. 'Ã' => 'ã',
  42720. 'Ä' => 'ä',
  42721. 'Ã…' => 'Ã¥',
  42722. 'Æ' => 'æ',
  42723. 'Ç' => 'ç',
  42724. 'È' => 'è',
  42725. 'É' => 'é',
  42726. 'Ê' => 'ê',
  42727. 'Ë' => 'ë',
  42728. 'Ì' => 'ì',
  42729. '�' => 'í',
  42730. 'Î' => 'î',
  42731. '�' => 'ï',
  42732. '�' => 'ð',
  42733. 'Ñ' => 'ñ',
  42734. 'Ò' => 'ò',
  42735. 'Ó' => 'ó',
  42736. 'Ô' => 'ô',
  42737. 'Õ' => 'õ',
  42738. 'Ö' => 'ö',
  42739. 'Ø' => 'ø',
  42740. 'Ù' => 'ù',
  42741. 'Ú' => 'ú',
  42742. 'Û' => 'û',
  42743. 'Ü' => 'ü',
  42744. '�' => 'ý',
  42745. 'Þ' => 'þ',
  42746. 'Ā' => '�',
  42747. 'Ă' => 'ă',
  42748. 'Ä„' => 'Ä…',
  42749. 'Ć' => 'ć',
  42750. 'Ĉ' => 'ĉ',
  42751. 'ÄŠ' => 'Ä‹',
  42752. 'Č' => '�',
  42753. 'Ď' => '�',
  42754. '�' => 'đ',
  42755. 'Ä’' => 'Ä“',
  42756. 'Ä”' => 'Ä•',
  42757. 'Ä–' => 'Ä—',
  42758. 'Ę' => 'ę',
  42759. 'Äš' => 'Ä›',
  42760. 'Ĝ' => '�',
  42761. 'Äž' => 'ÄŸ',
  42762. 'Ä ' => 'Ä¡',
  42763. 'Ä¢' => 'Ä£',
  42764. 'Ĥ' => 'ĥ',
  42765. 'Ħ' => 'ħ',
  42766. 'Ĩ' => 'ĩ',
  42767. 'Ī' => 'ī',
  42768. 'Ĭ' => 'ĭ',
  42769. 'Į' => 'į',
  42770. 'Ä°' => 'i',
  42771. 'IJ' => 'ij',
  42772. 'Ĵ' => 'ĵ',
  42773. 'Ķ' => 'ķ',
  42774. 'Ĺ' => 'ĺ',
  42775. 'Ļ' => 'ļ',
  42776. 'Ľ' => 'ľ',
  42777. 'Ä¿' => 'Å€',
  42778. '�' => 'ł',
  42779. 'Ń' => 'ń',
  42780. 'Ņ' => 'ņ',
  42781. 'Ň' => 'ň',
  42782. 'ÅŠ' => 'Å‹',
  42783. 'Ō' => '�',
  42784. 'Ŏ' => '�',
  42785. '�' => 'ő',
  42786. 'Å’' => 'Å“',
  42787. 'Å”' => 'Å•',
  42788. 'Å–' => 'Å—',
  42789. 'Ř' => 'ř',
  42790. 'Åš' => 'Å›',
  42791. 'Ŝ' => '�',
  42792. 'Åž' => 'ÅŸ',
  42793. 'Å ' => 'Å¡',
  42794. 'Å¢' => 'Å£',
  42795. 'Ť' => 'ť',
  42796. 'Ŧ' => 'ŧ',
  42797. 'Ũ' => 'ũ',
  42798. 'Ū' => 'ū',
  42799. 'Ŭ' => 'ŭ',
  42800. 'Ů' => 'ů',
  42801. 'Ű' => 'ű',
  42802. 'Ų' => 'ų',
  42803. 'Ŵ' => 'ŵ',
  42804. 'Ŷ' => 'ŷ',
  42805. 'Ÿ' => 'ÿ',
  42806. 'Ź' => 'ź',
  42807. 'Ż' => 'ż',
  42808. 'Ž' => 'ž',
  42809. '�' => 'ɓ',
  42810. 'Ƃ' => 'ƃ',
  42811. 'Æ„' => 'Æ…',
  42812. 'Ɔ' => 'ɔ',
  42813. 'Ƈ' => 'ƈ',
  42814. 'Ɖ' => 'ɖ',
  42815. 'ÆŠ' => 'É—',
  42816. 'Ƌ' => 'ƌ',
  42817. 'Ǝ' => '�',
  42818. '�' => 'ə',
  42819. '�' => 'ɛ',
  42820. 'Æ‘' => 'Æ’',
  42821. 'Æ“' => 'É ',
  42822. 'Æ”' => 'É£',
  42823. 'Æ–' => 'É©',
  42824. 'Ɨ' => 'ɨ',
  42825. 'Ƙ' => 'ƙ',
  42826. 'Ɯ' => 'ɯ',
  42827. '�' => 'ɲ',
  42828. 'Ɵ' => 'ɵ',
  42829. 'Æ ' => 'Æ¡',
  42830. 'Æ¢' => 'Æ£',
  42831. 'Ƥ' => 'ƥ',
  42832. 'Ʀ' => 'ʀ',
  42833. 'Ƨ' => 'ƨ',
  42834. 'Ʃ' => 'ʃ',
  42835. 'Ƭ' => 'ƭ',
  42836. 'Ʈ' => 'ʈ',
  42837. 'Ư' => 'ư',
  42838. 'Ʊ' => 'ʊ',
  42839. 'Ʋ' => 'ʋ',
  42840. 'Ƴ' => 'ƴ',
  42841. 'Ƶ' => 'ƶ',
  42842. 'Æ·' => 'Ê’',
  42843. 'Ƹ' => 'ƹ',
  42844. 'Ƽ' => 'ƽ',
  42845. 'DŽ' => 'dž',
  42846. 'Dž' => 'dž',
  42847. 'LJ' => 'lj',
  42848. 'Lj' => 'lj',
  42849. 'NJ' => 'nj',
  42850. 'Nj' => 'nj',
  42851. '�' => 'ǎ',
  42852. '�' => '�',
  42853. 'Ç‘' => 'Ç’',
  42854. 'Ç“' => 'Ç”',
  42855. 'Ç•' => 'Ç–',
  42856. 'Ǘ' => 'ǘ',
  42857. 'Ç™' => 'Çš',
  42858. 'Ǜ' => 'ǜ',
  42859. 'Çž' => 'ÇŸ',
  42860. 'Ç ' => 'Ç¡',
  42861. 'Ç¢' => 'Ç£',
  42862. 'Ǥ' => 'ǥ',
  42863. 'Ǧ' => 'ǧ',
  42864. 'Ǩ' => 'ǩ',
  42865. 'Ǫ' => 'ǫ',
  42866. 'Ǭ' => 'ǭ',
  42867. 'Ǯ' => 'ǯ',
  42868. 'DZ' => 'dz',
  42869. 'Dz' => 'dz',
  42870. 'Ǵ' => 'ǵ',
  42871. 'Ƕ' => 'ƕ',
  42872. 'Ç·' => 'Æ¿',
  42873. 'Ǹ' => 'ǹ',
  42874. 'Ǻ' => 'ǻ',
  42875. 'Ǽ' => 'ǽ',
  42876. 'Ǿ' => 'ǿ',
  42877. 'Ȁ' => '�',
  42878. 'Ȃ' => 'ȃ',
  42879. 'È„' => 'È…',
  42880. 'Ȇ' => 'ȇ',
  42881. 'Ȉ' => 'ȉ',
  42882. 'ÈŠ' => 'È‹',
  42883. 'Ȍ' => '�',
  42884. 'Ȏ' => '�',
  42885. '�' => 'ȑ',
  42886. 'È’' => 'È“',
  42887. 'È”' => 'È•',
  42888. 'È–' => 'È—',
  42889. 'Ș' => 'ș',
  42890. 'Èš' => 'È›',
  42891. 'Ȝ' => '�',
  42892. 'Èž' => 'ÈŸ',
  42893. 'È ' => 'Æž',
  42894. 'È¢' => 'È£',
  42895. 'Ȥ' => 'ȥ',
  42896. 'Ȧ' => 'ȧ',
  42897. 'Ȩ' => 'ȩ',
  42898. 'Ȫ' => 'ȫ',
  42899. 'Ȭ' => 'ȭ',
  42900. 'Ȯ' => 'ȯ',
  42901. 'Ȱ' => 'ȱ',
  42902. 'Ȳ' => 'ȳ',
  42903. 'Ⱥ' => 'ⱥ',
  42904. 'Ȼ' => 'ȼ',
  42905. 'Ƚ' => 'ƚ',
  42906. 'Ⱦ' => 'ⱦ',
  42907. '�' => 'ɂ',
  42908. 'Ƀ' => 'ƀ',
  42909. 'Ʉ' => 'ʉ',
  42910. 'Ʌ' => 'ʌ',
  42911. 'Ɇ' => 'ɇ',
  42912. 'Ɉ' => 'ɉ',
  42913. 'ÉŠ' => 'É‹',
  42914. 'Ɍ' => '�',
  42915. 'Ɏ' => '�',
  42916. 'Ͱ' => 'ͱ',
  42917. 'Ͳ' => 'ͳ',
  42918. 'Ͷ' => 'ͷ',
  42919. 'Ϳ' => 'ϳ',
  42920. 'Ά' => 'ά',
  42921. 'Έ' => 'έ',
  42922. 'Ή' => 'ή',
  42923. 'Ί' => 'ί',
  42924. 'Ό' => 'ό',
  42925. 'Ύ' => '�',
  42926. '�' => 'ώ',
  42927. 'Α' => 'α',
  42928. 'Β' => 'β',
  42929. 'Γ' => 'γ',
  42930. 'Δ' => 'δ',
  42931. 'Ε' => 'ε',
  42932. 'Ζ' => 'ζ',
  42933. 'Η' => 'η',
  42934. 'Θ' => 'θ',
  42935. 'Ι' => 'ι',
  42936. 'Κ' => 'κ',
  42937. 'Λ' => 'λ',
  42938. 'Μ' => 'μ',
  42939. '�' => 'ν',
  42940. 'Ξ' => 'ξ',
  42941. 'Ο' => 'ο',
  42942. 'Π' => 'π',
  42943. 'Ρ' => '�',
  42944. 'Σ' => 'σ',
  42945. 'Τ' => 'τ',
  42946. 'Î¥' => 'Ï…',
  42947. 'Φ' => 'φ',
  42948. 'Χ' => 'χ',
  42949. 'Ψ' => 'ψ',
  42950. 'Ω' => 'ω',
  42951. 'Ϊ' => 'ϊ',
  42952. 'Ϋ' => 'ϋ',
  42953. '�' => 'ϗ',
  42954. 'Ϙ' => 'ϙ',
  42955. 'Ïš' => 'Ï›',
  42956. 'Ϝ' => '�',
  42957. 'Ïž' => 'ÏŸ',
  42958. 'Ï ' => 'Ï¡',
  42959. 'Ï¢' => 'Ï£',
  42960. 'Ϥ' => 'ϥ',
  42961. 'Ϧ' => 'ϧ',
  42962. 'Ϩ' => 'ϩ',
  42963. 'Ϫ' => 'ϫ',
  42964. 'Ϭ' => 'ϭ',
  42965. 'Ϯ' => 'ϯ',
  42966. 'ϴ' => 'θ',
  42967. 'Ϸ' => 'ϸ',
  42968. 'Ϲ' => 'ϲ',
  42969. 'Ϻ' => 'ϻ',
  42970. 'Ͻ' => 'ͻ',
  42971. 'Ͼ' => 'ͼ',
  42972. 'Ͽ' => 'ͽ',
  42973. 'Ѐ' => '�',
  42974. '�' => 'ё',
  42975. 'Ђ' => 'ђ',
  42976. 'Ѓ' => 'ѓ',
  42977. 'Є' => 'є',
  42978. 'Ð…' => 'Ñ•',
  42979. 'І' => 'і',
  42980. 'Ї' => 'ї',
  42981. 'Ј' => 'ј',
  42982. 'Љ' => 'љ',
  42983. 'Њ' => 'њ',
  42984. 'Ћ' => 'ћ',
  42985. 'Ќ' => 'ќ',
  42986. '�' => '�',
  42987. 'ÐŽ' => 'Ñž',
  42988. '�' => 'џ',
  42989. '�' => 'а',
  42990. 'Б' => 'б',
  42991. 'В' => 'в',
  42992. 'Г' => 'г',
  42993. 'Д' => 'д',
  42994. 'Е' => 'е',
  42995. 'Ж' => 'ж',
  42996. 'З' => 'з',
  42997. 'И' => 'и',
  42998. 'Й' => 'й',
  42999. 'К' => 'к',
  43000. 'Л' => 'л',
  43001. 'М' => 'м',
  43002. '�' => 'н',
  43003. 'О' => 'о',
  43004. 'П' => 'п',
  43005. 'Р' => 'р',
  43006. 'С' => '�',
  43007. 'Т' => 'т',
  43008. 'У' => 'у',
  43009. 'Ф' => 'ф',
  43010. 'Ð¥' => 'Ñ…',
  43011. 'Ц' => 'ц',
  43012. 'Ч' => 'ч',
  43013. 'Ш' => 'ш',
  43014. 'Щ' => 'щ',
  43015. 'Ъ' => 'ъ',
  43016. 'Ы' => 'ы',
  43017. 'Ь' => 'ь',
  43018. 'Э' => '�',
  43019. 'Ю' => 'ю',
  43020. 'Я' => '�',
  43021. 'Ñ ' => 'Ñ¡',
  43022. 'Ñ¢' => 'Ñ£',
  43023. 'Ѥ' => 'ѥ',
  43024. 'Ѧ' => 'ѧ',
  43025. 'Ѩ' => 'ѩ',
  43026. 'Ѫ' => 'ѫ',
  43027. 'Ѭ' => 'ѭ',
  43028. 'Ѯ' => 'ѯ',
  43029. 'Ѱ' => 'ѱ',
  43030. 'Ѳ' => 'ѳ',
  43031. 'Ѵ' => 'ѵ',
  43032. 'Ѷ' => 'ѷ',
  43033. 'Ѹ' => 'ѹ',
  43034. 'Ѻ' => 'ѻ',
  43035. 'Ѽ' => 'ѽ',
  43036. 'Ѿ' => 'ѿ',
  43037. 'Ò€' => 'Ò�',
  43038. 'ÒŠ' => 'Ò‹',
  43039. 'Ҍ' => '�',
  43040. 'ÒŽ' => 'Ò�',
  43041. 'Ò�' => 'Ò‘',
  43042. 'Ò’' => 'Ò“',
  43043. 'Ò”' => 'Ò•',
  43044. 'Ò–' => 'Ò—',
  43045. 'Ò˜' => 'Ò™',
  43046. 'Òš' => 'Ò›',
  43047. 'Ҝ' => '�',
  43048. 'Òž' => 'ÒŸ',
  43049. 'Ò ' => 'Ò¡',
  43050. 'Ò¢' => 'Ò£',
  43051. 'Ò¤' => 'Ò¥',
  43052. 'Ò¦' => 'Ò§',
  43053. 'Ò¨' => 'Ò©',
  43054. 'Òª' => 'Ò«',
  43055. 'Ò¬' => 'Ò­',
  43056. 'Ò®' => 'Ò¯',
  43057. 'Ò°' => 'Ò±',
  43058. 'Ò²' => 'Ò³',
  43059. 'Ò´' => 'Òµ',
  43060. 'Ò¶' => 'Ò·',
  43061. 'Ò¸' => 'Ò¹',
  43062. 'Òº' => 'Ò»',
  43063. 'Ò¼' => 'Ò½',
  43064. 'Ò¾' => 'Ò¿',
  43065. 'Ó€' => 'Ó�',
  43066. 'Ó�' => 'Ó‚',
  43067. 'Óƒ' => 'Ó„',
  43068. 'Ó…' => 'Ó†',
  43069. 'Ó‡' => 'Óˆ',
  43070. 'Ó‰' => 'ÓŠ',
  43071. 'Ӌ' => 'ӌ',
  43072. 'Ó�' => 'ÓŽ',
  43073. 'Ó�' => 'Ó‘',
  43074. 'Ó’' => 'Ó“',
  43075. 'Ó”' => 'Ó•',
  43076. 'Ó–' => 'Ó—',
  43077. 'Ó˜' => 'Ó™',
  43078. 'Óš' => 'Ó›',
  43079. 'Ӝ' => '�',
  43080. 'Óž' => 'ÓŸ',
  43081. 'Ó ' => 'Ó¡',
  43082. 'Ó¢' => 'Ó£',
  43083. 'Ó¤' => 'Ó¥',
  43084. 'Ó¦' => 'Ó§',
  43085. 'Ó¨' => 'Ó©',
  43086. 'Óª' => 'Ó«',
  43087. 'Ó¬' => 'Ó­',
  43088. 'Ó®' => 'Ó¯',
  43089. 'Ó°' => 'Ó±',
  43090. 'Ó²' => 'Ó³',
  43091. 'Ó´' => 'Óµ',
  43092. 'Ó¶' => 'Ó·',
  43093. 'Ó¸' => 'Ó¹',
  43094. 'Óº' => 'Ó»',
  43095. 'Ó¼' => 'Ó½',
  43096. 'Ó¾' => 'Ó¿',
  43097. 'Ô€' => 'Ô�',
  43098. 'Ô‚' => 'Ôƒ',
  43099. 'Ô„' => 'Ô…',
  43100. 'Ô†' => 'Ô‡',
  43101. 'Ôˆ' => 'Ô‰',
  43102. 'ÔŠ' => 'Ô‹',
  43103. 'Ԍ' => '�',
  43104. 'ÔŽ' => 'Ô�',
  43105. 'Ô�' => 'Ô‘',
  43106. 'Ô’' => 'Ô“',
  43107. 'Ô”' => 'Ô•',
  43108. 'Ô–' => 'Ô—',
  43109. 'Ô˜' => 'Ô™',
  43110. 'Ôš' => 'Ô›',
  43111. 'Ԝ' => '�',
  43112. 'Ôž' => 'ÔŸ',
  43113. 'Ô ' => 'Ô¡',
  43114. 'Ô¢' => 'Ô£',
  43115. 'Ô¤' => 'Ô¥',
  43116. 'Ô¦' => 'Ô§',
  43117. 'Ô¨' => 'Ô©',
  43118. 'Ôª' => 'Ô«',
  43119. 'Ô¬' => 'Ô­',
  43120. 'Ô®' => 'Ô¯',
  43121. 'Ô±' => 'Õ¡',
  43122. 'Ô²' => 'Õ¢',
  43123. 'Ô³' => 'Õ£',
  43124. 'Ô´' => 'Õ¤',
  43125. 'Ôµ' => 'Õ¥',
  43126. 'Ô¶' => 'Õ¦',
  43127. 'Ô·' => 'Õ§',
  43128. 'Ô¸' => 'Õ¨',
  43129. 'Ô¹' => 'Õ©',
  43130. 'Ôº' => 'Õª',
  43131. 'Ô»' => 'Õ«',
  43132. 'Ô¼' => 'Õ¬',
  43133. 'Ô½' => 'Õ­',
  43134. 'Ô¾' => 'Õ®',
  43135. 'Ô¿' => 'Õ¯',
  43136. 'Õ€' => 'Õ°',
  43137. 'Õ�' => 'Õ±',
  43138. 'Õ‚' => 'Õ²',
  43139. 'Õƒ' => 'Õ³',
  43140. 'Õ„' => 'Õ´',
  43141. 'Õ…' => 'Õµ',
  43142. 'Õ†' => 'Õ¶',
  43143. 'Õ‡' => 'Õ·',
  43144. 'Õˆ' => 'Õ¸',
  43145. 'Õ‰' => 'Õ¹',
  43146. 'ÕŠ' => 'Õº',
  43147. 'Õ‹' => 'Õ»',
  43148. 'Ռ' => 'ռ',
  43149. 'Õ�' => 'Õ½',
  43150. 'ÕŽ' => 'Õ¾',
  43151. 'Õ�' => 'Õ¿',
  43152. 'Õ�' => 'Ö€',
  43153. 'Õ‘' => 'Ö�',
  43154. 'Õ’' => 'Ö‚',
  43155. 'Õ“' => 'Öƒ',
  43156. 'Õ”' => 'Ö„',
  43157. 'Õ•' => 'Ö…',
  43158. 'Õ–' => 'Ö†',
  43159. 'á‚ ' => 'â´€',
  43160. 'á‚¡' => 'â´�',
  43161. 'á‚¢' => 'â´‚',
  43162. 'á‚£' => 'â´ƒ',
  43163. 'Ⴄ' => 'ⴄ',
  43164. 'á‚¥' => 'â´…',
  43165. 'Ⴆ' => 'ⴆ',
  43166. 'Ⴇ' => 'ⴇ',
  43167. 'Ⴈ' => 'ⴈ',
  43168. 'á‚©' => 'â´‰',
  43169. 'Ⴊ' => 'ⴊ',
  43170. 'á‚«' => 'â´‹',
  43171. 'Ⴌ' => 'ⴌ',
  43172. 'á‚­' => 'â´�',
  43173. 'á‚®' => 'â´Ž',
  43174. 'Ⴏ' => '�',
  43175. 'á‚°' => 'â´�',
  43176. 'Ⴑ' => 'ⴑ',
  43177. 'Ⴒ' => 'ⴒ',
  43178. 'Ⴓ' => 'ⴓ',
  43179. 'á‚´' => 'â´”',
  43180. 'Ⴕ' => 'ⴕ',
  43181. 'Ⴖ' => 'ⴖ',
  43182. 'á‚·' => 'â´—',
  43183. 'Ⴘ' => 'ⴘ',
  43184. 'Ⴙ' => 'ⴙ',
  43185. 'Ⴚ' => 'ⴚ',
  43186. 'á‚»' => 'â´›',
  43187. 'Ⴜ' => 'ⴜ',
  43188. 'Ⴝ' => '�',
  43189. 'Ⴞ' => 'ⴞ',
  43190. 'á‚¿' => 'â´Ÿ',
  43191. 'Ⴠ' => 'ⴠ',
  43192. '�' => 'ⴡ',
  43193. 'Ⴢ' => 'ⴢ',
  43194. 'Ⴣ' => 'ⴣ',
  43195. 'Ⴤ' => 'ⴤ',
  43196. 'Ⴥ' => 'ⴥ',
  43197. 'Ⴧ' => 'ⴧ',
  43198. '�' => 'ⴭ',
  43199. 'Ḁ' => '�',
  43200. 'Ḃ' => 'ḃ',
  43201. 'Ḅ' => 'ḅ',
  43202. 'Ḇ' => 'ḇ',
  43203. 'Ḉ' => 'ḉ',
  43204. 'Ḋ' => 'ḋ',
  43205. 'Ḍ' => '�',
  43206. 'Ḏ' => '�',
  43207. '�' => 'ḑ',
  43208. 'Ḓ' => 'ḓ',
  43209. 'Ḕ' => 'ḕ',
  43210. 'Ḗ' => 'ḗ',
  43211. 'Ḙ' => 'ḙ',
  43212. 'Ḛ' => 'ḛ',
  43213. 'Ḝ' => '�',
  43214. 'Ḟ' => 'ḟ',
  43215. 'Ḡ' => 'ḡ',
  43216. 'Ḣ' => 'ḣ',
  43217. 'Ḥ' => 'ḥ',
  43218. 'Ḧ' => 'ḧ',
  43219. 'Ḩ' => 'ḩ',
  43220. 'Ḫ' => 'ḫ',
  43221. 'Ḭ' => 'ḭ',
  43222. 'Ḯ' => 'ḯ',
  43223. 'Ḱ' => 'ḱ',
  43224. 'Ḳ' => 'ḳ',
  43225. 'Ḵ' => 'ḵ',
  43226. 'Ḷ' => 'ḷ',
  43227. 'Ḹ' => 'ḹ',
  43228. 'Ḻ' => 'ḻ',
  43229. 'Ḽ' => 'ḽ',
  43230. 'Ḿ' => 'ḿ',
  43231. 'Ṁ' => '�',
  43232. 'Ṃ' => 'ṃ',
  43233. 'Ṅ' => 'ṅ',
  43234. 'Ṇ' => 'ṇ',
  43235. 'Ṉ' => 'ṉ',
  43236. 'Ṋ' => 'ṋ',
  43237. 'Ṍ' => '�',
  43238. 'Ṏ' => '�',
  43239. '�' => 'ṑ',
  43240. 'Ṓ' => 'ṓ',
  43241. 'Ṕ' => 'ṕ',
  43242. 'á¹–' => 'á¹—',
  43243. 'Ṙ' => 'ṙ',
  43244. 'Ṛ' => 'ṛ',
  43245. 'Ṝ' => '�',
  43246. 'Ṟ' => 'ṟ',
  43247. 'Ṡ' => 'ṡ',
  43248. 'á¹¢' => 'á¹£',
  43249. 'Ṥ' => 'ṥ',
  43250. 'Ṧ' => 'ṧ',
  43251. 'Ṩ' => 'ṩ',
  43252. 'Ṫ' => 'ṫ',
  43253. 'Ṭ' => 'ṭ',
  43254. 'Ṯ' => 'ṯ',
  43255. 'á¹°' => 'á¹±',
  43256. 'á¹²' => 'á¹³',
  43257. 'á¹´' => 'á¹µ',
  43258. 'Ṷ' => 'ṷ',
  43259. 'Ṹ' => 'ṹ',
  43260. 'Ṻ' => 'ṻ',
  43261. 'á¹¼' => 'á¹½',
  43262. 'Ṿ' => 'ṿ',
  43263. 'Ẁ' => '�',
  43264. 'Ẃ' => 'ẃ',
  43265. 'Ẅ' => 'ẅ',
  43266. 'Ẇ' => 'ẇ',
  43267. 'Ẉ' => 'ẉ',
  43268. 'Ẋ' => 'ẋ',
  43269. 'Ẍ' => '�',
  43270. 'Ẏ' => '�',
  43271. '�' => 'ẑ',
  43272. 'Ẓ' => 'ẓ',
  43273. 'Ẕ' => 'ẕ',
  43274. 'ẞ' => 'ß',
  43275. 'Ạ' => 'ạ',
  43276. 'Ả' => 'ả',
  43277. 'Ấ' => 'ấ',
  43278. 'Ầ' => 'ầ',
  43279. 'Ẩ' => 'ẩ',
  43280. 'Ẫ' => 'ẫ',
  43281. 'Ậ' => 'ậ',
  43282. 'Ắ' => 'ắ',
  43283. 'Ằ' => 'ằ',
  43284. 'Ẳ' => 'ẳ',
  43285. 'Ẵ' => 'ẵ',
  43286. 'Ặ' => 'ặ',
  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. 'Ἤ' => 'ἤ',
  43342. 'á¼­' => 'á¼¥',
  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. 'Ὼ' => 'ὼ',
  43417. 'á¿»' => 'á½½',
  43418. 'ῼ' => 'ῳ',
  43419. 'Ω' => 'ω',
  43420. 'K' => 'k',
  43421. 'â„«' => 'Ã¥',
  43422. 'Ⅎ' => 'ⅎ',
  43423. 'â… ' => 'â…°',
  43424. 'â…¡' => 'â…±',
  43425. 'â…¢' => 'â…²',
  43426. 'â…£' => 'â…³',
  43427. 'â…¤' => 'â…´',
  43428. 'â…¥' => 'â…µ',
  43429. 'â…¦' => 'â…¶',
  43430. 'â…§' => 'â…·',
  43431. 'â…¨' => 'â…¸',
  43432. 'â…©' => 'â…¹',
  43433. 'â…ª' => 'â…º',
  43434. 'â…«' => 'â…»',
  43435. 'â…¬' => 'â…¼',
  43436. 'â…­' => 'â…½',
  43437. 'â…®' => 'â…¾',
  43438. 'â…¯' => 'â…¿',
  43439. 'Ↄ' => 'ↄ',
  43440. 'Ⓐ' => '�',
  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. 'A' => '�',
  43685. 'B' => 'b',
  43686. 'C' => 'c',
  43687. 'D' => 'd',
  43688. 'ï¼¥' => 'ï½…',
  43689. 'F' => 'f',
  43690. 'G' => 'g',
  43691. 'H' => 'h',
  43692. 'I' => 'i',
  43693. 'J' => 'j',
  43694. 'K' => 'k',
  43695. 'L' => 'l',
  43696. 'M' => '�',
  43697. 'N' => 'n',
  43698. 'O' => '�',
  43699. 'P' => '�',
  43700. 'Q' => 'q',
  43701. 'ï¼²' => 'ï½’',
  43702. 'S' => 's',
  43703. 'ï¼´' => 'ï½”',
  43704. 'U' => 'u',
  43705. 'V' => 'v',
  43706. 'ï¼·' => 'ï½—',
  43707. 'X' => 'x',
  43708. 'ï¼¹' => 'ï½™',
  43709. 'Z' => 'z',
  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. $result =& $data;
  43784. unset($data);
  43785. return $result;
  43786. <?php
  43787. static $data = array (
  43788. 'a' => 'A',
  43789. 'b' => 'B',
  43790. 'c' => 'C',
  43791. 'd' => 'D',
  43792. 'e' => 'E',
  43793. 'f' => 'F',
  43794. 'g' => 'G',
  43795. 'h' => 'H',
  43796. 'i' => 'I',
  43797. 'j' => 'J',
  43798. 'k' => 'K',
  43799. 'l' => 'L',
  43800. 'm' => 'M',
  43801. 'n' => 'N',
  43802. 'o' => 'O',
  43803. 'p' => 'P',
  43804. 'q' => 'Q',
  43805. 'r' => 'R',
  43806. 's' => 'S',
  43807. 't' => 'T',
  43808. 'u' => 'U',
  43809. 'v' => 'V',
  43810. 'w' => 'W',
  43811. 'x' => 'X',
  43812. 'y' => 'Y',
  43813. 'z' => 'Z',
  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. 'ı' => 'I',
  43871. 'ij' => 'IJ',
  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. 'Å¿' => 'S',
  43909. 'ƀ' => 'Ƀ',
  43910. 'ƃ' => 'Ƃ',
  43911. 'Æ…' => 'Æ„',
  43912. 'ƈ' => 'Ƈ',
  43913. 'ƌ' => 'Ƌ',
  43914. 'Æ’' => 'Æ‘',
  43915. 'ƕ' => 'Ƕ',
  43916. 'ƙ' => 'Ƙ',
  43917. 'ƚ' => 'Ƚ',
  43918. 'Æž' => 'È ',
  43919. 'Æ¡' => 'Æ ',
  43920. 'Æ£' => 'Æ¢',
  43921. 'ƥ' => 'Ƥ',
  43922. 'ƨ' => 'Ƨ',
  43923. 'ƭ' => 'Ƭ',
  43924. 'ư' => 'Ư',
  43925. 'ƴ' => 'Ƴ',
  43926. 'ƶ' => 'Ƶ',
  43927. 'ƹ' => 'Ƹ',
  43928. 'ƽ' => 'Ƽ',
  43929. 'Æ¿' => 'Ç·',
  43930. 'Ç…' => 'Ç„',
  43931. 'dž' => 'DŽ',
  43932. 'Lj' => 'LJ',
  43933. 'lj' => 'LJ',
  43934. 'Ç‹' => 'ÇŠ',
  43935. 'nj' => 'NJ',
  43936. 'ǎ' => '�',
  43937. '�' => '�',
  43938. 'Ç’' => 'Ç‘',
  43939. 'Ç”' => 'Ç“',
  43940. 'Ç–' => 'Ç•',
  43941. 'ǘ' => 'Ǘ',
  43942. 'Çš' => 'Ç™',
  43943. 'ǜ' => 'Ǜ',
  43944. '�' => 'Ǝ',
  43945. 'ÇŸ' => 'Çž',
  43946. 'Ç¡' => 'Ç ',
  43947. 'Ç£' => 'Ç¢',
  43948. 'ǥ' => 'Ǥ',
  43949. 'ǧ' => 'Ǧ',
  43950. 'ǩ' => 'Ǩ',
  43951. 'ǫ' => 'Ǫ',
  43952. 'ǭ' => 'Ǭ',
  43953. 'ǯ' => 'Ǯ',
  43954. 'Dz' => 'DZ',
  43955. 'dz' => 'DZ',
  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. 'ɉ' => 'Ɉ',
  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. 'Õ®' => 'Ô¾',
  44256. 'Õ¯' => 'Ô¿',
  44257. 'Õ°' => 'Õ€',
  44258. 'Õ±' => 'Õ�',
  44259. 'Õ²' => 'Õ‚',
  44260. 'Õ³' => 'Õƒ',
  44261. 'Õ´' => 'Õ„',
  44262. 'Õµ' => 'Õ…',
  44263. 'Õ¶' => 'Õ†',
  44264. 'Õ·' => 'Õ‡',
  44265. 'Õ¸' => 'Õˆ',
  44266. 'Õ¹' => 'Õ‰',
  44267. 'Õº' => 'ÕŠ',
  44268. 'Õ»' => 'Õ‹',
  44269. 'ռ' => 'Ռ',
  44270. 'Õ½' => 'Õ�',
  44271. 'Õ¾' => 'ÕŽ',
  44272. 'Õ¿' => 'Õ�',
  44273. 'Ö€' => 'Õ�',
  44274. 'Ö�' => 'Õ‘',
  44275. 'Ö‚' => 'Õ’',
  44276. 'Öƒ' => 'Õ“',
  44277. 'Ö„' => 'Õ”',
  44278. 'Ö…' => 'Õ•',
  44279. 'Ö†' => 'Õ–',
  44280. 'ᵹ' => '�',
  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. 'ẑ' => '�',
  44355. 'ẓ' => 'Ẓ',
  44356. 'ẕ' => 'Ẕ',
  44357. 'ẛ' => 'Ṡ',
  44358. 'ạ' => 'Ạ',
  44359. 'ả' => 'Ả',
  44360. 'ấ' => 'Ấ',
  44361. 'ầ' => 'Ầ',
  44362. 'ẩ' => 'Ẩ',
  44363. 'ẫ' => 'Ẫ',
  44364. 'ậ' => 'Ậ',
  44365. 'ắ' => 'Ắ',
  44366. 'ằ' => 'Ằ',
  44367. 'ẳ' => 'Ẳ',
  44368. 'ẵ' => 'Ẵ',
  44369. 'ặ' => 'Ặ',
  44370. 'ẹ' => 'Ẹ',
  44371. 'ẻ' => 'Ẻ',
  44372. 'ẽ' => 'Ẽ',
  44373. 'ế' => 'Ế',
  44374. '�' => 'Ề',
  44375. 'ể' => 'Ể',
  44376. 'ễ' => 'Ễ',
  44377. 'ệ' => 'Ệ',
  44378. 'ỉ' => 'Ỉ',
  44379. 'ị' => 'Ị',
  44380. '�' => 'Ọ',
  44381. '�' => 'Ỏ',
  44382. 'ố' => '�',
  44383. 'ồ' => 'Ồ',
  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. 'ὄ' => 'Ὄ',
  44441. 'ὅ' => '�',
  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. 'ᾒ' => 'ᾚ',
  44479. 'ᾓ' => 'ᾛ',
  44480. 'ᾔ' => 'ᾜ',
  44481. 'ᾕ' => '�',
  44482. 'ᾖ' => 'ᾞ',
  44483. 'ᾗ' => 'ᾟ',
  44484. 'ᾠ' => 'ᾨ',
  44485. 'ᾡ' => 'ᾩ',
  44486. 'ᾢ' => 'ᾪ',
  44487. 'ᾣ' => 'ᾫ',
  44488. 'ᾤ' => 'ᾬ',
  44489. 'á¾¥' => 'á¾­',
  44490. 'ᾦ' => 'ᾮ',
  44491. 'ᾧ' => 'ᾯ',
  44492. 'ᾰ' => 'Ᾰ',
  44493. 'á¾±' => 'á¾¹',
  44494. 'á¾³' => 'á¾¼',
  44495. 'ι' => 'Ι',
  44496. 'ῃ' => 'ῌ',
  44497. '�' => 'Ῐ',
  44498. 'á¿‘' => 'á¿™',
  44499. 'ῠ' => 'Ῠ',
  44500. 'á¿¡' => 'á¿©',
  44501. 'ῥ' => 'Ῥ',
  44502. 'ῳ' => 'ῼ',
  44503. 'ⅎ' => 'Ⅎ',
  44504. 'â…°' => 'â… ',
  44505. 'â…±' => 'â…¡',
  44506. 'â…²' => 'â…¢',
  44507. 'â…³' => 'â…£',
  44508. 'â…´' => 'â…¤',
  44509. 'â…µ' => 'â…¥',
  44510. 'â…¶' => 'â…¦',
  44511. 'â…·' => 'â…§',
  44512. 'â…¸' => 'â…¨',
  44513. 'â…¹' => 'â…©',
  44514. 'â…º' => 'â…ª',
  44515. 'â…»' => 'â…«',
  44516. 'â…¼' => 'â…¬',
  44517. 'â…½' => 'â…­',
  44518. 'â…¾' => 'â…®',
  44519. 'â…¿' => 'â…¯',
  44520. 'ↄ' => 'Ↄ',
  44521. '�' => 'Ⓐ',
  44522. 'â“‘' => 'â’·',
  44523. 'â“’' => 'â’¸',
  44524. 'â““' => 'â’¹',
  44525. 'â“”' => 'â’º',
  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. '�' => 'A',
  44791. 'b' => 'B',
  44792. 'c' => 'C',
  44793. 'd' => 'D',
  44794. 'ï½…' => 'ï¼¥',
  44795. 'f' => 'F',
  44796. 'g' => 'G',
  44797. 'h' => 'H',
  44798. 'i' => 'I',
  44799. 'j' => 'J',
  44800. 'k' => 'K',
  44801. 'l' => 'L',
  44802. '�' => 'M',
  44803. 'n' => 'N',
  44804. '�' => 'O',
  44805. '�' => 'P',
  44806. 'q' => 'Q',
  44807. 'ï½’' => 'ï¼²',
  44808. 's' => 'S',
  44809. 'ï½”' => 'ï¼´',
  44810. 'u' => 'U',
  44811. 'v' => 'V',
  44812. 'ï½—' => 'ï¼·',
  44813. 'x' => 'X',
  44814. 'ï½™' => 'ï¼¹',
  44815. 'z' => 'Z',
  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. $result =& $data;
  44890. unset($data);
  44891. return $result;
  44892. <?php
  44893. use Symfony\Polyfill\Mbstring as p;
  44894. if (!function_exists('mb_strlen')) {
  44895. define('MB_CASE_UPPER', 0);
  44896. define('MB_CASE_LOWER', 1);
  44897. define('MB_CASE_TITLE', 2);
  44898. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  44899. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  44900. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  44901. function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
  44902. function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
  44903. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  44904. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  44905. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  44906. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  44907. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  44908. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  44909. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  44910. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  44911. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  44912. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  44913. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  44914. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  44915. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  44916. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  44917. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  44918. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  44919. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  44920. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  44921. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  44922. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  44923. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  44924. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  44925. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  44926. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  44927. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  44928. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  44929. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  44930. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  44931. 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); }
  44932. }
  44933. if (!function_exists('mb_chr')) {
  44934. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  44935. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  44936. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  44937. }
  44938. <?php
  44939. namespace Symfony\Component\Process\Exception;
  44940. interface ExceptionInterface
  44941. {
  44942. }
  44943. <?php
  44944. namespace Symfony\Component\Process\Exception;
  44945. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  44946. {
  44947. }
  44948. <?php
  44949. namespace Symfony\Component\Process\Exception;
  44950. class LogicException extends \LogicException implements ExceptionInterface
  44951. {
  44952. }
  44953. <?php
  44954. namespace Symfony\Component\Process\Exception;
  44955. use Symfony\Component\Process\Process;
  44956. class ProcessFailedException extends RuntimeException
  44957. {
  44958. private $process;
  44959. public function __construct(Process $process)
  44960. {
  44961. if ($process->isSuccessful()) {
  44962. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  44963. }
  44964. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  44965. $process->getCommandLine(),
  44966. $process->getExitCode(),
  44967. $process->getExitCodeText(),
  44968. $process->getWorkingDirectory()
  44969. );
  44970. if (!$process->isOutputDisabled()) {
  44971. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  44972. $process->getOutput(),
  44973. $process->getErrorOutput()
  44974. );
  44975. }
  44976. parent::__construct($error);
  44977. $this->process = $process;
  44978. }
  44979. public function getProcess()
  44980. {
  44981. return $this->process;
  44982. }
  44983. }
  44984. <?php
  44985. namespace Symfony\Component\Process\Exception;
  44986. use Symfony\Component\Process\Process;
  44987. class ProcessTimedOutException extends RuntimeException
  44988. {
  44989. const TYPE_GENERAL = 1;
  44990. const TYPE_IDLE = 2;
  44991. private $process;
  44992. private $timeoutType;
  44993. public function __construct(Process $process, $timeoutType)
  44994. {
  44995. $this->process = $process;
  44996. $this->timeoutType = $timeoutType;
  44997. parent::__construct(sprintf(
  44998. 'The process "%s" exceeded the timeout of %s seconds.',
  44999. $process->getCommandLine(),
  45000. $this->getExceededTimeout()
  45001. ));
  45002. }
  45003. public function getProcess()
  45004. {
  45005. return $this->process;
  45006. }
  45007. public function isGeneralTimeout()
  45008. {
  45009. return self::TYPE_GENERAL === $this->timeoutType;
  45010. }
  45011. public function isIdleTimeout()
  45012. {
  45013. return self::TYPE_IDLE === $this->timeoutType;
  45014. }
  45015. public function getExceededTimeout()
  45016. {
  45017. switch ($this->timeoutType) {
  45018. case self::TYPE_GENERAL:
  45019. return $this->process->getTimeout();
  45020. case self::TYPE_IDLE:
  45021. return $this->process->getIdleTimeout();
  45022. default:
  45023. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  45024. }
  45025. }
  45026. }
  45027. <?php
  45028. namespace Symfony\Component\Process\Exception;
  45029. class RuntimeException extends \RuntimeException implements ExceptionInterface
  45030. {
  45031. }
  45032. <?php
  45033. namespace Symfony\Component\Process;
  45034. class ExecutableFinder
  45035. {
  45036. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  45037. public function setSuffixes(array $suffixes)
  45038. {
  45039. $this->suffixes = $suffixes;
  45040. }
  45041. public function addSuffix($suffix)
  45042. {
  45043. $this->suffixes[] = $suffix;
  45044. }
  45045. public function find($name, $default = null, array $extraDirs = array())
  45046. {
  45047. if (ini_get('open_basedir')) {
  45048. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  45049. $dirs = array();
  45050. foreach ($searchPath as $path) {
  45051. if (@is_dir($path)) {
  45052. $dirs[] = $path;
  45053. } else {
  45054. if (basename($path) == $name && @is_executable($path)) {
  45055. return $path;
  45056. }
  45057. }
  45058. }
  45059. } else {
  45060. $dirs = array_merge(
  45061. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  45062. $extraDirs
  45063. );
  45064. }
  45065. $suffixes = array('');
  45066. if ('\\' === DIRECTORY_SEPARATOR) {
  45067. $pathExt = getenv('PATHEXT');
  45068. $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  45069. }
  45070. foreach ($suffixes as $suffix) {
  45071. foreach ($dirs as $dir) {
  45072. if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || @is_executable($file))) {
  45073. return $file;
  45074. }
  45075. }
  45076. }
  45077. return $default;
  45078. }
  45079. }
  45080. Copyright (c) 2004-2018 Fabien Potencier
  45081. Permission is hereby granted, free of charge, to any person obtaining a copy
  45082. of this software and associated documentation files (the "Software"), to deal
  45083. in the Software without restriction, including without limitation the rights
  45084. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  45085. copies of the Software, and to permit persons to whom the Software is furnished
  45086. to do so, subject to the following conditions:
  45087. The above copyright notice and this permission notice shall be included in all
  45088. copies or substantial portions of the Software.
  45089. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  45090. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  45091. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  45092. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  45093. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  45094. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  45095. THE SOFTWARE.
  45096. <?php
  45097. namespace Symfony\Component\Process;
  45098. class PhpExecutableFinder
  45099. {
  45100. private $executableFinder;
  45101. public function __construct()
  45102. {
  45103. $this->executableFinder = new ExecutableFinder();
  45104. }
  45105. public function find($includeArgs = true)
  45106. {
  45107. $args = $this->findArguments();
  45108. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  45109. if (defined('HHVM_VERSION')) {
  45110. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  45111. }
  45112. if (defined('PHP_BINARY') && PHP_BINARY && \in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
  45113. return PHP_BINARY.$args;
  45114. }
  45115. if ($php = getenv('PHP_PATH')) {
  45116. if (!@is_executable($php)) {
  45117. return false;
  45118. }
  45119. return $php;
  45120. }
  45121. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  45122. if (@is_executable($php)) {
  45123. return $php;
  45124. }
  45125. }
  45126. if (@is_executable($php = PHP_BINDIR.('\\' === DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  45127. return $php;
  45128. }
  45129. $dirs = array(PHP_BINDIR);
  45130. if ('\\' === DIRECTORY_SEPARATOR) {
  45131. $dirs[] = 'C:\xampp\php\\';
  45132. }
  45133. return $this->executableFinder->find('php', false, $dirs);
  45134. }
  45135. public function findArguments()
  45136. {
  45137. $arguments = array();
  45138. if (defined('HHVM_VERSION')) {
  45139. $arguments[] = '--php';
  45140. } elseif ('phpdbg' === PHP_SAPI) {
  45141. $arguments[] = '-qrr';
  45142. }
  45143. return $arguments;
  45144. }
  45145. }
  45146. <?php
  45147. namespace Symfony\Component\Process;
  45148. use Symfony\Component\Process\Exception\RuntimeException;
  45149. class PhpProcess extends Process
  45150. {
  45151. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  45152. {
  45153. $executableFinder = new PhpExecutableFinder();
  45154. if (false === $php = $executableFinder->find()) {
  45155. $php = null;
  45156. }
  45157. if ('phpdbg' === PHP_SAPI) {
  45158. $file = tempnam(sys_get_temp_dir(), 'dbg');
  45159. file_put_contents($file, $script);
  45160. register_shutdown_function('unlink', $file);
  45161. $php .= ' '.ProcessUtils::escapeArgument($file);
  45162. $script = null;
  45163. }
  45164. if ('\\' !== DIRECTORY_SEPARATOR && null !== $php) {
  45165. $php = 'exec '.$php;
  45166. }
  45167. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  45168. }
  45169. public function setPhpBinary($php)
  45170. {
  45171. $this->setCommandLine($php);
  45172. }
  45173. public function start($callback = null)
  45174. {
  45175. if (null === $this->getCommandLine()) {
  45176. throw new RuntimeException('Unable to find the PHP executable.');
  45177. }
  45178. parent::start($callback);
  45179. }
  45180. }
  45181. <?php
  45182. namespace Symfony\Component\Process\Pipes;
  45183. abstract class AbstractPipes implements PipesInterface
  45184. {
  45185. public $pipes = array();
  45186. private $inputBuffer = '';
  45187. private $input;
  45188. private $blocked = true;
  45189. private $lastError;
  45190. public function __construct($input)
  45191. {
  45192. if (is_resource($input)) {
  45193. $this->input = $input;
  45194. } elseif (is_string($input)) {
  45195. $this->inputBuffer = $input;
  45196. } else {
  45197. $this->inputBuffer = (string) $input;
  45198. }
  45199. }
  45200. public function close()
  45201. {
  45202. foreach ($this->pipes as $pipe) {
  45203. fclose($pipe);
  45204. }
  45205. $this->pipes = array();
  45206. }
  45207. protected function hasSystemCallBeenInterrupted()
  45208. {
  45209. $lastError = $this->lastError;
  45210. $this->lastError = null;
  45211. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  45212. }
  45213. protected function unblock()
  45214. {
  45215. if (!$this->blocked) {
  45216. return;
  45217. }
  45218. foreach ($this->pipes as $pipe) {
  45219. stream_set_blocking($pipe, 0);
  45220. }
  45221. if (null !== $this->input) {
  45222. stream_set_blocking($this->input, 0);
  45223. }
  45224. $this->blocked = false;
  45225. }
  45226. protected function write()
  45227. {
  45228. if (!isset($this->pipes[0])) {
  45229. return;
  45230. }
  45231. $input = $this->input;
  45232. $r = $e = array();
  45233. $w = array($this->pipes[0]);
  45234. if (false === @stream_select($r, $w, $e, 0, 0)) {
  45235. return;
  45236. }
  45237. foreach ($w as $stdin) {
  45238. if (isset($this->inputBuffer[0])) {
  45239. $written = fwrite($stdin, $this->inputBuffer);
  45240. $this->inputBuffer = substr($this->inputBuffer, $written);
  45241. if (isset($this->inputBuffer[0])) {
  45242. return array($this->pipes[0]);
  45243. }
  45244. }
  45245. if ($input) {
  45246. for (;;) {
  45247. $data = fread($input, self::CHUNK_SIZE);
  45248. if (!isset($data[0])) {
  45249. break;
  45250. }
  45251. $written = fwrite($stdin, $data);
  45252. $data = substr($data, $written);
  45253. if (isset($data[0])) {
  45254. $this->inputBuffer = $data;
  45255. return array($this->pipes[0]);
  45256. }
  45257. }
  45258. if (feof($input)) {
  45259. $this->input = null;
  45260. }
  45261. }
  45262. }
  45263. if (null === $this->input && !isset($this->inputBuffer[0])) {
  45264. fclose($this->pipes[0]);
  45265. unset($this->pipes[0]);
  45266. } elseif (!$w) {
  45267. return array($this->pipes[0]);
  45268. }
  45269. }
  45270. public function handleError($type, $msg)
  45271. {
  45272. $this->lastError = $msg;
  45273. }
  45274. }
  45275. <?php
  45276. namespace Symfony\Component\Process\Pipes;
  45277. interface PipesInterface
  45278. {
  45279. const CHUNK_SIZE = 16384;
  45280. public function getDescriptors();
  45281. public function getFiles();
  45282. public function readAndWrite($blocking, $close = false);
  45283. public function areOpen();
  45284. public function close();
  45285. }
  45286. <?php
  45287. namespace Symfony\Component\Process\Pipes;
  45288. use Symfony\Component\Process\Process;
  45289. class UnixPipes extends AbstractPipes
  45290. {
  45291. private $ttyMode;
  45292. private $ptyMode;
  45293. private $disableOutput;
  45294. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  45295. {
  45296. $this->ttyMode = (bool) $ttyMode;
  45297. $this->ptyMode = (bool) $ptyMode;
  45298. $this->disableOutput = (bool) $disableOutput;
  45299. parent::__construct($input);
  45300. }
  45301. public function __destruct()
  45302. {
  45303. $this->close();
  45304. }
  45305. public function getDescriptors()
  45306. {
  45307. if ($this->disableOutput) {
  45308. $nullstream = fopen('/dev/null', 'c');
  45309. return array(
  45310. array('pipe', 'r'),
  45311. $nullstream,
  45312. $nullstream,
  45313. );
  45314. }
  45315. if ($this->ttyMode) {
  45316. return array(
  45317. array('file', '/dev/tty', 'r'),
  45318. array('file', '/dev/tty', 'w'),
  45319. array('file', '/dev/tty', 'w'),
  45320. );
  45321. }
  45322. if ($this->ptyMode && Process::isPtySupported()) {
  45323. return array(
  45324. array('pty'),
  45325. array('pty'),
  45326. array('pty'),
  45327. );
  45328. }
  45329. return array(
  45330. array('pipe', 'r'),
  45331. array('pipe', 'w'),
  45332. array('pipe', 'w'),
  45333. );
  45334. }
  45335. public function getFiles()
  45336. {
  45337. return array();
  45338. }
  45339. public function readAndWrite($blocking, $close = false)
  45340. {
  45341. $this->unblock();
  45342. $w = $this->write();
  45343. $read = $e = array();
  45344. $r = $this->pipes;
  45345. unset($r[0]);
  45346. set_error_handler(array($this, 'handleError'));
  45347. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  45348. restore_error_handler();
  45349. if (!$this->hasSystemCallBeenInterrupted()) {
  45350. $this->pipes = array();
  45351. }
  45352. return $read;
  45353. }
  45354. restore_error_handler();
  45355. foreach ($r as $pipe) {
  45356. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  45357. do {
  45358. $data = fread($pipe, self::CHUNK_SIZE);
  45359. $read[$type] .= $data;
  45360. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  45361. if (!isset($read[$type][0])) {
  45362. unset($read[$type]);
  45363. }
  45364. if ($close && feof($pipe)) {
  45365. fclose($pipe);
  45366. unset($this->pipes[$type]);
  45367. }
  45368. }
  45369. return $read;
  45370. }
  45371. public function areOpen()
  45372. {
  45373. return (bool) $this->pipes;
  45374. }
  45375. public static function create(Process $process, $input)
  45376. {
  45377. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  45378. }
  45379. }
  45380. <?php
  45381. namespace Symfony\Component\Process\Pipes;
  45382. use Symfony\Component\Process\Process;
  45383. use Symfony\Component\Process\Exception\RuntimeException;
  45384. class WindowsPipes extends AbstractPipes
  45385. {
  45386. private $files = array();
  45387. private $fileHandles = array();
  45388. private $readBytes = array(
  45389. Process::STDOUT => 0,
  45390. Process::STDERR => 0,
  45391. );
  45392. private $disableOutput;
  45393. public function __construct($disableOutput, $input)
  45394. {
  45395. $this->disableOutput = (bool) $disableOutput;
  45396. if (!$this->disableOutput) {
  45397. $pipes = array(
  45398. Process::STDOUT => Process::OUT,
  45399. Process::STDERR => Process::ERR,
  45400. );
  45401. $tmpCheck = false;
  45402. $tmpDir = sys_get_temp_dir();
  45403. $lastError = 'unknown reason';
  45404. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  45405. for ($i = 0;; ++$i) {
  45406. foreach ($pipes as $pipe => $name) {
  45407. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  45408. if (file_exists($file) && !unlink($file)) {
  45409. continue 2;
  45410. }
  45411. $h = fopen($file, 'xb');
  45412. if (!$h) {
  45413. $error = $lastError;
  45414. if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) {
  45415. continue;
  45416. }
  45417. restore_error_handler();
  45418. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
  45419. }
  45420. if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) {
  45421. continue 2;
  45422. }
  45423. if (isset($this->files[$pipe])) {
  45424. unlink($this->files[$pipe]);
  45425. }
  45426. $this->files[$pipe] = $file;
  45427. }
  45428. break;
  45429. }
  45430. restore_error_handler();
  45431. }
  45432. parent::__construct($input);
  45433. }
  45434. public function __destruct()
  45435. {
  45436. $this->close();
  45437. $this->removeFiles();
  45438. }
  45439. public function getDescriptors()
  45440. {
  45441. if ($this->disableOutput) {
  45442. $nullstream = fopen('NUL', 'c');
  45443. return array(
  45444. array('pipe', 'r'),
  45445. $nullstream,
  45446. $nullstream,
  45447. );
  45448. }
  45449. return array(
  45450. array('pipe', 'r'),
  45451. array('file', 'NUL', 'w'),
  45452. array('file', 'NUL', 'w'),
  45453. );
  45454. }
  45455. public function getFiles()
  45456. {
  45457. return $this->files;
  45458. }
  45459. public function readAndWrite($blocking, $close = false)
  45460. {
  45461. $this->unblock();
  45462. $w = $this->write();
  45463. $read = $r = $e = array();
  45464. if ($blocking) {
  45465. if ($w) {
  45466. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  45467. } elseif ($this->fileHandles) {
  45468. usleep(Process::TIMEOUT_PRECISION * 1E6);
  45469. }
  45470. }
  45471. foreach ($this->fileHandles as $type => $fileHandle) {
  45472. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  45473. if (isset($data[0])) {
  45474. $this->readBytes[$type] += strlen($data);
  45475. $read[$type] = $data;
  45476. }
  45477. if ($close) {
  45478. fclose($fileHandle);
  45479. unset($this->fileHandles[$type]);
  45480. }
  45481. }
  45482. return $read;
  45483. }
  45484. public function areOpen()
  45485. {
  45486. return $this->pipes && $this->fileHandles;
  45487. }
  45488. public function close()
  45489. {
  45490. parent::close();
  45491. foreach ($this->fileHandles as $handle) {
  45492. fclose($handle);
  45493. }
  45494. $this->fileHandles = array();
  45495. }
  45496. public static function create(Process $process, $input)
  45497. {
  45498. return new static($process->isOutputDisabled(), $input);
  45499. }
  45500. private function removeFiles()
  45501. {
  45502. foreach ($this->files as $filename) {
  45503. if (file_exists($filename)) {
  45504. @unlink($filename);
  45505. }
  45506. }
  45507. $this->files = array();
  45508. }
  45509. }
  45510. <?php
  45511. namespace Symfony\Component\Process;
  45512. use Symfony\Component\Process\Exception\InvalidArgumentException;
  45513. use Symfony\Component\Process\Exception\LogicException;
  45514. use Symfony\Component\Process\Exception\ProcessFailedException;
  45515. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  45516. use Symfony\Component\Process\Exception\RuntimeException;
  45517. use Symfony\Component\Process\Pipes\PipesInterface;
  45518. use Symfony\Component\Process\Pipes\UnixPipes;
  45519. use Symfony\Component\Process\Pipes\WindowsPipes;
  45520. class Process
  45521. {
  45522. const ERR = 'err';
  45523. const OUT = 'out';
  45524. const STATUS_READY = 'ready';
  45525. const STATUS_STARTED = 'started';
  45526. const STATUS_TERMINATED = 'terminated';
  45527. const STDIN = 0;
  45528. const STDOUT = 1;
  45529. const STDERR = 2;
  45530. const TIMEOUT_PRECISION = 0.2;
  45531. private $callback;
  45532. private $commandline;
  45533. private $cwd;
  45534. private $env;
  45535. private $input;
  45536. private $starttime;
  45537. private $lastOutputTime;
  45538. private $timeout;
  45539. private $idleTimeout;
  45540. private $options;
  45541. private $exitcode;
  45542. private $fallbackStatus = array();
  45543. private $processInformation;
  45544. private $outputDisabled = false;
  45545. private $stdout;
  45546. private $stderr;
  45547. private $enhanceWindowsCompatibility = true;
  45548. private $enhanceSigchildCompatibility;
  45549. private $process;
  45550. private $status = self::STATUS_READY;
  45551. private $incrementalOutputOffset = 0;
  45552. private $incrementalErrorOutputOffset = 0;
  45553. private $tty;
  45554. private $pty;
  45555. private $useFileHandles = false;
  45556. private $processPipes;
  45557. private $latestSignal;
  45558. private static $sigchild;
  45559. public static $exitCodes = array(
  45560. 0 => 'OK',
  45561. 1 => 'General error',
  45562. 2 => 'Misuse of shell builtins',
  45563. 126 => 'Invoked command cannot execute',
  45564. 127 => 'Command not found',
  45565. 128 => 'Invalid exit argument',
  45566. 129 => 'Hangup',
  45567. 130 => 'Interrupt',
  45568. 131 => 'Quit and dump core',
  45569. 132 => 'Illegal instruction',
  45570. 133 => 'Trace/breakpoint trap',
  45571. 134 => 'Process aborted',
  45572. 135 => 'Bus error: "access to undefined portion of memory object"',
  45573. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  45574. 137 => 'Kill (terminate immediately)',
  45575. 138 => 'User-defined 1',
  45576. 139 => 'Segmentation violation',
  45577. 140 => 'User-defined 2',
  45578. 141 => 'Write to pipe with no one reading',
  45579. 142 => 'Signal raised by alarm',
  45580. 143 => 'Termination (request to terminate)',
  45581. 145 => 'Child process terminated, stopped (or continued*)',
  45582. 146 => 'Continue if stopped',
  45583. 147 => 'Stop executing temporarily',
  45584. 148 => 'Terminal stop signal',
  45585. 149 => 'Background process attempting to read from tty ("in")',
  45586. 150 => 'Background process attempting to write to tty ("out")',
  45587. 151 => 'Urgent data available on socket',
  45588. 152 => 'CPU time limit exceeded',
  45589. 153 => 'File size limit exceeded',
  45590. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  45591. 155 => 'Profiling timer expired',
  45592. 157 => 'Pollable event',
  45593. 159 => 'Bad syscall',
  45594. );
  45595. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  45596. {
  45597. if (!function_exists('proc_open')) {
  45598. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  45599. }
  45600. $this->commandline = $commandline;
  45601. $this->cwd = $cwd;
  45602. if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
  45603. $this->cwd = getcwd();
  45604. }
  45605. if (null !== $env) {
  45606. $this->setEnv($env);
  45607. }
  45608. $this->setInput($input);
  45609. $this->setTimeout($timeout);
  45610. $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
  45611. $this->pty = false;
  45612. $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  45613. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  45614. }
  45615. public function __destruct()
  45616. {
  45617. $this->stop(0);
  45618. }
  45619. public function __clone()
  45620. {
  45621. $this->resetProcessData();
  45622. }
  45623. public function run($callback = null)
  45624. {
  45625. $this->start($callback);
  45626. return $this->wait();
  45627. }
  45628. public function mustRun($callback = null)
  45629. {
  45630. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45631. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  45632. }
  45633. if (0 !== $this->run($callback)) {
  45634. throw new ProcessFailedException($this);
  45635. }
  45636. return $this;
  45637. }
  45638. public function start($callback = null)
  45639. {
  45640. if ($this->isRunning()) {
  45641. throw new RuntimeException('Process is already running');
  45642. }
  45643. if ($this->outputDisabled && null !== $callback) {
  45644. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  45645. }
  45646. $this->resetProcessData();
  45647. $this->starttime = $this->lastOutputTime = microtime(true);
  45648. $this->callback = $this->buildCallback($callback);
  45649. $descriptors = $this->getDescriptors();
  45650. $commandline = $this->commandline;
  45651. if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  45652. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  45653. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  45654. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  45655. }
  45656. $commandline .= '"';
  45657. if (!isset($this->options['bypass_shell'])) {
  45658. $this->options['bypass_shell'] = true;
  45659. }
  45660. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45661. $descriptors[3] = array('pipe', 'w');
  45662. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  45663. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  45664. $ptsWorkaround = fopen(__FILE__, 'r');
  45665. }
  45666. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  45667. if (!is_resource($this->process)) {
  45668. throw new RuntimeException('Unable to launch a new process.');
  45669. }
  45670. $this->status = self::STATUS_STARTED;
  45671. if (isset($descriptors[3])) {
  45672. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  45673. }
  45674. if ($this->tty) {
  45675. return;
  45676. }
  45677. $this->updateStatus(false);
  45678. $this->checkTimeout();
  45679. }
  45680. public function restart($callback = null)
  45681. {
  45682. if ($this->isRunning()) {
  45683. throw new RuntimeException('Process is already running');
  45684. }
  45685. $process = clone $this;
  45686. $process->start($callback);
  45687. return $process;
  45688. }
  45689. public function wait($callback = null)
  45690. {
  45691. $this->requireProcessIsStarted(__FUNCTION__);
  45692. $this->updateStatus(false);
  45693. if (null !== $callback) {
  45694. $this->callback = $this->buildCallback($callback);
  45695. }
  45696. do {
  45697. $this->checkTimeout();
  45698. $running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  45699. $this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
  45700. } while ($running);
  45701. while ($this->isRunning()) {
  45702. usleep(1000);
  45703. }
  45704. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  45705. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  45706. }
  45707. return $this->exitcode;
  45708. }
  45709. public function getPid()
  45710. {
  45711. return $this->isRunning() ? $this->processInformation['pid'] : null;
  45712. }
  45713. public function signal($signal)
  45714. {
  45715. $this->doSignal($signal, true);
  45716. return $this;
  45717. }
  45718. public function disableOutput()
  45719. {
  45720. if ($this->isRunning()) {
  45721. throw new RuntimeException('Disabling output while the process is running is not possible.');
  45722. }
  45723. if (null !== $this->idleTimeout) {
  45724. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  45725. }
  45726. $this->outputDisabled = true;
  45727. return $this;
  45728. }
  45729. public function enableOutput()
  45730. {
  45731. if ($this->isRunning()) {
  45732. throw new RuntimeException('Enabling output while the process is running is not possible.');
  45733. }
  45734. $this->outputDisabled = false;
  45735. return $this;
  45736. }
  45737. public function isOutputDisabled()
  45738. {
  45739. return $this->outputDisabled;
  45740. }
  45741. public function getOutput()
  45742. {
  45743. $this->readPipesForOutput(__FUNCTION__);
  45744. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  45745. return '';
  45746. }
  45747. return $ret;
  45748. }
  45749. public function getIncrementalOutput()
  45750. {
  45751. $this->readPipesForOutput(__FUNCTION__);
  45752. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  45753. $this->incrementalOutputOffset = ftell($this->stdout);
  45754. if (false === $latest) {
  45755. return '';
  45756. }
  45757. return $latest;
  45758. }
  45759. public function clearOutput()
  45760. {
  45761. ftruncate($this->stdout, 0);
  45762. fseek($this->stdout, 0);
  45763. $this->incrementalOutputOffset = 0;
  45764. return $this;
  45765. }
  45766. public function getErrorOutput()
  45767. {
  45768. $this->readPipesForOutput(__FUNCTION__);
  45769. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  45770. return '';
  45771. }
  45772. return $ret;
  45773. }
  45774. public function getIncrementalErrorOutput()
  45775. {
  45776. $this->readPipesForOutput(__FUNCTION__);
  45777. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  45778. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  45779. if (false === $latest) {
  45780. return '';
  45781. }
  45782. return $latest;
  45783. }
  45784. public function clearErrorOutput()
  45785. {
  45786. ftruncate($this->stderr, 0);
  45787. fseek($this->stderr, 0);
  45788. $this->incrementalErrorOutputOffset = 0;
  45789. return $this;
  45790. }
  45791. public function getExitCode()
  45792. {
  45793. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45794. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  45795. }
  45796. $this->updateStatus(false);
  45797. return $this->exitcode;
  45798. }
  45799. public function getExitCodeText()
  45800. {
  45801. if (null === $exitcode = $this->getExitCode()) {
  45802. return;
  45803. }
  45804. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  45805. }
  45806. public function isSuccessful()
  45807. {
  45808. return 0 === $this->getExitCode();
  45809. }
  45810. public function hasBeenSignaled()
  45811. {
  45812. $this->requireProcessIsTerminated(__FUNCTION__);
  45813. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45814. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  45815. }
  45816. return $this->processInformation['signaled'];
  45817. }
  45818. public function getTermSignal()
  45819. {
  45820. $this->requireProcessIsTerminated(__FUNCTION__);
  45821. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  45822. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  45823. }
  45824. return $this->processInformation['termsig'];
  45825. }
  45826. public function hasBeenStopped()
  45827. {
  45828. $this->requireProcessIsTerminated(__FUNCTION__);
  45829. return $this->processInformation['stopped'];
  45830. }
  45831. public function getStopSignal()
  45832. {
  45833. $this->requireProcessIsTerminated(__FUNCTION__);
  45834. return $this->processInformation['stopsig'];
  45835. }
  45836. public function isRunning()
  45837. {
  45838. if (self::STATUS_STARTED !== $this->status) {
  45839. return false;
  45840. }
  45841. $this->updateStatus(false);
  45842. return $this->processInformation['running'];
  45843. }
  45844. public function isStarted()
  45845. {
  45846. return self::STATUS_READY != $this->status;
  45847. }
  45848. public function isTerminated()
  45849. {
  45850. $this->updateStatus(false);
  45851. return self::STATUS_TERMINATED == $this->status;
  45852. }
  45853. public function getStatus()
  45854. {
  45855. $this->updateStatus(false);
  45856. return $this->status;
  45857. }
  45858. public function stop($timeout = 10, $signal = null)
  45859. {
  45860. $timeoutMicro = microtime(true) + $timeout;
  45861. if ($this->isRunning()) {
  45862. $this->doSignal(15, false);
  45863. do {
  45864. usleep(1000);
  45865. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  45866. if ($this->isRunning()) {
  45867. $this->doSignal($signal ?: 9, false);
  45868. }
  45869. }
  45870. if ($this->isRunning()) {
  45871. if (isset($this->fallbackStatus['pid'])) {
  45872. unset($this->fallbackStatus['pid']);
  45873. return $this->stop(0, $signal);
  45874. }
  45875. $this->close();
  45876. }
  45877. return $this->exitcode;
  45878. }
  45879. public function addOutput($line)
  45880. {
  45881. $this->lastOutputTime = microtime(true);
  45882. fseek($this->stdout, 0, SEEK_END);
  45883. fwrite($this->stdout, $line);
  45884. fseek($this->stdout, $this->incrementalOutputOffset);
  45885. }
  45886. public function addErrorOutput($line)
  45887. {
  45888. $this->lastOutputTime = microtime(true);
  45889. fseek($this->stderr, 0, SEEK_END);
  45890. fwrite($this->stderr, $line);
  45891. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  45892. }
  45893. public function getCommandLine()
  45894. {
  45895. return $this->commandline;
  45896. }
  45897. public function setCommandLine($commandline)
  45898. {
  45899. $this->commandline = $commandline;
  45900. return $this;
  45901. }
  45902. public function getTimeout()
  45903. {
  45904. return $this->timeout;
  45905. }
  45906. public function getIdleTimeout()
  45907. {
  45908. return $this->idleTimeout;
  45909. }
  45910. public function setTimeout($timeout)
  45911. {
  45912. $this->timeout = $this->validateTimeout($timeout);
  45913. return $this;
  45914. }
  45915. public function setIdleTimeout($timeout)
  45916. {
  45917. if (null !== $timeout && $this->outputDisabled) {
  45918. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  45919. }
  45920. $this->idleTimeout = $this->validateTimeout($timeout);
  45921. return $this;
  45922. }
  45923. public function setTty($tty)
  45924. {
  45925. if ('\\' === DIRECTORY_SEPARATOR && $tty) {
  45926. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  45927. }
  45928. if ($tty) {
  45929. static $isTtySupported;
  45930. if (null === $isTtySupported) {
  45931. $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);
  45932. }
  45933. if (!$isTtySupported) {
  45934. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  45935. }
  45936. }
  45937. $this->tty = (bool) $tty;
  45938. return $this;
  45939. }
  45940. public function isTty()
  45941. {
  45942. return $this->tty;
  45943. }
  45944. public function setPty($bool)
  45945. {
  45946. $this->pty = (bool) $bool;
  45947. return $this;
  45948. }
  45949. public function isPty()
  45950. {
  45951. return $this->pty;
  45952. }
  45953. public function getWorkingDirectory()
  45954. {
  45955. if (null === $this->cwd) {
  45956. return getcwd() ?: null;
  45957. }
  45958. return $this->cwd;
  45959. }
  45960. public function setWorkingDirectory($cwd)
  45961. {
  45962. $this->cwd = $cwd;
  45963. return $this;
  45964. }
  45965. public function getEnv()
  45966. {
  45967. return $this->env;
  45968. }
  45969. public function setEnv(array $env)
  45970. {
  45971. $env = array_filter($env, function ($value) {
  45972. return !is_array($value);
  45973. });
  45974. $this->env = array();
  45975. foreach ($env as $key => $value) {
  45976. $this->env[$key] = (string) $value;
  45977. }
  45978. return $this;
  45979. }
  45980. public function getStdin()
  45981. {
  45982. @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);
  45983. return $this->getInput();
  45984. }
  45985. public function getInput()
  45986. {
  45987. return $this->input;
  45988. }
  45989. public function setStdin($stdin)
  45990. {
  45991. @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);
  45992. return $this->setInput($stdin);
  45993. }
  45994. public function setInput($input)
  45995. {
  45996. if ($this->isRunning()) {
  45997. throw new LogicException('Input can not be set while the process is running.');
  45998. }
  45999. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  46000. return $this;
  46001. }
  46002. public function getOptions()
  46003. {
  46004. return $this->options;
  46005. }
  46006. public function setOptions(array $options)
  46007. {
  46008. $this->options = $options;
  46009. return $this;
  46010. }
  46011. public function getEnhanceWindowsCompatibility()
  46012. {
  46013. return $this->enhanceWindowsCompatibility;
  46014. }
  46015. public function setEnhanceWindowsCompatibility($enhance)
  46016. {
  46017. $this->enhanceWindowsCompatibility = (bool) $enhance;
  46018. return $this;
  46019. }
  46020. public function getEnhanceSigchildCompatibility()
  46021. {
  46022. return $this->enhanceSigchildCompatibility;
  46023. }
  46024. public function setEnhanceSigchildCompatibility($enhance)
  46025. {
  46026. $this->enhanceSigchildCompatibility = (bool) $enhance;
  46027. return $this;
  46028. }
  46029. public function checkTimeout()
  46030. {
  46031. if (self::STATUS_STARTED !== $this->status) {
  46032. return;
  46033. }
  46034. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  46035. $this->stop(0);
  46036. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  46037. }
  46038. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  46039. $this->stop(0);
  46040. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  46041. }
  46042. }
  46043. public static function isPtySupported()
  46044. {
  46045. static $result;
  46046. if (null !== $result) {
  46047. return $result;
  46048. }
  46049. if ('\\' === DIRECTORY_SEPARATOR) {
  46050. return $result = false;
  46051. }
  46052. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  46053. }
  46054. private function getDescriptors()
  46055. {
  46056. if ('\\' === DIRECTORY_SEPARATOR) {
  46057. $this->processPipes = WindowsPipes::create($this, $this->input);
  46058. } else {
  46059. $this->processPipes = UnixPipes::create($this, $this->input);
  46060. }
  46061. return $this->processPipes->getDescriptors();
  46062. }
  46063. protected function buildCallback($callback)
  46064. {
  46065. $that = $this;
  46066. $out = self::OUT;
  46067. $callback = function ($type, $data) use ($that, $callback, $out) {
  46068. if ($out == $type) {
  46069. $that->addOutput($data);
  46070. } else {
  46071. $that->addErrorOutput($data);
  46072. }
  46073. if (null !== $callback) {
  46074. call_user_func($callback, $type, $data);
  46075. }
  46076. };
  46077. return $callback;
  46078. }
  46079. protected function updateStatus($blocking)
  46080. {
  46081. if (self::STATUS_STARTED !== $this->status) {
  46082. return;
  46083. }
  46084. $this->processInformation = proc_get_status($this->process);
  46085. $running = $this->processInformation['running'];
  46086. $this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
  46087. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46088. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  46089. }
  46090. if (!$running) {
  46091. $this->close();
  46092. }
  46093. }
  46094. protected function isSigchildEnabled()
  46095. {
  46096. if (null !== self::$sigchild) {
  46097. return self::$sigchild;
  46098. }
  46099. if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
  46100. return self::$sigchild = false;
  46101. }
  46102. ob_start();
  46103. phpinfo(INFO_GENERAL);
  46104. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  46105. }
  46106. private function readPipesForOutput($caller)
  46107. {
  46108. if ($this->outputDisabled) {
  46109. throw new LogicException('Output has been disabled.');
  46110. }
  46111. $this->requireProcessIsStarted($caller);
  46112. $this->updateStatus(false);
  46113. }
  46114. private function validateTimeout($timeout)
  46115. {
  46116. $timeout = (float) $timeout;
  46117. if (0.0 === $timeout) {
  46118. $timeout = null;
  46119. } elseif ($timeout < 0) {
  46120. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  46121. }
  46122. return $timeout;
  46123. }
  46124. private function readPipes($blocking, $close)
  46125. {
  46126. $result = $this->processPipes->readAndWrite($blocking, $close);
  46127. $callback = $this->callback;
  46128. foreach ($result as $type => $data) {
  46129. if (3 !== $type) {
  46130. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  46131. } elseif (!isset($this->fallbackStatus['signaled'])) {
  46132. $this->fallbackStatus['exitcode'] = (int) $data;
  46133. }
  46134. }
  46135. }
  46136. private function close()
  46137. {
  46138. $this->processPipes->close();
  46139. if (is_resource($this->process)) {
  46140. proc_close($this->process);
  46141. }
  46142. $this->exitcode = $this->processInformation['exitcode'];
  46143. $this->status = self::STATUS_TERMINATED;
  46144. if (-1 === $this->exitcode) {
  46145. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  46146. $this->exitcode = 128 + $this->processInformation['termsig'];
  46147. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46148. $this->processInformation['signaled'] = true;
  46149. $this->processInformation['termsig'] = -1;
  46150. }
  46151. }
  46152. $this->callback = null;
  46153. return $this->exitcode;
  46154. }
  46155. private function resetProcessData()
  46156. {
  46157. $this->starttime = null;
  46158. $this->callback = null;
  46159. $this->exitcode = null;
  46160. $this->fallbackStatus = array();
  46161. $this->processInformation = null;
  46162. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  46163. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  46164. $this->process = null;
  46165. $this->latestSignal = null;
  46166. $this->status = self::STATUS_READY;
  46167. $this->incrementalOutputOffset = 0;
  46168. $this->incrementalErrorOutputOffset = 0;
  46169. }
  46170. private function doSignal($signal, $throwException)
  46171. {
  46172. if (null === $pid = $this->getPid()) {
  46173. if ($throwException) {
  46174. throw new LogicException('Can not send signal on a non running process.');
  46175. }
  46176. return false;
  46177. }
  46178. if ('\\' === DIRECTORY_SEPARATOR) {
  46179. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  46180. if ($exitCode && $this->isRunning()) {
  46181. if ($throwException) {
  46182. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  46183. }
  46184. return false;
  46185. }
  46186. } else {
  46187. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  46188. $ok = @proc_terminate($this->process, $signal);
  46189. } elseif (function_exists('posix_kill')) {
  46190. $ok = @posix_kill($pid, $signal);
  46191. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  46192. $ok = false === fgets($pipes[2]);
  46193. }
  46194. if (!$ok) {
  46195. if ($throwException) {
  46196. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  46197. }
  46198. return false;
  46199. }
  46200. }
  46201. $this->latestSignal = (int) $signal;
  46202. $this->fallbackStatus['signaled'] = true;
  46203. $this->fallbackStatus['exitcode'] = -1;
  46204. $this->fallbackStatus['termsig'] = $this->latestSignal;
  46205. return true;
  46206. }
  46207. private function requireProcessIsStarted($functionName)
  46208. {
  46209. if (!$this->isStarted()) {
  46210. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  46211. }
  46212. }
  46213. private function requireProcessIsTerminated($functionName)
  46214. {
  46215. if (!$this->isTerminated()) {
  46216. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  46217. }
  46218. }
  46219. }
  46220. <?php
  46221. namespace Symfony\Component\Process;
  46222. use Symfony\Component\Process\Exception\InvalidArgumentException;
  46223. use Symfony\Component\Process\Exception\LogicException;
  46224. class ProcessBuilder
  46225. {
  46226. private $arguments;
  46227. private $cwd;
  46228. private $env = array();
  46229. private $input;
  46230. private $timeout = 60;
  46231. private $options = array();
  46232. private $inheritEnv = true;
  46233. private $prefix = array();
  46234. private $outputDisabled = false;
  46235. public function __construct(array $arguments = array())
  46236. {
  46237. $this->arguments = $arguments;
  46238. }
  46239. public static function create(array $arguments = array())
  46240. {
  46241. return new static($arguments);
  46242. }
  46243. public function add($argument)
  46244. {
  46245. $this->arguments[] = $argument;
  46246. return $this;
  46247. }
  46248. public function setPrefix($prefix)
  46249. {
  46250. $this->prefix = is_array($prefix) ? $prefix : array($prefix);
  46251. return $this;
  46252. }
  46253. public function setArguments(array $arguments)
  46254. {
  46255. $this->arguments = $arguments;
  46256. return $this;
  46257. }
  46258. public function setWorkingDirectory($cwd)
  46259. {
  46260. $this->cwd = $cwd;
  46261. return $this;
  46262. }
  46263. public function inheritEnvironmentVariables($inheritEnv = true)
  46264. {
  46265. $this->inheritEnv = $inheritEnv;
  46266. return $this;
  46267. }
  46268. public function setEnv($name, $value)
  46269. {
  46270. $this->env[$name] = $value;
  46271. return $this;
  46272. }
  46273. public function addEnvironmentVariables(array $variables)
  46274. {
  46275. $this->env = array_replace($this->env, $variables);
  46276. return $this;
  46277. }
  46278. public function setInput($input)
  46279. {
  46280. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  46281. return $this;
  46282. }
  46283. public function setTimeout($timeout)
  46284. {
  46285. if (null === $timeout) {
  46286. $this->timeout = null;
  46287. return $this;
  46288. }
  46289. $timeout = (float) $timeout;
  46290. if ($timeout < 0) {
  46291. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  46292. }
  46293. $this->timeout = $timeout;
  46294. return $this;
  46295. }
  46296. public function setOption($name, $value)
  46297. {
  46298. $this->options[$name] = $value;
  46299. return $this;
  46300. }
  46301. public function disableOutput()
  46302. {
  46303. $this->outputDisabled = true;
  46304. return $this;
  46305. }
  46306. public function enableOutput()
  46307. {
  46308. $this->outputDisabled = false;
  46309. return $this;
  46310. }
  46311. public function getProcess()
  46312. {
  46313. if (0 === count($this->prefix) && 0 === count($this->arguments)) {
  46314. throw new LogicException('You must add() command arguments before calling getProcess().');
  46315. }
  46316. $options = $this->options;
  46317. $arguments = array_merge($this->prefix, $this->arguments);
  46318. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  46319. if ($this->inheritEnv) {
  46320. $env = array_replace($_ENV, $_SERVER, $this->env);
  46321. } else {
  46322. $env = $this->env;
  46323. }
  46324. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  46325. if ($this->outputDisabled) {
  46326. $process->disableOutput();
  46327. }
  46328. return $process;
  46329. }
  46330. }
  46331. <?php
  46332. namespace Symfony\Component\Process;
  46333. use Symfony\Component\Process\Exception\InvalidArgumentException;
  46334. class ProcessUtils
  46335. {
  46336. private function __construct()
  46337. {
  46338. }
  46339. public static function escapeArgument($argument)
  46340. {
  46341. if ('\\' === DIRECTORY_SEPARATOR) {
  46342. if ('' === $argument) {
  46343. return escapeshellarg($argument);
  46344. }
  46345. $escapedArgument = '';
  46346. $quote = false;
  46347. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  46348. if ('"' === $part) {
  46349. $escapedArgument .= '\\"';
  46350. } elseif (self::isSurroundedBy($part, '%')) {
  46351. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  46352. } else {
  46353. if ('\\' === substr($part, -1)) {
  46354. $part .= '\\';
  46355. }
  46356. $quote = true;
  46357. $escapedArgument .= $part;
  46358. }
  46359. }
  46360. if ($quote) {
  46361. $escapedArgument = '"'.$escapedArgument.'"';
  46362. }
  46363. return $escapedArgument;
  46364. }
  46365. return "'".str_replace("'", "'\\''", $argument)."'";
  46366. }
  46367. public static function validateInput($caller, $input)
  46368. {
  46369. if (null !== $input) {
  46370. if (is_resource($input)) {
  46371. return $input;
  46372. }
  46373. if (is_string($input)) {
  46374. return $input;
  46375. }
  46376. if (is_scalar($input)) {
  46377. return (string) $input;
  46378. }
  46379. if (is_object($input) && method_exists($input, '__toString')) {
  46380. @trigger_error('Passing an object as an input is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  46381. return (string) $input;
  46382. }
  46383. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  46384. }
  46385. return $input;
  46386. }
  46387. private static function isSurroundedBy($arg, $char)
  46388. {
  46389. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  46390. }
  46391. }
  46392. Copyright (c) 2011 Jordi Boggiano
  46393. Permission is hereby granted, free of charge, to any person obtaining a copy
  46394. of this software and associated documentation files (the "Software"), to deal
  46395. in the Software without restriction, including without limitation the rights
  46396. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46397. copies of the Software, and to permit persons to whom the Software is furnished
  46398. to do so, subject to the following conditions:
  46399. The above copyright notice and this permission notice shall be included in all
  46400. copies or substantial portions of the Software.
  46401. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46402. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46403. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46404. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46405. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46406. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  46407. THE SOFTWARE.
  46408. <?php
  46409. namespace Seld\JsonLint;
  46410. class DuplicateKeyException extends ParsingException
  46411. {
  46412. public function __construct($message, $key, array $details = array())
  46413. {
  46414. $details['key'] = $key;
  46415. parent::__construct($message, $details);
  46416. }
  46417. public function getKey()
  46418. {
  46419. return $this->details['key'];
  46420. }
  46421. }
  46422. <?php
  46423. namespace Seld\JsonLint;
  46424. use stdClass;
  46425. class JsonParser
  46426. {
  46427. const DETECT_KEY_CONFLICTS = 1;
  46428. const ALLOW_DUPLICATE_KEYS = 2;
  46429. const PARSE_TO_ASSOC = 4;
  46430. private $lexer;
  46431. private $flags;
  46432. private $stack;
  46433. private $vstack;
  46434. private $lstack;
  46435. private $symbols = array(
  46436. 'error' => 2,
  46437. 'JSONString' => 3,
  46438. 'STRING' => 4,
  46439. 'JSONNumber' => 5,
  46440. 'NUMBER' => 6,
  46441. 'JSONNullLiteral' => 7,
  46442. 'NULL' => 8,
  46443. 'JSONBooleanLiteral' => 9,
  46444. 'TRUE' => 10,
  46445. 'FALSE' => 11,
  46446. 'JSONText' => 12,
  46447. 'JSONValue' => 13,
  46448. 'EOF' => 14,
  46449. 'JSONObject' => 15,
  46450. 'JSONArray' => 16,
  46451. '{' => 17,
  46452. '}' => 18,
  46453. 'JSONMemberList' => 19,
  46454. 'JSONMember' => 20,
  46455. ':' => 21,
  46456. ',' => 22,
  46457. '[' => 23,
  46458. ']' => 24,
  46459. 'JSONElementList' => 25,
  46460. '$accept' => 0,
  46461. '$end' => 1,
  46462. );
  46463. private $terminals_ = array(
  46464. 2 => "error",
  46465. 4 => "STRING",
  46466. 6 => "NUMBER",
  46467. 8 => "NULL",
  46468. 10 => "TRUE",
  46469. 11 => "FALSE",
  46470. 14 => "EOF",
  46471. 17 => "{",
  46472. 18 => "}",
  46473. 21 => ":",
  46474. 22 => ",",
  46475. 23 => "[",
  46476. 24 => "]",
  46477. );
  46478. private $productions_ = array(
  46479. 0,
  46480. array(3, 1),
  46481. array(5, 1),
  46482. array(7, 1),
  46483. array(9, 1),
  46484. array(9, 1),
  46485. array(12, 2),
  46486. array(13, 1),
  46487. array(13, 1),
  46488. array(13, 1),
  46489. array(13, 1),
  46490. array(13, 1),
  46491. array(13, 1),
  46492. array(15, 2),
  46493. array(15, 3),
  46494. array(20, 3),
  46495. array(19, 1),
  46496. array(19, 3),
  46497. array(16, 2),
  46498. array(16, 3),
  46499. array(25, 1),
  46500. array(25, 3)
  46501. );
  46502. 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)),
  46503. );
  46504. private $defaultActions = array(
  46505. 16 => array(2, 6)
  46506. );
  46507. public function lint($input, $flags = 0)
  46508. {
  46509. try {
  46510. $this->parse($input, $flags);
  46511. } catch (ParsingException $e) {
  46512. return $e;
  46513. }
  46514. }
  46515. public function parse($input, $flags = 0)
  46516. {
  46517. $this->failOnBOM($input);
  46518. $this->flags = $flags;
  46519. $this->stack = array(0);
  46520. $this->vstack = array(null);
  46521. $this->lstack = array();
  46522. $yytext = '';
  46523. $yylineno = 0;
  46524. $yyleng = 0;
  46525. $recovering = 0;
  46526. $TERROR = 2;
  46527. $EOF = 1;
  46528. $this->lexer = new Lexer();
  46529. $this->lexer->setInput($input);
  46530. $yyloc = $this->lexer->yylloc;
  46531. $this->lstack[] = $yyloc;
  46532. $symbol = null;
  46533. $preErrorSymbol = null;
  46534. $state = null;
  46535. $action = null;
  46536. $a = null;
  46537. $r = null;
  46538. $yyval = new stdClass;
  46539. $p = null;
  46540. $len = null;
  46541. $newState = null;
  46542. $expected = null;
  46543. $errStr = null;
  46544. while (true) {
  46545. $state = $this->stack[count($this->stack)-1];
  46546. if (isset($this->defaultActions[$state])) {
  46547. $action = $this->defaultActions[$state];
  46548. } else {
  46549. if ($symbol == null) {
  46550. $symbol = $this->lex();
  46551. }
  46552. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  46553. }
  46554. if (!$action || !$action[0]) {
  46555. if (!$recovering) {
  46556. $expected = array();
  46557. foreach ($this->table[$state] as $p => $ignore) {
  46558. if (isset($this->terminals_[$p]) && $p > 2) {
  46559. $expected[] = "'" . $this->terminals_[$p] . "'";
  46560. }
  46561. }
  46562. $message = null;
  46563. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  46564. $message = "Invalid string";
  46565. if ("'" === substr($this->lexer->match, 0, 1)) {
  46566. $message .= ", it appears you used single quotes instead of double quotes";
  46567. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  46568. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  46569. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  46570. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  46571. }
  46572. }
  46573. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  46574. $errStr .= $this->lexer->showPosition() . "\n";
  46575. if ($message) {
  46576. $errStr .= $message;
  46577. } else {
  46578. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  46579. $errStr .= implode(', ', $expected);
  46580. }
  46581. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  46582. $errStr .= " - It appears you have an extra trailing comma";
  46583. }
  46584. $this->parseError($errStr, array(
  46585. 'text' => $this->lexer->match,
  46586. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  46587. 'line' => $this->lexer->yylineno,
  46588. 'loc' => $yyloc,
  46589. 'expected' => $expected,
  46590. ));
  46591. }
  46592. if ($recovering == 3) {
  46593. if ($symbol == $EOF) {
  46594. throw new ParsingException($errStr ?: 'Parsing halted.');
  46595. }
  46596. $yyleng = $this->lexer->yyleng;
  46597. $yytext = $this->lexer->yytext;
  46598. $yylineno = $this->lexer->yylineno;
  46599. $yyloc = $this->lexer->yylloc;
  46600. $symbol = $this->lex();
  46601. }
  46602. while (true) {
  46603. if (array_key_exists($TERROR, $this->table[$state])) {
  46604. break;
  46605. }
  46606. if ($state == 0) {
  46607. throw new ParsingException($errStr ?: 'Parsing halted.');
  46608. }
  46609. $this->popStack(1);
  46610. $state = $this->stack[count($this->stack)-1];
  46611. }
  46612. $preErrorSymbol = $symbol;
  46613. $symbol = $TERROR;
  46614. $state = $this->stack[count($this->stack)-1];
  46615. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  46616. $recovering = 3;
  46617. }
  46618. if (is_array($action[0]) && count($action) > 1) {
  46619. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  46620. }
  46621. switch ($action[0]) {
  46622. case 1:
  46623. $this->stack[] = $symbol;
  46624. $this->vstack[] = $this->lexer->yytext;
  46625. $this->lstack[] = $this->lexer->yylloc;
  46626. $this->stack[] = $action[1];
  46627. $symbol = null;
  46628. if (!$preErrorSymbol) {
  46629. $yyleng = $this->lexer->yyleng;
  46630. $yytext = $this->lexer->yytext;
  46631. $yylineno = $this->lexer->yylineno;
  46632. $yyloc = $this->lexer->yylloc;
  46633. if ($recovering > 0) {
  46634. $recovering--;
  46635. }
  46636. } else {
  46637. $symbol = $preErrorSymbol;
  46638. $preErrorSymbol = null;
  46639. }
  46640. break;
  46641. case 2:
  46642. $len = $this->productions_[$action[1]][1];
  46643. $yyval->token = $this->vstack[count($this->vstack) - $len];
  46644. $yyval->store = array(
  46645. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  46646. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  46647. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  46648. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  46649. );
  46650. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  46651. if (!$r instanceof Undefined) {
  46652. return $r;
  46653. }
  46654. if ($len) {
  46655. $this->popStack($len);
  46656. }
  46657. $this->stack[] = $this->productions_[$action[1]][0];
  46658. $this->vstack[] = $yyval->token;
  46659. $this->lstack[] = $yyval->store;
  46660. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  46661. $this->stack[] = $newState;
  46662. break;
  46663. case 3:
  46664. return true;
  46665. }
  46666. }
  46667. return true;
  46668. }
  46669. protected function parseError($str, $hash)
  46670. {
  46671. throw new ParsingException($str, $hash);
  46672. }
  46673. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  46674. {
  46675. $len = count($tokens) - 1;
  46676. switch ($yystate) {
  46677. case 1:
  46678. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  46679. $yyval->token = $yytext;
  46680. break;
  46681. case 2:
  46682. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  46683. $yyval->token = floatval($yytext);
  46684. } else {
  46685. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  46686. }
  46687. break;
  46688. case 3:
  46689. $yyval->token = null;
  46690. break;
  46691. case 4:
  46692. $yyval->token = true;
  46693. break;
  46694. case 5:
  46695. $yyval->token = false;
  46696. break;
  46697. case 6:
  46698. return $yyval->token = $tokens[$len-1];
  46699. case 13:
  46700. if ($this->flags & self::PARSE_TO_ASSOC) {
  46701. $yyval->token = array();
  46702. } else {
  46703. $yyval->token = new stdClass;
  46704. }
  46705. break;
  46706. case 14:
  46707. $yyval->token = $tokens[$len-1];
  46708. break;
  46709. case 15:
  46710. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  46711. break;
  46712. case 16:
  46713. if (PHP_VERSION_ID < 70100) {
  46714. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  46715. } else {
  46716. $property = $tokens[$len][0];
  46717. }
  46718. if ($this->flags & self::PARSE_TO_ASSOC) {
  46719. $yyval->token = array();
  46720. $yyval->token[$property] = $tokens[$len][1];
  46721. } else {
  46722. $yyval->token = new stdClass;
  46723. $yyval->token->$property = $tokens[$len][1];
  46724. }
  46725. break;
  46726. case 17:
  46727. if ($this->flags & self::PARSE_TO_ASSOC) {
  46728. $yyval->token =& $tokens[$len-2];
  46729. $key = $tokens[$len][0];
  46730. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  46731. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  46732. $errStr .= $this->lexer->showPosition() . "\n";
  46733. $errStr .= "Duplicate key: ".$tokens[$len][0];
  46734. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  46735. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  46736. $duplicateCount = 1;
  46737. do {
  46738. $duplicateKey = $key . '.' . $duplicateCount++;
  46739. } while (isset($tokens[$len-2][$duplicateKey]));
  46740. $key = $duplicateKey;
  46741. }
  46742. $tokens[$len-2][$key] = $tokens[$len][1];
  46743. } else {
  46744. $yyval->token = $tokens[$len-2];
  46745. if (PHP_VERSION_ID < 70100) {
  46746. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  46747. } else {
  46748. $key = $tokens[$len][0];
  46749. }
  46750. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  46751. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  46752. $errStr .= $this->lexer->showPosition() . "\n";
  46753. $errStr .= "Duplicate key: ".$tokens[$len][0];
  46754. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  46755. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  46756. $duplicateCount = 1;
  46757. do {
  46758. $duplicateKey = $key . '.' . $duplicateCount++;
  46759. } while (isset($tokens[$len-2]->$duplicateKey));
  46760. $key = $duplicateKey;
  46761. }
  46762. $tokens[$len-2]->$key = $tokens[$len][1];
  46763. }
  46764. break;
  46765. case 18:
  46766. $yyval->token = array();
  46767. break;
  46768. case 19:
  46769. $yyval->token = $tokens[$len-1];
  46770. break;
  46771. case 20:
  46772. $yyval->token = array($tokens[$len]);
  46773. break;
  46774. case 21:
  46775. $tokens[$len-2][] = $tokens[$len];
  46776. $yyval->token = $tokens[$len-2];
  46777. break;
  46778. }
  46779. return new Undefined();
  46780. }
  46781. private function stringInterpolation($match)
  46782. {
  46783. switch ($match[0]) {
  46784. case '\\\\':
  46785. return '\\';
  46786. case '\"':
  46787. return '"';
  46788. case '\b':
  46789. return chr(8);
  46790. case '\f':
  46791. return chr(12);
  46792. case '\n':
  46793. return "\n";
  46794. case '\r':
  46795. return "\r";
  46796. case '\t':
  46797. return "\t";
  46798. case '\/':
  46799. return "/";
  46800. default:
  46801. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
  46802. }
  46803. }
  46804. private function popStack($n)
  46805. {
  46806. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  46807. $this->vstack = array_slice($this->vstack, 0, - $n);
  46808. $this->lstack = array_slice($this->lstack, 0, - $n);
  46809. }
  46810. private function lex()
  46811. {
  46812. $token = $this->lexer->lex() ?: 1;
  46813. if (!is_numeric($token)) {
  46814. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  46815. }
  46816. return $token;
  46817. }
  46818. private function failOnBOM($input)
  46819. {
  46820. $bom = "\xEF\xBB\xBF";
  46821. if (substr($input, 0, 3) === $bom) {
  46822. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  46823. }
  46824. }
  46825. }
  46826. <?php
  46827. namespace Seld\JsonLint;
  46828. class Lexer
  46829. {
  46830. private $EOF = 1;
  46831. private $rules = array(
  46832. 0 => '/^\s+/',
  46833. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  46834. 2 => '{^"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  46835. 3 => '/^\{/',
  46836. 4 => '/^\}/',
  46837. 5 => '/^\[/',
  46838. 6 => '/^\]/',
  46839. 7 => '/^,/',
  46840. 8 => '/^:/',
  46841. 9 => '/^true\b/',
  46842. 10 => '/^false\b/',
  46843. 11 => '/^null\b/',
  46844. 12 => '/^$/',
  46845. 13 => '/^./',
  46846. );
  46847. private $conditions = array(
  46848. "INITIAL" => array(
  46849. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  46850. "inclusive" => true,
  46851. ),
  46852. );
  46853. private $conditionStack;
  46854. private $input;
  46855. private $more;
  46856. private $done;
  46857. private $matched;
  46858. public $match;
  46859. public $yylineno;
  46860. public $yyleng;
  46861. public $yytext;
  46862. public $yylloc;
  46863. public function lex()
  46864. {
  46865. $r = $this->next();
  46866. if (!$r instanceof Undefined) {
  46867. return $r;
  46868. }
  46869. return $this->lex();
  46870. }
  46871. public function setInput($input)
  46872. {
  46873. $this->input = $input;
  46874. $this->more = false;
  46875. $this->done = false;
  46876. $this->yylineno = $this->yyleng = 0;
  46877. $this->yytext = $this->matched = $this->match = '';
  46878. $this->conditionStack = array('INITIAL');
  46879. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  46880. return $this;
  46881. }
  46882. public function showPosition()
  46883. {
  46884. $pre = str_replace("\n", '', $this->getPastInput());
  46885. $c = str_repeat('-', max(0, strlen($pre) - 1));
  46886. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  46887. }
  46888. public function getPastInput()
  46889. {
  46890. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  46891. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  46892. }
  46893. public function getUpcomingInput()
  46894. {
  46895. $next = $this->match;
  46896. if (strlen($next) < 20) {
  46897. $next .= substr($this->input, 0, 20 - strlen($next));
  46898. }
  46899. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  46900. }
  46901. protected function parseError($str, $hash)
  46902. {
  46903. throw new \Exception($str);
  46904. }
  46905. private function next()
  46906. {
  46907. if ($this->done) {
  46908. return $this->EOF;
  46909. }
  46910. if ($this->input === '') {
  46911. $this->done = true;
  46912. }
  46913. $token = null;
  46914. $match = null;
  46915. $col = null;
  46916. $lines = null;
  46917. if (!$this->more) {
  46918. $this->yytext = '';
  46919. $this->match = '';
  46920. }
  46921. $rules = $this->getCurrentRules();
  46922. $rulesLen = count($rules);
  46923. for ($i=0; $i < $rulesLen; $i++) {
  46924. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  46925. preg_match_all('/\n.*/', $match[0], $lines);
  46926. $lines = $lines[0];
  46927. if ($lines) {
  46928. $this->yylineno += count($lines);
  46929. }
  46930. $this->yylloc = array(
  46931. 'first_line' => $this->yylloc['last_line'],
  46932. 'last_line' => $this->yylineno+1,
  46933. 'first_column' => $this->yylloc['last_column'],
  46934. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  46935. );
  46936. $this->yytext .= $match[0];
  46937. $this->match .= $match[0];
  46938. $this->yyleng = strlen($this->yytext);
  46939. $this->more = false;
  46940. $this->input = substr($this->input, strlen($match[0]));
  46941. $this->matched .= $match[0];
  46942. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  46943. if ($token) {
  46944. return $token;
  46945. }
  46946. return new Undefined();
  46947. }
  46948. }
  46949. if ($this->input === "") {
  46950. return $this->EOF;
  46951. }
  46952. $this->parseError(
  46953. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  46954. array(
  46955. 'text' => "",
  46956. 'token' => null,
  46957. 'line' => $this->yylineno,
  46958. )
  46959. );
  46960. }
  46961. private function getCurrentRules()
  46962. {
  46963. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  46964. }
  46965. private function performAction($avoiding_name_collisions, $YY_START)
  46966. {
  46967. switch ($avoiding_name_collisions) {
  46968. case 0:
  46969. break;
  46970. case 1:
  46971. return 6;
  46972. break;
  46973. case 2:
  46974. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  46975. return 4;
  46976. case 3:
  46977. return 17;
  46978. case 4:
  46979. return 18;
  46980. case 5:
  46981. return 23;
  46982. case 6:
  46983. return 24;
  46984. case 7:
  46985. return 22;
  46986. case 8:
  46987. return 21;
  46988. case 9:
  46989. return 10;
  46990. case 10:
  46991. return 11;
  46992. case 11:
  46993. return 8;
  46994. case 12:
  46995. return 14;
  46996. case 13:
  46997. return 'INVALID';
  46998. }
  46999. }
  47000. }
  47001. <?php
  47002. namespace Seld\JsonLint;
  47003. class ParsingException extends \Exception
  47004. {
  47005. protected $details;
  47006. public function __construct($message, $details = array())
  47007. {
  47008. $this->details = $details;
  47009. parent::__construct($message);
  47010. }
  47011. public function getDetails()
  47012. {
  47013. return $this->details;
  47014. }
  47015. }
  47016. <?php
  47017. namespace Seld\JsonLint;
  47018. class Undefined
  47019. {
  47020. }
  47021. MIT License
  47022. Copyright (c) 2016
  47023. Permission is hereby granted, free of charge, to any person obtaining a copy
  47024. of this software and associated documentation files (the "Software"), to deal
  47025. in the Software without restriction, including without limitation the rights
  47026. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47027. copies of the Software, and to permit persons to whom the Software is
  47028. furnished to do so, subject to the following conditions:
  47029. The above copyright notice and this permission notice shall be included in all
  47030. copies or substantial portions of the Software.
  47031. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47032. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47033. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47034. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47035. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47036. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  47037. SOFTWARE.
  47038. <?php
  47039. require __DIR__ . '/../vendor/autoload.php';
  47040. $data = json_decode(file_get_contents('data.json'));
  47041. $validator = new JsonSchema\Validator();
  47042. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  47043. if ($validator->isValid()) {
  47044. echo "The supplied JSON validates against the schema.\n";
  47045. } else {
  47046. echo "JSON does not validate. Violations:\n";
  47047. foreach ($validator->getErrors() as $error) {
  47048. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  47049. }
  47050. }
  47051. <?php
  47052. namespace JsonSchema\Constraints;
  47053. use JsonSchema\Entity\JsonPointer;
  47054. use JsonSchema\Exception\InvalidArgumentException;
  47055. use JsonSchema\Exception\ValidationException;
  47056. use JsonSchema\Validator;
  47057. class BaseConstraint
  47058. {
  47059. protected $errors = array();
  47060. protected $errorMask = Validator::ERROR_NONE;
  47061. protected $factory;
  47062. public function __construct(Factory $factory = null)
  47063. {
  47064. $this->factory = $factory ?: new Factory();
  47065. }
  47066. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  47067. {
  47068. $error = array(
  47069. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  47070. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  47071. 'message' => $message,
  47072. 'constraint' => $constraint,
  47073. 'context' => $this->factory->getErrorContext(),
  47074. );
  47075. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  47076. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  47077. }
  47078. if (is_array($more) && count($more) > 0) {
  47079. $error += $more;
  47080. }
  47081. $this->errors[] = $error;
  47082. $this->errorMask |= $error['context'];
  47083. }
  47084. public function addErrors(array $errors)
  47085. {
  47086. if ($errors) {
  47087. $this->errors = array_merge($this->errors, $errors);
  47088. $errorMask = &$this->errorMask;
  47089. array_walk($errors, function ($error) use (&$errorMask) {
  47090. if (isset($error['context'])) {
  47091. $errorMask |= $error['context'];
  47092. }
  47093. });
  47094. }
  47095. }
  47096. public function getErrors($errorContext = Validator::ERROR_ALL)
  47097. {
  47098. if ($errorContext === Validator::ERROR_ALL) {
  47099. return $this->errors;
  47100. }
  47101. return array_filter($this->errors, function ($error) use ($errorContext) {
  47102. if ($errorContext & $error['context']) {
  47103. return true;
  47104. }
  47105. });
  47106. }
  47107. public function numErrors($errorContext = Validator::ERROR_ALL)
  47108. {
  47109. if ($errorContext === Validator::ERROR_ALL) {
  47110. return count($this->errors);
  47111. }
  47112. return count($this->getErrors($errorContext));
  47113. }
  47114. public function isValid()
  47115. {
  47116. return !$this->getErrors();
  47117. }
  47118. public function reset()
  47119. {
  47120. $this->errors = array();
  47121. $this->errorMask = Validator::ERROR_NONE;
  47122. }
  47123. public function getErrorMask()
  47124. {
  47125. return $this->errorMask;
  47126. }
  47127. public static function arrayToObjectRecursive($array)
  47128. {
  47129. $json = json_encode($array);
  47130. if (json_last_error() !== \JSON_ERROR_NONE) {
  47131. $message = 'Unable to encode schema array as JSON';
  47132. if (function_exists('json_last_error_msg')) {
  47133. $message .= ': ' . json_last_error_msg();
  47134. }
  47135. throw new InvalidArgumentException($message);
  47136. }
  47137. return (object) json_decode($json);
  47138. }
  47139. }
  47140. <?php
  47141. namespace JsonSchema\Constraints;
  47142. use JsonSchema\Entity\JsonPointer;
  47143. class CollectionConstraint extends Constraint
  47144. {
  47145. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47146. {
  47147. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  47148. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  47149. }
  47150. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  47151. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  47152. }
  47153. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  47154. $unique = $value;
  47155. if (is_array($value) && count($value)) {
  47156. $unique = array_map(function ($e) {
  47157. return var_export($e, true);
  47158. }, $value);
  47159. }
  47160. if (count(array_unique($unique)) != count($value)) {
  47161. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  47162. }
  47163. }
  47164. if (isset($schema->items)) {
  47165. $this->validateItems($value, $schema, $path, $i);
  47166. }
  47167. }
  47168. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47169. {
  47170. if (is_object($schema->items)) {
  47171. if (isset($schema->items->type)
  47172. && (
  47173. $schema->items->type == 'string'
  47174. || $schema->items->type == 'number'
  47175. || $schema->items->type == 'integer'
  47176. )
  47177. && !isset($schema->additionalItems)
  47178. ) {
  47179. $type = $schema->items->type;
  47180. $typeValidator = $this->factory->createInstanceFor('type');
  47181. $validator = $this->factory->createInstanceFor($type === 'integer' ? 'number' : $type);
  47182. foreach ($value as $k => &$v) {
  47183. $k_path = $this->incrementPath($path, $k);
  47184. $typeValidator->check($v, $schema->items, $k_path, $i);
  47185. $validator->check($v, $schema->items, $k_path, $i);
  47186. }
  47187. unset($v);
  47188. $this->addErrors($typeValidator->getErrors());
  47189. $this->addErrors($validator->getErrors());
  47190. } else {
  47191. foreach ($value as $k => &$v) {
  47192. $initErrors = $this->getErrors();
  47193. $this->checkUndefined($v, $schema->items, $path, $k);
  47194. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  47195. $secondErrors = $this->getErrors();
  47196. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  47197. }
  47198. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  47199. $this->errors = $secondErrors;
  47200. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  47201. $this->errors = $initErrors;
  47202. }
  47203. }
  47204. unset($v);
  47205. }
  47206. } else {
  47207. foreach ($value as $k => &$v) {
  47208. if (array_key_exists($k, $schema->items)) {
  47209. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  47210. } else {
  47211. if (property_exists($schema, 'additionalItems')) {
  47212. if ($schema->additionalItems !== false) {
  47213. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  47214. } else {
  47215. $this->addError(
  47216. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  47217. }
  47218. } else {
  47219. $this->checkUndefined($v, new \stdClass(), $path, $k);
  47220. }
  47221. }
  47222. }
  47223. unset($v);
  47224. if (count($value) > 0) {
  47225. for ($k = count($value); $k < count($schema->items); $k++) {
  47226. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  47227. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  47228. }
  47229. }
  47230. }
  47231. }
  47232. }
  47233. <?php
  47234. namespace JsonSchema\Constraints;
  47235. use JsonSchema\Entity\JsonPointer;
  47236. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  47237. {
  47238. protected $inlineSchemaProperty = '$schema';
  47239. const CHECK_MODE_NONE = 0x00000000;
  47240. const CHECK_MODE_NORMAL = 0x00000001;
  47241. const CHECK_MODE_TYPE_CAST = 0x00000002;
  47242. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  47243. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  47244. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  47245. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  47246. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  47247. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  47248. protected function incrementPath(JsonPointer $path = null, $i)
  47249. {
  47250. $path = $path ?: new JsonPointer('');
  47251. $path = $path->withPropertyPaths(
  47252. array_merge(
  47253. $path->getPropertyPaths(),
  47254. array_filter(array($i), 'strlen')
  47255. )
  47256. );
  47257. return $path;
  47258. }
  47259. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47260. {
  47261. $validator = $this->factory->createInstanceFor('collection');
  47262. $validator->check($value, $schema, $path, $i);
  47263. $this->addErrors($validator->getErrors());
  47264. }
  47265. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  47266. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  47267. {
  47268. $validator = $this->factory->createInstanceFor('object');
  47269. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  47270. $this->addErrors($validator->getErrors());
  47271. }
  47272. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  47273. {
  47274. $validator = $this->factory->createInstanceFor('type');
  47275. $validator->check($value, $schema, $path, $i);
  47276. $this->addErrors($validator->getErrors());
  47277. }
  47278. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  47279. {
  47280. $validator = $this->factory->createInstanceFor('undefined');
  47281. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  47282. $this->addErrors($validator->getErrors());
  47283. }
  47284. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  47285. {
  47286. $validator = $this->factory->createInstanceFor('string');
  47287. $validator->check($value, $schema, $path, $i);
  47288. $this->addErrors($validator->getErrors());
  47289. }
  47290. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  47291. {
  47292. $validator = $this->factory->createInstanceFor('number');
  47293. $validator->check($value, $schema, $path, $i);
  47294. $this->addErrors($validator->getErrors());
  47295. }
  47296. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  47297. {
  47298. $validator = $this->factory->createInstanceFor('enum');
  47299. $validator->check($value, $schema, $path, $i);
  47300. $this->addErrors($validator->getErrors());
  47301. }
  47302. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  47303. {
  47304. $validator = $this->factory->createInstanceFor('format');
  47305. $validator->check($value, $schema, $path, $i);
  47306. $this->addErrors($validator->getErrors());
  47307. }
  47308. protected function getTypeCheck()
  47309. {
  47310. return $this->factory->getTypeCheck();
  47311. }
  47312. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  47313. {
  47314. $result = array_map(
  47315. function ($path) {
  47316. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  47317. },
  47318. $pointer->getPropertyPaths()
  47319. );
  47320. return trim(implode('', $result), '.');
  47321. }
  47322. }
  47323. <?php
  47324. namespace JsonSchema\Constraints;
  47325. use JsonSchema\Entity\JsonPointer;
  47326. interface ConstraintInterface
  47327. {
  47328. public function getErrors();
  47329. public function addErrors(array $errors);
  47330. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  47331. public function isValid();
  47332. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  47333. }
  47334. <?php
  47335. namespace JsonSchema\Constraints;
  47336. use JsonSchema\Entity\JsonPointer;
  47337. class EnumConstraint extends Constraint
  47338. {
  47339. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47340. {
  47341. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  47342. return;
  47343. }
  47344. $type = gettype($element);
  47345. foreach ($schema->enum as $enum) {
  47346. $enumType = gettype($enum);
  47347. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  47348. if ((object) $element == $enum) {
  47349. return;
  47350. }
  47351. }
  47352. if ($type === gettype($enum)) {
  47353. if ($type == 'object') {
  47354. if ($element == $enum) {
  47355. return;
  47356. }
  47357. } elseif ($element === $enum) {
  47358. return;
  47359. }
  47360. }
  47361. }
  47362. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  47363. }
  47364. }
  47365. <?php
  47366. namespace JsonSchema\Constraints;
  47367. use JsonSchema\Exception\InvalidArgumentException;
  47368. use JsonSchema\SchemaStorage;
  47369. use JsonSchema\SchemaStorageInterface;
  47370. use JsonSchema\Uri\UriRetriever;
  47371. use JsonSchema\UriRetrieverInterface;
  47372. use JsonSchema\Validator;
  47373. class Factory
  47374. {
  47375. protected $schemaStorage;
  47376. protected $uriRetriever;
  47377. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  47378. private $typeCheck = array();
  47379. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  47380. protected $constraintMap = array(
  47381. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  47382. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  47383. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  47384. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  47385. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  47386. 'string' => 'JsonSchema\Constraints\StringConstraint',
  47387. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  47388. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  47389. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  47390. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  47391. 'validator' => 'JsonSchema\Validator'
  47392. );
  47393. private $instanceCache = array();
  47394. public function __construct(
  47395. SchemaStorageInterface $schemaStorage = null,
  47396. UriRetrieverInterface $uriRetriever = null,
  47397. $checkMode = Constraint::CHECK_MODE_NORMAL
  47398. ) {
  47399. $this->setConfig($checkMode);
  47400. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  47401. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  47402. }
  47403. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  47404. {
  47405. $this->checkMode = $checkMode;
  47406. }
  47407. public function addConfig($options)
  47408. {
  47409. $this->checkMode |= $options;
  47410. }
  47411. public function removeConfig($options)
  47412. {
  47413. $this->checkMode &= ~$options;
  47414. }
  47415. public function getConfig($options = null)
  47416. {
  47417. if ($options === null) {
  47418. return $this->checkMode;
  47419. }
  47420. return $this->checkMode & $options;
  47421. }
  47422. public function getUriRetriever()
  47423. {
  47424. return $this->uriRetriever;
  47425. }
  47426. public function getSchemaStorage()
  47427. {
  47428. return $this->schemaStorage;
  47429. }
  47430. public function getTypeCheck()
  47431. {
  47432. if (!isset($this->typeCheck[$this->checkMode])) {
  47433. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  47434. ? new TypeCheck\LooseTypeCheck()
  47435. : new TypeCheck\StrictTypeCheck();
  47436. }
  47437. return $this->typeCheck[$this->checkMode];
  47438. }
  47439. public function setConstraintClass($name, $class)
  47440. {
  47441. if (!class_exists($class)) {
  47442. throw new InvalidArgumentException('Unknown constraint ' . $name);
  47443. }
  47444. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  47445. throw new InvalidArgumentException('Invalid class ' . $name);
  47446. }
  47447. $this->constraintMap[$name] = $class;
  47448. return $this;
  47449. }
  47450. public function createInstanceFor($constraintName)
  47451. {
  47452. if (!isset($this->constraintMap[$constraintName])) {
  47453. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  47454. }
  47455. if (!isset($this->instanceCache[$constraintName])) {
  47456. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  47457. }
  47458. return clone $this->instanceCache[$constraintName];
  47459. }
  47460. public function getErrorContext()
  47461. {
  47462. return $this->errorContext;
  47463. }
  47464. public function setErrorContext($errorContext)
  47465. {
  47466. $this->errorContext = $errorContext;
  47467. }
  47468. }
  47469. <?php
  47470. namespace JsonSchema\Constraints;
  47471. use JsonSchema\Entity\JsonPointer;
  47472. use JsonSchema\Rfc3339;
  47473. class FormatConstraint extends Constraint
  47474. {
  47475. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47476. {
  47477. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  47478. return;
  47479. }
  47480. switch ($schema->format) {
  47481. case 'date':
  47482. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  47483. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  47484. }
  47485. break;
  47486. case 'time':
  47487. if (!$this->validateDateTime($element, 'H:i:s')) {
  47488. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  47489. }
  47490. break;
  47491. case 'date-time':
  47492. if (null === Rfc3339::createFromString($element)) {
  47493. $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));
  47494. }
  47495. break;
  47496. case 'utc-millisec':
  47497. if (!$this->validateDateTime($element, 'U')) {
  47498. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  47499. }
  47500. break;
  47501. case 'regex':
  47502. if (!$this->validateRegex($element)) {
  47503. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  47504. }
  47505. break;
  47506. case 'color':
  47507. if (!$this->validateColor($element)) {
  47508. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  47509. }
  47510. break;
  47511. case 'style':
  47512. if (!$this->validateStyle($element)) {
  47513. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  47514. }
  47515. break;
  47516. case 'phone':
  47517. if (!$this->validatePhone($element)) {
  47518. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  47519. }
  47520. break;
  47521. case 'uri':
  47522. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  47523. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  47524. }
  47525. break;
  47526. case 'uriref':
  47527. case 'uri-reference':
  47528. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  47529. if (substr($element, 0, 2) === '//') {
  47530. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  47531. } elseif (substr($element, 0, 1) === '/') {
  47532. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  47533. } elseif (strlen($element)) {
  47534. $pathParts = explode('/', $element, 2);
  47535. if (strpos($pathParts[0], ':') !== false) {
  47536. $validURL = null;
  47537. } else {
  47538. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  47539. }
  47540. } else {
  47541. $validURL = null;
  47542. }
  47543. if ($validURL === null) {
  47544. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  47545. }
  47546. }
  47547. break;
  47548. case 'email':
  47549. $filterFlags = FILTER_NULL_ON_FAILURE;
  47550. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  47551. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  47552. }
  47553. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  47554. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  47555. }
  47556. break;
  47557. case 'ip-address':
  47558. case 'ipv4':
  47559. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  47560. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  47561. }
  47562. break;
  47563. case 'ipv6':
  47564. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  47565. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  47566. }
  47567. break;
  47568. case 'host-name':
  47569. case 'hostname':
  47570. if (!$this->validateHostname($element)) {
  47571. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  47572. }
  47573. break;
  47574. default:
  47575. break;
  47576. }
  47577. }
  47578. protected function validateDateTime($datetime, $format)
  47579. {
  47580. $dt = \DateTime::createFromFormat($format, $datetime);
  47581. if (!$dt) {
  47582. return false;
  47583. }
  47584. if ($datetime === $dt->format($format)) {
  47585. return true;
  47586. }
  47587. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  47588. return true;
  47589. }
  47590. return false;
  47591. }
  47592. protected function validateRegex($regex)
  47593. {
  47594. return false !== @preg_match('/' . $regex . '/u', '');
  47595. }
  47596. protected function validateColor($color)
  47597. {
  47598. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  47599. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  47600. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  47601. return true;
  47602. }
  47603. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  47604. }
  47605. protected function validateStyle($style)
  47606. {
  47607. $properties = explode(';', rtrim($style, ';'));
  47608. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  47609. return empty($invalidEntries);
  47610. }
  47611. protected function validatePhone($phone)
  47612. {
  47613. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  47614. }
  47615. protected function validateHostname($host)
  47616. {
  47617. $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';
  47618. return preg_match($hostnameRegex, $host);
  47619. }
  47620. }
  47621. <?php
  47622. namespace JsonSchema\Constraints;
  47623. use JsonSchema\Entity\JsonPointer;
  47624. class NumberConstraint extends Constraint
  47625. {
  47626. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47627. {
  47628. if (isset($schema->exclusiveMinimum)) {
  47629. if (isset($schema->minimum)) {
  47630. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  47631. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  47632. } elseif ($element < $schema->minimum) {
  47633. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  47634. }
  47635. } else {
  47636. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  47637. }
  47638. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  47639. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  47640. }
  47641. if (isset($schema->exclusiveMaximum)) {
  47642. if (isset($schema->maximum)) {
  47643. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  47644. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  47645. } elseif ($element > $schema->maximum) {
  47646. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  47647. }
  47648. } else {
  47649. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  47650. }
  47651. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  47652. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  47653. }
  47654. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  47655. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  47656. }
  47657. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  47658. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  47659. }
  47660. $this->checkFormat($element, $schema, $path, $i);
  47661. }
  47662. private function fmod($number1, $number2)
  47663. {
  47664. $number1 = abs($number1);
  47665. $modulus = fmod($number1, $number2);
  47666. $precision = abs(0.0000000001);
  47667. $diff = (float) ($modulus - $number2);
  47668. if (-$precision < $diff && $diff < $precision) {
  47669. return 0.0;
  47670. }
  47671. $decimals1 = mb_strpos($number1, '.') ? mb_strlen($number1) - mb_strpos($number1, '.') - 1 : 0;
  47672. $decimals2 = mb_strpos($number2, '.') ? mb_strlen($number2) - mb_strpos($number2, '.') - 1 : 0;
  47673. return (float) round($modulus, max($decimals1, $decimals2));
  47674. }
  47675. }
  47676. <?php
  47677. namespace JsonSchema\Constraints;
  47678. use JsonSchema\Entity\JsonPointer;
  47679. class ObjectConstraint extends Constraint
  47680. {
  47681. protected $appliedDefaults = array();
  47682. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  47683. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  47684. {
  47685. if ($element instanceof UndefinedConstraint) {
  47686. return;
  47687. }
  47688. $this->appliedDefaults = $appliedDefaults;
  47689. $matches = array();
  47690. if ($patternProperties) {
  47691. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  47692. }
  47693. if ($properties) {
  47694. $this->validateProperties($element, $properties, $path);
  47695. }
  47696. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  47697. }
  47698. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  47699. {
  47700. $try = array('/', '#', '+', '~', '%');
  47701. $matches = array();
  47702. foreach ($patternProperties as $pregex => $schema) {
  47703. $delimiter = '/';
  47704. foreach ($try as $delimiter) {
  47705. if (strpos($pregex, $delimiter) === false) {
  47706. break;
  47707. }
  47708. }
  47709. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  47710. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  47711. continue;
  47712. }
  47713. foreach ($element as $i => $value) {
  47714. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  47715. $matches[] = $i;
  47716. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  47717. }
  47718. }
  47719. }
  47720. return $matches;
  47721. }
  47722. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  47723. $properties = null, $additionalProp = null)
  47724. {
  47725. $this->validateMinMaxConstraint($element, $schema, $path);
  47726. foreach ($element as $i => $value) {
  47727. $definition = $this->getProperty($properties, $i);
  47728. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  47729. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  47730. }
  47731. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  47732. if ($additionalProp === true) {
  47733. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  47734. } else {
  47735. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  47736. }
  47737. }
  47738. $require = $this->getProperty($definition, 'requires');
  47739. if ($require && !$this->getProperty($element, $require)) {
  47740. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  47741. }
  47742. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  47743. if (is_object($property)) {
  47744. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  47745. }
  47746. }
  47747. }
  47748. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  47749. {
  47750. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  47751. foreach ($properties as $i => $value) {
  47752. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  47753. $definition = $this->getProperty($properties, $i);
  47754. if (is_object($definition)) {
  47755. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  47756. }
  47757. }
  47758. }
  47759. protected function &getProperty(&$element, $property, $fallback = null)
  47760. {
  47761. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  47762. return $element[$property];
  47763. } elseif (is_object($element) && property_exists($element, $property)) {
  47764. return $element->$property;
  47765. }
  47766. return $fallback;
  47767. }
  47768. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  47769. {
  47770. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  47771. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  47772. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  47773. }
  47774. }
  47775. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  47776. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  47777. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  47778. }
  47779. }
  47780. }
  47781. }
  47782. <?php
  47783. namespace JsonSchema\Constraints;
  47784. use JsonSchema\Entity\JsonPointer;
  47785. use JsonSchema\Exception\InvalidArgumentException;
  47786. use JsonSchema\Exception\InvalidSchemaException;
  47787. use JsonSchema\Exception\RuntimeException;
  47788. use JsonSchema\Validator;
  47789. class SchemaConstraint extends Constraint
  47790. {
  47791. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  47792. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47793. {
  47794. if ($schema !== null) {
  47795. $validationSchema = $schema;
  47796. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  47797. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  47798. } else {
  47799. throw new InvalidArgumentException('no schema found to verify against');
  47800. }
  47801. if (is_array($validationSchema)) {
  47802. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  47803. }
  47804. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  47805. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  47806. throw new RuntimeException('Cannot validate the schema of a non-object');
  47807. }
  47808. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  47809. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  47810. } else {
  47811. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  47812. }
  47813. $schemaStorage = $this->factory->getSchemaStorage();
  47814. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  47815. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  47816. }
  47817. $initialErrorCount = $this->numErrors();
  47818. $initialConfig = $this->factory->getConfig();
  47819. $initialContext = $this->factory->getErrorContext();
  47820. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  47821. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  47822. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  47823. try {
  47824. $this->check($validationSchema, $schemaSpec);
  47825. } catch (\Exception $e) {
  47826. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  47827. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  47828. }
  47829. }
  47830. if ($this->numErrors() > $initialErrorCount) {
  47831. $this->addError($path, 'Schema is not valid', 'schema');
  47832. }
  47833. $this->factory->setConfig($initialConfig);
  47834. $this->factory->setErrorContext($initialContext);
  47835. }
  47836. $this->checkUndefined($element, $validationSchema, $path, $i);
  47837. }
  47838. }
  47839. <?php
  47840. namespace JsonSchema\Constraints;
  47841. use JsonSchema\Entity\JsonPointer;
  47842. class StringConstraint extends Constraint
  47843. {
  47844. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47845. {
  47846. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  47847. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  47848. 'maxLength' => $schema->maxLength,
  47849. ));
  47850. }
  47851. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  47852. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  47853. 'minLength' => $schema->minLength,
  47854. ));
  47855. }
  47856. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  47857. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  47858. 'pattern' => $schema->pattern,
  47859. ));
  47860. }
  47861. $this->checkFormat($element, $schema, $path, $i);
  47862. }
  47863. private function strlen($string)
  47864. {
  47865. if (extension_loaded('mbstring')) {
  47866. return mb_strlen($string, mb_detect_encoding($string));
  47867. }
  47868. return strlen($string);
  47869. }
  47870. }
  47871. <?php
  47872. namespace JsonSchema\Constraints\TypeCheck;
  47873. class LooseTypeCheck implements TypeCheckInterface
  47874. {
  47875. public static function isObject($value)
  47876. {
  47877. return
  47878. is_object($value) ||
  47879. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  47880. }
  47881. public static function isArray($value)
  47882. {
  47883. return
  47884. is_array($value) &&
  47885. (count($value) == 0 || !self::isAssociativeArray($value));
  47886. }
  47887. public static function propertyGet($value, $property)
  47888. {
  47889. if (is_object($value)) {
  47890. return $value->{$property};
  47891. }
  47892. return $value[$property];
  47893. }
  47894. public static function propertySet(&$value, $property, $data)
  47895. {
  47896. if (is_object($value)) {
  47897. $value->{$property} = $data;
  47898. } else {
  47899. $value[$property] = $data;
  47900. }
  47901. }
  47902. public static function propertyExists($value, $property)
  47903. {
  47904. if (is_object($value)) {
  47905. return property_exists($value, $property);
  47906. }
  47907. return array_key_exists($property, $value);
  47908. }
  47909. public static function propertyCount($value)
  47910. {
  47911. if (is_object($value)) {
  47912. return count(get_object_vars($value));
  47913. }
  47914. return count($value);
  47915. }
  47916. private static function isAssociativeArray($arr)
  47917. {
  47918. return array_keys($arr) !== range(0, count($arr) - 1);
  47919. }
  47920. }
  47921. <?php
  47922. namespace JsonSchema\Constraints\TypeCheck;
  47923. class StrictTypeCheck implements TypeCheckInterface
  47924. {
  47925. public static function isObject($value)
  47926. {
  47927. return is_object($value);
  47928. }
  47929. public static function isArray($value)
  47930. {
  47931. return is_array($value);
  47932. }
  47933. public static function propertyGet($value, $property)
  47934. {
  47935. return $value->{$property};
  47936. }
  47937. public static function propertySet(&$value, $property, $data)
  47938. {
  47939. $value->{$property} = $data;
  47940. }
  47941. public static function propertyExists($value, $property)
  47942. {
  47943. return property_exists($value, $property);
  47944. }
  47945. public static function propertyCount($value)
  47946. {
  47947. return count(get_object_vars($value));
  47948. }
  47949. }
  47950. <?php
  47951. namespace JsonSchema\Constraints\TypeCheck;
  47952. interface TypeCheckInterface
  47953. {
  47954. public static function isObject($value);
  47955. public static function isArray($value);
  47956. public static function propertyGet($value, $property);
  47957. public static function propertySet(&$value, $property, $data);
  47958. public static function propertyExists($value, $property);
  47959. public static function propertyCount($value);
  47960. }
  47961. <?php
  47962. namespace JsonSchema\Constraints;
  47963. use JsonSchema\Entity\JsonPointer;
  47964. use JsonSchema\Exception\InvalidArgumentException;
  47965. use UnexpectedValueException as StandardUnexpectedValueException;
  47966. class TypeConstraint extends Constraint
  47967. {
  47968. public static $wording = array(
  47969. 'integer' => 'an integer',
  47970. 'number' => 'a number',
  47971. 'boolean' => 'a boolean',
  47972. 'object' => 'an object',
  47973. 'array' => 'an array',
  47974. 'string' => 'a string',
  47975. 'null' => 'a null',
  47976. 'any' => null,
  47977. 0 => null,
  47978. );
  47979. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  47980. {
  47981. $type = isset($schema->type) ? $schema->type : null;
  47982. $isValid = false;
  47983. $wording = array();
  47984. if (is_array($type)) {
  47985. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  47986. } elseif (is_object($type)) {
  47987. $this->checkUndefined($value, $type, $path);
  47988. return;
  47989. } else {
  47990. $isValid = $this->validateType($value, $type);
  47991. }
  47992. if ($isValid === false) {
  47993. if (!is_array($type)) {
  47994. $this->validateTypeNameWording($type);
  47995. $wording[] = self::$wording[$type];
  47996. }
  47997. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  47998. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  47999. }
  48000. }
  48001. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  48002. {
  48003. foreach ($type as $tp) {
  48004. if (is_object($tp)) {
  48005. if (!$isValid) {
  48006. $validator = $this->factory->createInstanceFor('type');
  48007. $subSchema = new \stdClass();
  48008. $subSchema->type = $tp;
  48009. $validator->check($value, $subSchema, $path, null);
  48010. $error = $validator->getErrors();
  48011. $isValid = !(bool) $error;
  48012. $validTypesWording[] = self::$wording['object'];
  48013. }
  48014. } else {
  48015. $this->validateTypeNameWording($tp);
  48016. $validTypesWording[] = self::$wording[$tp];
  48017. if (!$isValid) {
  48018. $isValid = $this->validateType($value, $tp);
  48019. }
  48020. }
  48021. }
  48022. }
  48023. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  48024. {
  48025. if ($listEnd === false || !isset($elements[1])) {
  48026. return implode($delimiter, $elements);
  48027. }
  48028. $lastElement = array_slice($elements, -1);
  48029. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  48030. $implodedElements = array_merge(array($firsElements), $lastElement);
  48031. return join(" $listEnd ", $implodedElements);
  48032. }
  48033. protected function validateTypeNameWording($type)
  48034. {
  48035. if (!isset(self::$wording[$type])) {
  48036. throw new StandardUnexpectedValueException(
  48037. sprintf(
  48038. 'No wording for %s available, expected wordings are: [%s]',
  48039. var_export($type, true),
  48040. implode(', ', array_filter(self::$wording)))
  48041. );
  48042. }
  48043. }
  48044. protected function validateType(&$value, $type)
  48045. {
  48046. if (!$type) {
  48047. return true;
  48048. }
  48049. if ('any' === $type) {
  48050. return true;
  48051. }
  48052. if ('object' === $type) {
  48053. return $this->getTypeCheck()->isObject($value);
  48054. }
  48055. if ('array' === $type) {
  48056. return $this->getTypeCheck()->isArray($value);
  48057. }
  48058. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  48059. if ('integer' === $type) {
  48060. if ($coerce) {
  48061. $value = $this->toInteger($value);
  48062. }
  48063. return is_int($value);
  48064. }
  48065. if ('number' === $type) {
  48066. if ($coerce) {
  48067. $value = $this->toNumber($value);
  48068. }
  48069. return is_numeric($value) && !is_string($value);
  48070. }
  48071. if ('boolean' === $type) {
  48072. if ($coerce) {
  48073. $value = $this->toBoolean($value);
  48074. }
  48075. return is_bool($value);
  48076. }
  48077. if ('string' === $type) {
  48078. return is_string($value);
  48079. }
  48080. if ('email' === $type) {
  48081. return is_string($value);
  48082. }
  48083. if ('null' === $type) {
  48084. return is_null($value);
  48085. }
  48086. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  48087. }
  48088. protected function toBoolean($value)
  48089. {
  48090. if ($value === 'true') {
  48091. return true;
  48092. }
  48093. if ($value === 'false') {
  48094. return false;
  48095. }
  48096. return $value;
  48097. }
  48098. protected function toNumber($value)
  48099. {
  48100. if (is_numeric($value)) {
  48101. return $value + 0;
  48102. }
  48103. return $value;
  48104. }
  48105. protected function toInteger($value)
  48106. {
  48107. if (is_numeric($value) && (int) $value == $value) {
  48108. return (int) $value;
  48109. }
  48110. return $value;
  48111. }
  48112. }
  48113. <?php
  48114. namespace JsonSchema\Constraints;
  48115. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  48116. use JsonSchema\Entity\JsonPointer;
  48117. use JsonSchema\Exception\ValidationException;
  48118. use JsonSchema\Uri\UriResolver;
  48119. class UndefinedConstraint extends Constraint
  48120. {
  48121. protected $appliedDefaults = array();
  48122. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  48123. {
  48124. if (is_null($schema) || !is_object($schema)) {
  48125. return;
  48126. }
  48127. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  48128. if ($fromDefault) {
  48129. $path->setFromDefault();
  48130. }
  48131. $this->validateCommonProperties($value, $schema, $path, $i);
  48132. $this->validateOfProperties($value, $schema, $path, '');
  48133. $this->validateTypes($value, $schema, $path, $i);
  48134. }
  48135. public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null)
  48136. {
  48137. if ($this->getTypeCheck()->isArray($value)) {
  48138. $this->checkArray($value, $schema, $path, $i);
  48139. }
  48140. if (LooseTypeCheck::isObject($value)) {
  48141. $this->checkObject(
  48142. $value,
  48143. $schema,
  48144. $path,
  48145. isset($schema->properties) ? $schema->properties : null,
  48146. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  48147. isset($schema->patternProperties) ? $schema->patternProperties : null,
  48148. $this->appliedDefaults
  48149. );
  48150. }
  48151. if (is_string($value)) {
  48152. $this->checkString($value, $schema, $path, $i);
  48153. }
  48154. if (is_numeric($value)) {
  48155. $this->checkNumber($value, $schema, $path, $i);
  48156. }
  48157. if (isset($schema->enum)) {
  48158. $this->checkEnum($value, $schema, $path, $i);
  48159. }
  48160. }
  48161. protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '')
  48162. {
  48163. if (isset($schema->extends)) {
  48164. if (is_string($schema->extends)) {
  48165. $schema->extends = $this->validateUri($schema, $schema->extends);
  48166. }
  48167. if (is_array($schema->extends)) {
  48168. foreach ($schema->extends as $extends) {
  48169. $this->checkUndefined($value, $extends, $path, $i);
  48170. }
  48171. } else {
  48172. $this->checkUndefined($value, $schema->extends, $path, $i);
  48173. }
  48174. }
  48175. if (!$path->fromDefault()) {
  48176. $this->applyDefaultValues($value, $schema, $path);
  48177. }
  48178. if ($this->getTypeCheck()->isObject($value)) {
  48179. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  48180. foreach ($schema->required as $required) {
  48181. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  48182. $this->addError(
  48183. $this->incrementPath($path ?: new JsonPointer(''), $required),
  48184. 'The property ' . $required . ' is required',
  48185. 'required'
  48186. );
  48187. }
  48188. }
  48189. } elseif (isset($schema->required) && !is_array($schema->required)) {
  48190. if ($schema->required && $value instanceof self) {
  48191. $propertyPaths = $path->getPropertyPaths();
  48192. $propertyName = end($propertyPaths);
  48193. $this->addError(
  48194. $path,
  48195. 'The property ' . $propertyName . ' is required',
  48196. 'required'
  48197. );
  48198. }
  48199. }
  48200. }
  48201. if (!($value instanceof self)) {
  48202. $this->checkType($value, $schema, $path, $i);
  48203. }
  48204. if (isset($schema->disallow)) {
  48205. $initErrors = $this->getErrors();
  48206. $typeSchema = new \stdClass();
  48207. $typeSchema->type = $schema->disallow;
  48208. $this->checkType($value, $typeSchema, $path);
  48209. if (count($this->getErrors()) == count($initErrors)) {
  48210. $this->addError($path, 'Disallowed value was matched', 'disallow');
  48211. } else {
  48212. $this->errors = $initErrors;
  48213. }
  48214. }
  48215. if (isset($schema->not)) {
  48216. $initErrors = $this->getErrors();
  48217. $this->checkUndefined($value, $schema->not, $path, $i);
  48218. if (count($this->getErrors()) == count($initErrors)) {
  48219. $this->addError($path, 'Matched a schema which it should not', 'not');
  48220. } else {
  48221. $this->errors = $initErrors;
  48222. }
  48223. }
  48224. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  48225. $this->validateDependencies($value, $schema->dependencies, $path);
  48226. }
  48227. }
  48228. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  48229. {
  48230. if (!$requiredOnly) {
  48231. return true;
  48232. }
  48233. if (
  48234. $name !== null
  48235. && isset($parentSchema->required)
  48236. && is_array($parentSchema->required)
  48237. && in_array($name, $parentSchema->required)
  48238. ) {
  48239. return true;
  48240. }
  48241. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  48242. return true;
  48243. }
  48244. return false;
  48245. }
  48246. protected function applyDefaultValues(&$value, $schema, $path)
  48247. {
  48248. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  48249. return;
  48250. }
  48251. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  48252. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  48253. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  48254. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  48255. if (
  48256. !LooseTypeCheck::propertyExists($value, $currentProperty)
  48257. && property_exists($propertyDefinition, 'default')
  48258. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  48259. ) {
  48260. if (is_object($propertyDefinition->default)) {
  48261. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  48262. } else {
  48263. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  48264. }
  48265. $this->appliedDefaults[] = $currentProperty;
  48266. }
  48267. }
  48268. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  48269. $items = array();
  48270. if (LooseTypeCheck::isArray($schema->items)) {
  48271. $items = $schema->items;
  48272. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  48273. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  48274. }
  48275. foreach ($items as $currentItem => $itemDefinition) {
  48276. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  48277. if (
  48278. !array_key_exists($currentItem, $value)
  48279. && property_exists($itemDefinition, 'default')
  48280. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  48281. if (is_object($itemDefinition->default)) {
  48282. $value[$currentItem] = clone $itemDefinition->default;
  48283. } else {
  48284. $value[$currentItem] = $itemDefinition->default;
  48285. }
  48286. }
  48287. $path->setFromDefault();
  48288. }
  48289. } elseif (
  48290. $value instanceof self
  48291. && property_exists($schema, 'default')
  48292. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  48293. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  48294. $path->setFromDefault();
  48295. }
  48296. }
  48297. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  48298. {
  48299. if ($value instanceof self) {
  48300. return;
  48301. }
  48302. if (isset($schema->allOf)) {
  48303. $isValid = true;
  48304. foreach ($schema->allOf as $allOf) {
  48305. $initErrors = $this->getErrors();
  48306. $this->checkUndefined($value, $allOf, $path, $i);
  48307. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  48308. }
  48309. if (!$isValid) {
  48310. $this->addError($path, 'Failed to match all schemas', 'allOf');
  48311. }
  48312. }
  48313. if (isset($schema->anyOf)) {
  48314. $isValid = false;
  48315. $startErrors = $this->getErrors();
  48316. $caughtException = null;
  48317. foreach ($schema->anyOf as $anyOf) {
  48318. $initErrors = $this->getErrors();
  48319. try {
  48320. $this->checkUndefined($value, $anyOf, $path, $i);
  48321. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  48322. break;
  48323. }
  48324. } catch (ValidationException $e) {
  48325. $isValid = false;
  48326. }
  48327. }
  48328. if (!$isValid) {
  48329. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  48330. } else {
  48331. $this->errors = $startErrors;
  48332. }
  48333. }
  48334. if (isset($schema->oneOf)) {
  48335. $allErrors = array();
  48336. $matchedSchemas = 0;
  48337. $startErrors = $this->getErrors();
  48338. foreach ($schema->oneOf as $oneOf) {
  48339. try {
  48340. $this->errors = array();
  48341. $this->checkUndefined($value, $oneOf, $path, $i);
  48342. if (count($this->getErrors()) == 0) {
  48343. $matchedSchemas++;
  48344. }
  48345. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  48346. } catch (ValidationException $e) {
  48347. }
  48348. }
  48349. if ($matchedSchemas !== 1) {
  48350. $this->addErrors(array_merge($allErrors, $startErrors));
  48351. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  48352. } else {
  48353. $this->errors = $startErrors;
  48354. }
  48355. }
  48356. }
  48357. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  48358. {
  48359. foreach ($dependencies as $key => $dependency) {
  48360. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  48361. if (is_string($dependency)) {
  48362. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  48363. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  48364. }
  48365. } elseif (is_array($dependency)) {
  48366. foreach ($dependency as $d) {
  48367. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  48368. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  48369. }
  48370. }
  48371. } elseif (is_object($dependency)) {
  48372. $this->checkUndefined($value, $dependency, $path, $i);
  48373. }
  48374. }
  48375. }
  48376. }
  48377. protected function validateUri($schema, $schemaUri = null)
  48378. {
  48379. $resolver = new UriResolver();
  48380. $retriever = $this->factory->getUriRetriever();
  48381. $jsonSchema = null;
  48382. if ($resolver->isValid($schemaUri)) {
  48383. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  48384. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  48385. }
  48386. return $jsonSchema;
  48387. }
  48388. }
  48389. <?php
  48390. namespace JsonSchema\Entity;
  48391. use JsonSchema\Exception\InvalidArgumentException;
  48392. class JsonPointer
  48393. {
  48394. private $filename;
  48395. private $propertyPaths = array();
  48396. private $fromDefault = false;
  48397. public function __construct($value)
  48398. {
  48399. if (!is_string($value)) {
  48400. throw new InvalidArgumentException('Ref value must be a string');
  48401. }
  48402. $splitRef = explode('#', $value, 2);
  48403. $this->filename = $splitRef[0];
  48404. if (array_key_exists(1, $splitRef)) {
  48405. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  48406. }
  48407. }
  48408. private function decodePropertyPaths($propertyPathString)
  48409. {
  48410. $paths = array();
  48411. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  48412. $path = $this->decodePath($path);
  48413. if (is_string($path) && '' !== $path) {
  48414. $paths[] = $path;
  48415. }
  48416. }
  48417. return $paths;
  48418. }
  48419. private function encodePropertyPaths()
  48420. {
  48421. return array_map(
  48422. array($this, 'encodePath'),
  48423. $this->getPropertyPaths()
  48424. );
  48425. }
  48426. private function decodePath($path)
  48427. {
  48428. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  48429. }
  48430. private function encodePath($path)
  48431. {
  48432. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  48433. }
  48434. public function getFilename()
  48435. {
  48436. return $this->filename;
  48437. }
  48438. public function getPropertyPaths()
  48439. {
  48440. return $this->propertyPaths;
  48441. }
  48442. public function withPropertyPaths(array $propertyPaths)
  48443. {
  48444. $new = clone $this;
  48445. $new->propertyPaths = $propertyPaths;
  48446. return $new;
  48447. }
  48448. public function getPropertyPathAsString()
  48449. {
  48450. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  48451. }
  48452. public function __toString()
  48453. {
  48454. return $this->getFilename() . $this->getPropertyPathAsString();
  48455. }
  48456. public function setFromDefault()
  48457. {
  48458. $this->fromDefault = true;
  48459. }
  48460. public function fromDefault()
  48461. {
  48462. return $this->fromDefault;
  48463. }
  48464. }
  48465. <?php
  48466. namespace JsonSchema\Exception;
  48467. interface ExceptionInterface
  48468. {
  48469. }
  48470. <?php
  48471. namespace JsonSchema\Exception;
  48472. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  48473. {
  48474. }
  48475. <?php
  48476. namespace JsonSchema\Exception;
  48477. class InvalidConfigException extends RuntimeException
  48478. {
  48479. }
  48480. <?php
  48481. namespace JsonSchema\Exception;
  48482. class InvalidSchemaException extends RuntimeException
  48483. {
  48484. }
  48485. <?php
  48486. namespace JsonSchema\Exception;
  48487. class InvalidSchemaMediaTypeException extends RuntimeException
  48488. {
  48489. }
  48490. <?php
  48491. namespace JsonSchema\Exception;
  48492. class InvalidSourceUriException extends InvalidArgumentException
  48493. {
  48494. }
  48495. <?php
  48496. namespace JsonSchema\Exception;
  48497. class JsonDecodingException extends RuntimeException
  48498. {
  48499. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  48500. {
  48501. switch ($code) {
  48502. case JSON_ERROR_DEPTH:
  48503. $message = 'The maximum stack depth has been exceeded';
  48504. break;
  48505. case JSON_ERROR_STATE_MISMATCH:
  48506. $message = 'Invalid or malformed JSON';
  48507. break;
  48508. case JSON_ERROR_CTRL_CHAR:
  48509. $message = 'Control character error, possibly incorrectly encoded';
  48510. break;
  48511. case JSON_ERROR_UTF8:
  48512. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  48513. break;
  48514. case JSON_ERROR_SYNTAX:
  48515. $message = 'JSON syntax is malformed';
  48516. break;
  48517. default:
  48518. $message = 'Syntax error';
  48519. }
  48520. parent::__construct($message, $code, $previous);
  48521. }
  48522. }
  48523. <?php
  48524. namespace JsonSchema\Exception;
  48525. class ResourceNotFoundException extends RuntimeException
  48526. {
  48527. }
  48528. <?php
  48529. namespace JsonSchema\Exception;
  48530. class RuntimeException extends \RuntimeException implements ExceptionInterface
  48531. {
  48532. }
  48533. <?php
  48534. namespace JsonSchema\Exception;
  48535. class UnresolvableJsonPointerException extends InvalidArgumentException
  48536. {
  48537. }
  48538. <?php
  48539. namespace JsonSchema\Exception;
  48540. class UriResolverException extends RuntimeException
  48541. {
  48542. }
  48543. <?php
  48544. namespace JsonSchema\Exception;
  48545. class ValidationException extends RuntimeException
  48546. {
  48547. }
  48548. <?php
  48549. namespace JsonSchema\Iterator;
  48550. class ObjectIterator implements \Iterator, \Countable
  48551. {
  48552. private $object;
  48553. private $position = 0;
  48554. private $data = array();
  48555. private $initialized = false;
  48556. public function __construct($object)
  48557. {
  48558. $this->object = $object;
  48559. }
  48560. public function current()
  48561. {
  48562. $this->initialize();
  48563. return $this->data[$this->position];
  48564. }
  48565. public function next()
  48566. {
  48567. $this->initialize();
  48568. $this->position++;
  48569. }
  48570. public function key()
  48571. {
  48572. $this->initialize();
  48573. return $this->position;
  48574. }
  48575. public function valid()
  48576. {
  48577. $this->initialize();
  48578. return isset($this->data[$this->position]);
  48579. }
  48580. public function rewind()
  48581. {
  48582. $this->initialize();
  48583. $this->position = 0;
  48584. }
  48585. public function count()
  48586. {
  48587. $this->initialize();
  48588. return count($this->data);
  48589. }
  48590. private function initialize()
  48591. {
  48592. if (!$this->initialized) {
  48593. $this->data = $this->buildDataFromObject($this->object);
  48594. $this->initialized = true;
  48595. }
  48596. }
  48597. private function buildDataFromObject($object)
  48598. {
  48599. $result = array();
  48600. $stack = new \SplStack();
  48601. $stack->push($object);
  48602. while (!$stack->isEmpty()) {
  48603. $current = $stack->pop();
  48604. if (is_object($current)) {
  48605. array_push($result, $current);
  48606. }
  48607. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  48608. if (is_object($propertyValue) || is_array($propertyValue)) {
  48609. $stack->push($propertyValue);
  48610. }
  48611. }
  48612. }
  48613. return $result;
  48614. }
  48615. private function getDataFromItem($item)
  48616. {
  48617. if (!is_object($item) && !is_array($item)) {
  48618. return array();
  48619. }
  48620. return is_object($item) ? get_object_vars($item) : $item;
  48621. }
  48622. }
  48623. <?php
  48624. namespace JsonSchema;
  48625. class Rfc3339
  48626. {
  48627. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  48628. public static function createFromString($string)
  48629. {
  48630. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  48631. return null;
  48632. }
  48633. $dateAndTime = $matches[1];
  48634. $microseconds = $matches[2] ?: '.000000';
  48635. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  48636. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  48637. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  48638. return $dateTime ?: null;
  48639. }
  48640. }
  48641. <?php
  48642. namespace JsonSchema;
  48643. use JsonSchema\Constraints\BaseConstraint;
  48644. use JsonSchema\Entity\JsonPointer;
  48645. use JsonSchema\Exception\UnresolvableJsonPointerException;
  48646. use JsonSchema\Uri\UriResolver;
  48647. use JsonSchema\Uri\UriRetriever;
  48648. class SchemaStorage implements SchemaStorageInterface
  48649. {
  48650. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  48651. protected $uriRetriever;
  48652. protected $uriResolver;
  48653. protected $schemas = array();
  48654. public function __construct(
  48655. UriRetrieverInterface $uriRetriever = null,
  48656. UriResolverInterface $uriResolver = null
  48657. ) {
  48658. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  48659. $this->uriResolver = $uriResolver ?: new UriResolver();
  48660. }
  48661. public function getUriRetriever()
  48662. {
  48663. return $this->uriRetriever;
  48664. }
  48665. public function getUriResolver()
  48666. {
  48667. return $this->uriResolver;
  48668. }
  48669. public function addSchema($id, $schema = null)
  48670. {
  48671. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  48672. $schema = $this->uriRetriever->retrieve($id);
  48673. }
  48674. if (is_array($schema)) {
  48675. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  48676. }
  48677. if (is_object($schema) && property_exists($schema, 'id')) {
  48678. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  48679. $schema->properties->id->format = 'uri-reference';
  48680. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  48681. $schema->properties->id->format = 'uri-reference';
  48682. $schema->properties->{'$ref'}->format = 'uri-reference';
  48683. }
  48684. }
  48685. $this->expandRefs($schema, $id);
  48686. $this->schemas[$id] = $schema;
  48687. }
  48688. private function expandRefs(&$schema, $base = null)
  48689. {
  48690. if (!is_object($schema)) {
  48691. if (is_array($schema)) {
  48692. foreach ($schema as &$member) {
  48693. $this->expandRefs($member, $base);
  48694. }
  48695. }
  48696. return;
  48697. }
  48698. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  48699. $base = $this->uriResolver->resolve($schema->id, $base);
  48700. }
  48701. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  48702. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  48703. $schema->{'$ref'} = (string) $refPointer;
  48704. }
  48705. foreach ($schema as &$member) {
  48706. $this->expandRefs($member, $base);
  48707. }
  48708. }
  48709. public function getSchema($id)
  48710. {
  48711. if (!array_key_exists($id, $this->schemas)) {
  48712. $this->addSchema($id);
  48713. }
  48714. return $this->schemas[$id];
  48715. }
  48716. public function resolveRef($ref)
  48717. {
  48718. $jsonPointer = new JsonPointer($ref);
  48719. $fileName = $jsonPointer->getFilename();
  48720. if (!strlen($fileName)) {
  48721. throw new UnresolvableJsonPointerException(sprintf(
  48722. "Could not resolve fragment '%s': no file is defined",
  48723. $jsonPointer->getPropertyPathAsString()
  48724. ));
  48725. }
  48726. $refSchema = $this->getSchema($fileName);
  48727. foreach ($jsonPointer->getPropertyPaths() as $path) {
  48728. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  48729. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  48730. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  48731. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  48732. } else {
  48733. throw new UnresolvableJsonPointerException(sprintf(
  48734. 'File: %s is found, but could not resolve fragment: %s',
  48735. $jsonPointer->getFilename(),
  48736. $jsonPointer->getPropertyPathAsString()
  48737. ));
  48738. }
  48739. }
  48740. return $refSchema;
  48741. }
  48742. public function resolveRefSchema($refSchema)
  48743. {
  48744. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  48745. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  48746. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  48747. unset($refSchema->{'$ref'});
  48748. }
  48749. return $refSchema;
  48750. }
  48751. }
  48752. <?php
  48753. namespace JsonSchema;
  48754. interface SchemaStorageInterface
  48755. {
  48756. public function addSchema($id, $schema = null);
  48757. public function getSchema($id);
  48758. public function resolveRef($ref);
  48759. public function resolveRefSchema($refSchema);
  48760. }
  48761. <?php
  48762. namespace JsonSchema\Uri\Retrievers;
  48763. abstract class AbstractRetriever implements UriRetrieverInterface
  48764. {
  48765. protected $contentType;
  48766. public function getContentType()
  48767. {
  48768. return $this->contentType;
  48769. }
  48770. }
  48771. <?php
  48772. namespace JsonSchema\Uri\Retrievers;
  48773. use JsonSchema\Exception\RuntimeException;
  48774. use JsonSchema\Validator;
  48775. class Curl extends AbstractRetriever
  48776. {
  48777. protected $messageBody;
  48778. public function __construct()
  48779. {
  48780. if (!function_exists('curl_init')) {
  48781. throw new RuntimeException('cURL not installed');
  48782. }
  48783. }
  48784. public function retrieve($uri)
  48785. {
  48786. $ch = curl_init();
  48787. curl_setopt($ch, CURLOPT_URL, $uri);
  48788. curl_setopt($ch, CURLOPT_HEADER, true);
  48789. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  48790. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  48791. $response = curl_exec($ch);
  48792. if (false === $response) {
  48793. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  48794. }
  48795. $this->fetchMessageBody($response);
  48796. $this->fetchContentType($response);
  48797. curl_close($ch);
  48798. return $this->messageBody;
  48799. }
  48800. private function fetchMessageBody($response)
  48801. {
  48802. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  48803. $this->messageBody = $match[1];
  48804. }
  48805. protected function fetchContentType($response)
  48806. {
  48807. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  48808. $this->contentType = trim($match[1]);
  48809. return true;
  48810. }
  48811. return false;
  48812. }
  48813. }
  48814. <?php
  48815. namespace JsonSchema\Uri\Retrievers;
  48816. use JsonSchema\Exception\ResourceNotFoundException;
  48817. class FileGetContents extends AbstractRetriever
  48818. {
  48819. protected $messageBody;
  48820. public function retrieve($uri)
  48821. {
  48822. $errorMessage = null;
  48823. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  48824. $errorMessage = $errstr;
  48825. });
  48826. $response = file_get_contents($uri);
  48827. restore_error_handler();
  48828. if ($errorMessage) {
  48829. throw new ResourceNotFoundException($errorMessage);
  48830. }
  48831. if (false === $response) {
  48832. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  48833. }
  48834. if ($response == ''
  48835. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  48836. ) {
  48837. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  48838. }
  48839. $this->messageBody = $response;
  48840. if (!empty($http_response_header)) {
  48841. $this->fetchContentType($http_response_header);
  48842. } else {
  48843. $this->contentType = null;
  48844. }
  48845. return $this->messageBody;
  48846. }
  48847. private function fetchContentType(array $headers)
  48848. {
  48849. foreach ($headers as $header) {
  48850. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  48851. return true;
  48852. }
  48853. }
  48854. return false;
  48855. }
  48856. protected static function getContentTypeMatchInHeader($header)
  48857. {
  48858. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  48859. return trim($match[1]);
  48860. }
  48861. return null;
  48862. }
  48863. }
  48864. <?php
  48865. namespace JsonSchema\Uri\Retrievers;
  48866. use JsonSchema\Validator;
  48867. class PredefinedArray extends AbstractRetriever
  48868. {
  48869. private $schemas;
  48870. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  48871. {
  48872. $this->schemas = $schemas;
  48873. $this->contentType = $contentType;
  48874. }
  48875. public function retrieve($uri)
  48876. {
  48877. if (!array_key_exists($uri, $this->schemas)) {
  48878. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  48879. 'The JSON schema "%s" was not found.',
  48880. $uri
  48881. ));
  48882. }
  48883. return $this->schemas[$uri];
  48884. }
  48885. }
  48886. <?php
  48887. namespace JsonSchema\Uri\Retrievers;
  48888. interface UriRetrieverInterface
  48889. {
  48890. public function retrieve($uri);
  48891. public function getContentType();
  48892. }
  48893. <?php
  48894. namespace JsonSchema\Uri;
  48895. use JsonSchema\Exception\UriResolverException;
  48896. use JsonSchema\UriResolverInterface;
  48897. class UriResolver implements UriResolverInterface
  48898. {
  48899. public function parse($uri)
  48900. {
  48901. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  48902. $components = array();
  48903. if (5 < count($match)) {
  48904. $components = array(
  48905. 'scheme' => $match[2],
  48906. 'authority' => $match[4],
  48907. 'path' => $match[5]
  48908. );
  48909. }
  48910. if (7 < count($match)) {
  48911. $components['query'] = $match[7];
  48912. }
  48913. if (9 < count($match)) {
  48914. $components['fragment'] = $match[9];
  48915. }
  48916. return $components;
  48917. }
  48918. public function generate(array $components)
  48919. {
  48920. $uri = $components['scheme'] . '://'
  48921. . $components['authority']
  48922. . $components['path'];
  48923. if (array_key_exists('query', $components) && strlen($components['query'])) {
  48924. $uri .= '?' . $components['query'];
  48925. }
  48926. if (array_key_exists('fragment', $components)) {
  48927. $uri .= '#' . $components['fragment'];
  48928. }
  48929. return $uri;
  48930. }
  48931. public function resolve($uri, $baseUri = null)
  48932. {
  48933. if (
  48934. !is_null($baseUri) &&
  48935. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  48936. !preg_match('|^[^/]+://|u', $baseUri)
  48937. ) {
  48938. if (is_file($baseUri)) {
  48939. $baseUri = 'file://' . realpath($baseUri);
  48940. } elseif (is_dir($baseUri)) {
  48941. $baseUri = 'file://' . realpath($baseUri) . '/';
  48942. } else {
  48943. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  48944. }
  48945. }
  48946. if ($uri == '') {
  48947. return $baseUri;
  48948. }
  48949. $components = $this->parse($uri);
  48950. $path = $components['path'];
  48951. if (!empty($components['scheme'])) {
  48952. return $uri;
  48953. }
  48954. $baseComponents = $this->parse($baseUri);
  48955. $basePath = $baseComponents['path'];
  48956. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  48957. if (isset($components['fragment'])) {
  48958. $baseComponents['fragment'] = $components['fragment'];
  48959. }
  48960. return $this->generate($baseComponents);
  48961. }
  48962. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  48963. {
  48964. $relativePath = self::normalizePath($relativePath);
  48965. if ($relativePath == '') {
  48966. return $basePath;
  48967. }
  48968. if ($relativePath[0] == '/') {
  48969. return $relativePath;
  48970. }
  48971. $basePathSegments = explode('/', $basePath);
  48972. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  48973. $numLevelUp = strlen($match[0]) /3 + 1;
  48974. if ($numLevelUp >= count($basePathSegments)) {
  48975. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  48976. }
  48977. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  48978. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  48979. return implode('/', $basePathSegments) . '/' . $path;
  48980. }
  48981. private static function normalizePath($path)
  48982. {
  48983. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  48984. $path = preg_replace('|//|', '/', $path);
  48985. return $path;
  48986. }
  48987. public function isValid($uri)
  48988. {
  48989. $components = $this->parse($uri);
  48990. return !empty($components);
  48991. }
  48992. }
  48993. <?php
  48994. namespace JsonSchema\Uri;
  48995. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  48996. use JsonSchema\Exception\JsonDecodingException;
  48997. use JsonSchema\Exception\ResourceNotFoundException;
  48998. use JsonSchema\Uri\Retrievers\FileGetContents;
  48999. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  49000. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  49001. use JsonSchema\Validator;
  49002. class UriRetriever implements BaseUriRetrieverInterface
  49003. {
  49004. protected $translationMap = array(
  49005. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  49006. );
  49007. protected $uriRetriever = null;
  49008. private $schemaCache = array();
  49009. public function confirmMediaType($uriRetriever, $uri)
  49010. {
  49011. $contentType = $uriRetriever->getContentType();
  49012. if (is_null($contentType)) {
  49013. return;
  49014. }
  49015. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  49016. return;
  49017. }
  49018. if (substr($uri, 0, 23) == 'http://json-schema.org/') {
  49019. return true;
  49020. }
  49021. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  49022. }
  49023. public function getUriRetriever()
  49024. {
  49025. if (is_null($this->uriRetriever)) {
  49026. $this->setUriRetriever(new FileGetContents());
  49027. }
  49028. return $this->uriRetriever;
  49029. }
  49030. public function resolvePointer($jsonSchema, $uri)
  49031. {
  49032. $resolver = new UriResolver();
  49033. $parsed = $resolver->parse($uri);
  49034. if (empty($parsed['fragment'])) {
  49035. return $jsonSchema;
  49036. }
  49037. $path = explode('/', $parsed['fragment']);
  49038. while ($path) {
  49039. $pathElement = array_shift($path);
  49040. if (!empty($pathElement)) {
  49041. $pathElement = str_replace('~1', '/', $pathElement);
  49042. $pathElement = str_replace('~0', '~', $pathElement);
  49043. if (!empty($jsonSchema->$pathElement)) {
  49044. $jsonSchema = $jsonSchema->$pathElement;
  49045. } else {
  49046. throw new ResourceNotFoundException(
  49047. 'Fragment "' . $parsed['fragment'] . '" not found'
  49048. . ' in ' . $uri
  49049. );
  49050. }
  49051. if (!is_object($jsonSchema)) {
  49052. throw new ResourceNotFoundException(
  49053. 'Fragment part "' . $pathElement . '" is no object '
  49054. . ' in ' . $uri
  49055. );
  49056. }
  49057. }
  49058. }
  49059. return $jsonSchema;
  49060. }
  49061. public function retrieve($uri, $baseUri = null, $translate = true)
  49062. {
  49063. $resolver = new UriResolver();
  49064. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  49065. $arParts = $resolver->parse($resolvedUri);
  49066. if (isset($arParts['fragment'])) {
  49067. unset($arParts['fragment']);
  49068. $fetchUri = $resolver->generate($arParts);
  49069. }
  49070. if ($translate) {
  49071. $fetchUri = $this->translate($fetchUri);
  49072. }
  49073. $jsonSchema = $this->loadSchema($fetchUri);
  49074. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  49075. if ($jsonSchema instanceof \stdClass) {
  49076. $jsonSchema->id = $resolvedUri;
  49077. }
  49078. return $jsonSchema;
  49079. }
  49080. protected function loadSchema($fetchUri)
  49081. {
  49082. if (isset($this->schemaCache[$fetchUri])) {
  49083. return $this->schemaCache[$fetchUri];
  49084. }
  49085. $uriRetriever = $this->getUriRetriever();
  49086. $contents = $this->uriRetriever->retrieve($fetchUri);
  49087. $this->confirmMediaType($uriRetriever, $fetchUri);
  49088. $jsonSchema = json_decode($contents);
  49089. if (JSON_ERROR_NONE < $error = json_last_error()) {
  49090. throw new JsonDecodingException($error);
  49091. }
  49092. $this->schemaCache[$fetchUri] = $jsonSchema;
  49093. return $jsonSchema;
  49094. }
  49095. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  49096. {
  49097. $this->uriRetriever = $uriRetriever;
  49098. return $this;
  49099. }
  49100. public function parse($uri)
  49101. {
  49102. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  49103. $components = array();
  49104. if (5 < count($match)) {
  49105. $components = array(
  49106. 'scheme' => $match[2],
  49107. 'authority' => $match[4],
  49108. 'path' => $match[5]
  49109. );
  49110. }
  49111. if (7 < count($match)) {
  49112. $components['query'] = $match[7];
  49113. }
  49114. if (9 < count($match)) {
  49115. $components['fragment'] = $match[9];
  49116. }
  49117. return $components;
  49118. }
  49119. public function generate(array $components)
  49120. {
  49121. $uri = $components['scheme'] . '://'
  49122. . $components['authority']
  49123. . $components['path'];
  49124. if (array_key_exists('query', $components)) {
  49125. $uri .= $components['query'];
  49126. }
  49127. if (array_key_exists('fragment', $components)) {
  49128. $uri .= $components['fragment'];
  49129. }
  49130. return $uri;
  49131. }
  49132. public function resolve($uri, $baseUri = null)
  49133. {
  49134. $components = $this->parse($uri);
  49135. $path = $components['path'];
  49136. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  49137. return $uri;
  49138. }
  49139. $baseComponents = $this->parse($baseUri);
  49140. $basePath = $baseComponents['path'];
  49141. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  49142. return $this->generate($baseComponents);
  49143. }
  49144. public function isValid($uri)
  49145. {
  49146. $components = $this->parse($uri);
  49147. return !empty($components);
  49148. }
  49149. public function setTranslation($from, $to)
  49150. {
  49151. $this->translationMap[$from] = $to;
  49152. }
  49153. public function translate($uri)
  49154. {
  49155. foreach ($this->translationMap as $from => $to) {
  49156. $uri = preg_replace($from, $to, $uri);
  49157. }
  49158. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  49159. return $uri;
  49160. }
  49161. }
  49162. <?php
  49163. namespace JsonSchema;
  49164. interface UriResolverInterface
  49165. {
  49166. public function resolve($uri, $baseUri = null);
  49167. }
  49168. <?php
  49169. namespace JsonSchema;
  49170. interface UriRetrieverInterface
  49171. {
  49172. public function retrieve($uri, $baseUri = null);
  49173. }
  49174. <?php
  49175. namespace JsonSchema;
  49176. use JsonSchema\Constraints\BaseConstraint;
  49177. use JsonSchema\Constraints\Constraint;
  49178. class Validator extends BaseConstraint
  49179. {
  49180. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  49181. const ERROR_NONE = 0x00000000;
  49182. const ERROR_ALL = 0xFFFFFFFF;
  49183. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  49184. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  49185. public function validate(&$value, $schema = null, $checkMode = null)
  49186. {
  49187. if (is_array($schema)) {
  49188. $schema = self::arrayToObjectRecursive($schema);
  49189. }
  49190. $initialCheckMode = $this->factory->getConfig();
  49191. if ($checkMode !== null) {
  49192. $this->factory->setConfig($checkMode);
  49193. }
  49194. if (is_object($schema) && property_exists($schema, 'id')) {
  49195. $schemaURI = $schema->id;
  49196. } else {
  49197. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  49198. }
  49199. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  49200. $validator = $this->factory->createInstanceFor('schema');
  49201. $validator->check(
  49202. $value,
  49203. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  49204. );
  49205. $this->factory->setConfig($initialCheckMode);
  49206. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  49207. return $validator->getErrorMask();
  49208. }
  49209. public function check($value, $schema)
  49210. {
  49211. return $this->validate($value, $schema);
  49212. }
  49213. public function coerce(&$value, $schema)
  49214. {
  49215. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  49216. }
  49217. }
  49218. Copyright (C) 2015 Composer
  49219. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49220. this software and associated documentation files (the "Software"), to deal in
  49221. the Software without restriction, including without limitation the rights to
  49222. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49223. of the Software, and to permit persons to whom the Software is furnished to do
  49224. so, subject to the following conditions:
  49225. The above copyright notice and this permission notice shall be included in all
  49226. copies or substantial portions of the Software.
  49227. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49228. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49229. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49230. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49231. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49232. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49233. SOFTWARE.
  49234. <?php
  49235. namespace Composer\Spdx;
  49236. class SpdxLicenses
  49237. {
  49238. const LICENSES_FILE = 'spdx-licenses.json';
  49239. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  49240. private $licenses;
  49241. private $licensesExpression;
  49242. private $exceptions;
  49243. private $exceptionsExpression;
  49244. public function __construct()
  49245. {
  49246. $this->loadLicenses();
  49247. $this->loadExceptions();
  49248. }
  49249. public function getLicenseByIdentifier($identifier)
  49250. {
  49251. $key = strtolower($identifier);
  49252. if (!isset($this->licenses[$key])) {
  49253. return;
  49254. }
  49255. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  49256. return array(
  49257. $name,
  49258. $isOsiApproved,
  49259. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  49260. $isDeprecatedLicenseId,
  49261. );
  49262. }
  49263. public function getLicenses()
  49264. {
  49265. return $this->licenses;
  49266. }
  49267. public function getExceptionByIdentifier($identifier)
  49268. {
  49269. $key = strtolower($identifier);
  49270. if (!isset($this->exceptions[$key])) {
  49271. return;
  49272. }
  49273. list($identifier, $name) = $this->exceptions[$key];
  49274. return array(
  49275. $name,
  49276. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  49277. );
  49278. }
  49279. public function getIdentifierByName($name)
  49280. {
  49281. foreach ($this->licenses as $licenseData) {
  49282. if ($licenseData[1] === $name) {
  49283. return $licenseData[0];
  49284. }
  49285. }
  49286. foreach ($this->exceptions as $licenseData) {
  49287. if ($licenseData[1] === $name) {
  49288. return $licenseData[0];
  49289. }
  49290. }
  49291. }
  49292. public function isOsiApprovedByIdentifier($identifier)
  49293. {
  49294. return $this->licenses[strtolower($identifier)][2];
  49295. }
  49296. public function isDeprecatedByIdentifier($identifier)
  49297. {
  49298. return $this->licenses[strtolower($identifier)][3];
  49299. }
  49300. public function validate($license)
  49301. {
  49302. if (is_array($license)) {
  49303. $count = count($license);
  49304. if ($count !== count(array_filter($license, 'is_string'))) {
  49305. throw new \InvalidArgumentException('Array of strings expected.');
  49306. }
  49307. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  49308. }
  49309. if (!is_string($license)) {
  49310. throw new \InvalidArgumentException(sprintf(
  49311. 'Array or String expected, %s given.',
  49312. gettype($license)
  49313. ));
  49314. }
  49315. return $this->isValidLicenseString($license);
  49316. }
  49317. public static function getResourcesDir()
  49318. {
  49319. return dirname(__DIR__) . '/res';
  49320. }
  49321. private function loadLicenses()
  49322. {
  49323. if (null !== $this->licenses) {
  49324. return;
  49325. }
  49326. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  49327. $this->licenses = array();
  49328. foreach (json_decode($json, true) as $identifier => $license) {
  49329. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  49330. }
  49331. }
  49332. private function loadExceptions()
  49333. {
  49334. if (null !== $this->exceptions) {
  49335. return;
  49336. }
  49337. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  49338. $this->exceptions = array();
  49339. foreach (json_decode($json, true) as $identifier => $exception) {
  49340. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  49341. }
  49342. }
  49343. private function getLicensesExpression()
  49344. {
  49345. if (null === $this->licensesExpression) {
  49346. $licenses = array_map('preg_quote', array_keys($this->licenses));
  49347. rsort($licenses);
  49348. $licenses = implode('|', $licenses);
  49349. $this->licensesExpression = $licenses;
  49350. }
  49351. return $this->licensesExpression;
  49352. }
  49353. private function getExceptionsExpression()
  49354. {
  49355. if (null === $this->exceptionsExpression) {
  49356. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  49357. rsort($exceptions);
  49358. $exceptions = implode('|', $exceptions);
  49359. $this->exceptionsExpression = $exceptions;
  49360. }
  49361. return $this->exceptionsExpression;
  49362. }
  49363. private function isValidLicenseString($license)
  49364. {
  49365. if (isset($this->licenses[strtolower($license)])) {
  49366. return true;
  49367. }
  49368. $licenses = $this->getLicensesExpression();
  49369. $exceptions = $this->getExceptionsExpression();
  49370. $regex = <<<REGEX
  49371. {
  49372. (?(DEFINE)
  49373. # idstring: 1*( ALPHA / DIGIT / - / . )
  49374. (?<idstring>[\pL\pN.-]{1,})
  49375. # license-id: taken from list
  49376. (?<licenseid>${licenses})
  49377. # license-exception-id: taken from list
  49378. (?<licenseexceptionid>${exceptions})
  49379. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  49380. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  49381. # simple-expresssion: license-id / license-id+ / license-ref
  49382. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  49383. # compound-expression: 1*(
  49384. # simple-expression /
  49385. # simple-expression WITH license-exception-id /
  49386. # compound-expression AND compound-expression /
  49387. # compound-expression OR compound-expression
  49388. # ) / ( compound-expression ) )
  49389. (?<compound_head>
  49390. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  49391. | \( \s* (?&compound_expression) \s* \)
  49392. )
  49393. (?<compound_expression>
  49394. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  49395. )
  49396. # license-expression: 1*1(simple-expression / compound-expression)
  49397. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  49398. ) # end of define
  49399. ^(NONE | NOASSERTION | (?&license_expression))$
  49400. }xi
  49401. REGEX;
  49402. $match = preg_match($regex, $license);
  49403. if (0 === $match) {
  49404. return false;
  49405. }
  49406. if (false === $match) {
  49407. throw new \RuntimeException('Regex failed to compile/run.');
  49408. }
  49409. return true;
  49410. }
  49411. }
  49412. Copyright (C) 2015 Composer
  49413. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49414. this software and associated documentation files (the "Software"), to deal in
  49415. the Software without restriction, including without limitation the rights to
  49416. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49417. of the Software, and to permit persons to whom the Software is furnished to do
  49418. so, subject to the following conditions:
  49419. The above copyright notice and this permission notice shall be included in all
  49420. copies or substantial portions of the Software.
  49421. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49422. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49423. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49424. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49425. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49426. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49427. SOFTWARE.
  49428. <?php
  49429. namespace Composer\Semver;
  49430. use Composer\Semver\Constraint\Constraint;
  49431. class Comparator
  49432. {
  49433. public static function greaterThan($version1, $version2)
  49434. {
  49435. return self::compare($version1, '>', $version2);
  49436. }
  49437. public static function greaterThanOrEqualTo($version1, $version2)
  49438. {
  49439. return self::compare($version1, '>=', $version2);
  49440. }
  49441. public static function lessThan($version1, $version2)
  49442. {
  49443. return self::compare($version1, '<', $version2);
  49444. }
  49445. public static function lessThanOrEqualTo($version1, $version2)
  49446. {
  49447. return self::compare($version1, '<=', $version2);
  49448. }
  49449. public static function equalTo($version1, $version2)
  49450. {
  49451. return self::compare($version1, '==', $version2);
  49452. }
  49453. public static function notEqualTo($version1, $version2)
  49454. {
  49455. return self::compare($version1, '!=', $version2);
  49456. }
  49457. public static function compare($version1, $operator, $version2)
  49458. {
  49459. $constraint = new Constraint($operator, $version2);
  49460. return $constraint->matches(new Constraint('==', $version1));
  49461. }
  49462. }
  49463. <?php
  49464. namespace Composer\Semver\Constraint;
  49465. trigger_error('The ' . __CLASS__ . ' abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  49466. abstract class AbstractConstraint implements ConstraintInterface
  49467. {
  49468. protected $prettyString;
  49469. public function matches(ConstraintInterface $provider)
  49470. {
  49471. if ($provider instanceof $this) {
  49472. return $this->matchSpecific($provider);
  49473. }
  49474. return $provider->matches($this);
  49475. }
  49476. public function setPrettyString($prettyString)
  49477. {
  49478. $this->prettyString = $prettyString;
  49479. }
  49480. public function getPrettyString()
  49481. {
  49482. if ($this->prettyString) {
  49483. return $this->prettyString;
  49484. }
  49485. return $this->__toString();
  49486. }
  49487. }
  49488. <?php
  49489. namespace Composer\Semver\Constraint;
  49490. class Constraint implements ConstraintInterface
  49491. {
  49492. const OP_EQ = 0;
  49493. const OP_LT = 1;
  49494. const OP_LE = 2;
  49495. const OP_GT = 3;
  49496. const OP_GE = 4;
  49497. const OP_NE = 5;
  49498. private static $transOpStr = array(
  49499. '=' => self::OP_EQ,
  49500. '==' => self::OP_EQ,
  49501. '<' => self::OP_LT,
  49502. '<=' => self::OP_LE,
  49503. '>' => self::OP_GT,
  49504. '>=' => self::OP_GE,
  49505. '<>' => self::OP_NE,
  49506. '!=' => self::OP_NE,
  49507. );
  49508. private static $transOpInt = array(
  49509. self::OP_EQ => '==',
  49510. self::OP_LT => '<',
  49511. self::OP_LE => '<=',
  49512. self::OP_GT => '>',
  49513. self::OP_GE => '>=',
  49514. self::OP_NE => '!=',
  49515. );
  49516. protected $operator;
  49517. protected $version;
  49518. protected $prettyString;
  49519. public function matches(ConstraintInterface $provider)
  49520. {
  49521. if ($provider instanceof $this) {
  49522. return $this->matchSpecific($provider);
  49523. }
  49524. return $provider->matches($this);
  49525. }
  49526. public function setPrettyString($prettyString)
  49527. {
  49528. $this->prettyString = $prettyString;
  49529. }
  49530. public function getPrettyString()
  49531. {
  49532. if ($this->prettyString) {
  49533. return $this->prettyString;
  49534. }
  49535. return $this->__toString();
  49536. }
  49537. public static function getSupportedOperators()
  49538. {
  49539. return array_keys(self::$transOpStr);
  49540. }
  49541. public function __construct($operator, $version)
  49542. {
  49543. if (!isset(self::$transOpStr[$operator])) {
  49544. throw new \InvalidArgumentException(sprintf(
  49545. 'Invalid operator "%s" given, expected one of: %s',
  49546. $operator,
  49547. implode(', ', self::getSupportedOperators())
  49548. ));
  49549. }
  49550. $this->operator = self::$transOpStr[$operator];
  49551. $this->version = $version;
  49552. }
  49553. public function versionCompare($a, $b, $operator, $compareBranches = false)
  49554. {
  49555. if (!isset(self::$transOpStr[$operator])) {
  49556. throw new \InvalidArgumentException(sprintf(
  49557. 'Invalid operator "%s" given, expected one of: %s',
  49558. $operator,
  49559. implode(', ', self::getSupportedOperators())
  49560. ));
  49561. }
  49562. $aIsBranch = 'dev-' === substr($a, 0, 4);
  49563. $bIsBranch = 'dev-' === substr($b, 0, 4);
  49564. if ($aIsBranch && $bIsBranch) {
  49565. return $operator === '==' && $a === $b;
  49566. }
  49567. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  49568. return false;
  49569. }
  49570. return version_compare($a, $b, $operator);
  49571. }
  49572. public function matchSpecific(Constraint $provider, $compareBranches = false)
  49573. {
  49574. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  49575. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  49576. $isEqualOp = self::OP_EQ === $this->operator;
  49577. $isNonEqualOp = self::OP_NE === $this->operator;
  49578. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  49579. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  49580. if ($isNonEqualOp || $isProviderNonEqualOp) {
  49581. return !$isEqualOp && !$isProviderEqualOp
  49582. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  49583. }
  49584. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  49585. return true;
  49586. }
  49587. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  49588. if ($provider->version === $this->version
  49589. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  49590. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  49591. return false;
  49592. }
  49593. return true;
  49594. }
  49595. return false;
  49596. }
  49597. public function __toString()
  49598. {
  49599. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  49600. }
  49601. }
  49602. <?php
  49603. namespace Composer\Semver\Constraint;
  49604. interface ConstraintInterface
  49605. {
  49606. public function matches(ConstraintInterface $provider);
  49607. public function getPrettyString();
  49608. public function __toString();
  49609. }
  49610. <?php
  49611. namespace Composer\Semver\Constraint;
  49612. class EmptyConstraint implements ConstraintInterface
  49613. {
  49614. protected $prettyString;
  49615. public function matches(ConstraintInterface $provider)
  49616. {
  49617. return true;
  49618. }
  49619. public function setPrettyString($prettyString)
  49620. {
  49621. $this->prettyString = $prettyString;
  49622. }
  49623. public function getPrettyString()
  49624. {
  49625. if ($this->prettyString) {
  49626. return $this->prettyString;
  49627. }
  49628. return $this->__toString();
  49629. }
  49630. public function __toString()
  49631. {
  49632. return '[]';
  49633. }
  49634. }
  49635. <?php
  49636. namespace Composer\Semver\Constraint;
  49637. class MultiConstraint implements ConstraintInterface
  49638. {
  49639. protected $constraints;
  49640. protected $prettyString;
  49641. protected $conjunctive;
  49642. public function __construct(array $constraints, $conjunctive = true)
  49643. {
  49644. $this->constraints = $constraints;
  49645. $this->conjunctive = $conjunctive;
  49646. }
  49647. public function getConstraints()
  49648. {
  49649. return $this->constraints;
  49650. }
  49651. public function isConjunctive()
  49652. {
  49653. return $this->conjunctive;
  49654. }
  49655. public function isDisjunctive()
  49656. {
  49657. return !$this->conjunctive;
  49658. }
  49659. public function matches(ConstraintInterface $provider)
  49660. {
  49661. if (false === $this->conjunctive) {
  49662. foreach ($this->constraints as $constraint) {
  49663. if ($constraint->matches($provider)) {
  49664. return true;
  49665. }
  49666. }
  49667. return false;
  49668. }
  49669. foreach ($this->constraints as $constraint) {
  49670. if (!$constraint->matches($provider)) {
  49671. return false;
  49672. }
  49673. }
  49674. return true;
  49675. }
  49676. public function setPrettyString($prettyString)
  49677. {
  49678. $this->prettyString = $prettyString;
  49679. }
  49680. public function getPrettyString()
  49681. {
  49682. if ($this->prettyString) {
  49683. return $this->prettyString;
  49684. }
  49685. return $this->__toString();
  49686. }
  49687. public function __toString()
  49688. {
  49689. $constraints = array();
  49690. foreach ($this->constraints as $constraint) {
  49691. $constraints[] = (string) $constraint;
  49692. }
  49693. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  49694. }
  49695. }
  49696. <?php
  49697. namespace Composer\Semver;
  49698. use Composer\Semver\Constraint\Constraint;
  49699. class Semver
  49700. {
  49701. const SORT_ASC = 1;
  49702. const SORT_DESC = -1;
  49703. private static $versionParser;
  49704. public static function satisfies($version, $constraints)
  49705. {
  49706. if (null === self::$versionParser) {
  49707. self::$versionParser = new VersionParser();
  49708. }
  49709. $versionParser = self::$versionParser;
  49710. $provider = new Constraint('==', $versionParser->normalize($version));
  49711. $constraints = $versionParser->parseConstraints($constraints);
  49712. return $constraints->matches($provider);
  49713. }
  49714. public static function satisfiedBy(array $versions, $constraints)
  49715. {
  49716. $versions = array_filter($versions, function ($version) use ($constraints) {
  49717. return Semver::satisfies($version, $constraints);
  49718. });
  49719. return array_values($versions);
  49720. }
  49721. public static function sort(array $versions)
  49722. {
  49723. return self::usort($versions, self::SORT_ASC);
  49724. }
  49725. public static function rsort(array $versions)
  49726. {
  49727. return self::usort($versions, self::SORT_DESC);
  49728. }
  49729. private static function usort(array $versions, $direction)
  49730. {
  49731. if (null === self::$versionParser) {
  49732. self::$versionParser = new VersionParser();
  49733. }
  49734. $versionParser = self::$versionParser;
  49735. $normalized = array();
  49736. foreach ($versions as $key => $version) {
  49737. $normalized[] = array($versionParser->normalize($version), $key);
  49738. }
  49739. usort($normalized, function (array $left, array $right) use ($direction) {
  49740. if ($left[0] === $right[0]) {
  49741. return 0;
  49742. }
  49743. if (Comparator::lessThan($left[0], $right[0])) {
  49744. return -$direction;
  49745. }
  49746. return $direction;
  49747. });
  49748. $sorted = array();
  49749. foreach ($normalized as $item) {
  49750. $sorted[] = $versions[$item[1]];
  49751. }
  49752. return $sorted;
  49753. }
  49754. }
  49755. <?php
  49756. namespace Composer\Semver;
  49757. use Composer\Semver\Constraint\ConstraintInterface;
  49758. use Composer\Semver\Constraint\EmptyConstraint;
  49759. use Composer\Semver\Constraint\MultiConstraint;
  49760. use Composer\Semver\Constraint\Constraint;
  49761. class VersionParser
  49762. {
  49763. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  49764. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  49765. public static function parseStability($version)
  49766. {
  49767. $version = preg_replace('{#.+$}i', '', $version);
  49768. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  49769. return 'dev';
  49770. }
  49771. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  49772. if (!empty($match[3])) {
  49773. return 'dev';
  49774. }
  49775. if (!empty($match[1])) {
  49776. if ('beta' === $match[1] || 'b' === $match[1]) {
  49777. return 'beta';
  49778. }
  49779. if ('alpha' === $match[1] || 'a' === $match[1]) {
  49780. return 'alpha';
  49781. }
  49782. if ('rc' === $match[1]) {
  49783. return 'RC';
  49784. }
  49785. }
  49786. return 'stable';
  49787. }
  49788. public static function normalizeStability($stability)
  49789. {
  49790. $stability = strtolower($stability);
  49791. return $stability === 'rc' ? 'RC' : $stability;
  49792. }
  49793. public function normalize($version, $fullVersion = null)
  49794. {
  49795. $version = trim($version);
  49796. if (null === $fullVersion) {
  49797. $fullVersion = $version;
  49798. }
  49799. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  49800. $version = $match[1];
  49801. }
  49802. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  49803. return '9999999-dev';
  49804. }
  49805. if ('dev-' === strtolower(substr($version, 0, 4))) {
  49806. return 'dev-' . substr($version, 4);
  49807. }
  49808. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  49809. $version = $match[1];
  49810. }
  49811. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  49812. $version = $matches[1]
  49813. . (!empty($matches[2]) ? $matches[2] : '.0')
  49814. . (!empty($matches[3]) ? $matches[3] : '.0')
  49815. . (!empty($matches[4]) ? $matches[4] : '.0');
  49816. $index = 5;
  49817. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  49818. $version = preg_replace('{\D}', '.', $matches[1]);
  49819. $index = 2;
  49820. }
  49821. if (isset($index)) {
  49822. if (!empty($matches[$index])) {
  49823. if ('stable' === $matches[$index]) {
  49824. return $version;
  49825. }
  49826. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  49827. }
  49828. if (!empty($matches[$index + 2])) {
  49829. $version .= '-dev';
  49830. }
  49831. return $version;
  49832. }
  49833. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  49834. try {
  49835. return $this->normalizeBranch($match[1]);
  49836. } catch (\Exception $e) {
  49837. }
  49838. }
  49839. $extraMessage = '';
  49840. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  49841. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  49842. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  49843. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  49844. }
  49845. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  49846. }
  49847. public function parseNumericAliasPrefix($branch)
  49848. {
  49849. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  49850. return $matches['version'] . '.';
  49851. }
  49852. return false;
  49853. }
  49854. public function normalizeBranch($name)
  49855. {
  49856. $name = trim($name);
  49857. if (in_array($name, array('master', 'trunk', 'default'))) {
  49858. return $this->normalize($name);
  49859. }
  49860. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  49861. $version = '';
  49862. for ($i = 1; $i < 5; ++$i) {
  49863. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  49864. }
  49865. return str_replace('x', '9999999', $version) . '-dev';
  49866. }
  49867. return 'dev-' . $name;
  49868. }
  49869. public function parseConstraints($constraints)
  49870. {
  49871. $prettyConstraint = $constraints;
  49872. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  49873. $constraints = empty($match[1]) ? '*' : $match[1];
  49874. }
  49875. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  49876. $constraints = $match[1];
  49877. }
  49878. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  49879. $orGroups = array();
  49880. foreach ($orConstraints as $constraints) {
  49881. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  49882. if (count($andConstraints) > 1) {
  49883. $constraintObjects = array();
  49884. foreach ($andConstraints as $constraint) {
  49885. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  49886. $constraintObjects[] = $parsedConstraint;
  49887. }
  49888. }
  49889. } else {
  49890. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  49891. }
  49892. if (1 === count($constraintObjects)) {
  49893. $constraint = $constraintObjects[0];
  49894. } else {
  49895. $constraint = new MultiConstraint($constraintObjects);
  49896. }
  49897. $orGroups[] = $constraint;
  49898. }
  49899. if (1 === count($orGroups)) {
  49900. $constraint = $orGroups[0];
  49901. } elseif (2 === count($orGroups)
  49902. && $orGroups[0] instanceof MultiConstraint
  49903. && $orGroups[1] instanceof MultiConstraint
  49904. && 2 === count($orGroups[0]->getConstraints())
  49905. && 2 === count($orGroups[1]->getConstraints())
  49906. && ($a = (string) $orGroups[0])
  49907. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  49908. && ($b = (string) $orGroups[1])
  49909. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  49910. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  49911. ) {
  49912. $constraint = new MultiConstraint(array(
  49913. new Constraint('>=', substr($a, 4, $posA - 5)),
  49914. new Constraint('<', substr($b, $posB + 2, -1)),
  49915. ));
  49916. } else {
  49917. $constraint = new MultiConstraint($orGroups, false);
  49918. }
  49919. $constraint->setPrettyString($prettyConstraint);
  49920. return $constraint;
  49921. }
  49922. private function parseConstraint($constraint)
  49923. {
  49924. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  49925. $constraint = $match[1];
  49926. if ($match[2] !== 'stable') {
  49927. $stabilityModifier = $match[2];
  49928. }
  49929. }
  49930. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  49931. return array(new EmptyConstraint());
  49932. }
  49933. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  49934. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  49935. if (substr($constraint, 0, 2) === '~>') {
  49936. throw new \UnexpectedValueException(
  49937. 'Could not parse version constraint ' . $constraint . ': ' .
  49938. 'Invalid operator "~>", you probably meant to use the "~" operator'
  49939. );
  49940. }
  49941. if (isset($matches[4]) && '' !== $matches[4]) {
  49942. $position = 4;
  49943. } elseif (isset($matches[3]) && '' !== $matches[3]) {
  49944. $position = 3;
  49945. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  49946. $position = 2;
  49947. } else {
  49948. $position = 1;
  49949. }
  49950. $stabilitySuffix = '';
  49951. if (!empty($matches[5])) {
  49952. $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
  49953. }
  49954. if (!empty($matches[7])) {
  49955. $stabilitySuffix .= '-dev';
  49956. }
  49957. if (!$stabilitySuffix) {
  49958. $stabilitySuffix = '-dev';
  49959. }
  49960. $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix;
  49961. $lowerBound = new Constraint('>=', $lowVersion);
  49962. $highPosition = max(1, $position - 1);
  49963. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  49964. $upperBound = new Constraint('<', $highVersion);
  49965. return array(
  49966. $lowerBound,
  49967. $upperBound,
  49968. );
  49969. }
  49970. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  49971. if ('0' !== $matches[1] || '' === $matches[2]) {
  49972. $position = 1;
  49973. } elseif ('0' !== $matches[2] || '' === $matches[3]) {
  49974. $position = 2;
  49975. } else {
  49976. $position = 3;
  49977. }
  49978. $stabilitySuffix = '';
  49979. if (empty($matches[5]) && empty($matches[7])) {
  49980. $stabilitySuffix .= '-dev';
  49981. }
  49982. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  49983. $lowerBound = new Constraint('>=', $lowVersion);
  49984. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  49985. $upperBound = new Constraint('<', $highVersion);
  49986. return array(
  49987. $lowerBound,
  49988. $upperBound,
  49989. );
  49990. }
  49991. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  49992. if (isset($matches[3]) && '' !== $matches[3]) {
  49993. $position = 3;
  49994. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  49995. $position = 2;
  49996. } else {
  49997. $position = 1;
  49998. }
  49999. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  50000. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50001. if ($lowVersion === '0.0.0.0-dev') {
  50002. return array(new Constraint('<', $highVersion));
  50003. }
  50004. return array(
  50005. new Constraint('>=', $lowVersion),
  50006. new Constraint('<', $highVersion),
  50007. );
  50008. }
  50009. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  50010. $lowStabilitySuffix = '';
  50011. if (empty($matches[6]) && empty($matches[8])) {
  50012. $lowStabilitySuffix = '-dev';
  50013. }
  50014. $lowVersion = $this->normalize($matches['from']);
  50015. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  50016. $empty = function ($x) {
  50017. return ($x === 0 || $x === '0') ? false : empty($x);
  50018. };
  50019. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  50020. $highVersion = $this->normalize($matches['to']);
  50021. $upperBound = new Constraint('<=', $highVersion);
  50022. } else {
  50023. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  50024. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  50025. $upperBound = new Constraint('<', $highVersion);
  50026. }
  50027. return array(
  50028. $lowerBound,
  50029. $upperBound,
  50030. );
  50031. }
  50032. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  50033. try {
  50034. $version = $this->normalize($matches[2]);
  50035. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  50036. $version .= '-' . $stabilityModifier;
  50037. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  50038. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  50039. if (substr($matches[2], 0, 4) !== 'dev-') {
  50040. $version .= '-dev';
  50041. }
  50042. }
  50043. }
  50044. return array(new Constraint($matches[1] ?: '=', $version));
  50045. } catch (\Exception $e) {
  50046. }
  50047. }
  50048. $message = 'Could not parse version constraint ' . $constraint;
  50049. if (isset($e)) {
  50050. $message .= ': ' . $e->getMessage();
  50051. }
  50052. throw new \UnexpectedValueException($message);
  50053. }
  50054. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  50055. {
  50056. for ($i = 4; $i > 0; --$i) {
  50057. if ($i > $position) {
  50058. $matches[$i] = $pad;
  50059. } elseif ($i === $position && $increment) {
  50060. $matches[$i] += $increment;
  50061. if ($matches[$i] < 0) {
  50062. $matches[$i] = $pad;
  50063. --$position;
  50064. if ($i === 1) {
  50065. return;
  50066. }
  50067. }
  50068. }
  50069. }
  50070. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  50071. }
  50072. private function expandStability($stability)
  50073. {
  50074. $stability = strtolower($stability);
  50075. switch ($stability) {
  50076. case 'a':
  50077. return 'alpha';
  50078. case 'b':
  50079. return 'beta';
  50080. case 'p':
  50081. case 'pl':
  50082. return 'patch';
  50083. case 'rc':
  50084. return 'RC';
  50085. default:
  50086. return $stability;
  50087. }
  50088. }
  50089. }
  50090. Copyright (C) 2016 Composer
  50091. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50092. this software and associated documentation files (the "Software"), to deal in
  50093. the Software without restriction, including without limitation the rights to
  50094. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50095. of the Software, and to permit persons to whom the Software is furnished to do
  50096. so, subject to the following conditions:
  50097. The above copyright notice and this permission notice shall be included in all
  50098. copies or substantial portions of the Software.
  50099. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50100. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50101. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50102. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50103. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50104. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50105. SOFTWARE.
  50106. <?php
  50107. namespace Composer\CaBundle;
  50108. use Psr\Log\LoggerInterface;
  50109. use Symfony\Component\Process\PhpProcess;
  50110. class CaBundle
  50111. {
  50112. private static $caPath;
  50113. private static $caFileValidity = array();
  50114. private static $useOpensslParse;
  50115. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  50116. {
  50117. if (self::$caPath !== null) {
  50118. return self::$caPath;
  50119. }
  50120. $envCertFile = getenv('SSL_CERT_FILE');
  50121. if ($envCertFile && is_readable($envCertFile) && static::validateCaFile($envCertFile, $logger)) {
  50122. return self::$caPath = $envCertFile;
  50123. }
  50124. $envCertDir = getenv('SSL_CERT_DIR');
  50125. if ($envCertDir && is_dir($envCertDir) && is_readable($envCertDir)) {
  50126. return self::$caPath = $envCertDir;
  50127. }
  50128. $configured = ini_get('openssl.cafile');
  50129. if ($configured && strlen($configured) > 0 && is_readable($configured) && static::validateCaFile($configured, $logger)) {
  50130. return self::$caPath = $configured;
  50131. }
  50132. $configured = ini_get('openssl.capath');
  50133. if ($configured && is_dir($configured) && is_readable($configured)) {
  50134. return self::$caPath = $configured;
  50135. }
  50136. $caBundlePaths = array(
  50137. '/etc/pki/tls/certs/ca-bundle.crt',
  50138. '/etc/ssl/certs/ca-certificates.crt',
  50139. '/etc/ssl/ca-bundle.pem',
  50140. '/usr/local/share/certs/ca-root-nss.crt',
  50141. '/usr/ssl/certs/ca-bundle.crt',
  50142. '/opt/local/share/curl/curl-ca-bundle.crt',
  50143. '/usr/local/share/curl/curl-ca-bundle.crt',
  50144. '/usr/share/ssl/certs/ca-bundle.crt',
  50145. '/etc/ssl/cert.pem',
  50146. '/usr/local/etc/ssl/cert.pem',
  50147. '/usr/local/etc/openssl/cert.pem',
  50148. );
  50149. foreach ($caBundlePaths as $caBundle) {
  50150. if (@is_readable($caBundle) && static::validateCaFile($caBundle, $logger)) {
  50151. return self::$caPath = $caBundle;
  50152. }
  50153. }
  50154. foreach ($caBundlePaths as $caBundle) {
  50155. $caBundle = dirname($caBundle);
  50156. if (@is_dir($caBundle) && glob($caBundle.'/*')) {
  50157. return self::$caPath = $caBundle;
  50158. }
  50159. }
  50160. return self::$caPath = static::getBundledCaBundlePath();
  50161. }
  50162. public static function getBundledCaBundlePath()
  50163. {
  50164. $caBundleFile = __DIR__.'/../res/cacert.pem';
  50165. if (0 === strpos($caBundleFile, 'phar://')) {
  50166. file_put_contents(
  50167. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  50168. file_get_contents($caBundleFile)
  50169. );
  50170. register_shutdown_function(function() use ($tempCaBundleFile) {
  50171. @unlink($tempCaBundleFile);
  50172. });
  50173. $caBundleFile = $tempCaBundleFile;
  50174. }
  50175. return $caBundleFile;
  50176. }
  50177. public static function validateCaFile($filename, LoggerInterface $logger = null)
  50178. {
  50179. static $warned = false;
  50180. if (isset(self::$caFileValidity[$filename])) {
  50181. return self::$caFileValidity[$filename];
  50182. }
  50183. $contents = file_get_contents($filename);
  50184. if (!static::isOpensslParseSafe()) {
  50185. if (!$warned && $logger) {
  50186. $logger->warning(sprintf(
  50187. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  50188. PHP_VERSION
  50189. ));
  50190. $warned = true;
  50191. }
  50192. $isValid = !empty($contents);
  50193. } else {
  50194. $isValid = (bool) openssl_x509_parse($contents);
  50195. }
  50196. if ($logger) {
  50197. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  50198. }
  50199. return self::$caFileValidity[$filename] = $isValid;
  50200. }
  50201. public static function isOpensslParseSafe()
  50202. {
  50203. if (null !== self::$useOpensslParse) {
  50204. return self::$useOpensslParse;
  50205. }
  50206. if (PHP_VERSION_ID >= 50600) {
  50207. return self::$useOpensslParse = true;
  50208. }
  50209. if (
  50210. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  50211. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  50212. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  50213. ) {
  50214. return self::$useOpensslParse = true;
  50215. }
  50216. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  50217. return self::$useOpensslParse = false;
  50218. }
  50219. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  50220. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  50221. if (preg_match($regex, PHP_VERSION, $m)) {
  50222. return ((int) $m[1]) >= $fixedVersion;
  50223. }
  50224. return false;
  50225. };
  50226. if (
  50227. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  50228. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  50229. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  50230. ) {
  50231. return self::$useOpensslParse = true;
  50232. }
  50233. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  50234. return self::$useOpensslParse = false;
  50235. }
  50236. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  50237. $script = <<<'EOT'
  50238. error_reporting(-1);
  50239. $info = openssl_x509_parse(base64_decode('%s'));
  50240. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  50241. EOT;
  50242. $script = '<'."?php\n".sprintf($script, $cert);
  50243. try {
  50244. $process = new PhpProcess($script);
  50245. $process->mustRun();
  50246. } catch (\Exception $e) {
  50247. return self::$useOpensslParse = false;
  50248. }
  50249. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  50250. $errorOutput = trim($process->getErrorOutput());
  50251. if (
  50252. count($output) === 3
  50253. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  50254. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  50255. && $output[2] === 'int(-1)'
  50256. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  50257. ) {
  50258. return self::$useOpensslParse = true;
  50259. }
  50260. return self::$useOpensslParse = false;
  50261. }
  50262. public static function reset()
  50263. {
  50264. self::$caFileValidity = array();
  50265. self::$caPath = null;
  50266. self::$useOpensslParse = null;
  50267. }
  50268. }
  50269. MIT License
  50270. Copyright (c) 2017 Composer
  50271. Permission is hereby granted, free of charge, to any person obtaining a copy
  50272. of this software and associated documentation files (the "Software"), to deal
  50273. in the Software without restriction, including without limitation the rights
  50274. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  50275. copies of the Software, and to permit persons to whom the Software is
  50276. furnished to do so, subject to the following conditions:
  50277. The above copyright notice and this permission notice shall be included in all
  50278. copies or substantial portions of the Software.
  50279. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50280. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50281. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50282. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50283. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50284. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50285. SOFTWARE.
  50286. <?php
  50287. namespace Composer\XdebugHandler;
  50288. class PhpConfig
  50289. {
  50290. public function useOriginal()
  50291. {
  50292. $this->getDataAndReset();
  50293. return array();
  50294. }
  50295. public function useStandard()
  50296. {
  50297. if ($data = $this->getDataAndReset()) {
  50298. return array('-n', '-c', $data['tmpIni']);
  50299. }
  50300. return array();
  50301. }
  50302. public function usePersistent()
  50303. {
  50304. if ($data = $this->getDataAndReset()) {
  50305. Process::setEnv('PHPRC', $data['tmpIni']);
  50306. Process::setEnv('PHP_INI_SCAN_DIR', '');
  50307. }
  50308. return array();
  50309. }
  50310. private function getDataAndReset()
  50311. {
  50312. if ($data = XdebugHandler::getRestartSettings()) {
  50313. Process::setEnv('PHPRC', $data['phprc']);
  50314. Process::setEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  50315. }
  50316. return $data;
  50317. }
  50318. }
  50319. <?php
  50320. namespace Composer\XdebugHandler;
  50321. class Process
  50322. {
  50323. public static function addColorOption(array $args, $colorOption)
  50324. {
  50325. if (!$colorOption
  50326. || in_array($colorOption, $args)
  50327. || !preg_match('/^--([a-z]+$)|(^--[a-z]+=)/', $colorOption, $matches)) {
  50328. return $args;
  50329. }
  50330. if (isset($matches[2])) {
  50331. if (false !== ($index = array_search($matches[2].'auto', $args))) {
  50332. $args[$index] = $colorOption;
  50333. return $args;
  50334. } elseif (preg_grep('/^'.$matches[2].'/', $args)) {
  50335. return $args;
  50336. }
  50337. } elseif (in_array('--no-'.$matches[1], $args)) {
  50338. return $args;
  50339. }
  50340. if (false !== ($index = array_search('--', $args))) {
  50341. array_splice($args, $index, 0, $colorOption);
  50342. } else {
  50343. $args[] = $colorOption;
  50344. }
  50345. return $args;
  50346. }
  50347. public static function escape($arg, $meta = true, $module = false)
  50348. {
  50349. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  50350. return "'".str_replace("'", "'\\''", $arg)."'";
  50351. }
  50352. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  50353. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  50354. if ($meta) {
  50355. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  50356. if (!$meta) {
  50357. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  50358. } elseif ($module && !$dquotes && $quote) {
  50359. $meta = false;
  50360. }
  50361. }
  50362. if ($quote) {
  50363. $arg = '"'.preg_replace('/(\\\\*)$/', '$1$1', $arg).'"';
  50364. }
  50365. if ($meta) {
  50366. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  50367. }
  50368. return $arg;
  50369. }
  50370. public static function supportsColor($output)
  50371. {
  50372. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  50373. return (function_exists('sapi_windows_vt100_support')
  50374. && sapi_windows_vt100_support($output))
  50375. || false !== getenv('ANSICON')
  50376. || 'ON' === getenv('ConEmuANSI')
  50377. || 'xterm' === getenv('TERM');
  50378. }
  50379. if (function_exists('stream_isatty')) {
  50380. return stream_isatty($output);
  50381. } elseif (function_exists('posix_isatty')) {
  50382. return posix_isatty($output);
  50383. }
  50384. $stat = fstat($output);
  50385. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  50386. }
  50387. public static function setEnv($name, $value = false)
  50388. {
  50389. $unset = false === $value;
  50390. if (!putenv($unset ? $name : $name.'='.$value)) {
  50391. return false;
  50392. }
  50393. if ($unset) {
  50394. unset($_SERVER[$name]);
  50395. } else {
  50396. $_SERVER[$name] = $value;
  50397. }
  50398. return true;
  50399. }
  50400. }
  50401. <?php
  50402. namespace Composer\XdebugHandler;
  50403. use Psr\Log\LoggerInterface;
  50404. use Psr\Log\LogLevel;
  50405. class Status
  50406. {
  50407. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  50408. const CHECK = 'Check';
  50409. const ERROR = 'Error';
  50410. const INFO = 'Info';
  50411. const NORESTART = 'NoRestart';
  50412. const RESTART = 'Restart';
  50413. const RESTARTING = 'Restarting';
  50414. const RESTARTED = 'Restarted';
  50415. private $debug;
  50416. private $envAllowXdebug;
  50417. private $loaded;
  50418. private $logger;
  50419. private $time;
  50420. public function __construct($envAllowXdebug, $debug)
  50421. {
  50422. $start = getenv(self::ENV_RESTART);
  50423. Process::setEnv(self::ENV_RESTART);
  50424. $this->time = $start ? round((microtime(true) - $start) * 1000) : 0;
  50425. $this->envAllowXdebug = $envAllowXdebug;
  50426. $this->debug = $debug;
  50427. }
  50428. public function setLogger(LoggerInterface $logger)
  50429. {
  50430. $this->logger = $logger;
  50431. }
  50432. public function report($op, $data)
  50433. {
  50434. if ($this->logger || $this->debug) {
  50435. call_user_func(array($this, 'report'.$op), $data);
  50436. }
  50437. }
  50438. private function output($text, $level = null)
  50439. {
  50440. if ($this->logger) {
  50441. $this->logger->log($level ?: LogLevel::DEBUG, $text);
  50442. }
  50443. if ($this->debug) {
  50444. printf('xdebug-handler[%d] %s%s', getmypid(), $text, PHP_EOL);
  50445. }
  50446. }
  50447. private function reportCheck($loaded)
  50448. {
  50449. $this->loaded = $loaded;
  50450. $this->output('Checking '.$this->envAllowXdebug);
  50451. }
  50452. private function reportError($error)
  50453. {
  50454. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  50455. }
  50456. private function reportInfo($info)
  50457. {
  50458. $this->output($info);
  50459. }
  50460. private function reportNoRestart()
  50461. {
  50462. $this->output($this->getLoadedMessage());
  50463. if ($this->loaded) {
  50464. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  50465. if (!getenv($this->envAllowXdebug)) {
  50466. $text .= ' Allowed by application';
  50467. }
  50468. $this->output($text);
  50469. }
  50470. }
  50471. private function reportRestart()
  50472. {
  50473. $this->output($this->getLoadedMessage());
  50474. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  50475. }
  50476. private function reportRestarted()
  50477. {
  50478. $loaded = $this->getLoadedMessage();
  50479. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  50480. $level = $this->loaded ? LogLevel::WARNING : null;
  50481. $this->output($text, $level);
  50482. }
  50483. private function reportRestarting($command)
  50484. {
  50485. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  50486. $this->output($text);
  50487. $text = 'Running '.$command;
  50488. $this->output($text);
  50489. }
  50490. private function getEnvAllow()
  50491. {
  50492. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  50493. }
  50494. private function getLoadedMessage()
  50495. {
  50496. $loaded = $this->loaded ? sprintf('loaded (%s)', $this->loaded) : 'not loaded';
  50497. return 'The xdebug extension is '.$loaded;
  50498. }
  50499. }
  50500. <?php
  50501. namespace Composer\XdebugHandler;
  50502. use Psr\Log\LoggerInterface;
  50503. class XdebugHandler
  50504. {
  50505. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  50506. const SUFFIX_INIS = '_ORIGINAL_INIS';
  50507. const RESTART_ID = 'internal';
  50508. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  50509. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  50510. protected $tmpIni;
  50511. private static $inRestart;
  50512. private static $name;
  50513. private static $skipped;
  50514. private $cli;
  50515. private $colorOption;
  50516. private $debug;
  50517. private $envAllowXdebug;
  50518. private $envOriginalInis;
  50519. private $loaded;
  50520. private $script;
  50521. private $statusWriter;
  50522. public function __construct($envPrefix, $colorOption = '')
  50523. {
  50524. if (!is_string($envPrefix) || empty($envPrefix) || !is_string($colorOption)) {
  50525. throw new \RuntimeException('Invalid constructor parameter');
  50526. }
  50527. self::$name = strtoupper($envPrefix);
  50528. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  50529. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  50530. $this->colorOption = $colorOption;
  50531. if (extension_loaded('xdebug')) {
  50532. $ext = new \ReflectionExtension('xdebug');
  50533. $this->loaded = $ext->getVersion() ?: 'unknown';
  50534. }
  50535. if ($this->cli = PHP_SAPI === 'cli') {
  50536. $this->debug = getenv(self::DEBUG);
  50537. }
  50538. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  50539. }
  50540. public function setLogger(LoggerInterface $logger)
  50541. {
  50542. $this->statusWriter->setLogger($logger);
  50543. return $this;
  50544. }
  50545. public function setMainScript($script)
  50546. {
  50547. $this->script = $script;
  50548. return $this;
  50549. }
  50550. public function check()
  50551. {
  50552. $this->notify(Status::CHECK, $this->loaded);
  50553. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  50554. if (empty($envArgs[0]) && $this->requiresRestart((bool) $this->loaded)) {
  50555. $this->notify(Status::RESTART);
  50556. if ($this->prepareRestart()) {
  50557. $command = $this->getCommand();
  50558. $this->notify(Status::RESTARTING, $command);
  50559. $this->restart($command);
  50560. }
  50561. return;
  50562. }
  50563. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  50564. $this->notify(Status::RESTARTED);
  50565. Process::setEnv($this->envAllowXdebug);
  50566. self::$inRestart = true;
  50567. if (!$this->loaded) {
  50568. self::$skipped = $envArgs[1];
  50569. }
  50570. $this->setEnvRestartSettings($envArgs);
  50571. return;
  50572. }
  50573. $this->notify(Status::NORESTART);
  50574. if ($settings = self::getRestartSettings()) {
  50575. $this->syncSettings($settings);
  50576. }
  50577. }
  50578. public static function getAllIniFiles()
  50579. {
  50580. if (!empty(self::$name)) {
  50581. $env = getenv(self::$name.self::SUFFIX_INIS);
  50582. if (false !== $env) {
  50583. return explode(PATH_SEPARATOR, $env);
  50584. }
  50585. }
  50586. $paths = array((string) php_ini_loaded_file());
  50587. if ($scanned = php_ini_scanned_files()) {
  50588. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  50589. }
  50590. return $paths;
  50591. }
  50592. public static function getRestartSettings()
  50593. {
  50594. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  50595. if (count($envArgs) !== 6
  50596. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  50597. return;
  50598. }
  50599. return array(
  50600. 'tmpIni' => $envArgs[0],
  50601. 'scannedInis' => (bool) $envArgs[1],
  50602. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  50603. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  50604. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  50605. 'skipped' => $envArgs[5],
  50606. );
  50607. }
  50608. public static function getSkippedVersion()
  50609. {
  50610. return (string) self::$skipped;
  50611. }
  50612. protected function requiresRestart($isLoaded)
  50613. {
  50614. return $isLoaded;
  50615. }
  50616. protected function restart($command)
  50617. {
  50618. $this->doRestart($command);
  50619. }
  50620. private function doRestart($command)
  50621. {
  50622. passthru($command, $exitCode);
  50623. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  50624. if ($this->debug === '2') {
  50625. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  50626. } else {
  50627. @unlink($this->tmpIni);
  50628. }
  50629. exit($exitCode);
  50630. }
  50631. private function prepareRestart()
  50632. {
  50633. $error = '';
  50634. $iniFiles = self::getAllIniFiles();
  50635. $scannedInis = count($iniFiles) > 1;
  50636. if (!$this->cli) {
  50637. $error = 'Unsupported SAPI: '.PHP_SAPI;
  50638. } elseif (!defined('PHP_BINARY')) {
  50639. $error = 'PHP version is too old: '.PHP_VERSION;
  50640. } elseif (!$this->checkMainScript()) {
  50641. $error = 'Unable to access main script: '.$this->script;
  50642. } elseif (!$this->writeTmpIni($iniFiles)) {
  50643. $error = 'Unable to create temporary ini file';
  50644. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  50645. $error = 'Unable to set environment variables';
  50646. }
  50647. if ($error) {
  50648. $this->notify(Status::ERROR, $error);
  50649. }
  50650. return empty($error);
  50651. }
  50652. private function writeTmpIni(array $iniFiles)
  50653. {
  50654. if (!$this->tmpIni = tempnam(sys_get_temp_dir(), '')) {
  50655. return false;
  50656. }
  50657. if (empty($iniFiles[0])) {
  50658. array_shift($iniFiles);
  50659. }
  50660. $content = '';
  50661. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  50662. foreach ($iniFiles as $file) {
  50663. $data = preg_replace($regex, ';$1', file_get_contents($file));
  50664. $content .= $data.PHP_EOL;
  50665. }
  50666. if ($config = parse_ini_string($content)) {
  50667. $loaded = ini_get_all(null, false);
  50668. $content .= $this->mergeLoadedConfig($loaded, $config);
  50669. }
  50670. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  50671. return @file_put_contents($this->tmpIni, $content);
  50672. }
  50673. private function getCommand()
  50674. {
  50675. $args = array_slice($_SERVER['argv'], 1);
  50676. if (defined('STDOUT') && Process::supportsColor(STDOUT)) {
  50677. $args = Process::addColorOption($args, $this->colorOption);
  50678. }
  50679. $executable = array(PHP_BINARY, '-n', '-c', $this->tmpIni, $this->script);
  50680. $args = array_merge($executable, $args);
  50681. $cmd = Process::escape(array_shift($args), true, true);
  50682. foreach ($args as $arg) {
  50683. $cmd .= ' '.Process::escape($arg);
  50684. }
  50685. return $cmd;
  50686. }
  50687. private function setEnvironment($scannedInis, array $iniFiles)
  50688. {
  50689. $scanDir = getenv('PHP_INI_SCAN_DIR');
  50690. $phprc = getenv('PHPRC');
  50691. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  50692. return false;
  50693. }
  50694. $envArgs = array(
  50695. self::RESTART_ID,
  50696. $this->loaded,
  50697. (int) $scannedInis,
  50698. false === $scanDir ? '*' : $scanDir,
  50699. false === $phprc ? '*' : $phprc,
  50700. );
  50701. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  50702. }
  50703. private function notify($op, $data = null)
  50704. {
  50705. $this->statusWriter->report($op, $data);
  50706. }
  50707. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig)
  50708. {
  50709. $content = '';
  50710. foreach ($loadedConfig as $name => $value) {
  50711. if (!is_string($value) || strpos($name, 'xdebug') === 0) {
  50712. continue;
  50713. }
  50714. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  50715. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  50716. }
  50717. }
  50718. return $content;
  50719. }
  50720. private function checkMainScript()
  50721. {
  50722. if (null !== $this->script) {
  50723. return file_exists($this->script) || '--' === $this->script;
  50724. }
  50725. if (file_exists($this->script = $_SERVER['argv'][0])) {
  50726. return true;
  50727. }
  50728. $options = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false;
  50729. $trace = debug_backtrace($options);
  50730. if (($main = end($trace)) && isset($main['file'])) {
  50731. return file_exists($this->script = $main['file']);
  50732. }
  50733. return false;
  50734. }
  50735. private function setEnvRestartSettings($envArgs)
  50736. {
  50737. $settings = array(
  50738. php_ini_loaded_file(),
  50739. $envArgs[2],
  50740. $envArgs[3],
  50741. $envArgs[4],
  50742. getenv($this->envOriginalInis),
  50743. self::$skipped,
  50744. );
  50745. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  50746. }
  50747. private function syncSettings(array $settings)
  50748. {
  50749. if (false === getenv($this->envOriginalInis)) {
  50750. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  50751. }
  50752. self::$skipped = $settings['skipped'];
  50753. $this->notify(Status::INFO, 'Process called with existing restart settings');
  50754. }
  50755. }
  50756. Copyright (c) 2012 PHP Framework Interoperability Group
  50757. Permission is hereby granted, free of charge, to any person obtaining a copy
  50758. of this software and associated documentation files (the "Software"), to deal
  50759. in the Software without restriction, including without limitation the rights
  50760. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  50761. copies of the Software, and to permit persons to whom the Software is
  50762. furnished to do so, subject to the following conditions:
  50763. The above copyright notice and this permission notice shall be included in
  50764. all copies or substantial portions of the Software.
  50765. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50766. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50767. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50768. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50769. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50770. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  50771. THE SOFTWARE.
  50772. <?php
  50773. namespace Psr\Log;
  50774. abstract class AbstractLogger implements LoggerInterface
  50775. {
  50776. public function emergency($message, array $context = array())
  50777. {
  50778. $this->log(LogLevel::EMERGENCY, $message, $context);
  50779. }
  50780. public function alert($message, array $context = array())
  50781. {
  50782. $this->log(LogLevel::ALERT, $message, $context);
  50783. }
  50784. public function critical($message, array $context = array())
  50785. {
  50786. $this->log(LogLevel::CRITICAL, $message, $context);
  50787. }
  50788. public function error($message, array $context = array())
  50789. {
  50790. $this->log(LogLevel::ERROR, $message, $context);
  50791. }
  50792. public function warning($message, array $context = array())
  50793. {
  50794. $this->log(LogLevel::WARNING, $message, $context);
  50795. }
  50796. public function notice($message, array $context = array())
  50797. {
  50798. $this->log(LogLevel::NOTICE, $message, $context);
  50799. }
  50800. public function info($message, array $context = array())
  50801. {
  50802. $this->log(LogLevel::INFO, $message, $context);
  50803. }
  50804. public function debug($message, array $context = array())
  50805. {
  50806. $this->log(LogLevel::DEBUG, $message, $context);
  50807. }
  50808. }
  50809. <?php
  50810. namespace Psr\Log;
  50811. class InvalidArgumentException extends \InvalidArgumentException
  50812. {
  50813. }
  50814. <?php
  50815. namespace Psr\Log;
  50816. class LogLevel
  50817. {
  50818. const EMERGENCY = 'emergency';
  50819. const ALERT = 'alert';
  50820. const CRITICAL = 'critical';
  50821. const ERROR = 'error';
  50822. const WARNING = 'warning';
  50823. const NOTICE = 'notice';
  50824. const INFO = 'info';
  50825. const DEBUG = 'debug';
  50826. }
  50827. <?php
  50828. namespace Psr\Log;
  50829. interface LoggerAwareInterface
  50830. {
  50831. public function setLogger(LoggerInterface $logger);
  50832. }
  50833. <?php
  50834. namespace Psr\Log;
  50835. trait LoggerAwareTrait
  50836. {
  50837. protected $logger;
  50838. public function setLogger(LoggerInterface $logger)
  50839. {
  50840. $this->logger = $logger;
  50841. }
  50842. }
  50843. <?php
  50844. namespace Psr\Log;
  50845. interface LoggerInterface
  50846. {
  50847. public function emergency($message, array $context = array());
  50848. public function alert($message, array $context = array());
  50849. public function critical($message, array $context = array());
  50850. public function error($message, array $context = array());
  50851. public function warning($message, array $context = array());
  50852. public function notice($message, array $context = array());
  50853. public function info($message, array $context = array());
  50854. public function debug($message, array $context = array());
  50855. public function log($level, $message, array $context = array());
  50856. }
  50857. <?php
  50858. namespace Psr\Log;
  50859. trait LoggerTrait
  50860. {
  50861. public function emergency($message, array $context = array())
  50862. {
  50863. $this->log(LogLevel::EMERGENCY, $message, $context);
  50864. }
  50865. public function alert($message, array $context = array())
  50866. {
  50867. $this->log(LogLevel::ALERT, $message, $context);
  50868. }
  50869. public function critical($message, array $context = array())
  50870. {
  50871. $this->log(LogLevel::CRITICAL, $message, $context);
  50872. }
  50873. public function error($message, array $context = array())
  50874. {
  50875. $this->log(LogLevel::ERROR, $message, $context);
  50876. }
  50877. public function warning($message, array $context = array())
  50878. {
  50879. $this->log(LogLevel::WARNING, $message, $context);
  50880. }
  50881. public function notice($message, array $context = array())
  50882. {
  50883. $this->log(LogLevel::NOTICE, $message, $context);
  50884. }
  50885. public function info($message, array $context = array())
  50886. {
  50887. $this->log(LogLevel::INFO, $message, $context);
  50888. }
  50889. public function debug($message, array $context = array())
  50890. {
  50891. $this->log(LogLevel::DEBUG, $message, $context);
  50892. }
  50893. abstract public function log($level, $message, array $context = array());
  50894. }
  50895. <?php
  50896. namespace Psr\Log;
  50897. class NullLogger extends AbstractLogger
  50898. {
  50899. public function log($level, $message, array $context = array())
  50900. {
  50901. }
  50902. }
  50903. <?php
  50904. namespace Psr\Log\Test;
  50905. use Psr\Log\LoggerInterface;
  50906. use Psr\Log\LogLevel;
  50907. abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
  50908. {
  50909. abstract public function getLogger();
  50910. abstract public function getLogs();
  50911. public function testImplements()
  50912. {
  50913. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  50914. }
  50915. public function testLogsAtAllLevels($level, $message)
  50916. {
  50917. $logger = $this->getLogger();
  50918. $logger->{$level}($message, array('user' => 'Bob'));
  50919. $logger->log($level, $message, array('user' => 'Bob'));
  50920. $expected = array(
  50921. $level.' message of level '.$level.' with context: Bob',
  50922. $level.' message of level '.$level.' with context: Bob',
  50923. );
  50924. $this->assertEquals($expected, $this->getLogs());
  50925. }
  50926. public function provideLevelsAndMessages()
  50927. {
  50928. return array(
  50929. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  50930. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  50931. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  50932. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  50933. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  50934. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  50935. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  50936. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  50937. );
  50938. }
  50939. public function testThrowsOnInvalidLevel()
  50940. {
  50941. $logger = $this->getLogger();
  50942. $logger->log('invalid level', 'Foo');
  50943. }
  50944. public function testContextReplacement()
  50945. {
  50946. $logger = $this->getLogger();
  50947. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  50948. $expected = array('info {Message {nothing} Bob Bar a}');
  50949. $this->assertEquals($expected, $this->getLogs());
  50950. }
  50951. public function testObjectCastToString()
  50952. {
  50953. if (method_exists($this, 'createPartialMock')) {
  50954. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  50955. } else {
  50956. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  50957. }
  50958. $dummy->expects($this->once())
  50959. ->method('__toString')
  50960. ->will($this->returnValue('DUMMY'));
  50961. $this->getLogger()->warning($dummy);
  50962. $expected = array('warning DUMMY');
  50963. $this->assertEquals($expected, $this->getLogs());
  50964. }
  50965. public function testContextCanContainAnything()
  50966. {
  50967. $context = array(
  50968. 'bool' => true,
  50969. 'null' => null,
  50970. 'string' => 'Foo',
  50971. 'int' => 0,
  50972. 'float' => 0.5,
  50973. 'nested' => array('with object' => new DummyTest),
  50974. 'object' => new \DateTime,
  50975. 'resource' => fopen('php://memory', 'r'),
  50976. );
  50977. $this->getLogger()->warning('Crazy context data', $context);
  50978. $expected = array('warning Crazy context data');
  50979. $this->assertEquals($expected, $this->getLogs());
  50980. }
  50981. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  50982. {
  50983. $logger = $this->getLogger();
  50984. $logger->warning('Random message', array('exception' => 'oops'));
  50985. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  50986. $expected = array(
  50987. 'warning Random message',
  50988. 'critical Uncaught Exception!'
  50989. );
  50990. $this->assertEquals($expected, $this->getLogs());
  50991. }
  50992. }
  50993. class DummyTest
  50994. {
  50995. public function __toString()
  50996. {
  50997. }
  50998. }
  50999. <?php
  51000. require_once __DIR__ . '/composer/autoload_real.php';
  51001. return ComposerAutoloaderInitComposerPhar1534431432::getLoader();
  51002. <?php
  51003. $vendorDir = dirname(dirname(__FILE__));
  51004. $baseDir = dirname($vendorDir);
  51005. return array(
  51006. );
  51007. <?php
  51008. $vendorDir = dirname(dirname(__FILE__));
  51009. $baseDir = dirname($vendorDir);
  51010. return array(
  51011. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  51012. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  51013. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  51014. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  51015. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  51016. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  51017. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  51018. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  51019. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  51020. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  51021. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  51022. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  51023. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  51024. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  51025. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  51026. 'Composer\\' => array($baseDir . '/src/Composer'),
  51027. );
  51028. <?php
  51029. $vendorDir = dirname(dirname(__FILE__));
  51030. $baseDir = dirname($vendorDir);
  51031. return array(
  51032. );
  51033. <?php
  51034. $vendorDir = dirname(dirname(__FILE__));
  51035. $baseDir = dirname($vendorDir);
  51036. return array(
  51037. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  51038. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  51039. );
  51040. <?php
  51041. class ComposerAutoloaderInitComposerPhar1534431432
  51042. {
  51043. private static $loader;
  51044. public static function loadClassLoader($class)
  51045. {
  51046. if ('Composer\Autoload\ClassLoader' === $class) {
  51047. require __DIR__ . '/ClassLoader.php';
  51048. }
  51049. }
  51050. public static function getLoader()
  51051. {
  51052. if (null !== self::$loader) {
  51053. return self::$loader;
  51054. }
  51055. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1534431432', 'loadClassLoader'), true, true);
  51056. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  51057. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1534431432', 'loadClassLoader'));
  51058. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  51059. if ($useStaticLoader) {
  51060. require_once __DIR__ . '/autoload_static.php';
  51061. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1534431432::getInitializer($loader));
  51062. } else {
  51063. $map = require __DIR__ . '/autoload_namespaces.php';
  51064. foreach ($map as $namespace => $path) {
  51065. $loader->set($namespace, $path);
  51066. }
  51067. $map = require __DIR__ . '/autoload_psr4.php';
  51068. foreach ($map as $namespace => $path) {
  51069. $loader->setPsr4($namespace, $path);
  51070. }
  51071. $classMap = require __DIR__ . '/autoload_classmap.php';
  51072. if ($classMap) {
  51073. $loader->addClassMap($classMap);
  51074. }
  51075. }
  51076. $loader->register(true);
  51077. if ($useStaticLoader) {
  51078. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1534431432::$files;
  51079. } else {
  51080. $includeFiles = require __DIR__ . '/autoload_files.php';
  51081. }
  51082. foreach ($includeFiles as $fileIdentifier => $file) {
  51083. composerRequireComposerPhar1534431432($fileIdentifier, $file);
  51084. }
  51085. return $loader;
  51086. }
  51087. }
  51088. function composerRequireComposerPhar1534431432($fileIdentifier, $file)
  51089. {
  51090. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  51091. require $file;
  51092. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  51093. }
  51094. }
  51095. <?php
  51096. namespace Composer\Autoload;
  51097. class ComposerStaticInitComposerPhar1534431432
  51098. {
  51099. public static $files = array (
  51100. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  51101. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  51102. );
  51103. public static $prefixLengthsPsr4 = array (
  51104. 'S' =>
  51105. array (
  51106. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  51107. 'Symfony\\Polyfill\\Ctype\\' => 23,
  51108. 'Symfony\\Component\\Process\\' => 26,
  51109. 'Symfony\\Component\\Finder\\' => 25,
  51110. 'Symfony\\Component\\Filesystem\\' => 29,
  51111. 'Symfony\\Component\\Debug\\' => 24,
  51112. 'Symfony\\Component\\Console\\' => 26,
  51113. 'Seld\\PharUtils\\' => 15,
  51114. 'Seld\\JsonLint\\' => 14,
  51115. ),
  51116. 'P' =>
  51117. array (
  51118. 'Psr\\Log\\' => 8,
  51119. ),
  51120. 'J' =>
  51121. array (
  51122. 'JsonSchema\\' => 11,
  51123. ),
  51124. 'C' =>
  51125. array (
  51126. 'Composer\\XdebugHandler\\' => 23,
  51127. 'Composer\\Spdx\\' => 14,
  51128. 'Composer\\Semver\\' => 16,
  51129. 'Composer\\CaBundle\\' => 18,
  51130. 'Composer\\' => 9,
  51131. ),
  51132. );
  51133. public static $prefixDirsPsr4 = array (
  51134. 'Symfony\\Polyfill\\Mbstring\\' =>
  51135. array (
  51136. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  51137. ),
  51138. 'Symfony\\Polyfill\\Ctype\\' =>
  51139. array (
  51140. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  51141. ),
  51142. 'Symfony\\Component\\Process\\' =>
  51143. array (
  51144. 0 => __DIR__ . '/..' . '/symfony/process',
  51145. ),
  51146. 'Symfony\\Component\\Finder\\' =>
  51147. array (
  51148. 0 => __DIR__ . '/..' . '/symfony/finder',
  51149. ),
  51150. 'Symfony\\Component\\Filesystem\\' =>
  51151. array (
  51152. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  51153. ),
  51154. 'Symfony\\Component\\Debug\\' =>
  51155. array (
  51156. 0 => __DIR__ . '/..' . '/symfony/debug',
  51157. ),
  51158. 'Symfony\\Component\\Console\\' =>
  51159. array (
  51160. 0 => __DIR__ . '/..' . '/symfony/console',
  51161. ),
  51162. 'Seld\\PharUtils\\' =>
  51163. array (
  51164. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  51165. ),
  51166. 'Seld\\JsonLint\\' =>
  51167. array (
  51168. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  51169. ),
  51170. 'Psr\\Log\\' =>
  51171. array (
  51172. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  51173. ),
  51174. 'JsonSchema\\' =>
  51175. array (
  51176. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  51177. ),
  51178. 'Composer\\XdebugHandler\\' =>
  51179. array (
  51180. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  51181. ),
  51182. 'Composer\\Spdx\\' =>
  51183. array (
  51184. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  51185. ),
  51186. 'Composer\\Semver\\' =>
  51187. array (
  51188. 0 => __DIR__ . '/..' . '/composer/semver/src',
  51189. ),
  51190. 'Composer\\CaBundle\\' =>
  51191. array (
  51192. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  51193. ),
  51194. 'Composer\\' =>
  51195. array (
  51196. 0 => __DIR__ . '/../..' . '/src/Composer',
  51197. ),
  51198. );
  51199. public static function getInitializer(ClassLoader $loader)
  51200. {
  51201. return \Closure::bind(function () use ($loader) {
  51202. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1534431432::$prefixLengthsPsr4;
  51203. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1534431432::$prefixDirsPsr4;
  51204. }, null, ClassLoader::class);
  51205. }
  51206. }
  51207. <?php
  51208. namespace Composer\Autoload;
  51209. class ClassLoader
  51210. {
  51211. private $prefixLengthsPsr4 = array();
  51212. private $prefixDirsPsr4 = array();
  51213. private $fallbackDirsPsr4 = array();
  51214. private $prefixesPsr0 = array();
  51215. private $fallbackDirsPsr0 = array();
  51216. private $useIncludePath = false;
  51217. private $classMap = array();
  51218. private $classMapAuthoritative = false;
  51219. private $missingClasses = array();
  51220. private $apcuPrefix;
  51221. public function getPrefixes()
  51222. {
  51223. if (!empty($this->prefixesPsr0)) {
  51224. return call_user_func_array('array_merge', $this->prefixesPsr0);
  51225. }
  51226. return array();
  51227. }
  51228. public function getPrefixesPsr4()
  51229. {
  51230. return $this->prefixDirsPsr4;
  51231. }
  51232. public function getFallbackDirs()
  51233. {
  51234. return $this->fallbackDirsPsr0;
  51235. }
  51236. public function getFallbackDirsPsr4()
  51237. {
  51238. return $this->fallbackDirsPsr4;
  51239. }
  51240. public function getClassMap()
  51241. {
  51242. return $this->classMap;
  51243. }
  51244. public function addClassMap(array $classMap)
  51245. {
  51246. if ($this->classMap) {
  51247. $this->classMap = array_merge($this->classMap, $classMap);
  51248. } else {
  51249. $this->classMap = $classMap;
  51250. }
  51251. }
  51252. public function add($prefix, $paths, $prepend = false)
  51253. {
  51254. if (!$prefix) {
  51255. if ($prepend) {
  51256. $this->fallbackDirsPsr0 = array_merge(
  51257. (array) $paths,
  51258. $this->fallbackDirsPsr0
  51259. );
  51260. } else {
  51261. $this->fallbackDirsPsr0 = array_merge(
  51262. $this->fallbackDirsPsr0,
  51263. (array) $paths
  51264. );
  51265. }
  51266. return;
  51267. }
  51268. $first = $prefix[0];
  51269. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  51270. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  51271. return;
  51272. }
  51273. if ($prepend) {
  51274. $this->prefixesPsr0[$first][$prefix] = array_merge(
  51275. (array) $paths,
  51276. $this->prefixesPsr0[$first][$prefix]
  51277. );
  51278. } else {
  51279. $this->prefixesPsr0[$first][$prefix] = array_merge(
  51280. $this->prefixesPsr0[$first][$prefix],
  51281. (array) $paths
  51282. );
  51283. }
  51284. }
  51285. public function addPsr4($prefix, $paths, $prepend = false)
  51286. {
  51287. if (!$prefix) {
  51288. if ($prepend) {
  51289. $this->fallbackDirsPsr4 = array_merge(
  51290. (array) $paths,
  51291. $this->fallbackDirsPsr4
  51292. );
  51293. } else {
  51294. $this->fallbackDirsPsr4 = array_merge(
  51295. $this->fallbackDirsPsr4,
  51296. (array) $paths
  51297. );
  51298. }
  51299. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  51300. $length = strlen($prefix);
  51301. if ('\\' !== $prefix[$length - 1]) {
  51302. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  51303. }
  51304. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  51305. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  51306. } elseif ($prepend) {
  51307. $this->prefixDirsPsr4[$prefix] = array_merge(
  51308. (array) $paths,
  51309. $this->prefixDirsPsr4[$prefix]
  51310. );
  51311. } else {
  51312. $this->prefixDirsPsr4[$prefix] = array_merge(
  51313. $this->prefixDirsPsr4[$prefix],
  51314. (array) $paths
  51315. );
  51316. }
  51317. }
  51318. public function set($prefix, $paths)
  51319. {
  51320. if (!$prefix) {
  51321. $this->fallbackDirsPsr0 = (array) $paths;
  51322. } else {
  51323. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  51324. }
  51325. }
  51326. public function setPsr4($prefix, $paths)
  51327. {
  51328. if (!$prefix) {
  51329. $this->fallbackDirsPsr4 = (array) $paths;
  51330. } else {
  51331. $length = strlen($prefix);
  51332. if ('\\' !== $prefix[$length - 1]) {
  51333. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  51334. }
  51335. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  51336. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  51337. }
  51338. }
  51339. public function setUseIncludePath($useIncludePath)
  51340. {
  51341. $this->useIncludePath = $useIncludePath;
  51342. }
  51343. public function getUseIncludePath()
  51344. {
  51345. return $this->useIncludePath;
  51346. }
  51347. public function setClassMapAuthoritative($classMapAuthoritative)
  51348. {
  51349. $this->classMapAuthoritative = $classMapAuthoritative;
  51350. }
  51351. public function isClassMapAuthoritative()
  51352. {
  51353. return $this->classMapAuthoritative;
  51354. }
  51355. public function setApcuPrefix($apcuPrefix)
  51356. {
  51357. $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
  51358. }
  51359. public function getApcuPrefix()
  51360. {
  51361. return $this->apcuPrefix;
  51362. }
  51363. public function register($prepend = false)
  51364. {
  51365. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  51366. }
  51367. public function unregister()
  51368. {
  51369. spl_autoload_unregister(array($this, 'loadClass'));
  51370. }
  51371. public function loadClass($class)
  51372. {
  51373. if ($file = $this->findFile($class)) {
  51374. includeFile($file);
  51375. return true;
  51376. }
  51377. }
  51378. public function findFile($class)
  51379. {
  51380. if (isset($this->classMap[$class])) {
  51381. return $this->classMap[$class];
  51382. }
  51383. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  51384. return false;
  51385. }
  51386. if (null !== $this->apcuPrefix) {
  51387. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  51388. if ($hit) {
  51389. return $file;
  51390. }
  51391. }
  51392. $file = $this->findFileWithExtension($class, '.php');
  51393. if (false === $file && defined('HHVM_VERSION')) {
  51394. $file = $this->findFileWithExtension($class, '.hh');
  51395. }
  51396. if (null !== $this->apcuPrefix) {
  51397. apcu_add($this->apcuPrefix.$class, $file);
  51398. }
  51399. if (false === $file) {
  51400. $this->missingClasses[$class] = true;
  51401. }
  51402. return $file;
  51403. }
  51404. private function findFileWithExtension($class, $ext)
  51405. {
  51406. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  51407. $first = $class[0];
  51408. if (isset($this->prefixLengthsPsr4[$first])) {
  51409. $subPath = $class;
  51410. while (false !== $lastPos = strrpos($subPath, '\\')) {
  51411. $subPath = substr($subPath, 0, $lastPos);
  51412. $search = $subPath . '\\';
  51413. if (isset($this->prefixDirsPsr4[$search])) {
  51414. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  51415. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  51416. if (file_exists($file = $dir . $pathEnd)) {
  51417. return $file;
  51418. }
  51419. }
  51420. }
  51421. }
  51422. }
  51423. foreach ($this->fallbackDirsPsr4 as $dir) {
  51424. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  51425. return $file;
  51426. }
  51427. }
  51428. if (false !== $pos = strrpos($class, '\\')) {
  51429. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  51430. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  51431. } else {
  51432. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  51433. }
  51434. if (isset($this->prefixesPsr0[$first])) {
  51435. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  51436. if (0 === strpos($class, $prefix)) {
  51437. foreach ($dirs as $dir) {
  51438. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  51439. return $file;
  51440. }
  51441. }
  51442. }
  51443. }
  51444. }
  51445. foreach ($this->fallbackDirsPsr0 as $dir) {
  51446. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  51447. return $file;
  51448. }
  51449. }
  51450. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  51451. return $file;
  51452. }
  51453. return false;
  51454. }
  51455. }
  51456. function includeFile($file)
  51457. {
  51458. include $file;
  51459. }
  51460. ##
  51461. ## Bundle of CA Root Certificates
  51462. ##
  51463. ## Certificate data from Mozilla as of: Wed Jun 20 03:12:06 2018 GMT
  51464. ##
  51465. ## This is a bundle of X.509 certificates of public Certificate Authorities
  51466. ## (CA). These were automatically extracted from Mozilla's root certificates
  51467. ## file (certdata.txt). This file can be found in the mozilla source tree:
  51468. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  51469. ##
  51470. ## It contains the certificates in PEM format and therefore
  51471. ## can be directly used with curl / libcurl / php_curl, or with
  51472. ## an Apache+mod_ssl webserver for SSL client authentication.
  51473. ## Just configure this file as the SSLCACertificateFile.
  51474. ##
  51475. ## Conversion done with mk-ca-bundle.pl version 1.27.
  51476. ## SHA256: c80f571d9f4ebca4a91e0ad3a546f263153d71afffc845c6f8f52ce9d1a2e8ec
  51477. ##
  51478. GlobalSign Root CA
  51479. ==================
  51480. -----BEGIN CERTIFICATE-----
  51481. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  51482. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  51483. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  51484. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  51485. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  51486. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  51487. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  51488. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  51489. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  51490. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  51491. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  51492. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  51493. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  51494. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  51495. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  51496. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  51497. -----END CERTIFICATE-----
  51498. GlobalSign Root CA - R2
  51499. =======================
  51500. -----BEGIN CERTIFICATE-----
  51501. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  51502. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  51503. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  51504. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  51505. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  51506. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  51507. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  51508. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  51509. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  51510. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  51511. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  51512. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  51513. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  51514. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  51515. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  51516. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  51517. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  51518. -----END CERTIFICATE-----
  51519. Verisign Class 3 Public Primary Certification Authority - G3
  51520. ============================================================
  51521. -----BEGIN CERTIFICATE-----
  51522. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  51523. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  51524. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  51525. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  51526. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  51527. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  51528. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  51529. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  51530. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  51531. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  51532. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  51533. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  51534. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  51535. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  51536. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  51537. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  51538. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  51539. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  51540. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  51541. -----END CERTIFICATE-----
  51542. Entrust.net Premium 2048 Secure Server CA
  51543. =========================================
  51544. -----BEGIN CERTIFICATE-----
  51545. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  51546. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  51547. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  51548. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  51549. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  51550. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  51551. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  51552. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  51553. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  51554. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  51555. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  51556. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  51557. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  51558. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  51559. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  51560. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  51561. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  51562. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  51563. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  51564. -----END CERTIFICATE-----
  51565. Baltimore CyberTrust Root
  51566. =========================
  51567. -----BEGIN CERTIFICATE-----
  51568. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  51569. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  51570. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  51571. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  51572. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  51573. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  51574. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  51575. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  51576. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  51577. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  51578. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  51579. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  51580. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  51581. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  51582. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  51583. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  51584. -----END CERTIFICATE-----
  51585. AddTrust External Root
  51586. ======================
  51587. -----BEGIN CERTIFICATE-----
  51588. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  51589. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  51590. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  51591. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  51592. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  51593. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  51594. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  51595. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  51596. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  51597. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  51598. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  51599. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  51600. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  51601. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  51602. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  51603. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  51604. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  51605. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  51606. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  51607. -----END CERTIFICATE-----
  51608. Entrust Root Certification Authority
  51609. ====================================
  51610. -----BEGIN CERTIFICATE-----
  51611. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  51612. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  51613. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  51614. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  51615. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  51616. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  51617. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  51618. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  51619. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  51620. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  51621. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  51622. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  51623. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  51624. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  51625. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  51626. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  51627. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  51628. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  51629. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  51630. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  51631. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  51632. -----END CERTIFICATE-----
  51633. GeoTrust Global CA
  51634. ==================
  51635. -----BEGIN CERTIFICATE-----
  51636. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  51637. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  51638. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  51639. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  51640. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  51641. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  51642. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  51643. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  51644. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  51645. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  51646. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  51647. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  51648. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  51649. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  51650. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  51651. Mw==
  51652. -----END CERTIFICATE-----
  51653. GeoTrust Universal CA
  51654. =====================
  51655. -----BEGIN CERTIFICATE-----
  51656. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  51657. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  51658. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  51659. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  51660. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  51661. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  51662. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  51663. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  51664. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  51665. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  51666. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  51667. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  51668. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  51669. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  51670. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  51671. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  51672. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  51673. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  51674. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  51675. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  51676. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  51677. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  51678. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  51679. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  51680. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  51681. -----END CERTIFICATE-----
  51682. GeoTrust Universal CA 2
  51683. =======================
  51684. -----BEGIN CERTIFICATE-----
  51685. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  51686. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  51687. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  51688. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  51689. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  51690. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  51691. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  51692. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  51693. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  51694. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  51695. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  51696. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  51697. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  51698. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  51699. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  51700. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  51701. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  51702. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  51703. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  51704. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  51705. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  51706. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  51707. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  51708. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  51709. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  51710. -----END CERTIFICATE-----
  51711. Visa eCommerce Root
  51712. ===================
  51713. -----BEGIN CERTIFICATE-----
  51714. MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG
  51715. EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug
  51716. QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2
  51717. WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm
  51718. VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv
  51719. bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL
  51720. F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b
  51721. RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0
  51722. TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI
  51723. /k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs
  51724. GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG
  51725. MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc
  51726. CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW
  51727. YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz
  51728. zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu
  51729. YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
  51730. 398znM/jra6O1I7mT1GvFpLgXPYHDw==
  51731. -----END CERTIFICATE-----
  51732. Comodo AAA Services root
  51733. ========================
  51734. -----BEGIN CERTIFICATE-----
  51735. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  51736. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  51737. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  51738. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  51739. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  51740. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  51741. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  51742. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  51743. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  51744. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  51745. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  51746. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  51747. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  51748. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  51749. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  51750. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  51751. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  51752. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  51753. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  51754. -----END CERTIFICATE-----
  51755. QuoVadis Root CA
  51756. ================
  51757. -----BEGIN CERTIFICATE-----
  51758. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  51759. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  51760. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  51761. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  51762. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  51763. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  51764. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  51765. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  51766. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  51767. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  51768. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  51769. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  51770. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  51771. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  51772. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  51773. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  51774. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  51775. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  51776. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  51777. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  51778. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  51779. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  51780. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  51781. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  51782. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  51783. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  51784. 5nrQNiOKSnQ2+Q==
  51785. -----END CERTIFICATE-----
  51786. QuoVadis Root CA 2
  51787. ==================
  51788. -----BEGIN CERTIFICATE-----
  51789. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  51790. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  51791. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  51792. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  51793. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  51794. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  51795. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  51796. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  51797. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  51798. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  51799. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  51800. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  51801. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  51802. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  51803. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  51804. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  51805. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  51806. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  51807. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  51808. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  51809. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  51810. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  51811. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  51812. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  51813. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  51814. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  51815. -----END CERTIFICATE-----
  51816. QuoVadis Root CA 3
  51817. ==================
  51818. -----BEGIN CERTIFICATE-----
  51819. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  51820. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  51821. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  51822. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  51823. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  51824. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  51825. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  51826. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  51827. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  51828. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  51829. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  51830. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  51831. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  51832. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  51833. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  51834. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  51835. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  51836. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  51837. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  51838. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  51839. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  51840. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  51841. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  51842. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  51843. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  51844. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  51845. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  51846. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  51847. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  51848. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  51849. -----END CERTIFICATE-----
  51850. Security Communication Root CA
  51851. ==============================
  51852. -----BEGIN CERTIFICATE-----
  51853. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  51854. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  51855. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  51856. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  51857. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  51858. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  51859. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  51860. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  51861. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  51862. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  51863. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  51864. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  51865. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  51866. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  51867. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  51868. FL39vmwLAw==
  51869. -----END CERTIFICATE-----
  51870. Sonera Class 2 Root CA
  51871. ======================
  51872. -----BEGIN CERTIFICATE-----
  51873. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  51874. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  51875. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  51876. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  51877. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  51878. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  51879. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  51880. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  51881. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  51882. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  51883. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  51884. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  51885. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  51886. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  51887. llpwrN9M
  51888. -----END CERTIFICATE-----
  51889. XRamp Global CA Root
  51890. ====================
  51891. -----BEGIN CERTIFICATE-----
  51892. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  51893. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  51894. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  51895. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  51896. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  51897. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  51898. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  51899. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  51900. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  51901. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  51902. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  51903. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  51904. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  51905. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  51906. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  51907. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  51908. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  51909. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  51910. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  51911. -----END CERTIFICATE-----
  51912. Go Daddy Class 2 CA
  51913. ===================
  51914. -----BEGIN CERTIFICATE-----
  51915. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  51916. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  51917. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  51918. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  51919. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  51920. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  51921. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  51922. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  51923. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  51924. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  51925. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  51926. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  51927. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  51928. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  51929. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  51930. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  51931. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  51932. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  51933. vZ8=
  51934. -----END CERTIFICATE-----
  51935. Starfield Class 2 CA
  51936. ====================
  51937. -----BEGIN CERTIFICATE-----
  51938. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  51939. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  51940. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  51941. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  51942. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  51943. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  51944. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  51945. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  51946. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  51947. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  51948. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  51949. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  51950. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  51951. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  51952. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  51953. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  51954. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  51955. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  51956. QBFGmh95DmK/D5fs4C8fF5Q=
  51957. -----END CERTIFICATE-----
  51958. Taiwan GRCA
  51959. ===========
  51960. -----BEGIN CERTIFICATE-----
  51961. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  51962. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  51963. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  51964. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  51965. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  51966. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  51967. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  51968. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  51969. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  51970. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  51971. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  51972. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  51973. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  51974. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  51975. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  51976. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  51977. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  51978. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  51979. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  51980. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  51981. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  51982. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  51983. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  51984. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  51985. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  51986. -----END CERTIFICATE-----
  51987. DigiCert Assured ID Root CA
  51988. ===========================
  51989. -----BEGIN CERTIFICATE-----
  51990. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  51991. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  51992. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  51993. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  51994. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  51995. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  51996. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  51997. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  51998. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  51999. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  52000. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  52001. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  52002. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  52003. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  52004. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  52005. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  52006. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  52007. -----END CERTIFICATE-----
  52008. DigiCert Global Root CA
  52009. =======================
  52010. -----BEGIN CERTIFICATE-----
  52011. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  52012. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  52013. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  52014. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  52015. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  52016. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  52017. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  52018. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  52019. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  52020. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  52021. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  52022. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  52023. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  52024. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  52025. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  52026. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  52027. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  52028. -----END CERTIFICATE-----
  52029. DigiCert High Assurance EV Root CA
  52030. ==================================
  52031. -----BEGIN CERTIFICATE-----
  52032. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  52033. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  52034. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  52035. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  52036. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  52037. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  52038. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  52039. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  52040. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  52041. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  52042. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  52043. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  52044. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  52045. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  52046. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  52047. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  52048. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  52049. -----END CERTIFICATE-----
  52050. Certplus Class 2 Primary CA
  52051. ===========================
  52052. -----BEGIN CERTIFICATE-----
  52053. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  52054. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  52055. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  52056. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  52057. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  52058. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  52059. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  52060. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  52061. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  52062. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  52063. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  52064. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  52065. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  52066. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  52067. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  52068. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  52069. l7+ijrRU
  52070. -----END CERTIFICATE-----
  52071. DST Root CA X3
  52072. ==============
  52073. -----BEGIN CERTIFICATE-----
  52074. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  52075. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  52076. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  52077. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  52078. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  52079. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  52080. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  52081. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  52082. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  52083. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  52084. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  52085. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  52086. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  52087. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  52088. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  52089. -----END CERTIFICATE-----
  52090. SwissSign Gold CA - G2
  52091. ======================
  52092. -----BEGIN CERTIFICATE-----
  52093. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  52094. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  52095. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  52096. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  52097. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  52098. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  52099. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  52100. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  52101. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  52102. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  52103. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  52104. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  52105. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  52106. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  52107. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  52108. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  52109. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  52110. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  52111. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  52112. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  52113. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  52114. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  52115. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  52116. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  52117. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  52118. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  52119. -----END CERTIFICATE-----
  52120. SwissSign Silver CA - G2
  52121. ========================
  52122. -----BEGIN CERTIFICATE-----
  52123. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  52124. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  52125. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  52126. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  52127. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  52128. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  52129. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  52130. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  52131. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  52132. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  52133. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  52134. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  52135. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  52136. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  52137. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  52138. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  52139. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  52140. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  52141. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  52142. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  52143. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  52144. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  52145. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  52146. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  52147. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  52148. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  52149. -----END CERTIFICATE-----
  52150. GeoTrust Primary Certification Authority
  52151. ========================================
  52152. -----BEGIN CERTIFICATE-----
  52153. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  52154. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  52155. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  52156. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  52157. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  52158. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  52159. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  52160. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  52161. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  52162. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52163. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  52164. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  52165. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  52166. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  52167. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  52168. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  52169. -----END CERTIFICATE-----
  52170. thawte Primary Root CA
  52171. ======================
  52172. -----BEGIN CERTIFICATE-----
  52173. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  52174. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  52175. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  52176. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  52177. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  52178. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  52179. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  52180. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  52181. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  52182. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  52183. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  52184. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  52185. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  52186. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  52187. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  52188. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  52189. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  52190. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  52191. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  52192. -----END CERTIFICATE-----
  52193. VeriSign Class 3 Public Primary Certification Authority - G5
  52194. ============================================================
  52195. -----BEGIN CERTIFICATE-----
  52196. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  52197. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  52198. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  52199. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  52200. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  52201. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  52202. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  52203. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  52204. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  52205. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  52206. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  52207. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  52208. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  52209. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  52210. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  52211. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  52212. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  52213. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  52214. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  52215. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  52216. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  52217. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  52218. -----END CERTIFICATE-----
  52219. SecureTrust CA
  52220. ==============
  52221. -----BEGIN CERTIFICATE-----
  52222. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  52223. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  52224. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  52225. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  52226. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  52227. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  52228. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  52229. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  52230. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  52231. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  52232. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  52233. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  52234. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  52235. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  52236. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  52237. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  52238. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  52239. -----END CERTIFICATE-----
  52240. Secure Global CA
  52241. ================
  52242. -----BEGIN CERTIFICATE-----
  52243. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  52244. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  52245. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  52246. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  52247. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  52248. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  52249. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  52250. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  52251. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  52252. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  52253. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  52254. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  52255. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  52256. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  52257. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  52258. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  52259. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  52260. -----END CERTIFICATE-----
  52261. COMODO Certification Authority
  52262. ==============================
  52263. -----BEGIN CERTIFICATE-----
  52264. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  52265. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  52266. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  52267. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  52268. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  52269. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  52270. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  52271. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  52272. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  52273. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  52274. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  52275. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  52276. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  52277. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  52278. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  52279. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  52280. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  52281. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  52282. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  52283. -----END CERTIFICATE-----
  52284. Network Solutions Certificate Authority
  52285. =======================================
  52286. -----BEGIN CERTIFICATE-----
  52287. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  52288. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  52289. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  52290. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  52291. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  52292. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  52293. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  52294. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  52295. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  52296. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  52297. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  52298. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  52299. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  52300. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  52301. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  52302. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  52303. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  52304. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  52305. -----END CERTIFICATE-----
  52306. COMODO ECC Certification Authority
  52307. ==================================
  52308. -----BEGIN CERTIFICATE-----
  52309. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  52310. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  52311. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  52312. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  52313. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  52314. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  52315. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  52316. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  52317. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  52318. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  52319. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  52320. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  52321. -----END CERTIFICATE-----
  52322. OISTE WISeKey Global Root GA CA
  52323. ===============================
  52324. -----BEGIN CERTIFICATE-----
  52325. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  52326. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  52327. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  52328. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  52329. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  52330. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  52331. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  52332. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  52333. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  52334. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  52335. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  52336. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  52337. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  52338. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  52339. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  52340. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  52341. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  52342. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  52343. -----END CERTIFICATE-----
  52344. Certigna
  52345. ========
  52346. -----BEGIN CERTIFICATE-----
  52347. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  52348. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  52349. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  52350. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  52351. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  52352. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  52353. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  52354. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  52355. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  52356. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  52357. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  52358. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  52359. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  52360. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  52361. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  52362. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  52363. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  52364. -----END CERTIFICATE-----
  52365. Deutsche Telekom Root CA 2
  52366. ==========================
  52367. -----BEGIN CERTIFICATE-----
  52368. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  52369. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  52370. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  52371. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  52372. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  52373. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  52374. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  52375. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  52376. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  52377. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  52378. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  52379. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  52380. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  52381. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  52382. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  52383. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  52384. Cm26OWMohpLzGITY+9HPBVZkVw==
  52385. -----END CERTIFICATE-----
  52386. Cybertrust Global Root
  52387. ======================
  52388. -----BEGIN CERTIFICATE-----
  52389. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  52390. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  52391. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  52392. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  52393. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  52394. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  52395. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  52396. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  52397. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  52398. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  52399. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  52400. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  52401. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  52402. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  52403. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  52404. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  52405. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  52406. -----END CERTIFICATE-----
  52407. ePKI Root Certification Authority
  52408. =================================
  52409. -----BEGIN CERTIFICATE-----
  52410. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  52411. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  52412. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  52413. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  52414. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  52415. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  52416. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  52417. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  52418. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  52419. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  52420. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  52421. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  52422. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  52423. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  52424. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  52425. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  52426. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  52427. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  52428. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  52429. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  52430. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  52431. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  52432. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  52433. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  52434. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  52435. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  52436. -----END CERTIFICATE-----
  52437. certSIGN ROOT CA
  52438. ================
  52439. -----BEGIN CERTIFICATE-----
  52440. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  52441. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  52442. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  52443. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  52444. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  52445. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  52446. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  52447. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  52448. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  52449. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  52450. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  52451. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  52452. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  52453. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  52454. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  52455. -----END CERTIFICATE-----
  52456. GeoTrust Primary Certification Authority - G3
  52457. =============================================
  52458. -----BEGIN CERTIFICATE-----
  52459. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  52460. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  52461. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  52462. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  52463. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  52464. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  52465. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  52466. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  52467. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  52468. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  52469. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  52470. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  52471. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  52472. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  52473. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  52474. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  52475. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  52476. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  52477. -----END CERTIFICATE-----
  52478. thawte Primary Root CA - G2
  52479. ===========================
  52480. -----BEGIN CERTIFICATE-----
  52481. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  52482. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  52483. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  52484. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  52485. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  52486. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  52487. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  52488. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  52489. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  52490. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  52491. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  52492. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  52493. -----END CERTIFICATE-----
  52494. thawte Primary Root CA - G3
  52495. ===========================
  52496. -----BEGIN CERTIFICATE-----
  52497. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  52498. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  52499. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  52500. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  52501. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  52502. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  52503. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  52504. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  52505. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  52506. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  52507. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  52508. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  52509. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  52510. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  52511. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  52512. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  52513. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  52514. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  52515. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  52516. -----END CERTIFICATE-----
  52517. GeoTrust Primary Certification Authority - G2
  52518. =============================================
  52519. -----BEGIN CERTIFICATE-----
  52520. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  52521. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  52522. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  52523. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  52524. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  52525. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  52526. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  52527. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  52528. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  52529. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  52530. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  52531. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  52532. npaqBA+K
  52533. -----END CERTIFICATE-----
  52534. VeriSign Universal Root Certification Authority
  52535. ===============================================
  52536. -----BEGIN CERTIFICATE-----
  52537. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  52538. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  52539. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  52540. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  52541. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  52542. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  52543. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  52544. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  52545. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  52546. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  52547. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  52548. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  52549. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  52550. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  52551. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  52552. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  52553. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  52554. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  52555. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  52556. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  52557. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  52558. mJO37M2CYfE45k+XmCpajQ==
  52559. -----END CERTIFICATE-----
  52560. VeriSign Class 3 Public Primary Certification Authority - G4
  52561. ============================================================
  52562. -----BEGIN CERTIFICATE-----
  52563. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  52564. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  52565. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  52566. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  52567. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  52568. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  52569. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  52570. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  52571. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  52572. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  52573. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  52574. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  52575. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  52576. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  52577. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  52578. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  52579. -----END CERTIFICATE-----
  52580. NetLock Arany (Class Gold) Főtanúsítvány
  52581. ========================================
  52582. -----BEGIN CERTIFICATE-----
  52583. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  52584. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  52585. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  52586. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  52587. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  52588. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  52589. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  52590. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  52591. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  52592. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  52593. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  52594. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  52595. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  52596. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  52597. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  52598. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  52599. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  52600. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  52601. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  52602. -----END CERTIFICATE-----
  52603. Staat der Nederlanden Root CA - G2
  52604. ==================================
  52605. -----BEGIN CERTIFICATE-----
  52606. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  52607. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  52608. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  52609. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  52610. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  52611. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  52612. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  52613. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  52614. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  52615. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  52616. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  52617. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  52618. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  52619. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  52620. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  52621. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  52622. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  52623. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  52624. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  52625. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  52626. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  52627. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  52628. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  52629. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  52630. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  52631. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  52632. 66+KAQ==
  52633. -----END CERTIFICATE-----
  52634. Hongkong Post Root CA 1
  52635. =======================
  52636. -----BEGIN CERTIFICATE-----
  52637. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  52638. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  52639. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  52640. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  52641. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  52642. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  52643. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  52644. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  52645. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  52646. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  52647. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  52648. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  52649. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  52650. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  52651. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  52652. -----END CERTIFICATE-----
  52653. SecureSign RootCA11
  52654. ===================
  52655. -----BEGIN CERTIFICATE-----
  52656. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  52657. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  52658. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  52659. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  52660. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  52661. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  52662. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  52663. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  52664. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  52665. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  52666. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  52667. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  52668. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  52669. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  52670. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  52671. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  52672. -----END CERTIFICATE-----
  52673. Microsec e-Szigno Root CA 2009
  52674. ==============================
  52675. -----BEGIN CERTIFICATE-----
  52676. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  52677. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  52678. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  52679. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  52680. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  52681. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  52682. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  52683. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  52684. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  52685. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  52686. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  52687. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  52688. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  52689. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  52690. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  52691. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  52692. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  52693. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  52694. LXpUq3DDfSJlgnCW
  52695. -----END CERTIFICATE-----
  52696. GlobalSign Root CA - R3
  52697. =======================
  52698. -----BEGIN CERTIFICATE-----
  52699. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  52700. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  52701. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  52702. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  52703. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  52704. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  52705. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  52706. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  52707. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  52708. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  52709. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  52710. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  52711. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  52712. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  52713. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  52714. kpeDMdmztcpHWD9f
  52715. -----END CERTIFICATE-----
  52716. Autoridad de Certificacion Firmaprofesional CIF A62634068
  52717. =========================================================
  52718. -----BEGIN CERTIFICATE-----
  52719. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  52720. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  52721. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  52722. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  52723. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  52724. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  52725. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  52726. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  52727. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  52728. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  52729. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  52730. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  52731. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  52732. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  52733. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  52734. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  52735. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  52736. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  52737. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  52738. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  52739. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  52740. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  52741. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  52742. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  52743. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  52744. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  52745. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  52746. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  52747. -----END CERTIFICATE-----
  52748. Izenpe.com
  52749. ==========
  52750. -----BEGIN CERTIFICATE-----
  52751. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  52752. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  52753. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  52754. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  52755. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  52756. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  52757. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  52758. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  52759. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  52760. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  52761. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  52762. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  52763. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  52764. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  52765. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  52766. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  52767. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  52768. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  52769. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  52770. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  52771. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  52772. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  52773. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  52774. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  52775. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  52776. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  52777. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  52778. -----END CERTIFICATE-----
  52779. Chambers of Commerce Root - 2008
  52780. ================================
  52781. -----BEGIN CERTIFICATE-----
  52782. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  52783. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  52784. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  52785. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  52786. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  52787. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  52788. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  52789. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  52790. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  52791. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  52792. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  52793. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  52794. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  52795. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  52796. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  52797. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  52798. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  52799. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  52800. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  52801. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  52802. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  52803. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  52804. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  52805. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  52806. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  52807. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  52808. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  52809. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  52810. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  52811. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  52812. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  52813. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  52814. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  52815. -----END CERTIFICATE-----
  52816. Global Chambersign Root - 2008
  52817. ==============================
  52818. -----BEGIN CERTIFICATE-----
  52819. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  52820. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  52821. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  52822. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  52823. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  52824. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  52825. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  52826. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  52827. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  52828. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  52829. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  52830. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  52831. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  52832. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  52833. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  52834. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  52835. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  52836. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  52837. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  52838. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  52839. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  52840. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  52841. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  52842. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  52843. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  52844. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  52845. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  52846. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  52847. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  52848. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  52849. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  52850. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  52851. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  52852. -----END CERTIFICATE-----
  52853. Go Daddy Root Certificate Authority - G2
  52854. ========================================
  52855. -----BEGIN CERTIFICATE-----
  52856. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  52857. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  52858. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  52859. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  52860. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  52861. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  52862. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  52863. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  52864. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  52865. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  52866. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  52867. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  52868. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  52869. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  52870. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  52871. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  52872. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  52873. -----END CERTIFICATE-----
  52874. Starfield Root Certificate Authority - G2
  52875. =========================================
  52876. -----BEGIN CERTIFICATE-----
  52877. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  52878. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  52879. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  52880. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  52881. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  52882. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  52883. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  52884. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  52885. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  52886. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  52887. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  52888. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  52889. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  52890. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  52891. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  52892. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  52893. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  52894. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  52895. -----END CERTIFICATE-----
  52896. Starfield Services Root Certificate Authority - G2
  52897. ==================================================
  52898. -----BEGIN CERTIFICATE-----
  52899. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  52900. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  52901. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  52902. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  52903. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  52904. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  52905. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  52906. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  52907. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  52908. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  52909. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  52910. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  52911. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  52912. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  52913. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  52914. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  52915. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  52916. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  52917. -----END CERTIFICATE-----
  52918. AffirmTrust Commercial
  52919. ======================
  52920. -----BEGIN CERTIFICATE-----
  52921. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  52922. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  52923. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  52924. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  52925. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  52926. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  52927. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  52928. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  52929. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  52930. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  52931. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  52932. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  52933. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  52934. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  52935. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  52936. -----END CERTIFICATE-----
  52937. AffirmTrust Networking
  52938. ======================
  52939. -----BEGIN CERTIFICATE-----
  52940. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  52941. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  52942. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  52943. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  52944. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  52945. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  52946. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  52947. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  52948. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  52949. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  52950. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  52951. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  52952. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  52953. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  52954. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  52955. -----END CERTIFICATE-----
  52956. AffirmTrust Premium
  52957. ===================
  52958. -----BEGIN CERTIFICATE-----
  52959. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  52960. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  52961. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  52962. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  52963. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  52964. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  52965. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  52966. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  52967. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  52968. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  52969. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  52970. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  52971. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  52972. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  52973. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  52974. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  52975. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  52976. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  52977. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  52978. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  52979. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  52980. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  52981. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  52982. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  52983. -----END CERTIFICATE-----
  52984. AffirmTrust Premium ECC
  52985. =======================
  52986. -----BEGIN CERTIFICATE-----
  52987. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  52988. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  52989. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  52990. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  52991. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  52992. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  52993. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  52994. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  52995. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  52996. eQ==
  52997. -----END CERTIFICATE-----
  52998. Certum Trusted Network CA
  52999. =========================
  53000. -----BEGIN CERTIFICATE-----
  53001. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  53002. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  53003. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  53004. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  53005. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  53006. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  53007. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  53008. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  53009. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  53010. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  53011. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  53012. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  53013. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  53014. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  53015. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  53016. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  53017. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  53018. -----END CERTIFICATE-----
  53019. TWCA Root Certification Authority
  53020. =================================
  53021. -----BEGIN CERTIFICATE-----
  53022. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  53023. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  53024. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  53025. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  53026. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  53027. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  53028. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  53029. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  53030. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  53031. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  53032. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  53033. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  53034. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  53035. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  53036. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  53037. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  53038. -----END CERTIFICATE-----
  53039. Security Communication RootCA2
  53040. ==============================
  53041. -----BEGIN CERTIFICATE-----
  53042. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  53043. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  53044. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  53045. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  53046. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  53047. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  53048. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  53049. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  53050. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  53051. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  53052. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  53053. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  53054. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  53055. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  53056. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  53057. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  53058. -----END CERTIFICATE-----
  53059. EC-ACC
  53060. ======
  53061. -----BEGIN CERTIFICATE-----
  53062. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  53063. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  53064. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  53065. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  53066. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  53067. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  53068. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  53069. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  53070. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  53071. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  53072. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  53073. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  53074. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  53075. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  53076. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  53077. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  53078. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  53079. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  53080. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  53081. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  53082. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  53083. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  53084. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  53085. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  53086. 5EI=
  53087. -----END CERTIFICATE-----
  53088. Hellenic Academic and Research Institutions RootCA 2011
  53089. =======================================================
  53090. -----BEGIN CERTIFICATE-----
  53091. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  53092. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  53093. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  53094. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  53095. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  53096. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  53097. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  53098. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  53099. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  53100. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  53101. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  53102. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  53103. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  53104. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  53105. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  53106. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  53107. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  53108. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  53109. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  53110. -----END CERTIFICATE-----
  53111. Actalis Authentication Root CA
  53112. ==============================
  53113. -----BEGIN CERTIFICATE-----
  53114. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  53115. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  53116. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  53117. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  53118. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  53119. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  53120. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  53121. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  53122. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  53123. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  53124. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  53125. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  53126. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  53127. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  53128. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  53129. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  53130. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  53131. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  53132. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  53133. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  53134. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  53135. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  53136. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  53137. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  53138. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  53139. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  53140. -----END CERTIFICATE-----
  53141. Trustis FPS Root CA
  53142. ===================
  53143. -----BEGIN CERTIFICATE-----
  53144. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  53145. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  53146. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  53147. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  53148. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  53149. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  53150. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  53151. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  53152. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  53153. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  53154. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  53155. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  53156. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  53157. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  53158. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  53159. iB6XzCGcKQENZetX2fNXlrtIzYE=
  53160. -----END CERTIFICATE-----
  53161. Buypass Class 2 Root CA
  53162. =======================
  53163. -----BEGIN CERTIFICATE-----
  53164. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  53165. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  53166. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  53167. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  53168. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  53169. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  53170. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  53171. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  53172. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  53173. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  53174. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  53175. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  53176. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  53177. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  53178. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  53179. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  53180. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  53181. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  53182. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  53183. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  53184. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  53185. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  53186. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  53187. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  53188. rJgWVqA=
  53189. -----END CERTIFICATE-----
  53190. Buypass Class 3 Root CA
  53191. =======================
  53192. -----BEGIN CERTIFICATE-----
  53193. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  53194. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  53195. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  53196. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  53197. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  53198. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  53199. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  53200. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  53201. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  53202. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  53203. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  53204. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  53205. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  53206. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  53207. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  53208. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  53209. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  53210. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  53211. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  53212. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  53213. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  53214. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  53215. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  53216. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  53217. Cp/HuZc=
  53218. -----END CERTIFICATE-----
  53219. T-TeleSec GlobalRoot Class 3
  53220. ============================
  53221. -----BEGIN CERTIFICATE-----
  53222. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  53223. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  53224. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  53225. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  53226. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  53227. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  53228. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  53229. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  53230. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  53231. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  53232. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  53233. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  53234. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  53235. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  53236. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  53237. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  53238. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  53239. -----END CERTIFICATE-----
  53240. EE Certification Centre Root CA
  53241. ===============================
  53242. -----BEGIN CERTIFICATE-----
  53243. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  53244. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  53245. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  53246. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  53247. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  53248. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  53249. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  53250. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  53251. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  53252. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  53253. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  53254. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  53255. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  53256. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  53257. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  53258. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  53259. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  53260. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  53261. dcGWxZ0=
  53262. -----END CERTIFICATE-----
  53263. D-TRUST Root Class 3 CA 2 2009
  53264. ==============================
  53265. -----BEGIN CERTIFICATE-----
  53266. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  53267. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  53268. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  53269. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  53270. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  53271. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  53272. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  53273. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  53274. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  53275. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  53276. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  53277. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  53278. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  53279. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  53280. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  53281. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  53282. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  53283. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  53284. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  53285. -----END CERTIFICATE-----
  53286. D-TRUST Root Class 3 CA 2 EV 2009
  53287. =================================
  53288. -----BEGIN CERTIFICATE-----
  53289. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  53290. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  53291. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  53292. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  53293. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  53294. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  53295. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  53296. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  53297. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  53298. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  53299. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  53300. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  53301. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  53302. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  53303. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  53304. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  53305. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  53306. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  53307. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  53308. w9y4AyHqnxbxLFS1
  53309. -----END CERTIFICATE-----
  53310. CA Disig Root R2
  53311. ================
  53312. -----BEGIN CERTIFICATE-----
  53313. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  53314. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  53315. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  53316. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  53317. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  53318. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  53319. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  53320. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  53321. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  53322. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  53323. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  53324. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  53325. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  53326. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  53327. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  53328. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  53329. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  53330. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  53331. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  53332. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  53333. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  53334. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  53335. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  53336. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  53337. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  53338. -----END CERTIFICATE-----
  53339. ACCVRAIZ1
  53340. =========
  53341. -----BEGIN CERTIFICATE-----
  53342. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  53343. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  53344. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  53345. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  53346. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  53347. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  53348. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  53349. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  53350. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  53351. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  53352. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  53353. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  53354. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  53355. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  53356. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  53357. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  53358. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  53359. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  53360. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  53361. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  53362. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  53363. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  53364. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  53365. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  53366. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  53367. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  53368. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  53369. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  53370. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  53371. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  53372. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  53373. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  53374. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  53375. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  53376. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  53377. EfbRD0tVNEYqi4Y7
  53378. -----END CERTIFICATE-----
  53379. TWCA Global Root CA
  53380. ===================
  53381. -----BEGIN CERTIFICATE-----
  53382. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  53383. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  53384. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  53385. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  53386. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  53387. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  53388. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  53389. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  53390. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  53391. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  53392. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  53393. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  53394. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  53395. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  53396. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  53397. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  53398. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  53399. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  53400. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  53401. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  53402. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  53403. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  53404. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  53405. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  53406. -----END CERTIFICATE-----
  53407. TeliaSonera Root CA v1
  53408. ======================
  53409. -----BEGIN CERTIFICATE-----
  53410. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  53411. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  53412. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  53413. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  53414. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  53415. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  53416. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  53417. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  53418. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  53419. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  53420. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  53421. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  53422. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  53423. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  53424. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  53425. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  53426. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  53427. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  53428. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  53429. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  53430. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  53431. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  53432. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  53433. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  53434. -----END CERTIFICATE-----
  53435. E-Tugra Certification Authority
  53436. ===============================
  53437. -----BEGIN CERTIFICATE-----
  53438. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  53439. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  53440. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  53441. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  53442. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  53443. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  53444. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  53445. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  53446. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  53447. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  53448. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  53449. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  53450. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  53451. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  53452. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  53453. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  53454. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  53455. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  53456. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  53457. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  53458. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  53459. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  53460. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  53461. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  53462. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  53463. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  53464. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  53465. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  53466. C7TbO6Orb1wdtn7os4I07QZcJA==
  53467. -----END CERTIFICATE-----
  53468. T-TeleSec GlobalRoot Class 2
  53469. ============================
  53470. -----BEGIN CERTIFICATE-----
  53471. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  53472. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  53473. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  53474. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  53475. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  53476. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  53477. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  53478. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  53479. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  53480. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  53481. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  53482. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  53483. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  53484. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  53485. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  53486. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  53487. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  53488. -----END CERTIFICATE-----
  53489. Atos TrustedRoot 2011
  53490. =====================
  53491. -----BEGIN CERTIFICATE-----
  53492. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  53493. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  53494. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  53495. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  53496. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  53497. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  53498. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  53499. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  53500. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  53501. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  53502. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  53503. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  53504. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  53505. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  53506. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  53507. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  53508. -----END CERTIFICATE-----
  53509. QuoVadis Root CA 1 G3
  53510. =====================
  53511. -----BEGIN CERTIFICATE-----
  53512. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  53513. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  53514. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  53515. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  53516. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  53517. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  53518. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  53519. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  53520. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  53521. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  53522. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  53523. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  53524. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  53525. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53526. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  53527. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  53528. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  53529. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  53530. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  53531. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  53532. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  53533. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  53534. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  53535. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  53536. hMJKzRwuJIczYOXD
  53537. -----END CERTIFICATE-----
  53538. QuoVadis Root CA 2 G3
  53539. =====================
  53540. -----BEGIN CERTIFICATE-----
  53541. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  53542. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  53543. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  53544. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  53545. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  53546. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  53547. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  53548. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  53549. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  53550. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  53551. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  53552. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  53553. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  53554. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53555. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  53556. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  53557. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  53558. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  53559. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  53560. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  53561. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  53562. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  53563. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  53564. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  53565. O3jtZsSOeWmD3n+M
  53566. -----END CERTIFICATE-----
  53567. QuoVadis Root CA 3 G3
  53568. =====================
  53569. -----BEGIN CERTIFICATE-----
  53570. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  53571. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  53572. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  53573. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  53574. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  53575. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  53576. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  53577. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  53578. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  53579. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  53580. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  53581. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  53582. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  53583. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53584. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  53585. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  53586. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  53587. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  53588. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  53589. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  53590. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  53591. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  53592. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  53593. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  53594. PpxxVJkES/1Y+Zj0
  53595. -----END CERTIFICATE-----
  53596. DigiCert Assured ID Root G2
  53597. ===========================
  53598. -----BEGIN CERTIFICATE-----
  53599. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  53600. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  53601. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  53602. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  53603. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  53604. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  53605. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  53606. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  53607. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  53608. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  53609. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  53610. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  53611. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  53612. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  53613. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  53614. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  53615. IhNzbM8m9Yop5w==
  53616. -----END CERTIFICATE-----
  53617. DigiCert Assured ID Root G3
  53618. ===========================
  53619. -----BEGIN CERTIFICATE-----
  53620. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  53621. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  53622. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  53623. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  53624. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  53625. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  53626. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  53627. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  53628. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  53629. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  53630. 1vUhZscv6pZjamVFkpUBtA==
  53631. -----END CERTIFICATE-----
  53632. DigiCert Global Root G2
  53633. =======================
  53634. -----BEGIN CERTIFICATE-----
  53635. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  53636. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  53637. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  53638. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  53639. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  53640. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  53641. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  53642. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  53643. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  53644. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  53645. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  53646. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  53647. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  53648. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  53649. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  53650. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  53651. MrY=
  53652. -----END CERTIFICATE-----
  53653. DigiCert Global Root G3
  53654. =======================
  53655. -----BEGIN CERTIFICATE-----
  53656. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  53657. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  53658. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  53659. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  53660. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  53661. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  53662. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  53663. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  53664. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  53665. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  53666. VOKa5Vt8sycX
  53667. -----END CERTIFICATE-----
  53668. DigiCert Trusted Root G4
  53669. ========================
  53670. -----BEGIN CERTIFICATE-----
  53671. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  53672. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  53673. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  53674. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  53675. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  53676. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  53677. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  53678. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  53679. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  53680. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  53681. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  53682. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  53683. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  53684. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  53685. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  53686. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  53687. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  53688. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  53689. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  53690. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  53691. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  53692. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  53693. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  53694. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  53695. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  53696. 82Z+
  53697. -----END CERTIFICATE-----
  53698. COMODO RSA Certification Authority
  53699. ==================================
  53700. -----BEGIN CERTIFICATE-----
  53701. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  53702. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  53703. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  53704. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  53705. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  53706. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  53707. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  53708. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  53709. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  53710. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  53711. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  53712. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  53713. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  53714. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  53715. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  53716. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  53717. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  53718. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  53719. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  53720. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  53721. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  53722. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  53723. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  53724. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  53725. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  53726. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  53727. LaZRfyHBNVOFBkpdn627G190
  53728. -----END CERTIFICATE-----
  53729. USERTrust RSA Certification Authority
  53730. =====================================
  53731. -----BEGIN CERTIFICATE-----
  53732. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  53733. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  53734. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  53735. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  53736. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  53737. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  53738. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  53739. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  53740. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  53741. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  53742. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  53743. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  53744. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  53745. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  53746. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  53747. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  53748. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  53749. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  53750. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  53751. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  53752. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  53753. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  53754. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  53755. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  53756. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  53757. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  53758. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  53759. -----END CERTIFICATE-----
  53760. USERTrust ECC Certification Authority
  53761. =====================================
  53762. -----BEGIN CERTIFICATE-----
  53763. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  53764. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  53765. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  53766. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  53767. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  53768. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  53769. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  53770. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  53771. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  53772. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  53773. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  53774. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  53775. -----END CERTIFICATE-----
  53776. GlobalSign ECC Root CA - R4
  53777. ===========================
  53778. -----BEGIN CERTIFICATE-----
  53779. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  53780. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53781. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  53782. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53783. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  53784. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  53785. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  53786. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  53787. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  53788. -----END CERTIFICATE-----
  53789. GlobalSign ECC Root CA - R5
  53790. ===========================
  53791. -----BEGIN CERTIFICATE-----
  53792. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  53793. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53794. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  53795. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53796. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  53797. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  53798. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  53799. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  53800. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  53801. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  53802. -----END CERTIFICATE-----
  53803. Staat der Nederlanden Root CA - G3
  53804. ==================================
  53805. -----BEGIN CERTIFICATE-----
  53806. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53807. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53808. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  53809. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  53810. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  53811. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  53812. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  53813. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  53814. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  53815. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  53816. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  53817. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  53818. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  53819. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  53820. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  53821. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  53822. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  53823. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  53824. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  53825. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  53826. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  53827. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  53828. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  53829. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  53830. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  53831. -----END CERTIFICATE-----
  53832. Staat der Nederlanden EV Root CA
  53833. ================================
  53834. -----BEGIN CERTIFICATE-----
  53835. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53836. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53837. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  53838. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  53839. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  53840. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  53841. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  53842. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  53843. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  53844. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  53845. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  53846. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  53847. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  53848. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  53849. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  53850. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  53851. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  53852. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  53853. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  53854. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  53855. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  53856. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  53857. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  53858. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  53859. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  53860. -----END CERTIFICATE-----
  53861. IdenTrust Commercial Root CA 1
  53862. ==============================
  53863. -----BEGIN CERTIFICATE-----
  53864. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  53865. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  53866. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  53867. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  53868. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  53869. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  53870. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  53871. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  53872. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  53873. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  53874. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  53875. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  53876. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  53877. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  53878. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  53879. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  53880. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  53881. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  53882. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  53883. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  53884. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  53885. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  53886. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  53887. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  53888. cGzM7vRX+Bi6hG6H
  53889. -----END CERTIFICATE-----
  53890. IdenTrust Public Sector Root CA 1
  53891. =================================
  53892. -----BEGIN CERTIFICATE-----
  53893. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  53894. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  53895. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  53896. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  53897. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  53898. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  53899. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  53900. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  53901. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  53902. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  53903. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  53904. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  53905. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  53906. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  53907. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  53908. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  53909. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  53910. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  53911. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  53912. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  53913. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  53914. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  53915. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  53916. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  53917. 3Wl9af0AVqW3rLatt8o+Ae+c
  53918. -----END CERTIFICATE-----
  53919. Entrust Root Certification Authority - G2
  53920. =========================================
  53921. -----BEGIN CERTIFICATE-----
  53922. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  53923. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  53924. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  53925. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  53926. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  53927. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  53928. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  53929. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  53930. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  53931. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  53932. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  53933. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  53934. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  53935. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  53936. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  53937. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  53938. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  53939. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  53940. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  53941. e4pIb4tF9g==
  53942. -----END CERTIFICATE-----
  53943. Entrust Root Certification Authority - EC1
  53944. ==========================================
  53945. -----BEGIN CERTIFICATE-----
  53946. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  53947. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  53948. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  53949. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  53950. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  53951. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  53952. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  53953. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  53954. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  53955. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  53956. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  53957. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  53958. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  53959. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  53960. -----END CERTIFICATE-----
  53961. CFCA EV ROOT
  53962. ============
  53963. -----BEGIN CERTIFICATE-----
  53964. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  53965. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  53966. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  53967. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  53968. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  53969. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  53970. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  53971. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  53972. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  53973. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  53974. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  53975. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  53976. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  53977. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  53978. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  53979. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  53980. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  53981. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  53982. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  53983. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  53984. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  53985. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  53986. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  53987. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  53988. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  53989. -----END CERTIFICATE-----
  53990. Certinomis - Root CA
  53991. ====================
  53992. -----BEGIN CERTIFICATE-----
  53993. MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  53994. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
  53995. LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
  53996. EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
  53997. ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
  53998. P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
  53999. d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
  54000. z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
  54001. 8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
  54002. RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
  54003. 6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
  54004. FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV
  54005. PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH
  54006. i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj
  54007. YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I
  54008. 6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF
  54009. AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV
  54010. WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw
  54011. Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX
  54012. lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ
  54013. y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9
  54014. Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng
  54015. DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi
  54016. I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM
  54017. cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr
  54018. hkIGuUE=
  54019. -----END CERTIFICATE-----
  54020. OISTE WISeKey Global Root GB CA
  54021. ===============================
  54022. -----BEGIN CERTIFICATE-----
  54023. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  54024. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  54025. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  54026. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  54027. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  54028. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  54029. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  54030. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  54031. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  54032. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  54033. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  54034. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  54035. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  54036. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  54037. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  54038. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  54039. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  54040. -----END CERTIFICATE-----
  54041. SZAFIR ROOT CA2
  54042. ===============
  54043. -----BEGIN CERTIFICATE-----
  54044. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  54045. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  54046. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  54047. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  54048. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  54049. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  54050. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  54051. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  54052. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  54053. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  54054. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  54055. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  54056. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  54057. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  54058. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  54059. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  54060. -----END CERTIFICATE-----
  54061. Certum Trusted Network CA 2
  54062. ===========================
  54063. -----BEGIN CERTIFICATE-----
  54064. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  54065. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  54066. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  54067. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  54068. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  54069. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  54070. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  54071. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  54072. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  54073. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  54074. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  54075. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  54076. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  54077. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  54078. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  54079. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54080. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  54081. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  54082. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  54083. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  54084. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  54085. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  54086. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  54087. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  54088. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  54089. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  54090. zAYspsbiDrW5viSP
  54091. -----END CERTIFICATE-----
  54092. Hellenic Academic and Research Institutions RootCA 2015
  54093. =======================================================
  54094. -----BEGIN CERTIFICATE-----
  54095. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  54096. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  54097. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  54098. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  54099. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  54100. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  54101. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  54102. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  54103. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  54104. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  54105. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  54106. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  54107. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  54108. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  54109. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  54110. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  54111. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54112. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  54113. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  54114. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  54115. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  54116. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  54117. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  54118. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  54119. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  54120. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  54121. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  54122. p/UsQu0yrbYhnr68
  54123. -----END CERTIFICATE-----
  54124. Hellenic Academic and Research Institutions ECC RootCA 2015
  54125. ===========================================================
  54126. -----BEGIN CERTIFICATE-----
  54127. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  54128. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  54129. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  54130. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  54131. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  54132. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  54133. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  54134. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  54135. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  54136. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  54137. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  54138. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  54139. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  54140. -----END CERTIFICATE-----
  54141. Certplus Root CA G1
  54142. ===================
  54143. -----BEGIN CERTIFICATE-----
  54144. MIIFazCCA1OgAwIBAgISESBVg+QtPlRWhS2DN7cs3EYRMA0GCSqGSIb3DQEBDQUAMD4xCzAJBgNV
  54145. BAYTAkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTAe
  54146. Fw0xNDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhD
  54147. ZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTCCAiIwDQYJKoZIhvcNAQEBBQAD
  54148. ggIPADCCAgoCggIBANpQh7bauKk+nWT6VjOaVj0W5QOVsjQcmm1iBdTYj+eJZJ+622SLZOZ5KmHN
  54149. r49aiZFluVj8tANfkT8tEBXgfs+8/H9DZ6itXjYj2JizTfNDnjl8KvzsiNWI7nC9hRYt6kuJPKNx
  54150. Qv4c/dMcLRC4hlTqQ7jbxofaqK6AJc96Jh2qkbBIb6613p7Y1/oA/caP0FG7Yn2ksYyy/yARujVj
  54151. BYZHYEMzkPZHogNPlk2dT8Hq6pyi/jQu3rfKG3akt62f6ajUeD94/vI4CTYd0hYCyOwqaK/1jpTv
  54152. LRN6HkJKHRUxrgwEV/xhc/MxVoYxgKDEEW4wduOU8F8ExKyHcomYxZ3MVwia9Az8fXoFOvpHgDm2
  54153. z4QTd28n6v+WZxcIbekN1iNQMLAVdBM+5S//Ds3EC0pd8NgAM0lm66EYfFkuPSi5YXHLtaW6uOrc
  54154. 4nBvCGrch2c0798wct3zyT8j/zXhviEpIDCB5BmlIOklynMxdCm+4kLV87ImZsdo/Rmz5yCTmehd
  54155. 4F6H50boJZwKKSTUzViGUkAksnsPmBIgJPaQbEfIDbsYIC7Z/fyL8inqh3SV4EJQeIQEQWGw9CEj
  54156. jy3LKCHyamz0GqbFFLQ3ZU+V/YDI+HLlJWvEYLF7bY5KinPOWftwenMGE9nTdDckQQoRb5fc5+R+
  54157. ob0V8rqHDz1oihYHAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0G
  54158. A1UdDgQWBBSowcCbkahDFXxdBie0KlHYlwuBsTAfBgNVHSMEGDAWgBSowcCbkahDFXxdBie0KlHY
  54159. lwuBsTANBgkqhkiG9w0BAQ0FAAOCAgEAnFZvAX7RvUz1isbwJh/k4DgYzDLDKTudQSk0YcbX8ACh
  54160. 66Ryj5QXvBMsdbRX7gp8CXrc1cqh0DQT+Hern+X+2B50ioUHj3/MeXrKls3N/U/7/SMNkPX0XtPG
  54161. YX2eEeAC7gkE2Qfdpoq3DIMku4NQkv5gdRE+2J2winq14J2by5BSS7CTKtQ+FjPlnsZlFT5kOwQ/
  54162. 2wyPX1wdaR+v8+khjPPvl/aatxm2hHSco1S1cE5j2FddUyGbQJJD+tZ3VTNPZNX70Cxqjm0lpu+F
  54163. 6ALEUz65noe8zDUa3qHpimOHZR4RKttjd5cUvpoUmRGywO6wT/gUITJDT5+rosuoD6o7BlXGEilX
  54164. CNQ314cnrUlZp5GrRHpejXDbl85IULFzk/bwg2D5zfHhMf1bfHEhYxQUqq/F3pN+aLHsIqKqkHWe
  54165. tUNy6mSjhEv9DKgma3GX7lZjZuhCVPnHHd/Qj1vfyDBviP4NxDMcU6ij/UgQ8uQKTuEVV/xuZDDC
  54166. VRHc6qnNSlSsKWNEz0pAoNZoWRsz+e86i9sgktxChL8Bq4fA1SCC28a5g4VCXA9DO2pJNdWY9BW/
  54167. +mGBDAkgGNLQFwzLSABQ6XaCjGTXOqAHVcweMcDvOrRl++O/QmueD6i9a5jc2NvLi6Td11n0bt3+
  54168. qsOR0C5CB8AMTVPNJLFMWx5R9N/pkvo=
  54169. -----END CERTIFICATE-----
  54170. Certplus Root CA G2
  54171. ===================
  54172. -----BEGIN CERTIFICATE-----
  54173. MIICHDCCAaKgAwIBAgISESDZkc6uo+jF5//pAq/Pc7xVMAoGCCqGSM49BAMDMD4xCzAJBgNVBAYT
  54174. AkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjAeFw0x
  54175. NDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhDZXJ0
  54176. cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  54177. BM0PW1aC3/BFGtat93nwHcmsltaeTpwftEIRyoa/bfuFo8XlGVzX7qY/aWfYeOKmycTbLXku54uN
  54178. Am8xIk0G42ByRZ0OQneezs/lf4WbGOT8zC5y0xaTTsqZY1yhBSpsBqNjMGEwDgYDVR0PAQH/BAQD
  54179. AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMB8GA1Ud
  54180. IwQYMBaAFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMAoGCCqGSM49BAMDA2gAMGUCMHD+sAvZ94OX7PNV
  54181. HdTcswYO/jOYnYs5kGuUIe22113WTNchp+e/IQ8rzfcq3IUHnQIxAIYUFuXcsGXCwI4Un78kFmjl
  54182. vPl5adytRSv3tjFzzAalU5ORGpOucGpnutee5WEaXw==
  54183. -----END CERTIFICATE-----
  54184. OpenTrust Root CA G1
  54185. ====================
  54186. -----BEGIN CERTIFICATE-----
  54187. MIIFbzCCA1egAwIBAgISESCzkFU5fX82bWTCp59rY45nMA0GCSqGSIb3DQEBCwUAMEAxCzAJBgNV
  54188. BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcx
  54189. MB4XDTE0MDUyNjA4NDU1MFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
  54190. CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzEwggIiMA0GCSqGSIb3DQEB
  54191. AQUAA4ICDwAwggIKAoICAQD4eUbalsUwXopxAy1wpLuwxQjczeY1wICkES3d5oeuXT2R0odsN7fa
  54192. Yp6bwiTXj/HbpqbfRm9RpnHLPhsxZ2L3EVs0J9V5ToybWL0iEA1cJwzdMOWo010hOHQX/uMftk87
  54193. ay3bfWAfjH1MBcLrARYVmBSO0ZB3Ij/swjm4eTrwSSTilZHcYTSSjFR077F9jAHiOH3BX2pfJLKO
  54194. YheteSCtqx234LSWSE9mQxAGFiQD4eCcjsZGT44ameGPuY4zbGneWK2gDqdkVBFpRGZPTBKnjix9
  54195. xNRbxQA0MMHZmf4yzgeEtE7NCv82TWLxp2NX5Ntqp66/K7nJ5rInieV+mhxNaMbBGN4zK1FGSxyO
  54196. 9z0M+Yo0FMT7MzUj8czxKselu7Cizv5Ta01BG2Yospb6p64KTrk5M0ScdMGTHPjgniQlQ/GbI4Kq
  54197. 3ywgsNw2TgOzfALU5nsaqocTvz6hdLubDuHAk5/XpGbKuxs74zD0M1mKB3IDVedzagMxbm+WG+Oi
  54198. n6+Sx+31QrclTDsTBM8clq8cIqPQqwWyTBIjUtz9GVsnnB47ev1CI9sjgBPwvFEVVJSmdz7QdFG9
  54199. URQIOTfLHzSpMJ1ShC5VkLG631UAC9hWLbFJSXKAqWLXwPYYEQRVzXR7z2FwefR7LFxckvzluFqr
  54200. TJOVoSfupb7PcSNCupt2LQIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  54201. /zAdBgNVHQ4EFgQUl0YhVyE12jZVx/PxN3DlCPaTKbYwHwYDVR0jBBgwFoAUl0YhVyE12jZVx/Px
  54202. N3DlCPaTKbYwDQYJKoZIhvcNAQELBQADggIBAB3dAmB84DWn5ph76kTOZ0BP8pNuZtQ5iSas000E
  54203. PLuHIT839HEl2ku6q5aCgZG27dmxpGWX4m9kWaSW7mDKHyP7Rbr/jyTwyqkxf3kfgLMtMrpkZ2Cv
  54204. uVnN35pJ06iCsfmYlIrM4LvgBBuZYLFGZdwIorJGnkSI6pN+VxbSFXJfLkur1J1juONI5f6ELlgK
  54205. n0Md/rcYkoZDSw6cMoYsYPXpSOqV7XAp8dUv/TW0V8/bhUiZucJvbI/NeJWsZCj9VrDDb8O+WVLh
  54206. X4SPgPL0DTatdrOjteFkdjpY3H1PXlZs5VVZV6Xf8YpmMIzUUmI4d7S+KNfKNsSbBfD4Fdvb8e80
  54207. nR14SohWZ25g/4/Ii+GOvUKpMwpZQhISKvqxnUOOBZuZ2mKtVzazHbYNeS2WuOvyDEsMpZTGMKcm
  54208. GS3tTAZQMPH9WD25SxdfGbRqhFS0OE85og2WaMMolP3tLR9Ka0OWLpABEPs4poEL0L9109S5zvE/
  54209. bw4cHjdx5RiHdRk/ULlepEU0rbDK5uUTdg8xFKmOLZTW1YVNcxVPS/KyPu1svf0OnWZzsD2097+o
  54210. 4BGkxK51CUpjAEggpsadCwmKtODmzj7HPiY46SvepghJAwSQiumPv+i2tCqjI40cHLI5kqiPAlxA
  54211. OXXUc0ECd97N4EOH1uS6SsNsEn/+KuYj1oxx
  54212. -----END CERTIFICATE-----
  54213. OpenTrust Root CA G2
  54214. ====================
  54215. -----BEGIN CERTIFICATE-----
  54216. MIIFbzCCA1egAwIBAgISESChaRu/vbm9UpaPI+hIvyYRMA0GCSqGSIb3DQEBDQUAMEAxCzAJBgNV
  54217. BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcy
  54218. MB4XDTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
  54219. CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzIwggIiMA0GCSqGSIb3DQEB
  54220. AQUAA4ICDwAwggIKAoICAQDMtlelM5QQgTJT32F+D3Y5z1zCU3UdSXqWON2ic2rxb95eolq5cSG+
  54221. Ntmh/LzubKh8NBpxGuga2F8ORAbtp+Dz0mEL4DKiltE48MLaARf85KxP6O6JHnSrT78eCbY2albz
  54222. 4e6WiWYkBuTNQjpK3eCasMSCRbP+yatcfD7J6xcvDH1urqWPyKwlCm/61UWY0jUJ9gNDlP7ZvyCV
  54223. eYCYitmJNbtRG6Q3ffyZO6v/v6wNj0OxmXsWEH4db0fEFY8ElggGQgT4hNYdvJGmQr5J1WqIP7wt
  54224. UdGejeBSzFfdNTVY27SPJIjki9/ca1TSgSuyzpJLHB9G+h3Ykst2Z7UJmQnlrBcUVXDGPKBWCgOz
  54225. 3GIZ38i1MH/1PCZ1Eb3XG7OHngevZXHloM8apwkQHZOJZlvoPGIytbU6bumFAYueQ4xncyhZW+vj
  54226. 3CzMpSZyYhK05pyDRPZRpOLAeiRXyg6lPzq1O4vldu5w5pLeFlwoW5cZJ5L+epJUzpM5ChaHvGOz
  54227. 9bGTXOBut9Dq+WIyiET7vycotjCVXRIouZW+j1MY5aIYFuJWpLIsEPUdN6b4t/bQWVyJ98LVtZR0
  54228. 0dX+G7bw5tYee9I8y6jj9RjzIR9u701oBnstXW5DiabA+aC/gh7PU3+06yzbXfZqfUAkBXKJOAGT
  54229. y3HCOV0GEfZvePg3DTmEJwIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  54230. /zAdBgNVHQ4EFgQUajn6QiL35okATV59M4PLuG53hq8wHwYDVR0jBBgwFoAUajn6QiL35okATV59
  54231. M4PLuG53hq8wDQYJKoZIhvcNAQENBQADggIBAJjLq0A85TMCl38th6aP1F5Kr7ge57tx+4BkJamz
  54232. Gj5oXScmp7oq4fBXgwpkTx4idBvpkF/wrM//T2h6OKQQbA2xx6R3gBi2oihEdqc0nXGEL8pZ0keI
  54233. mUEiyTCYYW49qKgFbdEfwFFEVn8nNQLdXpgKQuswv42hm1GqO+qTRmTFAHneIWv2V6CG1wZy7HBG
  54234. S4tz3aAhdT7cHcCP009zHIXZ/n9iyJVvttN7jLpTwm+bREx50B1ws9efAvSyB7DH5fitIw6mVskp
  54235. EndI2S9G/Tvw/HRwkqWOOAgfZDC2t0v7NqwQjqBSM2OdAzVWxWm9xiNaJ5T2pBL4LTM8oValX9YZ
  54236. 6e18CL13zSdkzJTaTkZQh+D5wVOAHrut+0dSixv9ovneDiK3PTNZbNTe9ZUGMg1RGUFcPk8G97kr
  54237. gCf2o6p6fAbhQ8MTOWIaNr3gKC6UAuQpLmBVrkA9sHSSXvAgZJY/X0VdiLWK2gKgW0VU3jg9CcCo
  54238. SmVGFvyqv1ROTVu+OEO3KMqLM6oaJbolXCkvW0pujOotnCr2BXbgd5eAiN1nE28daCSLT7d0geX0
  54239. YJ96Vdc+N9oWaz53rK4YcJUIeSkDiv7BO7M/Gg+kO14fWKGVyasvc0rQLW6aWQ9VGHgtPFGml4vm
  54240. u7JwqkwR3v98KzfUetF3NI/n+UL3PIEMS1IK
  54241. -----END CERTIFICATE-----
  54242. OpenTrust Root CA G3
  54243. ====================
  54244. -----BEGIN CERTIFICATE-----
  54245. MIICITCCAaagAwIBAgISESDm+Ez8JLC+BUCs2oMbNGA/MAoGCCqGSM49BAMDMEAxCzAJBgNVBAYT
  54246. AkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEczMB4X
  54247. DTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCU9w
  54248. ZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzMwdjAQBgcqhkjOPQIBBgUrgQQA
  54249. IgNiAARK7liuTcpm3gY6oxH84Bjwbhy6LTAMidnW7ptzg6kjFYwvWYpa3RTqnVkrQ7cG7DK2uu5B
  54250. ta1doYXM6h0UZqNnfkbilPPntlahFVmhTzeXuSIevRHr9LIfXsMUmuXZl5mjYzBhMA4GA1UdDwEB
  54251. /wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAf
  54252. BgNVHSMEGDAWgBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAKBggqhkjOPQQDAwNpADBmAjEAj6jcnboM
  54253. BBf6Fek9LykBl7+BFjNAk2z8+e2AcG+qj9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta
  54254. 3U1fJAuwACEl74+nBCZx4nxp5V2a+EEfOzmTk51V6s2N8fvB
  54255. -----END CERTIFICATE-----
  54256. ISRG Root X1
  54257. ============
  54258. -----BEGIN CERTIFICATE-----
  54259. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  54260. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  54261. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  54262. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  54263. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  54264. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  54265. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  54266. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  54267. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  54268. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  54269. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  54270. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  54271. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  54272. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  54273. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  54274. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  54275. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  54276. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  54277. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  54278. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  54279. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  54280. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  54281. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  54282. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  54283. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  54284. -----END CERTIFICATE-----
  54285. AC RAIZ FNMT-RCM
  54286. ================
  54287. -----BEGIN CERTIFICATE-----
  54288. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  54289. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  54290. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  54291. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  54292. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  54293. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  54294. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  54295. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  54296. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  54297. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  54298. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  54299. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  54300. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  54301. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  54302. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  54303. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  54304. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  54305. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  54306. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  54307. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  54308. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  54309. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  54310. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  54311. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  54312. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  54313. -----END CERTIFICATE-----
  54314. Amazon Root CA 1
  54315. ================
  54316. -----BEGIN CERTIFICATE-----
  54317. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  54318. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  54319. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  54320. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  54321. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  54322. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  54323. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  54324. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  54325. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  54326. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  54327. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  54328. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  54329. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  54330. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  54331. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  54332. -----END CERTIFICATE-----
  54333. Amazon Root CA 2
  54334. ================
  54335. -----BEGIN CERTIFICATE-----
  54336. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  54337. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  54338. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  54339. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  54340. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  54341. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  54342. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  54343. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  54344. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  54345. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  54346. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  54347. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  54348. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  54349. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  54350. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  54351. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  54352. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  54353. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  54354. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  54355. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  54356. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  54357. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  54358. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  54359. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  54360. -----END CERTIFICATE-----
  54361. Amazon Root CA 3
  54362. ================
  54363. -----BEGIN CERTIFICATE-----
  54364. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  54365. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  54366. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  54367. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  54368. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  54369. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  54370. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  54371. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  54372. -----END CERTIFICATE-----
  54373. Amazon Root CA 4
  54374. ================
  54375. -----BEGIN CERTIFICATE-----
  54376. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  54377. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  54378. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  54379. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  54380. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  54381. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  54382. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  54383. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  54384. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  54385. -----END CERTIFICATE-----
  54386. LuxTrust Global Root 2
  54387. ======================
  54388. -----BEGIN CERTIFICATE-----
  54389. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  54390. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  54391. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  54392. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  54393. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  54394. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  54395. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  54396. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  54397. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  54398. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  54399. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  54400. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  54401. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  54402. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  54403. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  54404. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  54405. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  54406. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  54407. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  54408. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  54409. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  54410. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  54411. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  54412. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  54413. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  54414. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  54415. -----END CERTIFICATE-----
  54416. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  54417. =============================================
  54418. -----BEGIN CERTIFICATE-----
  54419. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  54420. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  54421. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  54422. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  54423. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  54424. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  54425. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  54426. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  54427. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  54428. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  54429. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  54430. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  54431. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  54432. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  54433. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  54434. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  54435. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  54436. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  54437. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  54438. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  54439. -----END CERTIFICATE-----
  54440. GDCA TrustAUTH R5 ROOT
  54441. ======================
  54442. -----BEGIN CERTIFICATE-----
  54443. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  54444. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  54445. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  54446. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  54447. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  54448. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  54449. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  54450. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  54451. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  54452. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  54453. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  54454. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  54455. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  54456. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  54457. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  54458. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  54459. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  54460. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  54461. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  54462. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  54463. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  54464. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  54465. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  54466. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  54467. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  54468. -----END CERTIFICATE-----
  54469. TrustCor RootCert CA-1
  54470. ======================
  54471. -----BEGIN CERTIFICATE-----
  54472. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  54473. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  54474. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  54475. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  54476. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  54477. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  54478. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  54479. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  54480. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  54481. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  54482. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  54483. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  54484. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  54485. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  54486. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  54487. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  54488. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  54489. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  54490. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  54491. -----END CERTIFICATE-----
  54492. TrustCor RootCert CA-2
  54493. ======================
  54494. -----BEGIN CERTIFICATE-----
  54495. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  54496. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  54497. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  54498. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  54499. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  54500. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  54501. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  54502. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  54503. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  54504. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  54505. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  54506. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  54507. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  54508. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  54509. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  54510. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  54511. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  54512. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  54513. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  54514. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  54515. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  54516. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  54517. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  54518. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  54519. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  54520. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  54521. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  54522. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  54523. -----END CERTIFICATE-----
  54524. TrustCor ECA-1
  54525. ==============
  54526. -----BEGIN CERTIFICATE-----
  54527. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  54528. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  54529. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  54530. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  54531. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  54532. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  54533. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  54534. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  54535. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  54536. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  54537. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  54538. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  54539. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  54540. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  54541. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  54542. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  54543. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  54544. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  54545. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  54546. -----END CERTIFICATE-----
  54547. SSL.com Root Certification Authority RSA
  54548. ========================================
  54549. -----BEGIN CERTIFICATE-----
  54550. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  54551. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  54552. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  54553. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  54554. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  54555. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  54556. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  54557. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  54558. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  54559. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  54560. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  54561. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  54562. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  54563. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  54564. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  54565. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  54566. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  54567. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  54568. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  54569. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  54570. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  54571. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  54572. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  54573. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  54574. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  54575. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  54576. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  54577. -----END CERTIFICATE-----
  54578. SSL.com Root Certification Authority ECC
  54579. ========================================
  54580. -----BEGIN CERTIFICATE-----
  54581. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  54582. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  54583. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  54584. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  54585. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  54586. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  54587. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  54588. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  54589. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  54590. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  54591. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  54592. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  54593. -----END CERTIFICATE-----
  54594. SSL.com EV Root Certification Authority RSA R2
  54595. ==============================================
  54596. -----BEGIN CERTIFICATE-----
  54597. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  54598. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  54599. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  54600. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  54601. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  54602. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  54603. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  54604. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  54605. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  54606. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  54607. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  54608. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  54609. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  54610. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  54611. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  54612. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  54613. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  54614. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  54615. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  54616. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  54617. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  54618. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  54619. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  54620. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  54621. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  54622. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  54623. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  54624. -----END CERTIFICATE-----
  54625. SSL.com EV Root Certification Authority ECC
  54626. ===========================================
  54627. -----BEGIN CERTIFICATE-----
  54628. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  54629. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  54630. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  54631. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  54632. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  54633. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  54634. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  54635. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  54636. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  54637. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  54638. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  54639. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  54640. -----END CERTIFICATE-----
  54641. <?php
  54642. if (PHP_SAPI !== 'cli') {
  54643. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  54644. }
  54645. setlocale(LC_ALL, 'C');
  54646. require __DIR__.'/../src/bootstrap.php';
  54647. use Composer\Console\Application;
  54648. use Composer\XdebugHandler\XdebugHandler;
  54649. error_reporting(-1);
  54650. // Restart without xdebug
  54651. $xdebug = new XdebugHandler('Composer', '--ansi');
  54652. $xdebug->check();
  54653. unset($xdebug);
  54654. if (function_exists('ini_set')) {
  54655. @ini_set('display_errors', 1);
  54656. $memoryInBytes = function ($value) {
  54657. $unit = strtolower(substr($value, -1, 1));
  54658. $value = (int) $value;
  54659. switch($unit) {
  54660. case 'g':
  54661. $value *= 1024;
  54662. // no break (cumulative multiplier)
  54663. case 'm':
  54664. $value *= 1024;
  54665. // no break (cumulative multiplier)
  54666. case 'k':
  54667. $value *= 1024;
  54668. }
  54669. return $value;
  54670. };
  54671. $memoryLimit = trim(ini_get('memory_limit'));
  54672. // Increase memory_limit if it is lower than 1.5GB
  54673. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  54674. @ini_set('memory_limit', '1536M');
  54675. }
  54676. // Set user defined memory limit
  54677. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  54678. @ini_set('memory_limit', $memoryLimit);
  54679. }
  54680. unset($memoryInBytes, $memoryLimit);
  54681. }
  54682. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  54683. // run the command application
  54684. $application = new Application();
  54685. $application->run();
  54686. Copyright (c) Nils Adermann, Jordi Boggiano
  54687. Permission is hereby granted, free of charge, to any person obtaining a copy
  54688. of this software and associated documentation files (the "Software"), to deal
  54689. in the Software without restriction, including without limitation the rights
  54690. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  54691. copies of the Software, and to permit persons to whom the Software is furnished
  54692. to do so, subject to the following conditions:
  54693. The above copyright notice and this permission notice shall be included in all
  54694. copies or substantial portions of the Software.
  54695. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  54696. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  54697. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  54698. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  54699. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  54700. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  54701. THE SOFTWARE.
  54702. Qm/ “¹øen¨‰i­Ï³Ñn*lGBMB